# Client

### CLI <a href="#cli" id="cli"></a>

A user can query and interact with the `bank` module using the CLI.

#### Query <a href="#query" id="query"></a>

The `query` commands allow users to query `bank` state.

```bash
simd query bank --help
```

**balances**

The `balances` command allows users to query account balances by address.

```bash
simd query bank balances [address] [flags]
```

Example:

```bash
simd query bank balances cosmos1..
```

Example output:

```bash
balances:
- amount: "1000000000"
  denom: stake
pagination:
  next_key: null
  total: "0"
```

**denom-metadata**

The `denom-metadata` command allows users to query metadata for coin denominations. A user can query metadata for a single denomination using the `--denom` flag or all denominations without it.

```bash
simd query bank denom-metadata [flags]
```

Example:

```bash
simd query bank denom-metadata --denom stake
```

Example output:

```bash
metadata:
  base: stake
  denom_units:
  - aliases:
    - STAKE
    denom: stake
  description: native staking token of simulation app
  display: stake
  name: SimApp Token
  symbol: STK
```

**total**

The `total` command allows users to query the total supply of coins. A user can query the total supply for a single coin using the `--denom` flag or all coins without it.

```bash
simd query bank total [flags]
```

Example:

```bash
simd query bank total --denom stake
```

Example output:

```
amount: "10000000000"
denom: stake
```

**send-enabled**

The `send-enabled` command allows users to query for all or some SendEnabled entries.

```bash
simd query bank send-enabled [denom1 ...] [flags]
```

Example:

```
simd query bank send-enabled
```

Example output:

```
send_enabled:
- denom: foocoin
  enabled: true
- denom: barcoin
pagination:
  next-key: null
  total: 2 
```

#### Transactions <a href="#transactions" id="transactions"></a>

The `tx` commands allow users to interact with the `bank` module.

```bash
simd tx bank --help
```

**send**

The `send` command allows users to send funds from one account to another.

```
simd tx bank send [from_key_or_address] [to_address] [amount] [flags]
```

Example:

```
simd tx bank send cosmos1.. cosmos1.. 100stake
```

### gRPC <a href="#grpc" id="grpc"></a>

A user can query the `bank` module using gRPC endpoints.

#### Balance <a href="#balance" id="balance"></a>

The `Balance` endpoint allows users to query account balance by address for a given denomination.

```
cosmos.bank.v1beta1.Query/Balance
```

Example:

```
grpcurl -plaintext \
    -d '{"address":"cosmos1..","denom":"stake"}' \
    localhost:9090 \
    cosmos.bank.v1beta1.Query/Balance
```

Example output:

```bash
{
  "balance": {
    "denom": "stake",
    "amount": "1000000000"
  }
}
```

#### AllBalances <a href="#allbalances" id="allbalances"></a>

The `AllBalances` endpoint allows users to query account balance by address for all denominations.

```
cosmos.bank.v1beta1.Query/AllBalances
```

Example:

```
grpcurl -plaintext \
    -d '{"address":"cosmos1.."}' \
    localhost:9090 \
    cosmos.bank.v1beta1.Query/AllBalancesn
```

Example output:

```bash
{
  "balances": [
    {
      "denom": "stake",
      "amount": "1000000000"
    }
  ],
  "pagination": {
    "total": "1"
  }
}
```

#### DenomMetadata <a href="#denommetadata" id="denommetadata"></a>

The `DenomMetadata` endpoint allows users to query metadata for a single coin denomination.

```
cosmos.bank.v1beta1.Query/DenomMetadata
```

Example:

```
grpcurl -plaintext \
    -d '{"denom":"stake"}' \
    localhost:9090 \
    cosmos.bank.v1beta1.Query/DenomMetadata
```

Example output:

```bash
{
  "metadata": {
    "description": "native staking token of simulation app",
    "denomUnits": [
      {
        "denom": "stake",
        "aliases": [
          "STAKE"
        ]
      }
    ],
    "base": "stake",
    "display": "stake",
    "name": "SimApp Token",
    "symbol": "STK"
  }
}
```

