diff --git a/cmd/utils/explanations/explanations.go b/cmd/utils/explanations/explanations.go index 216c680b..8ca94b8b 100644 --- a/cmd/utils/explanations/explanations.go +++ b/cmd/utils/explanations/explanations.go @@ -10,9 +10,9 @@ var NodeNotFound = lipgloss.JoinHorizontal(lipgloss.Left, style.Cyan.Render("Explanation"), style.Bold(": "), ) + - "algorun could not find your node automatically. (ensure the node is running)\n\n" + + "algorun could not find your node automatically. Ensure the node is installed and running: If you have not installed algod yet, run \"nodekit bootstrap\". If your node is installed, start it with \"nodekit start\". \n\n" + lipgloss.JoinHorizontal(lipgloss.Left, - "Provide ", + "Otherwise for custom installations, provide ", style.Bold("--datadir"), " or set the goal-compatible ", style.Bold("ALGORAND_DATA"), diff --git a/internal/algod/participation/participation.go b/internal/algod/participation/participation.go index bf55cc4b..bcfb80b5 100644 --- a/internal/algod/participation/participation.go +++ b/internal/algod/participation/participation.go @@ -65,6 +65,10 @@ func GenerateKeys( return nil, err } if key.StatusCode() != 200 { + if key.JSON400 != nil { + return nil, errors.New(key.JSON400.Message) + } + status := key.Status() if status != "" { return nil, errors.New(status) diff --git a/ui/app/keys.go b/ui/app/keys.go index 133e4b65..75debd75 100644 --- a/ui/app/keys.go +++ b/ui/app/keys.go @@ -60,7 +60,7 @@ func GenerateCmd(account string, rangeType participation.RangeType, duration int Key: nil, Address: "", Active: false, - Err: &err, + Err: err, Type: ExceptionModal, } } diff --git a/ui/app/modal.go b/ui/app/modal.go index 2639bbb6..9e25d1ee 100644 --- a/ui/app/modal.go +++ b/ui/app/modal.go @@ -54,8 +54,8 @@ type ModalEvent struct { // Prefix adds prefix message to info modal Prefix string - // Err is a pointer to an error that represents an exceptional condition or failure state for the modal event. - Err *error + // Err is an error that represents an exceptional condition or failure state for the modal event. + Err error // Type represents the specific category or variant of the modal event. Type ModalType diff --git a/ui/modal/controller.go b/ui/modal/controller.go index ea18271b..5750267b 100644 --- a/ui/modal/controller.go +++ b/ui/modal/controller.go @@ -39,6 +39,12 @@ func (m ViewModel) HandleMessage(msg tea.Msg) (*ViewModel, tea.Cmd) { m.SetShortLink(msg) m.SetType(app.TransactionModal) case *algod.StateModel: + // Clear the catchup modal + if msg.Status.State != algod.FastCatchupState && m.Type == app.ExceptionModal && m.title == "Fast Catchup" { + m.Open = false + m.SetType(app.InfoModal) + } + m.State = msg m.transactionModal.State = msg m.infoModal.State = msg @@ -90,6 +96,13 @@ func (m ViewModel) HandleMessage(msg tea.Msg) (*ViewModel, tea.Cmd) { } case app.ModalEvent: + if msg.Type == app.ExceptionModal { + m.Open = true + m.exceptionModal.Message = msg.Err.Error() + m.generateModal.SetStep(generate.AddressStep) + m.SetType(app.ExceptionModal) + } + if msg.Type == app.InfoModal { m.infoModal.Prefix = msg.Prefix m.generateModal.SetStep(generate.AddressStep)