-
Notifications
You must be signed in to change notification settings - Fork 18
allow full local testing with anvil integration #27
base: main
Are you sure you want to change the base?
Conversation
I got the graph part of this working. Just in case I get hit by a 🚌, here are some notes on setup. I'll incorporate these into a readme before proposing the branch for merge.
You should now be able to run Some other notes: If you are doing test cycles you might need to jump into Postgres and drop the database ( |
Hey I came across this from another thread. I still haven't been able to get a local graph node working with Anvil. The errors I get are:
Can you tell me how you got past this? I tried to use this docker-compose: version: "3.3"
services:
chain-1337:
container_name: chain-1337-test
environment:
- MNEMONIC=$MNEMONIC
image: ghcr.io/foundry-rs/foundry:latest
ports:
- "8547:8545"
entrypoint: 'anvil --chain-id 1337 --mnemonic "$MNEMONIC" --host 0.0.0.0 --block-time 3 --verbosity'
graph-node-1337:
container_name: graph-node-1337-test
image: graphprotocol/graph-node:v0.26.0
ports:
- "8010:8000"
- "8001:8001"
- "8020:8020"
- "8030:8030"
- "8040:8040"
depends_on:
- ipfs
- postgres-1337
- chain-1337
environment:
postgres_host: postgres-1337
postgres_user: graph-node
postgres_pass: let-me-in
postgres_db: graph-node
ipfs: "ipfs:5001"
ethereum: "mainnet:http://chain-1337:8545"
GRAPH_LOG: info
postgres-1337:
container_name: postgres-1337-test
image: postgres
ports:
- "5432:5432"
command: ["postgres", "-cshared_preload_libraries=pg_stat_statements"]
environment:
POSTGRES_USER: graph-node
POSTGRES_PASSWORD: let-me-in
POSTGRES_DB: graph-node
ipfs:
container_name: ipfs-test
image: ipfs/go-ipfs:v0.4.23
ports:
- "5001:5001" |
@rhlsthrm Do you possibly have a typo in the port mapping for Foundry? Should it be |
@davisshaver No, internally it uses the docker network port which is the internal 8545 anyways. This is just the external port mapping. This exact config works with a hardhat node. |
@rhlsthrm Where does the |
@davisshaver this line right here:
maps the internal 8545 (the default port like you mentioned) to 8547 (this is just the exposed port on the host machine, this can be anything). This does not affect the internal ports on the node container, which is how the docker network refers to it. You can see more info here: https://docs.docker.com/compose/compose-file/#ports |
@rhlsthrm I see - well unfortunately I'm not sure what's going on, sorry I can't be more assistance. We are thinking about using the Docker container instead at some point so if we run into this issue I'll post notes here. Good luck! |
@@ -1,4 +1,5 @@ | |||
import ExampleNFTGoerli from "@web3-scaffold/contracts/deploys/goerli/ExampleNFT.json"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm trying to figure out a good way of allowing the chain to be specified here. 🤔
I started working on some docs that explain each ENV var and outline the
steps needed to start customizing to use with your own contract (based on
my experience). I’ll send a PR through tomorrow with it!
On Mon, Jul 4, 2022 at 8:31 PM Kevin Ingersoll ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In packages/app/.env
<#27 (comment)>:
> @@ -1,2 +1,4 @@
-CHAIN_ID=5
+NEXT_PUBLIC_CHAIN_SLUGS=
+NEXT_PUBLIC_CHAIN_STATUS=
+NEXT_PUBLIC_GRAPH_HOST=
It might simplify things and make things a little more explicit to just
put the whole URL here, e.g. NEXT_PUBLIC_SUBGRAPH_URL=
https://api.thegraph.com/subgraphs/name/holic/example-nft
And we can make that the default value here in .env so folks start off
with a clean + working subgraph, with instructions for pointing at their
own URL (local or otherwise)
—
Reply to this email directly, view it on GitHub
<#27 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAEVN3FJVHDBOXDX3K6WM7TVSN66LANCNFSM5Z23TR2A>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
--
Founder & CTO: https://therightchoyce.com
Co-Creator & DJ: https://adventuresbk.com
Music & Events: http://djchoycehacks.com
|
It shouldn’t matter because the subgraph is accessing the node through the internal container endpoint. This exact config works with a Hardhat node. On Jun 28, 2022, at 15:13, Davis Shaver ***@***.***> wrote:
@rhlsthrm Do you possibly have a typo in the port mapping for Foundry? Should it be 8545:8545 instead?
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Does anyone have a full working solution for how to connect anvil to the local graph node? |
Addresses #21. These changes should all be non-breaking, meaning that unless a user sets the new environmental variables, everything should work the same out of the box before and after merging this branch.
This PR:
CHAIN_ID
toNEXT_PUBLIC_CHAIN_SLUGS
so that the environment variable is available client side and allows for multiple chains to be specifiedNEXT_PUBLIC_CHAIN_STATUS
environment variable allowing thechainStatus
prop on<ConnectButton />
to be easily configured (this helps with UX when mainnet is included as a chain for ENS compatibility, but not meant to be used directly)NEXT_PUBLIC_CONTRACT_ADDRESS
environment variable allowing the contract address to be switched without changing underlying code (this helps with local testing workflow)NEXT_PUBLIC_SUBGRAPH_URL
environment variable allowing the subgraph URL to be explicitly specified without changing underlying code (if using a local graph node, for example)getContractAddress()
,getSubgraphURL()
,getChainStatus()
, andgetChains()
functionsHere are the
.env.local
settings that can be used for Foundry deployment.