Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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: 4 additions & 4 deletions cmd/eibc/fulfill/feeshare/feeshare.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ func Cmd() *cobra.Command {
return
}

if err != nil {
pterm.Error.Println("failed to expand home directory")
return
}
// if err != nil {
// pterm.Error.Println("failed to expand home directory")
// return
// }

eibcHome := filepath.Join(home, consts.ConfigDirName.Eibc)
eibcConfigPath := filepath.Join(eibcHome, "config.yaml")
Expand Down
6 changes: 4 additions & 2 deletions cmd/eibc/init/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,8 @@ func setupEibcClient(hd consts.HubData, eibcHome string, ki *keys.KeyInfo) error

rpc = strings.TrimSuffix(rpc, "/")

// Add :443 to HTTPS URLs if no port is specified
rpc = config.AddHttpsPortIfNeeded(rpc)
isValid := config.IsValidURL(rpc)

if !isValid {
Expand Down Expand Up @@ -433,13 +435,13 @@ func initializeEibcForEnvironment() (consts.HubData, error) {
var rollerConfig roller.RollappConfig
hdid, _ := pterm.DefaultInteractiveTextInput.WithDefaultText("provide hub chain id").
Show()
hdrpc, _ := pterm.DefaultInteractiveTextInput.WithDefaultText("provide hub rpc endpoint").
hdrpc, _ := pterm.DefaultInteractiveTextInput.WithDefaultText("provide hub rpc endpoint (example: https://hub.dym.xyz:443)").
Show()
hdws, _ := pterm.DefaultInteractiveTextInput.WithDefaultText("provide hub websocket endpoint, only fill this in when RPC and WebSocket are separate (optional)").
Show()

rollerConfig.HubData.ID = hdid
rollerConfig.HubData.RpcUrl = hdrpc
rollerConfig.HubData.RpcUrl = config.AddHttpsPortIfNeeded(hdrpc)

if hdws == "" {
rollerConfig.HubData.WsUrl = hdrpc
Expand Down
9 changes: 9 additions & 0 deletions cmd/rollapp/setup/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -1185,6 +1185,9 @@ func populateSequencerMetadata(raCfg roller.RollappConfig) error {
rpc = "https://" + rpc
}

// Add :443 to HTTPS URLs if no port is specified
rpc = config.AddHttpsPortIfNeeded(rpc)

isValid := config.IsValidURL(rpc)

// Validate the URL
Expand All @@ -1205,6 +1208,9 @@ func populateSequencerMetadata(raCfg roller.RollappConfig) error {
rest = "https://" + rest
}

// Add :443 to HTTPS URLs if no port is specified
rest = config.AddHttpsPortIfNeeded(rest)

isValid := config.IsValidURL(rest)

// Validate the URL
Expand All @@ -1226,6 +1232,9 @@ func populateSequencerMetadata(raCfg roller.RollappConfig) error {
evmRpc = "https://" + evmRpc
}

// Add :443 to HTTPS URLs if no port is specified
evmRpc = config.AddHttpsPortIfNeeded(evmRpc)

isValid := config.IsValidURL(evmRpc)

// Validate the URL
Expand Down
14 changes: 14 additions & 0 deletions utils/config/prompts.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,17 @@ import (
"github.com/dymensionxyz/roller/utils/roller"
)

// AddHttpsPortIfNeeded appends :443 to HTTPS URLs that don't already have a port specified
func AddHttpsPortIfNeeded(url string) string {
if strings.HasPrefix(url, "https://") {
// Check if URL already has a port
if !strings.Contains(url[8:], ":") {
return url + ":443"
}
}
return url
}

func PromptVmType() string {
vmtypes := []string{"evm", "wasm"}
vmtype, _ := pterm.DefaultInteractiveSelect.
Expand Down Expand Up @@ -50,6 +61,9 @@ func PromptCustomHubEndpoint(rollerConfig roller.RollappConfig) roller.RollappCo
rpcEndpoint, _ = pterm.DefaultInteractiveTextInput.WithDefaultText("We recommend using a private RPC endpoint for the hub. Please provide the hub rpc endpoint to use. You can obtain one here: https://blastapi.io/chains/dymension").
Show()

// Add :443 to HTTPS URLs if no port is specified
rpcEndpoint = AddHttpsPortIfNeeded(rpcEndpoint)

isValidUrl := IsValidURL(rpcEndpoint)
if isValidUrl {
break
Expand Down
Loading