-
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.
Merge branch 'main' into itaylevyofficial/101-run-status
# Conflicts: # .gitignore
- Loading branch information
Showing
17 changed files
with
135 additions
and
41 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 |
---|---|---|
@@ -1,7 +1,4 @@ | ||
/.vscode | ||
* | ||
!*/ | ||
!*.* | ||
build/ | ||
*.exe | ||
\.* | ||
/.vscode | ||
/.idea |
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
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
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,60 @@ | ||
package export | ||
|
||
import ( | ||
"fmt" | ||
"github.com/dymensionxyz/roller/cmd/consts" | ||
"github.com/dymensionxyz/roller/cmd/utils" | ||
"github.com/spf13/cobra" | ||
"os/exec" | ||
"path/filepath" | ||
"strings" | ||
) | ||
|
||
var supportedKeys = []string{ | ||
consts.KeysIds.HubSequencer, | ||
consts.KeysIds.RollappSequencer, | ||
} | ||
|
||
func Cmd() *cobra.Command { | ||
cmd := &cobra.Command{ | ||
Use: "export <key-id>", | ||
Short: fmt.Sprintf("Exports the private key of the given key id. The supported keys are %s", | ||
strings.Join(supportedKeys, ", ")), | ||
Run: func(cmd *cobra.Command, args []string) { | ||
home := cmd.Flag(utils.FlagNames.Home).Value.String() | ||
config, err := utils.LoadConfigFromTOML(home) | ||
utils.PrettifyErrorIfExists(err) | ||
|
||
keyID := args[0] | ||
if keyID == consts.KeysIds.HubSequencer { | ||
exportKeyCmd := getExportKeyCmdBinary(keyID, filepath.Join(home, consts.ConfigDirName.HubKeys), | ||
consts.Executables.Dymension) | ||
out, err := utils.ExecBashCommand(exportKeyCmd) | ||
utils.PrettifyErrorIfExists(err) | ||
fmt.Println(out.String()) | ||
} else if keyID == consts.KeysIds.RollappSequencer { | ||
exportKeyCmd := getExportKeyCmdBinary(keyID, filepath.Join(home, consts.ConfigDirName.Rollapp), | ||
config.RollappBinary) | ||
out, err := utils.ExecBashCommand(exportKeyCmd) | ||
utils.PrettifyErrorIfExists(err) | ||
fmt.Println(out.String()) | ||
} else { | ||
utils.PrettifyErrorIfExists(fmt.Errorf("invalid key id: %s. The supported keys are %s", keyID, | ||
strings.Join(supportedKeys, ", "))) | ||
} | ||
}, | ||
Args: cobra.ExactArgs(1), | ||
} | ||
|
||
return cmd | ||
} | ||
|
||
func getExportKeyCmdBinary(keyID, keyringDir, binary string) *exec.Cmd { | ||
flags := getExportKeyFlags(keyringDir) | ||
cmdStr := fmt.Sprintf("yes | %s keys export %s %s", binary, keyID, flags) | ||
return exec.Command("bash", "-c", cmdStr) | ||
} | ||
|
||
func getExportKeyFlags(keyringDir string) string { | ||
return fmt.Sprintf("--keyring-backend test --keyring-dir %s --unarmored-hex --unsafe", keyringDir) | ||
} |
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
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 |
---|---|---|
|
@@ -55,6 +55,6 @@ func Cmd() *cobra.Command { | |
utils.PrintAddresses(addresses) | ||
}, | ||
} | ||
utils.AddGlobalFlags(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
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
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
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
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
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,23 @@ | ||
package run | ||
|
||
import ( | ||
"github.com/dymensionxyz/roller/cmd/utils" | ||
"github.com/gizak/termui/v3" | ||
"github.com/gizak/termui/v3/widgets" | ||
) | ||
|
||
func getServicesInfo(rollappConfig utils.RollappConfig, termWidth int) *widgets.Table { | ||
table := widgets.NewTable() | ||
table.RowStyles[0] = termui.NewStyle(termui.ColorWhite, termui.ColorClear, termui.ModifierBold) | ||
table.SetRect(0, 13, termWidth, 22) | ||
table.Title = "Services Info" | ||
table.FillRow = true | ||
table.ColumnWidths = []int{termWidth / 6, termWidth / 2, termWidth / 3} | ||
table.Rows = [][]string{ | ||
{"Name", "Log File", "Ports"}, | ||
{"Sequencer", utils.GetSequencerLogPath(rollappConfig), "26657, 8545, 1317"}, | ||
{"Relayer", utils.GetRelayerLogPath(rollappConfig), ""}, | ||
{"DA Light Client", utils.GetDALogFilePath(rollappConfig.Home), "26659"}, | ||
} | ||
return table | ||
} |
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
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
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
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
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