쿼리(Queries)

우미 네트워크에서 사용할 수 있는 쿼리 개요

우미 네트워크 내에서 쿼리를 수행할 수 있는 방법으로는 CLI, 텐더민트의 RPC, 에플리케이션의 gRPC 및 API 인스턴스가 있습니다. 이 가이드에서 가능한 모든 쿼리와 호출하는 방법에 대한 구체적인 개요를 포함하고 있지는 않습니다.

CLI

모든 Cosmos SDK 기반 애플리케이션과 마찬가지로 오퍼레이터는 실행 중인 umeed 프로세스에 대해 쿼리를 호출할 수 있습니다. 규칙에 따라 쿼리는 모듈 하위 명령으로 수행됩니다.

예를 들어 계정 잔액을 쿼리는 다음과 같습니다.

$ umeed q bank balances umee17lu4h5nh28ctv9y6ldt0apqz7dxm8arvttx5xc
balances:
- amount: "5500000000000"
  denom: uumee
pagination:
  next_key: null
  total: "0"

umeed 프로세스는 localhost에 대해 쿼리합니다. 외부 노드에 대한 쿼리는 --node 플래그가 필요합니다.

--chaid-id--node와 같은 동일한 플래그를 반복해서 제공하지 않도록, config 폴더에서 아래와 같이 client.toml 넣을 수 있습니다.

$HOME/.umee/config/client.toml
chain-id = "<chain-id>"
output = "text"
broadcast-mode = "sync"

모든 모둘과 쿼리 명령어 $ umeed --help 을 통해 확인 가능합니다.

API and gRPC

활성화된 경우 umeed 노드는 gRPC 및 gRPC 게이트웨이 API를 개할 수 있습니다. 기본적으로 gRPC 서버는 포트 9090에서 실행되고 gRPC 게이트웨이 API 서버는 포트 1317에서 실행됩니다. 이 두 포트는 모두 app.toml에서 구성할 수 있습니다.

예를 들어 계정 잔액을 쿼리는 다음과 같습니다.

$ curl http://localhost:1317/cosmos/bank/v1beta1/balances/umee17lu4h5nh28ctv9y6ldt0apqz7dxm8arvttx5xc
{
  "balances": [
    {
      "denom": "uumee",
      "amount": "5500000000000"
    }
  ],
  "pagination": {
    "next_key": null,
    "total": "1"
  }
}

기본적으로, gRPC 게이트웨이 API 쿼리는 현재 블록 높이에 대한 상태를 표시합니다. 또한 x-cosmos-block-height 헤더를 통해 이전 높이의 쿼리를 지원합니다.

By default, the gRPC Gateway API queries for state against the current block height. It also supports queries at previous heights via the x-cosmos-block-height header:

$ curl -H "x-cosmos-block-height: 400" http://localhost:1317/cosmos/bank/v1beta1/balances/umee17lu4h5nh28ctv9y6ldt0apqz7dxm8arvttx5xc
{
  "balances": [
    {
      "denom": "uumee",
      "amount": "350000000011"
    }
  ],
  "pagination": {
    "next_key": null,
    "total": "1"
  }
}

gRPC 서버에 대해 직접 gRPC 쿼리를 호출할 수도 있습니다. grpcurl 을 사용하는 것이 좋습니다.

예를 들어 계정 잔액을 쿼리는 다음과 같습니다.

$ grpcurl -d '{"address": "umee17lu4h5nh28ctv9y6ldt0apqz7dxm8arvttx5xc"}' --plaintext 0.0.0.0:9090 cosmos.bank.v1beta1.Query/AllBalances
{
  "balances": [
    {
      "denom": "uumee",
      "amount": "5500000000000"
    }
  ],
  "pagination": {
    "total": "1"
  }
}

Last updated