2022-09-07 11:44:15 +00:00
|
|
|
# Cerc-io laconic gql
|
2022-04-05 07:09:27 +00:00
|
|
|
|
|
|
|
> Browser : http://localhost:9473 for gql
|
|
|
|
|
|
|
|
## Start server
|
|
|
|
|
|
|
|
```shell
|
2022-09-07 07:26:51 +00:00
|
|
|
./build/laconicd start --gql-playground --gql-server
|
2022-04-05 07:09:27 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
Basic node status:
|
|
|
|
|
|
|
|
```graphql
|
|
|
|
{
|
2022-09-07 07:26:51 +00:00
|
|
|
getStatus {
|
|
|
|
version
|
|
|
|
node {
|
|
|
|
id
|
|
|
|
network
|
|
|
|
moniker
|
2022-04-05 07:09:27 +00:00
|
|
|
}
|
2022-09-07 07:26:51 +00:00
|
|
|
sync {
|
|
|
|
latest_block_height
|
|
|
|
catching_up
|
|
|
|
}
|
|
|
|
num_peers
|
|
|
|
peers {
|
|
|
|
is_outbound
|
|
|
|
remote_ip
|
|
|
|
}
|
|
|
|
disk_usage
|
|
|
|
}
|
2022-04-05 07:09:27 +00:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
Full node status:
|
|
|
|
|
|
|
|
```graphql
|
|
|
|
{
|
2022-09-07 07:26:51 +00:00
|
|
|
getStatus {
|
|
|
|
version
|
|
|
|
node {
|
|
|
|
id
|
|
|
|
network
|
|
|
|
moniker
|
|
|
|
}
|
|
|
|
sync {
|
|
|
|
latest_block_hash
|
|
|
|
latest_block_time
|
|
|
|
latest_block_height
|
|
|
|
catching_up
|
|
|
|
}
|
|
|
|
validator {
|
|
|
|
address
|
|
|
|
voting_power
|
|
|
|
proposer_priority
|
2022-04-05 07:09:27 +00:00
|
|
|
}
|
2022-09-07 07:26:51 +00:00
|
|
|
validators {
|
|
|
|
address
|
|
|
|
voting_power
|
|
|
|
proposer_priority
|
|
|
|
}
|
|
|
|
num_peers
|
|
|
|
peers {
|
|
|
|
node {
|
|
|
|
id
|
|
|
|
network
|
|
|
|
moniker
|
|
|
|
}
|
|
|
|
is_outbound
|
|
|
|
remote_ip
|
|
|
|
}
|
|
|
|
disk_usage
|
|
|
|
}
|
2022-04-05 07:09:27 +00:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
Get records by IDs.
|
|
|
|
|
|
|
|
```graphql
|
|
|
|
{
|
2022-09-07 07:26:51 +00:00
|
|
|
getRecordsByIds(ids: ["QmYDtNCKtTu6u6jaHaFAC5PWZXcj7fAmry6NoWwMaixFHz"]) {
|
|
|
|
id
|
|
|
|
names
|
|
|
|
bondId
|
|
|
|
createTime
|
|
|
|
expiryTime
|
|
|
|
owners
|
|
|
|
attributes {
|
|
|
|
key
|
|
|
|
value {
|
|
|
|
string
|
|
|
|
}
|
2022-04-05 07:09:27 +00:00
|
|
|
}
|
2022-09-07 07:26:51 +00:00
|
|
|
}
|
2022-04-05 07:09:27 +00:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
Query records.
|
|
|
|
|
|
|
|
```graphql
|
|
|
|
{
|
2022-09-07 07:26:51 +00:00
|
|
|
queryRecords(attributes: [{ key: "type", value: { string: "crn:bot" } }]) {
|
|
|
|
id
|
|
|
|
names
|
|
|
|
bondId
|
|
|
|
createTime
|
|
|
|
expiryTime
|
|
|
|
owners
|
|
|
|
attributes {
|
|
|
|
key
|
|
|
|
value {
|
|
|
|
string
|
|
|
|
}
|
2022-04-05 07:09:27 +00:00
|
|
|
}
|
2022-09-07 07:26:51 +00:00
|
|
|
}
|
2022-04-05 07:09:27 +00:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
Get account details:
|
|
|
|
|
|
|
|
```graphql
|
|
|
|
{
|
2022-09-07 07:26:51 +00:00
|
|
|
getAccounts(addresses: ["cosmos1wh8vvd0ymc5nt37h29z8kk2g2ays45ct2qu094"]) {
|
|
|
|
address
|
|
|
|
pubKey
|
|
|
|
number
|
|
|
|
sequence
|
|
|
|
balance {
|
|
|
|
type
|
|
|
|
quantity
|
2022-04-05 07:09:27 +00:00
|
|
|
}
|
2022-09-07 07:26:51 +00:00
|
|
|
}
|
2022-04-05 07:09:27 +00:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
Query bonds:
|
|
|
|
|
|
|
|
```graphql
|
|
|
|
{
|
2022-09-07 07:26:51 +00:00
|
|
|
queryBonds(
|
|
|
|
attributes: [
|
|
|
|
{
|
|
|
|
key: "owner"
|
|
|
|
value: { string: "cosmos1wh8vvd0ymc5nt37h29z8kk2g2ays45ct2qu094" }
|
|
|
|
}
|
|
|
|
]
|
|
|
|
) {
|
|
|
|
id
|
|
|
|
owner
|
|
|
|
balance {
|
|
|
|
type
|
|
|
|
quantity
|
2022-04-05 07:09:27 +00:00
|
|
|
}
|
2022-09-07 07:26:51 +00:00
|
|
|
}
|
2022-04-05 07:09:27 +00:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
Get bonds by IDs.
|
|
|
|
|
|
|
|
```graphql
|
|
|
|
{
|
2022-09-07 07:26:51 +00:00
|
|
|
getBondsByIds(
|
|
|
|
ids: [
|
|
|
|
"1c2b677cb2a27c88cc6bf8acf675c94b69051125b40c4fd073153b10f046dd87"
|
|
|
|
"c3f7a78c5042d2003880962ba31ff3b01fcf5942960e0bc3ca331f816346a440"
|
|
|
|
]
|
|
|
|
) {
|
|
|
|
id
|
|
|
|
owner
|
|
|
|
balance {
|
|
|
|
type
|
|
|
|
quantity
|
2022-04-05 07:09:27 +00:00
|
|
|
}
|
2022-09-07 07:26:51 +00:00
|
|
|
}
|
2022-04-05 07:09:27 +00:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
Query Bonds by Owner
|
|
|
|
|
|
|
|
```graphql
|
|
|
|
{
|
2022-09-07 07:26:51 +00:00
|
|
|
queryBondsByOwner(
|
|
|
|
ownerAddresses: ["ethm1mfdjngh5jvjs9lqtt9a7y2hlgw8v3syh3hsqzk"]
|
|
|
|
) {
|
|
|
|
owner
|
|
|
|
bonds {
|
|
|
|
id
|
|
|
|
owner
|
|
|
|
balance {
|
|
|
|
type
|
|
|
|
quantity
|
|
|
|
}
|
2022-04-05 07:09:27 +00:00
|
|
|
}
|
2022-09-07 07:26:51 +00:00
|
|
|
}
|
2022-04-05 07:09:27 +00:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
Query auctions by ids
|
|
|
|
|
|
|
|
```graphql
|
|
|
|
{
|
2022-09-07 07:26:51 +00:00
|
|
|
getAuctionsByIds(
|
|
|
|
ids: ["be98f2073c246194276554eefdb4c95b682a35a0f06fbe619a6da57c10c93e90"]
|
|
|
|
) {
|
|
|
|
id
|
|
|
|
ownerAddress
|
|
|
|
createTime
|
|
|
|
minimumBid {
|
|
|
|
type
|
|
|
|
quantity
|
|
|
|
}
|
|
|
|
commitFee {
|
|
|
|
type
|
|
|
|
quantity
|
|
|
|
}
|
|
|
|
commitsEndTime
|
|
|
|
revealFee {
|
|
|
|
type
|
|
|
|
quantity
|
|
|
|
}
|
|
|
|
revealsEndTime
|
|
|
|
winnerBid {
|
|
|
|
type
|
|
|
|
quantity
|
|
|
|
}
|
|
|
|
winnerPrice {
|
|
|
|
type
|
|
|
|
quantity
|
2022-04-05 07:09:27 +00:00
|
|
|
}
|
2022-09-07 07:26:51 +00:00
|
|
|
winnerAddress
|
|
|
|
bids {
|
|
|
|
bidderAddress
|
|
|
|
commitHash
|
|
|
|
commitTime
|
|
|
|
commitFee {
|
|
|
|
type
|
|
|
|
quantity
|
|
|
|
}
|
|
|
|
revealFee {
|
|
|
|
type
|
|
|
|
quantity
|
|
|
|
}
|
|
|
|
revealTime
|
|
|
|
bidAmount {
|
|
|
|
type
|
|
|
|
quantity
|
|
|
|
}
|
|
|
|
status
|
|
|
|
}
|
|
|
|
}
|
2022-04-05 07:09:27 +00:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
LookUp Authorities
|
|
|
|
|
|
|
|
```graphql
|
|
|
|
{
|
2022-09-07 07:26:51 +00:00
|
|
|
lookupAuthorities(names: []) {
|
|
|
|
ownerAddress
|
|
|
|
ownerAddress
|
|
|
|
height
|
|
|
|
bondId
|
|
|
|
status
|
|
|
|
expiryTime
|
|
|
|
auction {
|
|
|
|
id
|
|
|
|
ownerAddress
|
|
|
|
createTime
|
|
|
|
minimumBid {
|
|
|
|
type
|
|
|
|
quantity
|
|
|
|
}
|
|
|
|
commitFee {
|
|
|
|
type
|
|
|
|
quantity
|
|
|
|
}
|
|
|
|
commitsEndTime
|
|
|
|
revealFee {
|
|
|
|
type
|
|
|
|
quantity
|
|
|
|
}
|
|
|
|
revealsEndTime
|
|
|
|
winnerBid {
|
|
|
|
type
|
|
|
|
quantity
|
|
|
|
}
|
|
|
|
winnerPrice {
|
|
|
|
type
|
|
|
|
quantity
|
|
|
|
}
|
|
|
|
winnerAddress
|
|
|
|
bids {
|
|
|
|
bidderAddress
|
|
|
|
commitHash
|
|
|
|
commitTime
|
|
|
|
commitFee {
|
|
|
|
type
|
|
|
|
quantity
|
|
|
|
}
|
|
|
|
revealFee {
|
|
|
|
type
|
|
|
|
quantity
|
2022-04-05 07:09:27 +00:00
|
|
|
}
|
2022-09-07 07:26:51 +00:00
|
|
|
revealTime
|
|
|
|
bidAmount {
|
|
|
|
type
|
|
|
|
quantity
|
|
|
|
}
|
|
|
|
status
|
|
|
|
}
|
2022-04-05 07:09:27 +00:00
|
|
|
}
|
2022-09-07 07:26:51 +00:00
|
|
|
}
|
2022-04-05 07:09:27 +00:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
LookUp Names
|
|
|
|
|
|
|
|
```graphql
|
|
|
|
{
|
2022-09-07 07:26:51 +00:00
|
|
|
lookupNames(names: ["crn://hello/test"]) {
|
|
|
|
latest {
|
|
|
|
id
|
|
|
|
height
|
|
|
|
}
|
|
|
|
history {
|
|
|
|
id
|
|
|
|
height
|
2022-04-05 07:09:27 +00:00
|
|
|
}
|
2022-09-07 07:26:51 +00:00
|
|
|
}
|
2022-04-05 07:09:27 +00:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
Resolve Names
|
|
|
|
|
|
|
|
```graphql
|
|
|
|
{
|
2022-09-07 07:26:51 +00:00
|
|
|
resolveNames(names: ["asd"]) {
|
|
|
|
id
|
|
|
|
names
|
|
|
|
bondId
|
|
|
|
createTime
|
|
|
|
expiryTime
|
|
|
|
owners
|
|
|
|
attributes {
|
|
|
|
key
|
|
|
|
value {
|
|
|
|
string
|
|
|
|
}
|
2022-04-05 07:09:27 +00:00
|
|
|
}
|
2022-09-07 07:26:51 +00:00
|
|
|
}
|
2022-04-05 07:09:27 +00:00
|
|
|
}
|
2022-09-07 07:26:51 +00:00
|
|
|
```
|