Skip to content

Latest commit

 

History

History
64 lines (43 loc) · 2.57 KB

README.md

File metadata and controls

64 lines (43 loc) · 2.57 KB

IPNFT subgraph

Sepolia

API: https://subgraph.satsuma-prod.com/742d8952ab24/molecule--4039244/ip-nft-sepolia/api Playground: https://subgraph.satsuma-prod.com/molecule--4039244/ip-nft-sepolia/playground

Mainnet

API: https://subgraph.satsuma-prod.com/742d8952ab24/molecule--4039244/ip-nft-mainnet/api Playground: https://subgraph.satsuma-prod.com/molecule--4039244/ip-nft-mainnet/playground

Prerequisites

  • you can deploy contracts locally (see the main README)
  • you'll need docker (and docker-compose) on your box
  • install jq (apt i jq / brew install jq)

Running subgraph and contracts locally

  1. follow the local development deployment instructions to create a local deployment by running the fixture or dev scripts.
  2. Ensure the resulting contract addresses match the ones in your .env file and are available in your local environment (source .env). When executed on a fresh node with the default mnemonic, the addresses in .env.example are the deterministic contract addresses.
  3. Startup docker containers
docker compose up

The containers must be able to access your host box to connect to your local (anvil) chain. On Mac it likely just works since it can resolve host.docker.internal. On Linux setup.sh might be able to find your host's local network address and replace it in the compose file. Also make sure that you start your local blockchain node to be able to respond to the interface's traffic (e.g. by anvil -h 0.0.0.0). If you can't get this to work, you can instead start a ganache node as a docker service by using the docker-compose.ganache.yml override file:

docker-compose --file docker-compose.yml --file docker-compose.ganache.yml up
  1. Prepare subgraph deployment
yarn abis
yarn prepare:local

This copies over your contracts' ABIs and creates a subgraph.yaml file with the contract addresses on your local chain, according to your environment.

  1. Build and deploy the subgraph
yarn build
yarn create:local
yarn deploy:local
  1. Checkout the local GraphQL API at http://localhost:8000/subgraphs/name/moleculeprotocol/ipnft-subgraph

If your local dev node needs a little "push", this is how you manually can mine a block:

curl -H "Content-Type: application/json" -X POST --data '{"jsonrpc":"2.0","method":"evm_mine","params":[],"id":1}' 127.0.0.1:8545

deploying on the hosted service

  1. get an api key for using the hosted service
  2. yarn graph auth --product hosted-service <your api key>
  3. yarn graph deploy --product hosted-service <userprefix>/<graphname>