From 24eb2dc9e40cb6f00952584cc91f19754bcde893 Mon Sep 17 00:00:00 2001 From: Itay Levy Date: Wed, 28 Jun 2023 12:00:55 +0200 Subject: [PATCH 1/2] Now the addresses are being printed nicer --- cmd/config/init/genesis.go | 2 +- cmd/config/init/init.go | 5 +++- cmd/config/init/keys.go | 43 ++++++++++++++++----------- cmd/config/init/output.go | 2 +- cmd/config/init/relayer.go | 4 +-- cmd/config/init/rollapp.go | 2 +- cmd/consts/consts.go | 4 +-- cmd/da-light-client/start/start.go | 2 +- cmd/keys/list/list.go | 31 ++++++++++++++----- cmd/register/bash_commands.go | 4 +-- cmd/relayer/start/start.go | 4 +-- cmd/sequencer/start/start.go | 2 +- cmd/utils/balance.go | 2 +- cmd/utils/fetch_accounts_data.go | 2 +- cmd/utils/keys.go | 20 ++++++------- test/config/init/testutils/keys.go | 6 ++-- test/config/init/testutils/rollapp.go | 4 +-- 17 files changed, 83 insertions(+), 56 deletions(-) diff --git a/cmd/config/init/genesis.go b/cmd/config/init/genesis.go index 940d6e4b..bd14b86b 100644 --- a/cmd/config/init/genesis.go +++ b/cmd/config/init/genesis.go @@ -24,7 +24,7 @@ func initializeRollappGenesis(initConfig utils.RollappConfig) error { relayerBalanceStr := relayerGenesisBalance.String() + initConfig.Denom rollappConfigDirPath := filepath.Join(initConfig.Home, consts.ConfigDirName.Rollapp) genesisSequencerAccountCmd := exec.Command(initConfig.RollappBinary, "add-genesis-account", - consts.KeyNames.RollappSequencer, sequencerBalanceStr, "--keyring-backend", "test", "--home", rollappConfigDirPath) + consts.KeysIds.RollappSequencer, sequencerBalanceStr, "--keyring-backend", "test", "--home", rollappConfigDirPath) _, err := utils.ExecBashCommand(genesisSequencerAccountCmd) if err != nil { return err diff --git a/cmd/config/init/init.go b/cmd/config/init/init.go index 045c031d..c03db78c 100644 --- a/cmd/config/init/init.go +++ b/cmd/config/init/init.go @@ -45,7 +45,10 @@ func InitCmd() *cobra.Command { utils.PrettifyErrorIfExists(initializeLightNodeConfig(initConfig)) daAddress, err := utils.GetCelestiaAddress(initConfig.Home) utils.PrettifyErrorIfExists(err) - addresses[consts.KeyNames.DALightNode] = daAddress + addresses = append(addresses, utils.AddressData{ + Addr: daAddress, + Name: consts.KeysIds.DALightNode, + }) utils.PrettifyErrorIfExists(initializeRollappConfig(initConfig)) utils.PrettifyErrorIfExists(initializeRollappGenesis(initConfig)) utils.PrettifyErrorIfExists(utils.WriteConfigToTOML(initConfig)) diff --git a/cmd/config/init/keys.go b/cmd/config/init/keys.go index c9d25186..ab8fdbba 100644 --- a/cmd/config/init/keys.go +++ b/cmd/config/init/keys.go @@ -10,7 +10,7 @@ import ( "github.com/dymensionxyz/roller/cmd/utils" ) -func generateKeys(rollappConfig utils.RollappConfig) (map[string]string, error) { +func generateKeys(rollappConfig utils.RollappConfig) ([]utils.AddressData, error) { sequencerAddresses, err := generateSequencersKeys(rollappConfig) if err != nil { return nil, err @@ -19,12 +19,12 @@ func generateKeys(rollappConfig utils.RollappConfig) (map[string]string, error) if err != nil { return nil, err } - return utils.MergeMaps(sequencerAddresses, relayerAddresses), nil + return append(sequencerAddresses, relayerAddresses...), nil } -func generateSequencersKeys(initConfig utils.RollappConfig) (map[string]string, error) { +func generateSequencersKeys(initConfig utils.RollappConfig) ([]utils.AddressData, error) { keys := getSequencerKeysConfig() - addresses := make(map[string]string) + addresses := make([]utils.AddressData, 0) for _, key := range keys { var address string var err error @@ -36,7 +36,10 @@ func generateSequencersKeys(initConfig utils.RollappConfig) (map[string]string, if err != nil { return nil, err } - addresses[key.ID] = address + addresses = append(addresses, utils.AddressData{ + Addr: address, + Name: key.ID, + }) } return addresses, nil } @@ -45,13 +48,13 @@ func getSequencerKeysConfig() []utils.CreateKeyConfig { return []utils.CreateKeyConfig{ { Dir: consts.ConfigDirName.HubKeys, - ID: consts.KeyNames.HubSequencer, + ID: consts.KeysIds.HubSequencer, CoinType: consts.CoinTypes.Cosmos, Prefix: consts.AddressPrefixes.Hub, }, { Dir: consts.ConfigDirName.Rollapp, - ID: consts.KeyNames.RollappSequencer, + ID: consts.KeysIds.RollappSequencer, CoinType: consts.CoinTypes.EVM, Prefix: consts.AddressPrefixes.Rollapp, }, @@ -60,15 +63,15 @@ func getSequencerKeysConfig() []utils.CreateKeyConfig { func getRelayerKeysConfig(rollappConfig utils.RollappConfig) map[string]utils.CreateKeyConfig { return map[string]utils.CreateKeyConfig{ - consts.KeyNames.RollappRelayer: { + consts.KeysIds.RollappRelayer: { Dir: path.Join(rollappConfig.Home, consts.ConfigDirName.Relayer), - ID: consts.KeyNames.RollappRelayer, + ID: consts.KeysIds.RollappRelayer, CoinType: consts.CoinTypes.EVM, Prefix: consts.AddressPrefixes.Rollapp, }, - consts.KeyNames.HubRelayer: { + consts.KeysIds.HubRelayer: { Dir: path.Join(rollappConfig.Home, consts.ConfigDirName.Relayer), - ID: consts.KeyNames.HubRelayer, + ID: consts.KeysIds.HubRelayer, CoinType: consts.CoinTypes.Cosmos, Prefix: consts.AddressPrefixes.Hub, }, @@ -89,11 +92,11 @@ func createAddressBinary(keyConfig utils.CreateKeyConfig, binaryPath string, hom return utils.ParseAddressFromOutput(out) } -func generateRelayerKeys(rollappConfig utils.RollappConfig) (map[string]string, error) { - relayerAddresses := make(map[string]string) +func generateRelayerKeys(rollappConfig utils.RollappConfig) ([]utils.AddressData, error) { + relayerAddresses := make([]utils.AddressData, 0) keys := getRelayerKeysConfig(rollappConfig) - createRollappKeyCmd := getAddRlyKeyCmd(keys[consts.KeyNames.RollappRelayer], rollappConfig.RollappID) - createHubKeyCmd := getAddRlyKeyCmd(keys[consts.KeyNames.HubRelayer], rollappConfig.HubData.ID) + createRollappKeyCmd := getAddRlyKeyCmd(keys[consts.KeysIds.RollappRelayer], rollappConfig.RollappID) + createHubKeyCmd := getAddRlyKeyCmd(keys[consts.KeysIds.HubRelayer], rollappConfig.HubData.ID) out, err := utils.ExecBashCommand(createRollappKeyCmd) if err != nil { return nil, err @@ -102,7 +105,10 @@ func generateRelayerKeys(rollappConfig utils.RollappConfig) (map[string]string, if err != nil { return nil, err } - relayerAddresses[consts.KeyNames.RollappRelayer] = relayerRollappAddress + relayerAddresses = append(relayerAddresses, utils.AddressData{ + Addr: relayerRollappAddress, + Name: consts.KeysIds.RollappRelayer, + }) out, err = utils.ExecBashCommand(createHubKeyCmd) if err != nil { return nil, err @@ -111,7 +117,10 @@ func generateRelayerKeys(rollappConfig utils.RollappConfig) (map[string]string, if err != nil { return nil, err } - relayerAddresses[consts.KeyNames.HubRelayer] = relayerHubAddress + relayerAddresses = append(relayerAddresses, utils.AddressData{ + Addr: relayerHubAddress, + Name: consts.KeysIds.HubRelayer, + }) return relayerAddresses, err } diff --git a/cmd/config/init/output.go b/cmd/config/init/output.go index ae0f5745..3c4430cf 100644 --- a/cmd/config/init/output.go +++ b/cmd/config/init/output.go @@ -5,7 +5,7 @@ import ( "github.com/dymensionxyz/roller/cmd/utils" ) -func printInitOutput(addresses map[string]string, rollappId string) { +func printInitOutput(addresses []utils.AddressData, rollappId string) { fmt.Printf("šŸ’ˆ RollApp '%s' configuration files have been successfully generated on your local machine. Congratulations!\n\n", rollappId) utils.PrintAddresses(addresses) fmt.Printf("\nšŸ”” Please fund these addresses to register and run the rollapp.\n") diff --git a/cmd/config/init/relayer.go b/cmd/config/init/relayer.go index 3ec7c765..7471ae23 100644 --- a/cmd/config/init/relayer.go +++ b/cmd/config/init/relayer.go @@ -98,14 +98,14 @@ func addChainsConfig(rollappConfig ChainConfig, hubConfig ChainConfig, relayerHo ChainConfig: rollappConfig, GasPrices: "0.0" + rollappConfig.Denom, ClientType: "01-dymint", - KeyName: consts.KeyNames.RollappRelayer, + KeyName: consts.KeysIds.RollappRelayer, }) relayerHubConfig := getRelayerFileChainConfig(RelayerChainConfig{ ChainConfig: hubConfig, GasPrices: "0.0" + hubConfig.Denom, ClientType: "07-tendermint", - KeyName: consts.KeyNames.HubRelayer, + KeyName: consts.KeysIds.HubRelayer, }) if err := addChainToRelayer(relayerRollappConfig, relayerHome); err != nil { diff --git a/cmd/config/init/rollapp.go b/cmd/config/init/rollapp.go index 62a2b18a..72a29bf4 100644 --- a/cmd/config/init/rollapp.go +++ b/cmd/config/init/rollapp.go @@ -11,7 +11,7 @@ import ( ) func initializeRollappConfig(initConfig utils.RollappConfig) error { - initRollappCmd := exec.Command(initConfig.RollappBinary, "init", consts.KeyNames.HubSequencer, "--chain-id", + initRollappCmd := exec.Command(initConfig.RollappBinary, "init", consts.KeysIds.HubSequencer, "--chain-id", initConfig.RollappID, "--home", filepath.Join(initConfig.Home, consts.ConfigDirName.Rollapp)) _, err := utils.ExecBashCommand(initRollappCmd) if err != nil { diff --git a/cmd/consts/consts.go b/cmd/consts/consts.go index d7cc6b70..dbdcf535 100644 --- a/cmd/consts/consts.go +++ b/cmd/consts/consts.go @@ -22,7 +22,7 @@ var Executables = struct { Dymension: fmt.Sprintf("%s/dymd", internalBinsDir), } -var KeyNames = struct { +var KeysIds = struct { HubSequencer string RollappSequencer string RollappRelayer string @@ -79,4 +79,4 @@ const DefaultRelayerPath = "hub-rollapp" const DefaultRollappRPC = "http://localhost:26657" const DefaultDALCRPC = "http://localhost:26659" const CelestiaRestApiEndpoint = "https://api-arabica-8.consensus.celestia-arabica.com" -const DefaultCelestiaRPC = "consensus-full-arabica-8.celestia-arabica.com" \ No newline at end of file +const DefaultCelestiaRPC = "consensus-full-arabica-8.celestia-arabica.com" diff --git a/cmd/da-light-client/start/start.go b/cmd/da-light-client/start/start.go index 7332a52e..f7794fe6 100644 --- a/cmd/da-light-client/start/start.go +++ b/cmd/da-light-client/start/start.go @@ -57,7 +57,7 @@ func CheckDABalance(config utils.RollappConfig) ([]utils.NotFundedAddressData, e Address: accData.Address, CurrentBalance: accData.Balance, RequiredBalance: lcMinBalance, - KeyName: consts.KeyNames.DALightNode, + KeyName: consts.KeysIds.DALightNode, Denom: consts.Denoms.Celestia, }) } diff --git a/cmd/keys/list/list.go b/cmd/keys/list/list.go index a3d324d8..e85e277b 100644 --- a/cmd/keys/list/list.go +++ b/cmd/keys/list/list.go @@ -17,26 +17,41 @@ func Cmd() *cobra.Command { utils.PrettifyErrorIfExists(err) daAddr, err := utils.GetCelestiaAddress(rollappConfig.Home) utils.PrettifyErrorIfExists(err) - addresses := map[string]string{} - addresses[consts.KeyNames.DALightNode] = daAddr + addresses := make([]utils.AddressData, 0) + addresses = append(addresses, utils.AddressData{ + Addr: daAddr, + Name: consts.KeysIds.DALightNode, + }) hubSeqAddr, err := utils.GetAddressBinary(utils.GetKeyConfig{ Dir: filepath.Join(rollappConfig.Home, consts.ConfigDirName.HubKeys), - ID: consts.KeyNames.HubSequencer, + ID: consts.KeysIds.HubSequencer, }, consts.Executables.Dymension) utils.PrettifyErrorIfExists(err) - addresses[consts.KeyNames.HubSequencer] = hubSeqAddr + addresses = append(addresses, utils.AddressData{ + Addr: hubSeqAddr, + Name: consts.KeysIds.HubSequencer, + }) rollappSeqAddr, err := utils.GetAddressBinary(utils.GetKeyConfig{ Dir: filepath.Join(rollappConfig.Home, consts.ConfigDirName.Rollapp), - ID: consts.KeyNames.RollappSequencer, + ID: consts.KeysIds.RollappSequencer, }, consts.Executables.RollappEVM) utils.PrettifyErrorIfExists(err) - addresses[consts.KeyNames.RollappSequencer] = rollappSeqAddr + addresses = append(addresses, utils.AddressData{ + Addr: rollappSeqAddr, + Name: consts.KeysIds.RollappSequencer, + }) hubRlyAddr, err := utils.GetRelayerAddress(rollappConfig.Home, rollappConfig.HubData.ID) utils.PrettifyErrorIfExists(err) - addresses[consts.KeyNames.HubRelayer] = hubRlyAddr + addresses = append(addresses, utils.AddressData{ + Addr: hubRlyAddr, + Name: consts.KeysIds.HubRelayer, + }) rollappRlyAddr, err := utils.GetRelayerAddress(rollappConfig.Home, rollappConfig.RollappID) utils.PrettifyErrorIfExists(err) - addresses[consts.KeyNames.RollappRelayer] = rollappRlyAddr + addresses = append(addresses, utils.AddressData{ + Addr: rollappRlyAddr, + Name: consts.KeysIds.RollappRelayer, + }) utils.PrintAddresses(addresses) }, } diff --git a/cmd/register/bash_commands.go b/cmd/register/bash_commands.go index f770de23..e40f8c70 100644 --- a/cmd/register/bash_commands.go +++ b/cmd/register/bash_commands.go @@ -43,7 +43,7 @@ func getRegisterSequencerCmd(rollappConfig utils.RollappConfig) (*exec.Cmd, erro return nil, err } description := fmt.Sprintf(`{"Moniker":"%s","Identity":"","Website":"","SecurityContact":"","Details":""}`, - consts.KeyNames.HubSequencer) + consts.KeysIds.HubSequencer) cmdArgs := []string{ "tx", "sequencer", "create-sequencer", seqPubKey, @@ -57,7 +57,7 @@ func getRegisterSequencerCmd(rollappConfig utils.RollappConfig) (*exec.Cmd, erro func getCommonDymdTxFlags(rollappConfig utils.RollappConfig) []string { commonFlags := utils.GetCommonDymdFlags(rollappConfig) txArgs := []string{ - "--from", consts.KeyNames.HubSequencer, + "--from", consts.KeysIds.HubSequencer, "--keyring-backend", "test", "--keyring-dir", filepath.Join(rollappConfig.Home, consts.ConfigDirName.HubKeys), "--yes", "--broadcast-mode", "block", "--chain-id", rollappConfig.HubData.ID, diff --git a/cmd/relayer/start/start.go b/cmd/relayer/start/start.go index f68f9338..b4469a1a 100644 --- a/cmd/relayer/start/start.go +++ b/cmd/relayer/start/start.go @@ -89,7 +89,7 @@ func GetRlyHubInsufficientBalances(config utils.RollappConfig) ([]utils.NotFunde insufficientBalances := make([]utils.NotFundedAddressData, 0) if HubRlyBalance.Cmp(oneDayRelayPriceHub) < 0 { insufficientBalances = append(insufficientBalances, utils.NotFundedAddressData{ - KeyName: consts.KeyNames.HubRelayer, + KeyName: consts.KeysIds.HubRelayer, Address: HubRlyAddr, CurrentBalance: HubRlyBalance, RequiredBalance: oneDayRelayPriceHub, @@ -110,7 +110,7 @@ func GetRelayerInsufficientBalances(config utils.RollappConfig) ([]utils.NotFund } if rolRlyData.Balance.Cmp(oneDayRelayPriceRollapp) < 0 { insufficientBalances = append(insufficientBalances, utils.NotFundedAddressData{ - KeyName: consts.KeyNames.RollappRelayer, + KeyName: consts.KeysIds.RollappRelayer, Address: rolRlyData.Address, CurrentBalance: rolRlyData.Balance, RequiredBalance: oneDayRelayPriceRollapp, diff --git a/cmd/sequencer/start/start.go b/cmd/sequencer/start/start.go index 85615040..5773cda5 100644 --- a/cmd/sequencer/start/start.go +++ b/cmd/sequencer/start/start.go @@ -84,7 +84,7 @@ func GetStartRollappCmd(rollappConfig utils.RollappConfig, lightNodeEndpoint str "--max-log-size", "2000", "--module-log-level-override", "", "--dymint.settlement_config.node_address", rollappConfig.HubData.RPC_URL, - "--dymint.settlement_config.dym_account_name", consts.KeyNames.HubSequencer, + "--dymint.settlement_config.dym_account_name", consts.KeysIds.HubSequencer, "--dymint.settlement_config.keyring_home_dir", hubKeysDir, "--dymint.settlement_config.gas_fees", "0udym", "--dymint.settlement_config.gas_prices", "0udym", diff --git a/cmd/utils/balance.go b/cmd/utils/balance.go index 9198f7bd..f4fa78a1 100644 --- a/cmd/utils/balance.go +++ b/cmd/utils/balance.go @@ -72,7 +72,7 @@ func GetSequencerInsufficientAddrs(config RollappConfig, requiredBalance big.Int Denom: consts.Denoms.Hub, CurrentBalance: sequencerData.Balance, RequiredBalance: &requiredBalance, - KeyName: consts.KeyNames.HubSequencer, + KeyName: consts.KeysIds.HubSequencer, }, }, nil } diff --git a/cmd/utils/fetch_accounts_data.go b/cmd/utils/fetch_accounts_data.go index abd4d3fb..379d32ac 100644 --- a/cmd/utils/fetch_accounts_data.go +++ b/cmd/utils/fetch_accounts_data.go @@ -46,7 +46,7 @@ func GetHubRlyAccData(config RollappConfig) (*AccountData, error) { func GetSequencerData(config RollappConfig) (*AccountData, error) { sequencerAddress, err := GetAddressBinary(GetKeyConfig{ - ID: consts.KeyNames.HubSequencer, + ID: consts.KeysIds.HubSequencer, Dir: filepath.Join(config.Home, consts.ConfigDirName.HubKeys), }, consts.Executables.Dymension) if err != nil { diff --git a/cmd/utils/keys.go b/cmd/utils/keys.go index b673539b..5e041c03 100644 --- a/cmd/utils/keys.go +++ b/cmd/utils/keys.go @@ -29,7 +29,7 @@ func ParseAddressFromOutput(output bytes.Buffer) (string, error) { func GetCelestiaAddress(rollerRoot string) (string, error) { daKeysDir := filepath.Join(rollerRoot, consts.ConfigDirName.DALightNode, consts.KeysDirName) cmd := exec.Command( - consts.Executables.CelKey, "show", consts.KeyNames.DALightNode, "--node.type", "light", "--keyring-dir", + consts.Executables.CelKey, "show", consts.KeysIds.DALightNode, "--node.type", "light", "--keyring-dir", daKeysDir, "--keyring-backend", "test", "--output", "json", ) output, err := ExecBashCommand(cmd) @@ -84,17 +84,17 @@ func GetRelayerAddress(home string, chainID string) (string, error) { return strings.TrimSuffix(out.String(), "\n"), err } -func PrintAddresses(addresses map[string]string) { - fmt.Printf("šŸ”‘ Addresses:\n\n") +type AddressData struct { + Name string + Addr string +} - data := [][]string{ - {"Celestia", addresses[consts.KeyNames.DALightNode]}, - {"Sequencer, Hub", addresses[consts.KeyNames.HubSequencer]}, - {"Sequencer, Rollapp", addresses[consts.KeyNames.RollappSequencer]}, - {"Relayer, Hub", addresses[consts.KeyNames.HubRelayer]}, - {"Relayer, RollApp", addresses[consts.KeyNames.RollappRelayer]}, +func PrintAddresses(addresses []AddressData) { + fmt.Printf("šŸ”‘ Addresses:\n\n") + data := make([][]string, 0, len(addresses)) + for _, address := range addresses { + data = append(data, []string{address.Name, address.Addr}) } - table := tablewriter.NewWriter(os.Stdout) table.SetAlignment(tablewriter.ALIGN_LEFT) table.SetHeaderAlignment(tablewriter.ALIGN_LEFT) diff --git a/test/config/init/testutils/keys.go b/test/config/init/testutils/keys.go index 7fc922e4..b209312b 100644 --- a/test/config/init/testutils/keys.go +++ b/test/config/init/testutils/keys.go @@ -93,7 +93,7 @@ func getLightNodeKeysDir(root string) string { func VerifyLightNodeKeys(root string) error { lightNodeKeysDir := filepath.Join(getLightNodeKeysDir(root), innerKeysDirName) - infoFilePath := filepath.Join(lightNodeKeysDir, consts.KeyNames.DALightNode+".info") + infoFilePath := filepath.Join(lightNodeKeysDir, consts.KeysIds.DALightNode+".info") err := verifyFileExists(infoFilePath) if err != nil { return err @@ -108,7 +108,7 @@ func getRelayerKeysDir(root string) string { func VerifyRelayerKeys(root string, rollappID string, hubID string) error { relayerKeysDir := getRelayerKeysDir(root) rollappKeysDir := filepath.Join(relayerKeysDir, rollappID, innerKeysDirName) - rollappKeyInfoPath := filepath.Join(rollappKeysDir, consts.KeyNames.RollappRelayer+".info") + rollappKeyInfoPath := filepath.Join(rollappKeysDir, consts.KeysIds.RollappRelayer+".info") if err := verifyFileExists(rollappKeyInfoPath); err != nil { return err } @@ -116,7 +116,7 @@ func VerifyRelayerKeys(root string, rollappID string, hubID string) error { return err } hubKeysDir := filepath.Join(relayerKeysDir, hubID, innerKeysDirName) - hubKeyInfoPath := filepath.Join(hubKeysDir, consts.KeyNames.HubRelayer+".info") + hubKeyInfoPath := filepath.Join(hubKeysDir, consts.KeysIds.HubRelayer+".info") if err := verifyFileExists(hubKeyInfoPath); err != nil { return err } diff --git a/test/config/init/testutils/rollapp.go b/test/config/init/testutils/rollapp.go index a5fa5277..0561b3f7 100644 --- a/test/config/init/testutils/rollapp.go +++ b/test/config/init/testutils/rollapp.go @@ -20,12 +20,12 @@ func getHubKeysDir(root string) string { func VerifyRollappKeys(root string) error { rollappKeysDir := getRollappKeysDir(root) - sequencerKeyInfoPath := filepath.Join(rollappKeysDir, consts.KeyNames.RollappSequencer+".info") + sequencerKeyInfoPath := filepath.Join(rollappKeysDir, consts.KeysIds.RollappSequencer+".info") if err := verifyFileExists(sequencerKeyInfoPath); err != nil { return err } hubKeysDir := getHubKeysDir(root) - relayerKeyInfoPath := filepath.Join(hubKeysDir, consts.KeyNames.HubSequencer+".info") + relayerKeyInfoPath := filepath.Join(hubKeysDir, consts.KeysIds.HubSequencer+".info") if err := verifyFileExists(relayerKeyInfoPath); err != nil { return err } From 877167d7b34272b065517d1865f122de580f3609 Mon Sep 17 00:00:00 2001 From: Itay Levy Date: Wed, 28 Jun 2023 12:06:19 +0200 Subject: [PATCH 2/2] Now the addresses are being formatted nicely on init --- cmd/config/init/output.go | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/cmd/config/init/output.go b/cmd/config/init/output.go index 3c4430cf..eeea1ee6 100644 --- a/cmd/config/init/output.go +++ b/cmd/config/init/output.go @@ -2,11 +2,24 @@ package initconfig import ( "fmt" + "github.com/dymensionxyz/roller/cmd/consts" "github.com/dymensionxyz/roller/cmd/utils" ) func printInitOutput(addresses []utils.AddressData, rollappId string) { fmt.Printf("šŸ’ˆ RollApp '%s' configuration files have been successfully generated on your local machine. Congratulations!\n\n", rollappId) - utils.PrintAddresses(addresses) + requireFundingKeys := map[string]string{ + consts.KeysIds.HubSequencer: "Sequencer", + consts.KeysIds.HubRelayer: "Relayer", + consts.KeysIds.DALightNode: "Celestia", + } + filteredAddresses := make([]utils.AddressData, 0) + for _, address := range addresses { + if newName, ok := requireFundingKeys[address.Name]; ok { + address.Name = newName + filteredAddresses = append(filteredAddresses, address) + } + } + utils.PrintAddresses(filteredAddresses) fmt.Printf("\nšŸ”” Please fund these addresses to register and run the rollapp.\n") }