Skip to content

Commit

Permalink
hardcode heimdall url (#152)
Browse files Browse the repository at this point in the history
  • Loading branch information
technophile-04 committed Aug 30, 2024
1 parent 170630b commit cf2c048
Show file tree
Hide file tree
Showing 7 changed files with 5 additions and 26 deletions.
4 changes: 0 additions & 4 deletions .github/workflows/test-app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}"

14 changes: 0 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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!
Expand Down
1 change: 0 additions & 1 deletion packages/nextjs/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -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=
3 changes: 0 additions & 3 deletions packages/nextjs/cypress.env.example.json

This file was deleted.

3 changes: 2 additions & 1 deletion packages/nextjs/cypress/support/commands.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
/// <reference types="cypress" />
import { HEIMDALL_API_URL } from "~~/utils/constants";

Cypress.Commands.add("wakeUpHeimdall", () => {
const contractAddress = "0x759c0e9d7858566df8ab751026bedce462ff42df";
const rpcUrl = "1rpc.io/sepolia";

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 => {
Expand Down
5 changes: 2 additions & 3 deletions packages/nextjs/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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.");
Expand Down
1 change: 1 addition & 0 deletions packages/nextjs/utils/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const HEIMDALL_API_URL = "https://heimdall-api-v2.fly.dev";

0 comments on commit cf2c048

Please sign in to comment.