|
1 | 1 | # @kleros/kleros-v2-subgraph-fastbridge |
2 | 2 |
|
3 | | -🚧 ⚖️ 🚧 |
| 3 | +## Deployments |
| 4 | + |
| 5 | +- [kleros/fastbridge-arbitrum-rinkeby](https://thegraph.com/hosted-service/subgraph/kleros/fastbridge-arbitrum-rinkeby) |
| 6 | + |
| 7 | +## Build |
| 8 | + |
| 9 | +```bash |
| 10 | +$ yarn |
| 11 | + |
| 12 | +$ yarn codegen |
| 13 | + |
| 14 | +$ yarn build |
| 15 | +``` |
| 16 | + |
| 17 | +## Deployment to The Graph (hosted service) |
| 18 | + |
| 19 | +### Authentication |
| 20 | + |
| 21 | +Get an API key from the thegraph.com, then authenticate. |
| 22 | + |
| 23 | +```bash |
| 24 | +$ yarn run graph auth --product hosted-service |
| 25 | +``` |
| 26 | + |
| 27 | +### Deployment |
| 28 | + |
| 29 | +```bash |
| 30 | +yarn deploy |
| 31 | +``` |
| 32 | + |
| 33 | +## Deployment to a local Graph node |
| 34 | + |
| 35 | +_Credits to the [scaffold-eth service package](https://github.com/scaffold-eth/scaffold-eth/tree/b03d07f15882db626300ffa04f222736b2a22f81/packages/services/graph-node)_ |
| 36 | + |
| 37 | +Preconfigured Docker image for running a Graph Node. |
| 38 | + |
| 39 | +## Usage |
| 40 | + |
| 41 | +**Prerequisite**: docker and docker-compose. |
| 42 | + |
| 43 | +```bash |
| 44 | +$ docker-compose up -d |
| 45 | +Starting graph-node_postgres_1 ... done |
| 46 | +Starting graph-node_ipfs_1 ... done |
| 47 | +Starting graph-node_graph-node_1 ... done |
| 48 | + |
| 49 | +$ docker-compose logs -f |
| 50 | +... |
| 51 | +``` |
| 52 | + |
| 53 | +This will start docker containers for the following services: |
| 54 | + |
| 55 | +- IPFS, |
| 56 | +- Postgres |
| 57 | +- **Graph Node** connecting to the Arbitrum Rinkeby official RPC |
| 58 | + |
| 59 | +This also creates persistent data directories for IPFS and Postgres in `./data/ipfs` and `./data/postgres`. |
| 60 | + |
| 61 | +Once this is up and running, you can use [`graph-cli`](https://github.com/graphprotocol/graph-cli) to create and deploy your subgraph to the running Graph Node. |
| 62 | + |
| 63 | +```bash |
| 64 | +# First time only. |
| 65 | +$ yarn create-local |
| 66 | +Created subgraph: fastbridge |
| 67 | + |
| 68 | +$ yarn deploy-local --version-label v0.0.1 |
| 69 | +✔ Apply migrations |
| 70 | +✔ Load subgraph from subgraph.yaml |
| 71 | + Compile data source: FastBridgeSender => build/FastBridgeSender/FastBridgeSender.wasm |
| 72 | +✔ Compile subgraph |
| 73 | + Copy schema file build/schema.graphql |
| 74 | + Write subgraph file build/FastBridgeSender/abis/FastBridgeSender.json |
| 75 | + Write subgraph manifest build/subgraph.yaml |
| 76 | +✔ Write compiled subgraph to build/ |
| 77 | + Add file to IPFS build/schema.graphql |
| 78 | + .. Qmb3Uahj4qKh5u3V4KuraXJqsrUVwPtvva1KQQSb5tLov9 |
| 79 | + Add file to IPFS build/FastBridgeSender/abis/FastBridgeSender.json |
| 80 | + .. QmQas2SuTQH6zybTVMGBym76kyBoTp7MwkogcmtHAeMoRj |
| 81 | + Add file to IPFS build/FastBridgeSender/FastBridgeSender.wasm |
| 82 | + .. QmSLfCYp19WW5JEiaKdmcGFgBCJ5DA723dEkM6QvXE2eCa |
| 83 | +✔ Upload subgraph to IPFS |
| 84 | + |
| 85 | +Build completed: QmWjRVXec6auQdnpvYJ7F8vW7PzkJHYJhFtorWZAhtP9A3 |
| 86 | + |
| 87 | +Deployed to http://localhost:8000/subgraphs/name/fastbridge/graphql |
| 88 | + |
| 89 | +Subgraph endpoints: |
| 90 | +Queries (HTTP): http://localhost:8000/subgraphs/name/fastbridge |
| 91 | +``` |
| 92 | + |
| 93 | +## Access |
| 94 | + |
| 95 | +### Graph Node |
| 96 | + |
| 97 | +- GraphiQL: `http://localhost:8000/` |
| 98 | +- HTTP: `http://localhost:8000/subgraphs/name/<subgraph-name>` |
| 99 | +- WebSockets: `ws://localhost:8001/subgraphs/name/<subgraph-name>` |
| 100 | +- Admin: `http://localhost:8020/` |
| 101 | + |
| 102 | +### IPFS |
| 103 | + |
| 104 | +- `127.0.0.1:5001` or `/ip4/127.0.0.1/tcp/5001` |
| 105 | + |
| 106 | +### Postgres |
| 107 | + |
| 108 | +- `postgresql://graph-node:let-me-in@localhost:5432/graph-node` |
0 commit comments