7
7
"path/filepath"
8
8
"runtime"
9
9
"strconv"
10
- "strings"
11
10
"time"
12
11
13
12
tea "github.com/charmbracelet/bubbletea"
@@ -24,13 +23,16 @@ type RunL1NodeNetworkSelect struct {
24
23
25
24
type L1NodeNetworkOption string
26
25
27
- const (
28
- Mainnet L1NodeNetworkOption = "Mainnet"
29
- Testnet L1NodeNetworkOption = "Testnet"
30
- Local L1NodeNetworkOption = "Local"
26
+ var (
27
+ Mainnet L1NodeNetworkOption = ""
28
+ Testnet L1NodeNetworkOption = ""
31
29
)
32
30
31
+ const Local L1NodeNetworkOption = "Local"
32
+
33
33
func NewRunL1NodeNetworkSelect (state * RunL1NodeState ) * RunL1NodeNetworkSelect {
34
+ Testnet = L1NodeNetworkOption (fmt .Sprintf ("Testnet (%s)" , utils .GetConfig ("constants.chain_id.testnet" )))
35
+ Mainnet = L1NodeNetworkOption (fmt .Sprintf ("Mainnet (%s)" , utils .GetConfig ("constants.chain_id.mainnet" )))
34
36
return & RunL1NodeNetworkSelect {
35
37
Selector : utils.Selector [L1NodeNetworkOption ]{
36
38
Options : []L1NodeNetworkOption {
@@ -60,7 +62,10 @@ func (m *RunL1NodeNetworkSelect) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
60
62
m .state .weave .PushPreviousResponse (styles .RenderPreviousResponse (styles .ArrowSeparator , m .GetQuestion (), []string {"network" }, selectedString ))
61
63
switch * selected {
62
64
case Mainnet , Testnet :
63
- lowerNetwork := strings .ToLower (selectedString )
65
+ lowerNetwork := "testnet"
66
+ if * selected == Mainnet {
67
+ lowerNetwork = "mainnet"
68
+ }
64
69
chainId := utils .GetConfig (fmt .Sprintf ("constants.chain_id.%s" , lowerNetwork ))
65
70
genesisEndpoint , err := utils .GetEndpointURL (lowerNetwork , "genesis" )
66
71
if err != nil {
@@ -775,7 +780,11 @@ func initializeApp(state *RunL1NodeState) tea.Cmd {
775
780
url = state .initiadEndpoint
776
781
case string (Mainnet ), string (Testnet ):
777
782
var result map [string ]interface {}
778
- err = utils .MakeGetRequestUsingConfig (strings .ToLower (state .network ), "lcd" , "/cosmos/base/tendermint/v1beta1/node_info" , nil , & result )
783
+ network := "testnet"
784
+ if state .network == string (Mainnet ) {
785
+ network = "mainnet"
786
+ }
787
+ err = utils .MakeGetRequestUsingConfig (network , "lcd" , "/cosmos/base/tendermint/v1beta1/node_info" , nil , & result )
779
788
if err != nil {
780
789
panic (err )
781
790
}
@@ -1055,6 +1064,7 @@ const (
1055
1064
)
1056
1065
1057
1066
func NewExistingDataReplaceSelect (state * RunL1NodeState ) * ExistingDataReplaceSelect {
1067
+ // TODO: Paraphrase the question and options
1058
1068
return & ExistingDataReplaceSelect {
1059
1069
Selector : utils.Selector [SyncConfirmationOption ]{
1060
1070
Options : []SyncConfirmationOption {
@@ -1082,6 +1092,7 @@ func (m *ExistingDataReplaceSelect) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
1082
1092
switch * selected {
1083
1093
case Skip :
1084
1094
m .state .replaceExistingData = false
1095
+ // TODO: Terminal state here
1085
1096
return m , tea .Quit
1086
1097
case ProceedWithSync :
1087
1098
m .state .replaceExistingData = true
0 commit comments