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

CLI: query ibc-transfer escrow-address #9383

Merged
merged 2 commits into from
May 25, 2021
Merged
Show file tree
Hide file tree
Changes from all 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
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <port> <channel id>` 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
Expand Down
1 change: 1 addition & 0 deletions x/ibc/applications/transfer/client/cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ func GetQueryCmd() *cobra.Command {
GetCmdQueryDenomTrace(),
GetCmdQueryDenomTraces(),
GetCmdParams(),
GetCmdQueryEscrowAddress(),
)

return queryCmd
Expand Down
22 changes: 22 additions & 0 deletions x/ibc/applications/transfer/client/cli/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}