Skip to content

Commit

Permalink
New cmd: query ibc-transfer escrow-address (#198)
Browse files Browse the repository at this point in the history
* New cmd: query ibc-transfer escrow-address

* Update modules/apps/transfer/client/cli/query.go

* fix build, add changelog

Co-authored-by: Aditya <adityasripal@gmail.com>
Co-authored-by: Colin Axnér <25233464+colin-axner@users.noreply.github.com>
  • Loading branch information
3 people committed May 27, 2021
1 parent 665287d commit 79659be
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ Ref: https://keepachangelog.com/en/1.0.0/
* (modules/light-clients/07-tendermint) [\#125](https://github.com/cosmos/ibc-go/pull/125) Implement efficient iteration of consensus states and pruning of earliest expired consensus state on UpdateClient.
* (modules/light-clients/07-tendermint) [\#141](https://github.com/cosmos/ibc-go/pull/141) Return early in case there's a duplicate update call to save Gas.

### Features

* [\#198](https://github.com/cosmos/ibc-go/pull/198) 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

### Client Breaking Changes

* (02-client/cli) [\#196](https://github.com/cosmos/ibc-go/pull/196) Rename `node-state` cli command to `self-consensus-state`.
Expand Down
1 change: 1 addition & 0 deletions modules/apps/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
25 changes: 25 additions & 0 deletions modules/apps/transfer/client/cli/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,28 @@ 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 {
clientCtx, err := client.GetClientQueryContext(cmd)
if err != nil {
return err
}
port := args[0]
channel := args[1]
addr := types.GetEscrowAddress(port, channel)
return clientCtx.PrintString(fmt.Sprintf("%s\n", addr.String()))
},
}

flags.AddQueryFlagsToCmd(cmd)

return cmd
}

0 comments on commit 79659be

Please sign in to comment.