Add GQL schema in run script
All checks were successful
/ test (pull_request) Successful in 1m16s
/ build (pull_request) Successful in 2m2s
/ lint (pull_request) Successful in 1m19s

This commit is contained in:
IshaVenikar 2025-05-26 16:34:39 +05:30
parent 2a9b9f240b
commit be55efd877
6 changed files with 124 additions and 27 deletions

View File

@ -1,5 +1,8 @@
type Multisig {
id: ID!
# The @search annotation allows us to query the list of multisigs and filter
# by (chainId, address) pairs. We use "hash" since we only need exact matches.
# See https://dgraph.io/docs/graphql/schema/directives/search/#string
chainId: String! @search(by: [hash])
address: String! @search(by: [hash])
creator: String @search(by: [hash])

View File

@ -1,32 +1,31 @@
version: '3.8'
services:
cosmos-multisig-ui:
image: cerc/cosmos-multisig-ui:local
restart: unless-stopped
depends_on:
- alpha
network_mode: "host"
network_mode: "host" # For local testing, to allow the container to directly access host machine ports from container
environment:
DGRAPH_URL: ${DGRAPH_URL:-http://localhost:8080/graphql}
NEXT_PUBLIC_MULTICHAIN: ${NEXT_PUBLIC_MULTICHAIN:-true}
NEXT_PUBLIC_REGISTRY_NAME: ${NEXT_PUBLIC_REGISTRY_NAME:-laconic}
NEXT_PUBLIC_LOGO: ${NEXT_PUBLIC_LOGO:-}
NEXT_PUBLIC_CHAIN_ID: ${NEXT_PUBLIC_CHAIN_ID:-laconic_9000-1}
NEXT_PUBLIC_CHAIN_DISPLAY_NAME: ${NEXT_PUBLIC_CHAIN_DISPLAY_NAME:-Laconic Network}
NEXT_PUBLIC_NODE_ADDRESSES: ${NEXT_PUBLIC_NODE_ADDRESSES:-["http://localhost:26657"]}
NEXT_PUBLIC_DENOM: ${NEXT_PUBLIC_DENOM:-alnt}
NEXT_PUBLIC_DISPLAY_DENOM: ${NEXT_PUBLIC_DISPLAY_DENOM:-ALNT}
NEXT_PUBLIC_DISPLAY_DENOM_EXPONENT: ${NEXT_PUBLIC_DISPLAY_DENOM_EXPONENT:-18}
NEXT_PUBLIC_ASSETS: ${NEXT_PUBLIC_ASSETS:-[{"denom_units":[{"denom":"alnt","exponent":0},{"denom":"alnt","exponent":6}],"base":"alnt","name":"Laconic Token","display":"ALNT","symbol":"alnt"}]}
NEXT_PUBLIC_GAS_PRICE: ${NEXT_PUBLIC_GAS_PRICE:-0.01alnt}
NEXT_PUBLIC_ADDRESS_PREFIX: ${NEXT_PUBLIC_ADDRESS_PREFIX:-laconic}
NEXT_PUBLIC_IS_HTTP_ENABLED: ${NEXT_PUBLIC_IS_HTTP_ENABLED:-true}
NEXT_PUBLIC_MULTICHAIN: ${NEXT_PUBLIC_MULTICHAIN}
NEXT_PUBLIC_REGISTRY_NAME: ${NEXT_PUBLIC_REGISTRY_NAME}
NEXT_PUBLIC_LOGO: ${NEXT_PUBLIC_LOGO}
NEXT_PUBLIC_CHAIN_ID: ${NEXT_PUBLIC_CHAIN_ID}
NEXT_PUBLIC_CHAIN_DISPLAY_NAME: ${NEXT_PUBLIC_CHAIN_DISPLAY_NAME}
NEXT_PUBLIC_NODE_ADDRESSES: ${NEXT_PUBLIC_NODE_ADDRESSES}
NEXT_PUBLIC_DENOM: ${NEXT_PUBLIC_DENOM}
NEXT_PUBLIC_DISPLAY_DENOM: ${NEXT_PUBLIC_DISPLAY_DENOM}
NEXT_PUBLIC_DISPLAY_DENOM_EXPONENT: ${NEXT_PUBLIC_DISPLAY_DENOM_EXPONENT}
NEXT_PUBLIC_ASSETS: ${NEXT_PUBLIC_ASSETS}
NEXT_PUBLIC_GAS_PRICE: ${NEXT_PUBLIC_GAS_PRICE}
NEXT_PUBLIC_ADDRESS_PREFIX: ${NEXT_PUBLIC_ADDRESS_PREFIX}
NEXT_PUBLIC_IS_HTTP_ENABLED: ${NEXT_PUBLIC_IS_HTTP_ENABLED:-false}
command: ["bash", "/cosmos-script/run.sh"]
volumes:
- ../config/cosmos-multisig-ui/run.sh:/cosmos-script/run.sh
- ../config/cosmos-multisig-ui/db-schema.graphql:/cosmos-script/db-schema.graphql
ports:
- "3000:3000"
- "3000"
healthcheck:
test: ["CMD", "nc", "-vz", "127.0.0.1", "3000"]
interval: 20s

View File

@ -1,32 +1,30 @@
version: '3.8'
services:
zero:
image: dgraph/dgraph:latest
image: dgraph/dgraph:v21.03.2
volumes:
- zero-data:/dgraph
ports:
- "5080:5080"
- "6080:6080"
- "5080"
- "6080"
restart: on-failure
command: dgraph zero --my=zero:5080
alpha:
image: dgraph/dgraph:latest
image: dgraph/dgraph:v21.03.2
depends_on:
- zero
volumes:
- alpha-data:/dgraph
ports:
- "8080:8080"
- "9080:9080"
- "8080"
- "9080"
restart: on-failure
command: dgraph alpha --my=alpha:7080 --zero=zero:5080 --security "whitelist=0.0.0.0/0"
ratel:
image: dgraph/ratel:latest
image: dgraph/ratel:v21.03.0
ports:
- "8000:8000"
- "8000"
depends_on:
- alpha

View File

@ -0,0 +1,30 @@
type Multisig {
id: ID!
chainId: String! @search(by: [hash])
address: String! @search(by: [hash])
creator: String @search(by: [hash])
pubkeyJSON: String! @search(by: [fulltext])
transactions: [Transaction] @hasInverse(field: creator)
}
type Transaction {
id: ID!
txHash: String
creator: Multisig
dataJSON: String!
signatures: [Signature] @hasInverse(field: transaction)
}
type Signature {
transaction: Transaction!
bodyBytes: String!
signature: String!
address: String!
}
type Nonce {
id: ID!
chainId: String! @search(by: [hash])
address: String! @search(by: [hash])
nonce: Int!
}

View File

@ -5,6 +5,10 @@ if [ -n "$CERC_SCRIPT_DEBUG" ]; then
set -x
fi
# Load Dgraph schema
echo "Posting schema to Dgraph..."
curl -X POST localhost:8080/admin/schema -d @/cosmos-script/db-schema.graphql
echo "Using the following env variables:"
echo "DGRAPH_URL: ${DGRAPH_URL}"
echo "NEXT_PUBLIC_MULTICHAIN: ${NEXT_PUBLIC_MULTICHAIN}"

View File

@ -26,12 +26,75 @@ Instructions for running the `cosmos-multisig-ui` using [laconic-so](https://git
laconic-so --stack ~/cerc/cosmos-multisig-ui/stack-orchestrator/stacks/cosmos-multisig-ui deploy init --output cosmos-multisig-ui-spec.yml
```
* Edit `network` in the spec file to map container ports to host ports as required:
```bash
# cosmos-multisig-ui-spec.yml
...
network:
ports:
cosmos-multisig-ui:
- 3000:3000
zero:
- 5080:5080
- 6080:6080
alpha:
- 8080:8080
- 9080:9080
ratel:
- 8000:8000
...
```
* Create a deployment from the spec file:
```bash
laconic-so --stack ~/cerc/cosmos-multisig-ui/stack-orchestrator/stacks/cosmos-multisig-ui/ deploy create --spec-file cosmos-multisig-ui-spec.yml --deployment-dir cosmos-multisig-deployment
```
* Inside the `cosmos-multisig-deployment` deployment directory, open `config.env` file and set following env variables:
```bash
# Allow multiple networks/chains in app
NEXT_PUBLIC_MULTICHAIN=false
# Name of the chain registry
NEXT_PUBLIC_REGISTRY_NAME=laconic
# Path or URL to the logo asset (can be left empty if not needed)
NEXT_PUBLIC_LOGO=
# Chain ID
NEXT_PUBLIC_CHAIN_ID=laconic_9000-1
# Display name for the chain
NEXT_PUBLIC_CHAIN_DISPLAY_NAME="Laconic Network"
# JSON array of RPC node URLs
NEXT_PUBLIC_NODE_ADDRESSES='["http://localhost:26657"]'
# Native token base denom
NEXT_PUBLIC_DENOM=alnt
# Display name for the token (used in UI)
NEXT_PUBLIC_DISPLAY_DENOM=ALNT
# Exponent used to convert from base denom
NEXT_PUBLIC_DISPLAY_DENOM_EXPONENT=18
# JSON array of asset metadata
NEXT_PUBLIC_ASSETS='[{"denom_units":[{"denom":"alnt","exponent":0},{"denom":"alnt","exponent":6}],"base":"alnt","name":"Laconic Token","display":"ALNT","symbol":"alnt"}]'
# Minimum gas price
NEXT_PUBLIC_GAS_PRICE=0.01alnt
# Bech32 address prefix for the chain
NEXT_PUBLIC_ADDRESS_PREFIX=laconic
# Whether to use HTTP (true/false)
NEXT_PUBLIC_IS_HTTP_ENABLED=true
```
## Start the deployment
* Run: