Skip to content

Commit 5de371d

Browse files
committed
impv: initiation-2 testnet
1 parent 1e56fd1 commit 5de371d

File tree

3 files changed

+31
-16
lines changed

3 files changed

+31
-16
lines changed

models/initia/run_l1_node.go

+9-10
Original file line numberDiff line numberDiff line change
@@ -777,12 +777,16 @@ func initializeApp(state *RunL1NodeState) tea.Cmd {
777777
panic(err)
778778
}
779779

780-
applicationVersion, ok := result["application_version"].(map[string]interface{})
781-
if !ok {
782-
panic("failed to get node version")
780+
// TODO: Remove this logic when we have a working version of the node_info endpoint
781+
if state.chainId == "initiation-2" {
782+
nodeVersion = "v0.4.11-initiation.1"
783+
} else {
784+
applicationVersion, ok := result["application_version"].(map[string]interface{})
785+
if !ok {
786+
panic("failed to get node version")
787+
}
788+
nodeVersion = applicationVersion["version"].(string)
783789
}
784-
785-
nodeVersion = applicationVersion["version"].(string)
786790
state.initiadVersion = nodeVersion
787791
goos := runtime.GOOS
788792
goarch := runtime.GOARCH
@@ -863,11 +867,6 @@ func initializeApp(state *RunL1NodeState) tea.Cmd {
863867
}
864868

865869
func getBinaryURL(version, os, arch string) string {
866-
// Remove this when we have a release, or initiation-2 has prebuilt binaries
867-
if version == "v0.2.24-stage-2" {
868-
return "https://storage.googleapis.com/initia-binaries/initia_v0.2.24-stage-2_Darwin_aarch64.tar.gz"
869-
}
870-
871870
switch os {
872871
case "darwin":
873872
switch arch {

utils/config.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ const DefaultConfigTemplate = `
8888
"constants": {
8989
"chain_id": {
9090
"mainnet": "initia-1",
91-
"testnet": "initiation-1"
91+
"testnet": "initiation-2"
9292
},
9393
"endpoints": {
9494
"mainnet": {
@@ -97,9 +97,9 @@ const DefaultConfigTemplate = `
9797
"genesis": "https://initia.s3.ap-southeast-1.amazonaws.com/initia-1/genesis.json"
9898
},
9999
"testnet": {
100-
"rpc": "https://rpc.testnet.initia.xyz",
101-
"lcd": "https://lcd.testnet.initia.xyz",
102-
"genesis": "https://initia.s3.ap-southeast-1.amazonaws.com/initiation-1/genesis.json"
100+
"rpc": "https://rpc.initiation-2.initia.xyz",
101+
"lcd": "https://lcd.initiation-2.initia.xyz",
102+
"genesis": "https://storage.googleapis.com/initia-binaries/genesis.json"
103103
}
104104
}
105105
}

utils/service_manager.go

+18-2
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,18 @@ func EnableService(serviceName string) error {
117117
return nil
118118
}
119119

120+
func UnloadService(serviceName string) error {
121+
userHome, err := os.UserHomeDir()
122+
if err != nil {
123+
return fmt.Errorf("failed to get user home directory: %v", err)
124+
}
125+
loadCmd := exec.Command("launchctl", "unload", filepath.Join(userHome, fmt.Sprintf("Library/LaunchAgents/%s.plist", serviceName)))
126+
if err := loadCmd.Run(); err != nil {
127+
return fmt.Errorf("failed to load service: %v", err)
128+
}
129+
return nil
130+
}
131+
120132
func LoadService(serviceName string) error {
121133
userHome, err := os.UserHomeDir()
122134
if err != nil {
@@ -138,8 +150,12 @@ func StartService(serviceName string) error {
138150
}
139151
return nil
140152
case "darwin":
153+
err := LoadService(serviceName)
154+
if err != nil {
155+
return fmt.Errorf("failed to load service: %v", err)
156+
}
141157
startCmd := exec.Command("launchctl", "start", serviceName)
142-
if err := startCmd.Run(); err != nil {
158+
if err = startCmd.Run(); err != nil {
143159
return fmt.Errorf("failed to start service: %v", err)
144160
}
145161

@@ -162,7 +178,7 @@ func StopService(serviceName string) error {
162178
if err := cmd.Run(); err != nil {
163179
return fmt.Errorf("failed to stop service: %v", err)
164180
}
165-
return nil
181+
return UnloadService(serviceName)
166182
default:
167183
return fmt.Errorf("unsupported operating system: %s", runtime.GOOS)
168184
}

0 commit comments

Comments
 (0)