Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions endpoints.go
Original file line number Diff line number Diff line change
Expand Up @@ -599,3 +599,25 @@ func PostTx() {
erpc.MarshalSend(w, x)
})
}

// NetworkReturn is a simple struct that is used as helper to return network config
type NetworkReturn struct {
Network string
}

// GetNetwork checks which network the wrapper is running on
func GetNetwork(mainnet bool) {
http.HandleFunc("/network", func(w http.ResponseWriter, r *http.Request) {
err := erpc.CheckGet(w, r)
if err != nil {
log.Println(err)
return
}
var x NetworkReturn
x.Network = "Testnet"
if mainnet {
x.Network = "Mainnet"
}
erpc.MarshalSend(w, x)
})
}
1 change: 1 addition & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ func startHandlers() {
PostTx()
RelayTxid()
RelayGetRequest()
GetNetwork(opts.Mainnet)
}

func main() {
Expand Down