From 647b4438224d53d13956de1bd39f2d16e0b29f8f Mon Sep 17 00:00:00 2001 From: Aaron Buchwald Date: Mon, 1 Jun 2020 13:52:07 -0400 Subject: [PATCH] Add get network name call to admin --- api/admin/service.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/api/admin/service.go b/api/admin/service.go index ba8cad2..bddc7ba 100644 --- a/api/admin/service.go +++ b/api/admin/service.go @@ -10,6 +10,7 @@ import ( "github.com/ava-labs/gecko/api" "github.com/ava-labs/gecko/chains" + "github.com/ava-labs/gecko/genesis" "github.com/ava-labs/gecko/ids" "github.com/ava-labs/gecko/network" "github.com/ava-labs/gecko/snow/engine/common" @@ -78,6 +79,20 @@ func (service *Admin) GetNetworkID(r *http.Request, args *GetNetworkIDArgs, repl return nil } +type GetNetworkNameArgs struct{} + +type GetNetworkNameReply struct { + NetworkName string `json:"networkName"` +} + +// GetNetworkID returns the network ID this node is running on +func (service *Admin) GetNetworkName(r *http.Request, args *GetNetworkNameArgs, reply *GetNetworkNameReply) error { + service.log.Debug("Admin: GetNetworkName called") + + reply.NetworkName = genesis.NetworkName(service.networkID) + return nil +} + // GetBlockchainIDArgs are the arguments for calling GetBlockchainID type GetBlockchainIDArgs struct { Alias string `json:"alias"`