Skip to content

BLOCKCHAINDEVWEB/subgraph-nextjs-feature

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Subgraph Studio

Get started:

Clone code:

git clone https://github.com/BLOCKCHAINDEVWEB/subgraph-nextjs-feature.git
cd subgraph-nextjs-feature

Duplicate the .env file given as an example:

cd client
cp .env.sample .env

Complete your .env file with for example:

NEXT_PUBLIC_TEMPORARY_QUERY_URL=https://api.studio.thegraph.com/query/11783/feature/v0.0.1

Install dependencies:

yarn

Run your application:

npm run dev

Create your subgraph

Prerequisite

$ npm install -g @graphprotocol/graph-cli
$ graph help

Started your first subgraph

  • Open url https://thegraph.com/en/
  • Create your account network on TheGraph site on url https://thegraph.com/
  • Select Subgraph Studio in The Graph list
  • Click on button: Create a Subgraph
  • Give your Subgraph Name
  • Enter in your subgraph

In your terminal console:

  1. initialize your subgraph with smart-contract
  $ graph init --contract-name Feature \
  --index-events \
  --product subgraph-studio \
  --from-contract 0x10c6eE1Fc45dB7872...8fBdb7 
  ? Subgraph name » Feature
  ? Directory to create the subgraph in » Zola
  ? Ethereum network » Rinkeby
  ? Contract address » 0x10c6eE1Fc45dB7872...8fBdb7
  ? Contract Name » Feature
  1. authenticate whith your deploy key
$  graph auth --studio
? Deploy key » e03b9d...712d9f
  1. generate types for contract ABIs and GraphQL schema
$ graph codegen && graph build
  1. deploy your code with subgraph slug
$ graph deploy --studio feature
? Version Label (e.g. v0.0.1) · v0.0.1

Open your subgraph

  1. give an query in your playground
query {
  claimSubmits(first: 5) {
    id
    _transactionID
    _claimID
    _receiver
  }
}
  1. use your endpoint in a loading playground GraphQL

Learn more

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published