{"id":20093917,"url":"https://github.com/api3dao/api3-subgraph","last_synced_at":"2025-05-06T04:32:24.023Z","repository":{"id":192987463,"uuid":"635671928","full_name":"api3dao/api3-subgraph","owner":"api3dao","description":"Subgraph infrastructure and code","archived":true,"fork":false,"pushed_at":"2024-03-16T10:20:42.000Z","size":529,"stargazers_count":0,"open_issues_count":1,"forks_count":1,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-03-02T16:16:05.843Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/api3dao.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-05-03T07:52:31.000Z","updated_at":"2024-04-25T09:09:07.000Z","dependencies_parsed_at":"2024-11-13T16:49:00.049Z","dependency_job_id":"4a20fd69-ae36-4f44-bedd-df63ccf736f9","html_url":"https://github.com/api3dao/api3-subgraph","commit_stats":null,"previous_names":["api3dao/api3-subgraph"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/api3dao%2Fapi3-subgraph","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/api3dao%2Fapi3-subgraph/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/api3dao%2Fapi3-subgraph/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/api3dao%2Fapi3-subgraph/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/api3dao","download_url":"https://codeload.github.com/api3dao/api3-subgraph/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252622453,"owners_count":21777992,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-13T16:48:48.584Z","updated_at":"2025-05-06T04:32:23.735Z","avatar_url":"https://github.com/api3dao.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# API3 subgraph\n\n## Local Development\n\n1. For the scripts in `package.json` to work, you need to load your environment variables. The most convient way to doing this:\n   1. Copy `.env.example` to `.env`, and check / change the desired values\n   2. run the scripts like this: `npx dotenv-cli yarn script-name` (the [dotenv-cli](https://www.npmjs.com/package/dotenv-cli) will load the variables from the file named `.env` defaultly)\n2. Start a local graph node:\n   run `yarn compose-local-graph-node` (modify `.env` file to configure ports and chain names/urls)\n3. Common scripts for subgraph development in `package.json \u003e scripts`:\n\n   - `compose-local-graph-node`: just a shortcut for `docker-compose up` for the docker-compose.local.yml file\n\n   - you most probably using these in this order:\n     1. `generate-types`: generate the typescript types for the specified contract subgraph (controlled by the `CONTRACT_NAME` env variable)\n     2. `generate-chain-specific-configs`: generate all the subgraph.\\${CHAIN_NAME}.yaml files for the specified contract subgraph (controlled by the `CONTRACT_NAME` env variable) for all the specified chains (controlled by the `CHAINS` env variable, or - if it's not presented - by `chains` property in `subgraph_infrastructure.yaml`)\n     3. `build`: build the subgraph for the specified contract subgraph and specified chain (controlled by the `CONTRACT_NAME` and `CHAIN_NAME` env variables)\n     4. `register`: register a subgraph in the graph node (controlled by the `SUBGRAPH_NAME` and `GRAPH_NODE` env variables), `unregister` is the same, but for removing the registration\n     5. `deploy`: deploy the specified contract subgraph to the graph node (controlled by the `SUBGRAPH_NAME` (need to be registered before), `CONTRACT_NAME`, `CHAIN_NAME`, `IPFS_NODE`, `GRAPH_NODE`, `VERSION_LABEL` env variables)\n     6. `generate-build-deploy`: just a shortcut to run all the above scripts all at once\n\n## Adding a new subgraph\n\n### Keep the naming convention for new subgraphs for the scripts to be able to work: `subgraphs/$ContractName/src/subgraph.yaml`.\n\n1. create a new folder with the **exact name of the contract** `subgraphs/$ContractName`\n2. create an src folder inside it `subgraphs/$ContractName/src`\n3. Create the `subgraph.yaml` and the schema and mapping files inside the `src` folder (see the other subgraphs for examples)\n4. **Add the `generate-abis` script to the package.json** (see the other `generate-abis` scripts for examples)\n   1. create the `$contract-name:generate-abis` script\n   2. extend the `postinstall` script with it (so it will generate all the abis automatically when you install the dependencies)\n\n## Deploy on production:\n\n1. install dependencies `yarn install`\n2. export AWS credentials\n3. run the deployment script\n   ```bash\n   ./scripts/deploy-public-chain.sh --chain-name ${chain_name} --contract-name ${contract_name}\n   ```\n\nCurrently supported chains:\n\n- `Polygon Mumbai` (id: polygon-testnet)\n- `Polygon zkevm` (id: polygon-zkevm)\n- `Arbitrum` (id: arbitrum)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapi3dao%2Fapi3-subgraph","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fapi3dao%2Fapi3-subgraph","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapi3dao%2Fapi3-subgraph/lists"}