From 9fad6c49db742a2580101e9f3a3ced1ab8ebd560 Mon Sep 17 00:00:00 2001 From: juan-langa Date: Fri, 15 Dec 2023 13:47:38 +0100 Subject: [PATCH] Remove ts-node as dependency and install ts-node and Typescript only in github action --- .github/workflows/createForkWithFunds.yml | 16 +++- additional.d.ts | 6 -- package.json | 3 +- utilsManualTesting/createFork.ts | 4 +- utilsManualTesting/createForkGithub.ts | 26 +++++- yarn.lock | 96 +---------------------- 6 files changed, 41 insertions(+), 110 deletions(-) delete mode 100644 additional.d.ts diff --git a/.github/workflows/createForkWithFunds.yml b/.github/workflows/createForkWithFunds.yml index 86407810..6c8c3455 100644 --- a/.github/workflows/createForkWithFunds.yml +++ b/.github/workflows/createForkWithFunds.yml @@ -18,12 +18,24 @@ jobs: create-for-with-funds: name: 'Create fork and add funds' runs-on: ubuntu-latest + env: + TENDERLY_PROJECT: ${{ secrets.TENDERLY_PROJECT }} + TENDERLY_USER: ${{ secrets.TENDERLY_USER }} + TENDERLY_ACCESS_KEY: ${{ secrets.TENDERLY_ACCESS_KEY }} steps: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: node-version: 18 + - name: Install TypeScript and ts-node + run: npm install typescript ts-node - name: Install dependencies run: yarn - - name: Run create-fork - run: NETWORK=${{ inputs.network }} WALLET_ADDRESS=${{ inputs.wallet}} yarn create-fork-github + - name: Run create-fork-github + run: | + TENDERLY_PROJECT=${{ secrets.TENDERLY_PROJECT }} \ + TENDERLY_USER=${{ secrets.TENDERLY_USER }} \ + TENDERLY_ACCESS_KEY=${{ secrets.TENDERLY_ACCESS_KEY }} \ + NETWORK=${{ inputs.network }} \ + WALLET_ADDRESS=${{ inputs.wallet}} \ + yarn create-fork-github diff --git a/additional.d.ts b/additional.d.ts deleted file mode 100644 index e351584a..00000000 --- a/additional.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -declare namespace NodeJS { - interface ProcessEnv { - NETWORK: 'mainnet' | 'optimism' | 'arbitrum' | 'base'; - WALLET_ADDRESS: string; - } -} diff --git a/package.json b/package.json index f154a5b9..753a0b50 100644 --- a/package.json +++ b/package.json @@ -12,8 +12,7 @@ "@synthetixio/synpress": "^3.7.2-beta.7", "axios": "^1.6.0", "dotenv": "^16.3.1", - "ethers": "^6.7.1", - "ts-node": "^10.9.2" + "ethers": "^6.7.1" }, "scripts": { "no-wallet": "REPORT_FOLDER=no-wallet npx playwright test --project=no-wallet", diff --git a/utilsManualTesting/createFork.ts b/utilsManualTesting/createFork.ts index 8253c86a..932b159f 100644 --- a/utilsManualTesting/createFork.ts +++ b/utilsManualTesting/createFork.ts @@ -15,9 +15,11 @@ import * as tenderly from '../utils/tenderly'; const resp = await tenderly.createFork({ network }); const forkId = resp.data.root_transaction.fork_id; + console.log(`Selected network: ${network}`); if (network === 'mainnet') { walletAddress = await input({ message: 'Enter your wallet address: ' }); + console.log(`Wallet address: ${walletAddress}`); // When using 'Promise.all()' some of the transactions randomly fail await tenderly.setTokenBalance({ forkId, token: 'ETH', balance: '5000', walletAddress }); @@ -29,9 +31,7 @@ import * as tenderly from '../utils/tenderly'; await tenderly.setTokenBalance({ forkId, token: 'WBTC', balance: '10', walletAddress }); } - console.log(`Selected network: ${network}`); if (network === 'mainnet') { - console.log(`Wallet address: ${walletAddress}`); console.log('-------------------------------------'); console.log('Tokens and balance:'); console.log('ETH - 5000'); diff --git a/utilsManualTesting/createForkGithub.ts b/utilsManualTesting/createForkGithub.ts index 7567b30c..72db4a7b 100644 --- a/utilsManualTesting/createForkGithub.ts +++ b/utilsManualTesting/createForkGithub.ts @@ -1,9 +1,29 @@ import * as tenderly from '../utils/tenderly'; +type Networks = 'mainnet' | 'optimism' | 'arbitrum' | 'base'; + const { NETWORK, WALLET_ADDRESS } = process.env; +let network: Networks; +switch (NETWORK) { + case 'mainnet': + default: + network = 'mainnet'; + break; + case 'arbitrum': + network = 'arbitrum'; + break; + case 'base': + network = 'base'; + break; + case 'optimism': + network = 'optimism'; + break; +} + +let walletAddress: string = WALLET_ADDRESS; (async () => { - const resp = await tenderly.createFork({ network: NETWORK }); + const resp = await tenderly.createFork({ network }); const forkId = resp.data.root_transaction.fork_id; if (NETWORK === 'mainnet') { @@ -11,7 +31,7 @@ const { NETWORK, WALLET_ADDRESS } = process.env; forkId, token: 'ETH', balance: '5000', - walletAddress: WALLET_ADDRESS, + walletAddress: walletAddress, }); await tenderly.setTokenBalance({ forkId, @@ -23,7 +43,7 @@ const { NETWORK, WALLET_ADDRESS } = process.env; forkId, token: 'SDAI', balance: '200000', - walletAddress: WALLET_ADDRESS, + walletAddress: walletAddress, }); await tenderly.setTokenBalance({ forkId, diff --git a/yarn.lock b/yarn.lock index 63faf866..72a1465b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -248,13 +248,6 @@ resolved "https://registry.yarnpkg.com/@colors/colors/-/colors-1.5.0.tgz#bb504579c1cae923e6576a4f5da43d25f97bdbd9" integrity sha512-ooWCrlZP11i8GImSjTHYHLkvFDP48nS4+204nGb1RiX/WXYHmJA2III9/e2DWVabCESdW7hBAEzHRqUn9OUVvQ== -"@cspotcode/source-map-support@^0.8.0": - version "0.8.1" - resolved "https://registry.yarnpkg.com/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz#00629c35a688e05a88b1cda684fb9d5e73f000a1" - integrity sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw== - dependencies: - "@jridgewell/trace-mapping" "0.3.9" - "@cypress/code-coverage@^3.11.0": version "3.12.1" resolved "https://registry.yarnpkg.com/@cypress/code-coverage/-/code-coverage-3.12.1.tgz#cdfd155f9e4788d56ba55caff10c70abfbf72fd1" @@ -747,7 +740,7 @@ "@jridgewell/sourcemap-codec" "^1.4.10" "@jridgewell/trace-mapping" "^0.3.9" -"@jridgewell/resolve-uri@^3.0.3", "@jridgewell/resolve-uri@^3.1.0": +"@jridgewell/resolve-uri@^3.1.0": version "3.1.1" resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.1.1.tgz#c08679063f279615a3326583ba3a90d1d82cc721" integrity sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA== @@ -770,14 +763,6 @@ resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz#d7c6e6755c78567a951e04ab52ef0fd26de59f32" integrity sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg== -"@jridgewell/trace-mapping@0.3.9": - version "0.3.9" - resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz#6534fd5933a53ba7cbf3a17615e273a0d1273ff9" - integrity sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ== - dependencies: - "@jridgewell/resolve-uri" "^3.0.3" - "@jridgewell/sourcemap-codec" "^1.4.10" - "@jridgewell/trace-mapping@^0.3.17", "@jridgewell/trace-mapping@^0.3.9": version "0.3.19" resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.19.tgz#f8a3249862f91be48d3127c3cfe992f79b4b8811" @@ -992,26 +977,6 @@ "@testing-library/dom" "^9.0.0" "@types/react-dom" "^18.0.0" -"@tsconfig/node10@^1.0.7": - version "1.0.9" - resolved "https://registry.yarnpkg.com/@tsconfig/node10/-/node10-1.0.9.tgz#df4907fc07a886922637b15e02d4cebc4c0021b2" - integrity sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA== - -"@tsconfig/node12@^1.0.7": - version "1.0.11" - resolved "https://registry.yarnpkg.com/@tsconfig/node12/-/node12-1.0.11.tgz#ee3def1f27d9ed66dac6e46a295cffb0152e058d" - integrity sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag== - -"@tsconfig/node14@^1.0.0": - version "1.0.3" - resolved "https://registry.yarnpkg.com/@tsconfig/node14/-/node14-1.0.3.tgz#e4386316284f00b98435bf40f72f75a09dabf6c1" - integrity sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow== - -"@tsconfig/node16@^1.0.2": - version "1.0.4" - resolved "https://registry.yarnpkg.com/@tsconfig/node16/-/node16-1.0.4.tgz#0b92dcc0cc1c81f6f306a381f28e31b1a56536e9" - integrity sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA== - "@types/aria-query@^4.2.0": version "4.2.2" resolved "https://registry.yarnpkg.com/@types/aria-query/-/aria-query-4.2.2.tgz#ed4e0ad92306a704f9fb132a0cfcf77486dbe2bc" @@ -1344,16 +1309,6 @@ accepts@~1.3.4, accepts@~1.3.5, accepts@~1.3.8: mime-types "~2.1.34" negotiator "0.6.3" -acorn-walk@^8.1.1: - version "8.3.1" - resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-8.3.1.tgz#2f10f5b69329d90ae18c58bf1fa8fccd8b959a43" - integrity sha512-TgUZgYvqZprrl7YldZNoa9OciCAyZR+Ejm9eXzKCmjsF5IKp/wgQ7Z/ZpjpGTIUPwrHQIcYeI8qDh4PsEwxMbw== - -acorn@^8.4.1: - version "8.11.2" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.11.2.tgz#ca0d78b51895be5390a5903c5b3bdcdaf78ae40b" - integrity sha512-nc0Axzp/0FILLEVsm4fNwLCwMttvhEI263QtVPQcbpfZZ3ts0hLsZGOpE6czNlid7CJ9MlyH8reXkpsf3YUY4w== - acorn@^8.8.2: version "8.10.0" resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.10.0.tgz#8be5b3907a67221a81ab23c7889c4c5526b62ec5" @@ -1479,11 +1434,6 @@ archy@^1.0.0: resolved "https://registry.yarnpkg.com/archy/-/archy-1.0.0.tgz#f9c8c13757cc1dd7bc379ac77b2c62a5c2868c40" integrity sha512-Xg+9RwCg/0p32teKdGMPTPnVXKD0w3DfHnFTficozsAgsvq2XenPJq/MYpzzQ/v8zrOyJn6Ds39VA4JIDwFfqw== -arg@^4.1.0: - version "4.1.3" - resolved "https://registry.yarnpkg.com/arg/-/arg-4.1.3.tgz#269fc7ad5b8e42cb63c896d5666017261c144089" - integrity sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA== - argparse@^1.0.7: version "1.0.10" resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911" @@ -2243,11 +2193,6 @@ core-util-is@~1.0.0: resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.3.tgz#a6042d3634c2b27e9328f837b965fac83808db85" integrity sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ== -create-require@^1.1.0: - version "1.1.1" - resolved "https://registry.yarnpkg.com/create-require/-/create-require-1.1.1.tgz#c1d7e8f1e5f6cfc9ff65f9cd352d37348756c333" - integrity sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ== - cross-spawn@^7.0.0, cross-spawn@^7.0.3: version "7.0.3" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6" @@ -2574,11 +2519,6 @@ detect-node@^2.0.4: resolved "https://registry.yarnpkg.com/detect-node/-/detect-node-2.1.0.tgz#c9c70775a49c3d03bc2c06d9a73be550f978f8b1" integrity sha512-T0NIuQpnTvFDATNuHN5roPwSBG83rFsuO+MXXH9/3N1eFbn4wcPjttvjMLEPWJ0RGUYgQE7cGgS3tNxbqCGM7g== -diff@^4.0.1: - version "4.0.2" - resolved "https://registry.yarnpkg.com/diff/-/diff-4.0.2.tgz#60f3aecb89d5fae520c11aa19efc2bb982aade7d" - integrity sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A== - dir-glob@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/dir-glob/-/dir-glob-3.0.1.tgz#56dbf73d992a4a93ba1584f4534063fd2e41717f" @@ -4512,11 +4452,6 @@ make-dir@^4.0.0: dependencies: semver "^7.5.3" -make-error@^1.1.1: - version "1.3.6" - resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.6.tgz#2eb2e37ea9b67c4891f684a1394799af484cf7a2" - integrity sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw== - media-typer@0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/media-typer/-/media-typer-0.3.0.tgz#8710d7af0aa626f8fffa1ce00168545263255748" @@ -6008,25 +5943,6 @@ ts-interface-checker@^0.1.9: resolved "https://registry.yarnpkg.com/ts-interface-checker/-/ts-interface-checker-0.1.13.tgz#784fd3d679722bc103b1b4b8030bcddb5db2a699" integrity sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA== -ts-node@^10.9.2: - version "10.9.2" - resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-10.9.2.tgz#70f021c9e185bccdca820e26dc413805c101c71f" - integrity sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ== - dependencies: - "@cspotcode/source-map-support" "^0.8.0" - "@tsconfig/node10" "^1.0.7" - "@tsconfig/node12" "^1.0.7" - "@tsconfig/node14" "^1.0.0" - "@tsconfig/node16" "^1.0.2" - acorn "^8.4.1" - acorn-walk "^8.1.1" - arg "^4.1.0" - create-require "^1.1.0" - diff "^4.0.1" - make-error "^1.1.1" - v8-compile-cache-lib "^3.0.1" - yn "3.1.1" - tslib@2.4.0: version "2.4.0" resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.4.0.tgz#7cecaa7f073ce680a05847aa77be941098f36dc3" @@ -6236,11 +6152,6 @@ uuid@^8.3.2: resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2" integrity sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg== -v8-compile-cache-lib@^3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz#6336e8d71965cb3d35a1bbb7868445a7c05264bf" - integrity sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg== - vary@~1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc" @@ -6525,11 +6436,6 @@ yauzl@^2.10.0, yauzl@^2.4.2: buffer-crc32 "~0.2.3" fd-slicer "~1.1.0" -yn@3.1.1: - version "3.1.1" - resolved "https://registry.yarnpkg.com/yn/-/yn-3.1.1.tgz#1e87401a09d767c1d5eab26a6e4c185182d2eb50" - integrity sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q== - yocto-queue@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-1.0.0.tgz#7f816433fb2cbc511ec8bf7d263c3b58a1a3c251"