-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add a
roller relayer channel show
command (#352)
- Loading branch information
1 parent
6faff32
commit 1d8d7e6
Showing
3 changed files
with
48 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package channel | ||
|
||
import ( | ||
"github.com/dymensionxyz/roller/cmd/relayer/channel/show" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
func Cmd() *cobra.Command { | ||
cmd := &cobra.Command{ | ||
Use: "channel", | ||
Short: "Commands for managing the relayer channel", | ||
} | ||
cmd.AddCommand(show.Cmd()) | ||
return cmd | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package show | ||
|
||
import ( | ||
"fmt" | ||
"github.com/dymensionxyz/roller/cmd/utils" | ||
"github.com/dymensionxyz/roller/config" | ||
"github.com/dymensionxyz/roller/relayer" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
func Cmd() *cobra.Command { | ||
cmd := &cobra.Command{ | ||
Use: "show", | ||
Short: "Show the channel data of the relayer on the local machine.", | ||
Run: func(cmd *cobra.Command, args []string) { | ||
home := cmd.Flag(utils.FlagNames.Home).Value.String() | ||
rollappConfig, err := config.LoadConfigFromTOML(home) | ||
utils.PrettifyErrorIfExists(err) | ||
rly := relayer.NewRelayer(rollappConfig.Home, rollappConfig.RollappID, rollappConfig.HubData.ID) | ||
srcChannel, dstChannel, err := rly.LoadChannels() | ||
utils.PrettifyErrorIfExists(err) | ||
if srcChannel == "" { | ||
fmt.Println("💈 No channel has been created for the relayer yet.") | ||
} else { | ||
fmt.Printf("💈 Relayer Channels: src, %s <-> %s, dst\n", | ||
srcChannel, dstChannel) | ||
} | ||
}, | ||
} | ||
return cmd | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters