diff --git a/CHANGELOG.md b/CHANGELOG.md index c7bd85ca42d..5ece4ef04ca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -34,6 +34,14 @@ Ref: https://keepachangelog.com/en/1.0.0/ # Changelog +## Unreleased + +### Features + + +* [\#9383](https://github.com/cosmos/cosmos-sdk/pull/9383) New CLI command `query ibc-transfer escrow-address ` to get the escrow address for a channel; can be used to then query balance of escrowed tokens + + ## [v0.42.5](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.42.5) - 2021-05-18 ### Bug Fixes diff --git a/x/ibc/applications/transfer/client/cli/cli.go b/x/ibc/applications/transfer/client/cli/cli.go index d3ca8341e95..643af504178 100644 --- a/x/ibc/applications/transfer/client/cli/cli.go +++ b/x/ibc/applications/transfer/client/cli/cli.go @@ -19,6 +19,7 @@ func GetQueryCmd() *cobra.Command { GetCmdQueryDenomTrace(), GetCmdQueryDenomTraces(), GetCmdParams(), + GetCmdQueryEscrowAddress(), ) return queryCmd diff --git a/x/ibc/applications/transfer/client/cli/query.go b/x/ibc/applications/transfer/client/cli/query.go index 7d281bb4155..b9ac7263175 100644 --- a/x/ibc/applications/transfer/client/cli/query.go +++ b/x/ibc/applications/transfer/client/cli/query.go @@ -107,3 +107,25 @@ func GetCmdParams() *cobra.Command { return cmd } + +// GetCmdParams returns the command handler for ibc-transfer parameter querying. +func GetCmdQueryEscrowAddress() *cobra.Command { + cmd := &cobra.Command{ + Use: "escrow-address", + Short: "Get the escrow address for a channel", + Long: "Get the escrow address for a channel", + Args: cobra.ExactArgs(2), + Example: fmt.Sprintf("%s query ibc-transfer escrow-address [port] [channel-id]", version.AppName), + RunE: func(cmd *cobra.Command, args []string) error { + port := args[0] + channel := args[1] + addr := types.GetEscrowAddress(port, channel) + fmt.Println(addr.String()) + return nil + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +}