Skip to content

Commit f6f6bfb

Browse files
committed
fix: typosg
1 parent fb468e6 commit f6f6bfb

File tree

2 files changed

+29
-13
lines changed

2 files changed

+29
-13
lines changed

models/weaveinit/run_l1_node.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ func (m *RunL1NodeNetworkSelect) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
5757
if selected != nil {
5858
selectedString := string(*selected)
5959
m.state.network = selectedString
60-
m.state.weave.PreviousResponse += styles.RenderPreviousResponse(styles.ArrowSeparator, m.GetQuestion(), []string{}, selectedString)
60+
m.state.weave.PreviousResponse += styles.RenderPreviousResponse(styles.ArrowSeparator, m.GetQuestion(), []string{"network"}, selectedString)
6161
switch *selected {
6262
case Mainnet, Testnet:
6363
return NewRunL1NodeMonikerInput(m.state), cmd
@@ -94,7 +94,7 @@ func NewRunL1NodeVersionSelect(state *RunL1NodeState) *RunL1NodeVersionSelect {
9494
},
9595
state: state,
9696
versions: versions,
97-
question: "Which network will your node participate in?",
97+
question: "Which initiad version would you like to use?",
9898
}
9999
}
100100

@@ -119,7 +119,7 @@ func (m *RunL1NodeVersionSelect) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
119119
}
120120

121121
func (m *RunL1NodeVersionSelect) View() string {
122-
return styles.RenderPrompt("Which network will your node participate in?", []string{"network"}, styles.Question) + m.Selector.View()
122+
return m.state.weave.PreviousResponse + styles.RenderPrompt("Which initiad version would you like to use?", []string{"initiad version"}, styles.Question) + m.Selector.View()
123123
}
124124

125125
type RunL1NodeChainIdInput struct {

utils/http.go

+26-10
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"fmt"
66
"io"
77
"net/http"
8+
"runtime"
89
"strings"
910
"time"
1011
)
@@ -66,12 +67,30 @@ type InitiaRelease struct {
6667
} `json:"assets"`
6768
}
6869

69-
type InitiaVersionWithDownloadURL struct {
70-
Version string
71-
URL string
72-
}
70+
type InitiaVersionWithDownloadURL map[string]string
71+
72+
func ListInitiaReleases() InitiaVersionWithDownloadURL {
73+
goos := runtime.GOOS
74+
goarch := runtime.GOARCH
75+
76+
var os, arch string
77+
switch goos {
78+
case "darwin":
79+
os = "Darwin"
80+
case "linux":
81+
os = "Linux"
82+
default:
83+
panic(fmt.Errorf("unsupported OS: %s", goos))
84+
}
85+
switch goarch {
86+
case "amd64":
87+
arch = "x86_64"
88+
case "arm64":
89+
arch = "aarch64"
90+
default:
91+
panic(fmt.Errorf("unsupported architecture: %s", goarch))
92+
}
7393

74-
func ListInitiaReleases(os, arch string) []InitiaVersionWithDownloadURL {
7594
url := "https://api.github.com/repos/initia-labs/initia/releases"
7695
resp, err := http.Get(url)
7796
if err != nil {
@@ -94,15 +113,12 @@ func ListInitiaReleases(os, arch string) []InitiaVersionWithDownloadURL {
94113
}
95114

96115
searchString := fmt.Sprintf("%s_%s.tar.gz", os, arch)
97-
versions := make([]InitiaVersionWithDownloadURL, 0)
116+
versions := make(InitiaVersionWithDownloadURL)
98117

99118
for _, release := range releases {
100119
for _, asset := range release.Assets {
101120
if strings.Contains(asset.BrowserDownloadURL, searchString) {
102-
versions = append(versions, InitiaVersionWithDownloadURL{
103-
Version: release.TagName,
104-
URL: asset.BrowserDownloadURL,
105-
})
121+
versions[release.TagName] = asset.BrowserDownloadURL
106122
}
107123
}
108124
}

0 commit comments

Comments
 (0)