Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: add list of module safe queries and link to SDK docs #6246

Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 50 additions & 1 deletion docs/docs/02-apps/02-interchain-accounts/05-messages.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,56 @@ The packet `Sequence` is returned in the message response.

### Queries

It is possible to use [`MsgModuleQuerySafe`](https://github.com/cosmos/ibc-go/blob/eecfa5c09a4c38a5c9f2cc2a322d2286f45911da/proto/ibc/applications/interchain_accounts/host/v1/tx.proto#L41-L51) to execute a list of queries on the host chain. This message can be included in the list of encoded `sdk.Msg`s of `InterchainPacketData`. The host chain will return on the acknowledgment the responses for all the queries. Please note that only module safe queries can be executed. The following code block shows an example of how this message can be used to query the account balance of an account on the host chain. The resulting packet data variable is used to set the `PacketData` of `MsgSendTx`.
It is possible to use [`MsgModuleQuerySafe`](https://github.com/cosmos/ibc-go/blob/eecfa5c09a4c38a5c9f2cc2a322d2286f45911da/proto/ibc/applications/interchain_accounts/host/v1/tx.proto#L41-L51) to execute a list of queries on the host chain. This message can be included in the list of encoded `sdk.Msg`s of `InterchainPacketData`. The host chain will return on the acknowledgment the responses for all the queries. Please note that only module safe queries can be executed ([deterministic queries that are safe to be called from within the state machine](https://docs.cosmos.network/main/build/building-modules/query-services#calling-queries-from-the-state-machine)).
crodriguezvega marked this conversation as resolved.
Show resolved Hide resolved

The queries available from Cosmos SDK are:

```plaintext
/cosmos.auth.v1beta1.Query/Accounts
/cosmos.auth.v1beta1.Query/Account
/cosmos.auth.v1beta1.Query/AccountAddressByID
/cosmos.auth.v1beta1.Query/Params
/cosmos.auth.v1beta1.Query/ModuleAccounts
/cosmos.auth.v1beta1.Query/ModuleAccountByName
/cosmos.auth.v1beta1.Query/AccountInfo
/cosmos.bank.v1beta1.Query/Balance
/cosmos.bank.v1beta1.Query/AllBalances
/cosmos.bank.v1beta1.Query/SpendableBalances
/cosmos.bank.v1beta1.Query/SpendableBalanceByDenom
/cosmos.bank.v1beta1.Query/TotalSupply
/cosmos.bank.v1beta1.Query/SupplyOf
/cosmos.bank.v1beta1.Query/Params
/cosmos.bank.v1beta1.Query/DenomMetadata
/cosmos.bank.v1beta1.Query/DenomMetadataByQueryString
/cosmos.bank.v1beta1.Query/DenomsMetadata
/cosmos.bank.v1beta1.Query/DenomOwners
/cosmos.bank.v1beta1.Query/SendEnabled
/cosmos.circuit.v1.Query/Account
/cosmos.circuit.v1.Query/Accounts
/cosmos.circuit.v1.Query/DisabledList
/cosmos.staking.v1beta1.Query/Validators
/cosmos.staking.v1beta1.Query/Validator
/cosmos.staking.v1beta1.Query/ValidatorDelegations
/cosmos.staking.v1beta1.Query/ValidatorUnbondingDelegations
/cosmos.staking.v1beta1.Query/Delegation
/cosmos.staking.v1beta1.Query/UnbondingDelegation
/cosmos.staking.v1beta1.Query/DelegatorDelegations
/cosmos.staking.v1beta1.Query/DelegatorUnbondingDelegations
/cosmos.staking.v1beta1.Query/Redelegations
/cosmos.staking.v1beta1.Query/DelegatorValidators
/cosmos.staking.v1beta1.Query/DelegatorValidator
/cosmos.staking.v1beta1.Query/HistoricalInfo
/cosmos.staking.v1beta1.Query/Pool
/cosmos.staking.v1beta1.Query/Params
```

And the query available from ibc-go is:

```plaintext
/ibc.core.client.v1.Query/VerifyMembership
```

The following code block shows an example of how `MsgModuleQuerySafe` can be used to query the account balance of an account on the host chain. The resulting packet data variable is used to set the `PacketData` of `MsgSendTx`.

```go
balanceQuery := banktypes.NewQueryBalanceRequest("cosmos1...", "uatom")
Expand Down
Loading