#### DenomsMetadata <a href="#denomsmetadata" id="denomsmetadata"></a>

The `DenomsMetadata` endpoint allows users to query metadata for all coin denominations.

```bash
cosmos.bank.v1beta1.Query/DenomsMetadata
```

Example:

```
grpcurl -plaintext \
    localhost:9090 \
    cosmos.bank.v1beta1.Query/DenomsMetadata
```

Example output:

```bash
{
  "metadatas": [
    {
      "description": "native staking token of simulation app",
      "denomUnits": [
        {
          "denom": "stake",
          "aliases": [
            "STAKE"
          ]
        }
      ],
      "base": "stake",
      "display": "stake",
      "name": "SimApp Token",
      "symbol": "STK"
    }
  ],
  "pagination": {
    "total": "1"
  }
}
```

#### DenomOwners <a href="#denomowners" id="denomowners"></a>

The `DenomOwners` endpoint allows users to query metadata for a single coin denomination.

```
cosmos.bank.v1beta1.Query/DenomOwners
```

Example:

```
grpcurl -plaintext \
    -d '{"denom":"stake"}' \
    localhost:9090 \
    cosmos.bank.v1beta1.Query/DenomOwners
```

Example output:

```bash
{
  "denomOwners": [
    {
      "address": "cosmos1..",
      "balance": {
        "denom": "stake",
        "amount": "5000000000"
      }
    },
    {
      "address": "cosmos1..",
      "balance": {
        "denom": "stake",
        "amount": "5000000000"
      }
    },
  ],
  "pagination": {
    "total": "2"
  }
}
```

#### TotalSupply <a href="#totalsupply" id="totalsupply"></a>

The `TotalSupply` endpoint allows users to query the total supply of all coins.

```
cosmos.bank.v1beta1.Query/TotalSupply
```

Example:

```
grpcurl -plaintext \
    localhost:9090 \
    cosmos.bank.v1beta1.Query/TotalSupply
```

Example output:

```bash
{
  "supply": [
    {
      "denom": "stake",
      "amount": "10000000000"
    }
  ],
  "pagination": {
    "total": "1"
  }
}
```

#### SupplyOf <a href="#supplyof" id="supplyof"></a>

The `SupplyOf` endpoint allows users to query the total supply of a single coin.

```
cosmos.bank.v1beta1.Query/SupplyOf
```

Example:

```
grpcurl -plaintext \
    -d '{"denom":"stake"}' \
    localhost:9090 \
    cosmos.bank.v1beta1.Query/SupplyOf
```

Example output:

```bash
{
  "amount": {
    "denom": "stake",
    "amount": "10000000000"
  }
}
```

#### Params <a href="#params" id="params"></a>

The `Params` endpoint allows users to query the parameters of the `bank` module.

```
cosmos.bank.v1beta1.Query/Params
```

Example:

```
grpcurl -plaintext \
    localhost:9090 \
    cosmos.bank.v1beta1.Query/Params
```

Example output:

```bash
{
  "params": {
    "defaultSendEnabled": true
  }
}
```

#### SendEnabled <a href="#sendenabled" id="sendenabled"></a>

The `SendEnabled` enpoints allows users to query the SendEnabled entries of the `bank` module.

Any denominations NOT returned, use the `Params.DefaultSendEnabled` value.

```
cosmos.bank.v1beta1.Query/SendEnabled
```

Example:

```
grpcurl -plaintext \
    localhost:9090 \
    cosmos.bank.v1beta1.Query/SendEnabled
```

Example output:

```bash
{
  "send_enabled": [
    {
      "denom": "foocoin",
      "enabled": true
    },
    {
      "denom": "barcoin"
    }
  ],
  "pagination": {
    "next-key": null,
    "total": 2
  }
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.metanovaverse.com/protocol-developers/modules/bank/client.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
