diff --git a/.github/workflows/test-app.yaml b/.github/workflows/test-app.yaml index de3f038e..b9dbcbf1 100644 --- a/.github/workflows/test-app.yaml +++ b/.github/workflows/test-app.yaml @@ -22,7 +22,3 @@ jobs: browser: chrome start: yarn dev wait-on: "http://localhost:3000" - env: - NEXT_PUBLIC_HEIMDALL_URL: "${{ secrets.HEIMDALL_URL }}" - CYPRESS_HEIMDALL_URL: "${{ secrets.HEIMDALL_URL }}" - diff --git a/README.md b/README.md index b01f0456..f2286165 100644 --- a/README.md +++ b/README.md @@ -46,19 +46,6 @@ Visit your local instance of ABI Ninja at: `http://localhost:3000`. ABI Ninja uses Cypress for end-to-end testing. Our test suite covers user flows and ensures the application works correctly across different networks and contract types. The test suite will automatically run on pull requests. -## Setting Up Cypress Environment - -Before running the tests, you need to set up your Cypress environment: - -1. Copy the example environment file: - -``` -cp cypress.env.example.json cypress.env.json -``` - -2. Edit `cypress.env.json` and fill in heimdall_url - - ## Running Tests To run the Cypress tests: @@ -98,7 +85,6 @@ When adding new features or modifying existing ones, please update or add corres For more information on writing Cypress tests, refer to the Cypress Documentation. - ## Contributing to ABI Ninja We welcome contributions to ABI Ninja! diff --git a/packages/nextjs/.env.example b/packages/nextjs/.env.example index f24a8a3b..74956c51 100644 --- a/packages/nextjs/.env.example +++ b/packages/nextjs/.env.example @@ -17,7 +17,6 @@ NEXT_PUBLIC_ARBITRUM_ETHERSCAN_API_KEY= NEXT_PUBLIC_ZKSYNC_ETHERSCAN_API_KEY= NEXT_PUBLIC_SCROLL_ETHERSCAN_API_KEY= NEXT_PUBLIC_BASE_ETHERSCAN_API_KEY= -NEXT_PUBLIC_HEIMDALL_URL= NEXT_PUBLIC_ALCHEMY_API_KEY= NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID= diff --git a/packages/nextjs/cypress.env.example.json b/packages/nextjs/cypress.env.example.json deleted file mode 100644 index e8b1cc09..00000000 --- a/packages/nextjs/cypress.env.example.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "HEIMDALL_URL": "" -} \ No newline at end of file diff --git a/packages/nextjs/cypress/support/commands.ts b/packages/nextjs/cypress/support/commands.ts index 19b616aa..7393f36d 100644 --- a/packages/nextjs/cypress/support/commands.ts +++ b/packages/nextjs/cypress/support/commands.ts @@ -1,4 +1,5 @@ /// +import { HEIMDALL_API_URL } from "~~/utils/constants"; Cypress.Commands.add("wakeUpHeimdall", () => { const contractAddress = "0x759c0e9d7858566df8ab751026bedce462ff42df"; @@ -6,7 +7,7 @@ Cypress.Commands.add("wakeUpHeimdall", () => { cy.request({ method: "GET", - url: `${Cypress.env("HEIMDALL_URL")}/${contractAddress}?rpc_url=${rpcUrl}`, + url: `${HEIMDALL_API_URL}/${contractAddress}?rpc_url=${rpcUrl}`, failOnStatusCode: false, timeout: 30000, }).then(response => { diff --git a/packages/nextjs/pages/index.tsx b/packages/nextjs/pages/index.tsx index d591d8b6..ff90c786 100644 --- a/packages/nextjs/pages/index.tsx +++ b/packages/nextjs/pages/index.tsx @@ -15,6 +15,7 @@ import { AddressInput } from "~~/components/scaffold-eth"; import useFetchContractAbi from "~~/hooks/useFetchContractAbi"; import { useAbiNinjaState } from "~~/services/store/store"; import { parseAndCorrectJSON } from "~~/utils/abi"; +import { HEIMDALL_API_URL } from "~~/utils/constants"; import { notification } from "~~/utils/scaffold-eth"; enum TabName { @@ -131,9 +132,7 @@ const Home: NextPage = () => { const fetchAbiFromHeimdall = async (contractAddress: Address) => { try { const rpcUrlWithoutHttps = publicClient?.chain.rpcUrls.default.http[0].substring(8); - const response = await fetch( - `${process.env.NEXT_PUBLIC_HEIMDALL_URL}/${contractAddress}?rpc_url=${rpcUrlWithoutHttps}`, - ); + const response = await fetch(`${HEIMDALL_API_URL}/${contractAddress}?rpc_url=${rpcUrlWithoutHttps}`); const abi = await response.json(); if (abi.length === 0) { notification.error("Failed to fetch ABI from Heimdall. Please try again or enter ABI manually."); diff --git a/packages/nextjs/utils/constants.ts b/packages/nextjs/utils/constants.ts new file mode 100644 index 00000000..bfa27aee --- /dev/null +++ b/packages/nextjs/utils/constants.ts @@ -0,0 +1 @@ +export const HEIMDALL_API_URL = "https://heimdall-api-v2.fly.dev";