A subgraph indexing iexec-voucher-contracts
# install deps
npm ci
# generate code from the ABIs
npm run codegen
# build
npm run build
Prerequisites:
bellecour
RPC node (can be a test node)VoucherHub
contract deployed on RPC node's network- IPFS node with access to admin API
- graphnode connected to network
bellecour
with access to admin API
NB: you can run a dockerized stack with npm run start-test-stack
(npm run stop-test-stack
when done)
env:
NETWORK_NAME
(optional): custom graphnode network name (default bellecour)VOUCHER_HUB_ADDRESS
:VoucherHub
contract addressVOUCHER_HUB_START_BLOCK
: startVoucherHub
indexation block numberIPFS_URL
: IPFS admin api urlGRAPHNODE_URL
: graphnode admin api url
# set VoucherHub deployment details
export VOUCHER_HUB_ADDRESS="0x3137B6DF4f36D338b82260eDBB2E7bab034AFEda"
export VOUCHER_HUB_START_BLOCK=30306387
# set deployment urls
export IPFS_URL="http://localhost:5001"
export GRAPHNODE_URL="http://localhost:8020"
# generate code from the ABIs
npm run codegen
# build
npm run build
# deploy
npm run create
npm run deploy
once deployed the subgraph can be queried via the graphiql interface.
docker image for deploying the subgraph
docker build -f docker/Dockerfile . -t voucher-subgraph-deployer
env:
NETWORK_NAME
(optional): custom graphnode network name (default bellecour)VOUCHER_HUB_ADDRESS
:VoucherHub
contract addressVOUCHER_HUB_START_BLOCK
: startVoucherHub
indexation block numberIPFS_URL
: IPFS admin api urlGRAPHNODE_URL
: graphnode admin api url
docker run --rm \
-e NETWORK_NAME=bellecour \
-e VOUCHER_HUB_ADDRESS="0x3137B6DF4f36D338b82260eDBB2E7bab034AFEda" \
-e VOUCHER_HUB_START_BLOCK=30306387 \
-e IPFS_URL="http://ipfs:5001" \
-e GRAPHNODE_URL="http://graphnode:8020" \
voucher-subgraph-deployer
This pipeline handles building the voucher-subgraph Docker image, which is used for deploying the subgraph.
This pipeline is responsible for deploying the voucher-subgraph to the desired environment.
Steps:
- User Input: The pipeline prompts the user for input, such as the target host, network name, voucher hub address, and start block.
- Run Docker Image: The Docker container is executed, deploying the subgraph to the specified Graph Node and IPFS node.