@@ -87,7 +87,7 @@ func (m *RunL1NodeVersionInput) Init() tea.Cmd {
87
87
func (m * RunL1NodeVersionInput ) Update (msg tea.Msg ) (tea.Model , tea.Cmd ) {
88
88
input , done := m .TextInput .Update (msg )
89
89
if done {
90
- m .state .initiadVersion = string ( input .Text )
90
+ m .state .initiadVersion = input .Text
91
91
return NewRunL1NodeChainIdInput (m .state ), nil
92
92
}
93
93
m .TextInput = input
@@ -117,7 +117,7 @@ func (m *RunL1NodeChainIdInput) Init() tea.Cmd {
117
117
func (m * RunL1NodeChainIdInput ) Update (msg tea.Msg ) (tea.Model , tea.Cmd ) {
118
118
input , done := m .TextInput .Update (msg )
119
119
if done {
120
- m .state .chainId = string ( input .Text )
120
+ m .state .chainId = input .Text
121
121
return NewRunL1NodeMonikerInput (m .state ), nil
122
122
}
123
123
m .TextInput = input
@@ -147,7 +147,7 @@ func (m *RunL1NodeMonikerInput) Init() tea.Cmd {
147
147
func (m * RunL1NodeMonikerInput ) Update (msg tea.Msg ) (tea.Model , tea.Cmd ) {
148
148
input , done := m .TextInput .Update (msg )
149
149
if done {
150
- m .state .moniker = string ( input .Text )
150
+ m .state .moniker = input .Text
151
151
fmt .Println ("\n [info] state" , m .state )
152
152
return NewExistingAppChecker (m .state ), utils .DoTick ()
153
153
}
@@ -182,8 +182,10 @@ func (m *ExistingAppChecker) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
182
182
return m , tea .Quit
183
183
}
184
184
185
- configTomlPath := filepath .Join (homeDir , ".initia" , "config" , "config.toml" )
186
- if ! utils .FileOrFolderExists (configTomlPath ) {
185
+ initiaConfigPath := filepath .Join (homeDir , ".initia" , "config" )
186
+ appTomlPath := filepath .Join (initiaConfigPath , "app.toml" )
187
+ configTomlPath := filepath .Join (initiaConfigPath , "config.toml" )
188
+ if ! utils .FileOrFolderExists (configTomlPath ) || ! utils .FileOrFolderExists (appTomlPath ) {
187
189
m .state .existingApp = false
188
190
return NewMinGasPriceInput (m .state ), nil
189
191
} else {
@@ -233,6 +235,7 @@ func (m *ExistingAppReplaceSelect) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
233
235
switch * selected {
234
236
case UseCurrent :
235
237
m .state .replaceExistingApp = false
238
+ // TODO: Continue
236
239
fmt .Println ("\n [info] Using current files" )
237
240
case Replace :
238
241
m .state .replaceExistingApp = true
@@ -275,8 +278,8 @@ func (m *MinGasPriceInput) Init() tea.Cmd {
275
278
func (m * MinGasPriceInput ) Update (msg tea.Msg ) (tea.Model , tea.Cmd ) {
276
279
input , done := m .TextInput .Update (msg )
277
280
if done {
278
- m .state .minGasPrice = string ( input .Text )
279
- return m , tea . Quit
281
+ m .state .minGasPrice = input .Text
282
+ return NewEnableFeaturesCheckbox ( m . state ), nil
280
283
}
281
284
m .TextInput = input
282
285
return m , nil
@@ -285,7 +288,51 @@ func (m *MinGasPriceInput) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
285
288
func (m * MinGasPriceInput ) View () string {
286
289
preText := ""
287
290
if ! m .state .existingApp {
288
- preText += "No existing .initia directory found. Creating a new one. \n "
291
+ preText += "i There is no config/app.toml or config/config.toml available. You will need to enter the required information to proceed. \n \n "
289
292
}
290
293
return fmt .Sprintf ("%s? Please specify min-gas-price (uinit)\n > %s\n " , preText , m .TextInput .View ())
291
294
}
295
+
296
+ type EnableFeaturesCheckbox struct {
297
+ utils.Selector [EnableFeaturesOption ]
298
+ state * RunL1NodeState
299
+ }
300
+
301
+ type EnableFeaturesOption string
302
+
303
+ const (
304
+ LCD EnableFeaturesOption = "LCD API"
305
+ gRPC EnableFeaturesOption = "gRPC"
306
+ )
307
+
308
+ func NewEnableFeaturesCheckbox (state * RunL1NodeState ) * EnableFeaturesCheckbox {
309
+ return & EnableFeaturesCheckbox {
310
+ Selector : utils.Selector [EnableFeaturesOption ]{
311
+ Options : []EnableFeaturesOption {
312
+ LCD ,
313
+ gRPC ,
314
+ },
315
+ },
316
+ state : state ,
317
+ }
318
+ }
319
+
320
+ func (m * EnableFeaturesCheckbox ) Init () tea.Cmd {
321
+ return nil
322
+ }
323
+
324
+ func (m * EnableFeaturesCheckbox ) Update (msg tea.Msg ) (tea.Model , tea.Cmd ) {
325
+ return m , nil
326
+ }
327
+
328
+ func (m * EnableFeaturesCheckbox ) View () string {
329
+ view := "? Would you like to enable the following options?\n "
330
+ for i , option := range m .Options {
331
+ if i == m .Cursor {
332
+ view += "(■) " + string (option ) + "\n "
333
+ } else {
334
+ view += "( ) " + string (option ) + "\n "
335
+ }
336
+ }
337
+ return view + "\n Use arrow-keys. Space to select. Return to submit, or q to quit."
338
+ }
0 commit comments