Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
16 changes: 16 additions & 0 deletions utils/config/prompts.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package config

import (
"net/url"
"strings"

"github.com/pterm/pterm"
Expand All @@ -9,6 +10,18 @@ import (
"github.com/dymensionxyz/roller/utils/roller"
)

// AddHttpsPortIfNeeded appends :443 to HTTPS URLs that don't already have a port specified
func AddHttpsPortIfNeeded(rawurl string) string {
u, err := url.Parse(rawurl)
if err != nil || u.Scheme != "https" {
return rawurl
}
if !strings.Contains(u.Host, ":") {
u.Host = u.Host + ":443"
}
return u.String()
}

func PromptVmType() string {
vmtypes := []string{"evm", "wasm"}
vmtype, _ := pterm.DefaultInteractiveSelect.
Expand Down Expand Up @@ -50,6 +63,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