laconic-registry-cli/demo/README.md

120 lines
3.1 KiB
Markdown
Raw Normal View History

2024-05-08 09:51:23 +00:00
# Registry Demo
## Setup
2024-05-09 09:46:08 +00:00
* Install laconic CLI globally:
```bash
# In laconic-registry-cli repo root
yarn && yarn build
yarn global add file:$PWD
```
2024-05-09 08:58:57 +00:00
2024-05-08 09:51:23 +00:00
* Run the laconicd chain:
```bash
2024-05-09 08:58:57 +00:00
# In laconci2d repo
2024-05-08 09:51:23 +00:00
make install
./scripts/init.sh clean
```
* Create and populate `config.yml` following [config.example.yml](./config.example.yml):
```bash
2024-05-09 08:58:57 +00:00
# In laconic-registry-cli repo root
2024-05-09 05:50:14 +00:00
cp config.example.yml config.yml
2024-05-09 08:58:57 +00:00
# Update the gas value in config.yml
2024-05-09 06:26:57 +00:00
# gas: 500000
2024-05-09 08:58:57 +00:00
# Get user private key
2024-05-08 09:51:23 +00:00
laconicd keys export alice --unarmored-hex --unsafe --keyring-backend test --home ~/.laconicd
2024-05-09 08:58:57 +00:00
# Set the output as 'userKey' in config.yml
# userKey: <ALICE_PRIVATE_KEY>
2024-05-08 09:51:23 +00:00
2024-05-09 08:58:57 +00:00
# Create a bond
laconic --config config.yml registry bond create --type photon --quantity 100000000000
2024-05-08 09:51:23 +00:00
2024-05-09 08:58:57 +00:00
# Get the bond id
laconic --config config.yml registry bond list | jq -r '.[].id'
2024-05-08 09:51:23 +00:00
2024-05-09 08:58:57 +00:00
# Set the output as 'bondId' in config.yml
# bondId: <BOND_ID>
2024-05-08 09:51:23 +00:00
```
## Run
2024-05-09 08:58:57 +00:00
* Publish records:
2024-05-08 09:51:23 +00:00
```bash
2024-05-09 08:58:57 +00:00
# Publishes records and corresponding 'deployment' records from given directory
2024-05-09 06:26:57 +00:00
2024-05-09 08:58:57 +00:00
# In laconic-registry-cli repo root
2024-05-09 06:26:57 +00:00
# Use records dir path for '--records' as required
2024-05-09 08:58:57 +00:00
yarn ts-node demo/scripts/publish-records.ts --config config.yml --records <RECORDS_DIR>
2024-05-08 09:51:23 +00:00
```
### Example
* Query for `ajna-watcher` deployment(s):
* Find the `WatcherRecord` for `ajna-watcher`:
```bash
WATCHER_RECORD_ID=$(laconic registry record list --all --type WatcherRecord --name ajna-watcher | jq -r '.[].id')
```
* Find corresponding deployment(s):
```bash
laconic registry record list --all --type WatcherDeploymentRecord watcher $WATCHER_RECORD_ID
# Get the deployment URL(s)
laconic registry record list --all --type WatcherDeploymentRecord watcher $WATCHER_RECORD_ID | jq -r '.[].attributes.url'
2024-05-09 06:54:32 +00:00
# Expected output:
https://ajna-watcher-endpoint.example.com
2024-05-08 09:51:23 +00:00
```
2024-05-08 14:00:55 +00:00
* Query for `sushiswap-v3-subgraph` deployment(s):
* Find the `SubgraphRecord` for `sushiswap-v3-subgraph`:
```bash
SUBGRAPH_RECORD_ID=$(laconic registry record list --all --type SubgraphRecord --name sushiswap-v3-subgraph | jq -r '.[].id')
```
* Find corresponding deployment(s):
```bash
laconic registry record list --all --type SubgraphDeploymentRecord subgraph $SUBGRAPH_RECORD_ID
# Get the deployment URL(s)
laconic registry record list --all --type SubgraphDeploymentRecord subgraph $SUBGRAPH_RECORD_ID | jq -r '.[].attributes.url'
2024-05-09 06:54:32 +00:00
# Expected output:
# https://sushiswap-v3-subgraph-endpoint.example.com
2024-05-08 14:00:55 +00:00
```
2024-05-09 05:32:24 +00:00
* Query for `geth` service deployment(s):
2024-05-08 14:00:55 +00:00
2024-05-09 05:32:24 +00:00
* Find the `ServiceRecord` for `geth`:
2024-05-08 14:00:55 +00:00
```bash
2024-05-09 05:32:24 +00:00
SERVICE_RECORD_ID=$(laconic registry record list --all --type ServiceRecord --name geth | jq -r '.[].id')
2024-05-08 14:00:55 +00:00
```
* Find corresponding deployment(s):
```bash
laconic registry record list --all --type ServiceDeploymentRecord service $SERVICE_RECORD_ID
# Get the deployment URL(s)
laconic registry record list --all --type ServiceDeploymentRecord service $SERVICE_RECORD_ID | jq -r '.[].attributes.url'
2024-05-09 06:54:32 +00:00
# Expected output:
# https://geth-rpc-endpoint-1.example.com
# https://geth-rpc-endpoint-2.example.com
2024-05-08 14:00:55 +00:00
```