Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cawfree/autographed
The self-building, hot-reloading subgraph. The quickest way to start indexing your shit.
https://github.com/cawfree/autographed
ethereum graphprotocol indexing subgraph the-graph
Last synced: 11 days ago
JSON representation
The self-building, hot-reloading subgraph. The quickest way to start indexing your shit.
- Host: GitHub
- URL: https://github.com/cawfree/autographed
- Owner: cawfree
- License: mit
- Created: 2022-08-10T11:17:30.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-08-11T12:10:28.000Z (over 2 years ago)
- Last Synced: 2024-10-31T17:57:54.468Z (17 days ago)
- Topics: ethereum, graphprotocol, indexing, subgraph, the-graph
- Language: TypeScript
- Homepage: https://thegraph.com/en/
- Size: 147 KB
- Stars: 16
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# [`npx autographed`](https://github.com/cawfree/autographed)
The self-building, hot-reloading subgraph. The quickest way to start indexing your shit.### 🚀 getting started
Okay, so there's _a lot_ that goes into [__running a subgraph__](https://thegraph.com/docs/en/deploying/deploying-a-subgraph-to-hosted/). The purpose of this library is to take care of most of that, and just get you to indexing your smart contract as quickly as possible.
> __Notice:__ `autographed` dynamically generates all the mappings and runtime architecture you need to quickly query for historical blockchain data emitted during smart contract [`event`](https://solidity-by-example.org/events/)s. It is not suitable for writing custom indexing logic.
If this sounds like a good fit for you, you will need to make sure you have some of the following system dependencies available on your runtime.
First, please make sure you've installed and configured the [__Rust Toolchain__](https://www.rust-lang.org/):
```shell
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
```On top of that, you'll need to be able to run [__Docker Containers__](https://www.docker.com/). The easiest way to do this is to download and install [__Docker Desktop__](https://www.docker.com/products/docker-desktop/).
With these steps out of the way, you'll finally need to install these last low-level dependencies:
```shell
ipfs jq gsed libpq cmake
```Inside of your [__hardhat project root__](https://hardhat.org/hardhat-runner/docs/getting-started#overview), create a `.autograph.json`. This is what's used to control the name of the autogenerated subgraph, and which contracts in your local hardhat project you want to get indexed. You'll want to provide the addresses the contracts get deployed to when initializing your local chain.
```json
{
"name": "MySubgraphName",
"sources": [
{
"contractName": "MyContractName",
"contractAddress": "0x..."
}
]
}
```For a vanilla project configuration, an initial contract deployment transaction sent by `(await ethers.getSigners())[0]`, commonly referred to as `owner`, will be stored at the on-chain address `0x5FbDB2315678afecb367f032d93F642f64180aa3`.
There are some additional configuration options that can be used to tune the generator to your local runtime. By default, `autographed` will use the following settings:
```shell
GRAPH_NODE_GRAPHQL_PORT=8000
GRAPH_NODE_STATUS_PORT=8020
IPFS_PORT=5001
POSTGRES_PORT=5432
ETHEREUM_PORT=8545
ETHEREUM_NETWORK=hardhat
POSTGRES_DB=dev
POSTGRES_USER=dev
POSTGRES_PASSWORD=dev
```These can be overridden using [__environment variables__](https://stackoverflow.com/a/34154491) i.e:
```shell
IPFS_PORT=420 ETHEREUM_PORT=6969 npx autographed
```> There's a ton of binary files that will need to be compiled on your first run. In the mean time, why don't you put on a cup of coffee or do some yoga or something? ☕️
### 🔨 building
If you'd like to build this repo yourself, just `git clone` and run `yarn` from the top-level directory. You can also use `yarn test` to make sure everything's working okay or if you need to debug any issues you ~~might~~ will encounter.### ✌️ license
[__MIT__](./LICENSE)