diff --git a/client/info.go b/client/info.go index 85b10515018e8d4c4e01fb7b5946c4d529bd0e6a..08c43ae6f30d4c27a235bd548f2b17c3dda061ca 100644 --- a/client/info.go +++ b/client/info.go @@ -11,11 +11,9 @@ const ( ) // Info gets the info of the node. -func (api *GoShimmerAPI) Info(knownPeers bool) (*webapi_info.Response, error) { +func (api *GoShimmerAPI) Info() (*webapi_info.Response, error) { res := &webapi_info.Response{} - if err := api.do(http.MethodGet, func() string { - return routeInfo - }(), nil, res); err != nil { + if err := api.do(http.MethodGet, routeInfo, nil, res); err != nil { return nil, err } return res, nil diff --git a/pluginmgr/webapi/plugins.go b/pluginmgr/webapi/plugins.go index 76f1df7589bc908190e084fceba4688fd826e047..464d058c33ddb59fe421511e5cae440a0f93698b 100644 --- a/pluginmgr/webapi/plugins.go +++ b/pluginmgr/webapi/plugins.go @@ -20,5 +20,5 @@ var PLUGINS = node.Plugins( drng.PLUGIN, message.PLUGIN, autopeering.PLUGIN, - info.PLUGIN, + info.Plugin, ) diff --git a/plugins/webapi/info/plugin.go b/plugins/webapi/info/plugin.go index 1d8c3d04313d4f62bf5b5657959be2b7181d0cd1..e2ae0357c4e29bc264fc60072c841ff9caa30aee 100644 --- a/plugins/webapi/info/plugin.go +++ b/plugins/webapi/info/plugin.go @@ -8,10 +8,10 @@ import ( "github.com/iotaledger/goshimmer/plugins/webapi" "github.com/iotaledger/hive.go/node" "github.com/labstack/echo" - "github.com/mr-tron/base58" ) -var PLUGIN = node.NewPlugin("WebAPI info Endpoint", node.Enabled, configure) +// Plugin exports the plugin +var Plugin = node.NewPlugin("WebAPI info Endpoint", node.Enabled, configure) func configure(plugin *node.Plugin) { webapi.Server.GET("info", getInfo) @@ -21,7 +21,7 @@ func configure(plugin *node.Plugin) { // e.g., // { // "version":"v0.2.0", -// "identity":"7BxV1v3nFHefn4J88jeZebqnJRvSHt1jC7ME6tmKLhy7", +// "identityID":"5bf4aa1d6c47e4ce", // "publickey":"CjUsn86jpFHWnSCx3NhWfU4Lk16mDdy1Hr7ERSTv3xn9", // "enabledplugins":[ // "Config", @@ -53,8 +53,8 @@ func configure(plugin *node.Plugin) { // ] // } func getInfo(c echo.Context) error { - enabledPlugins := []string{} - disabledPlugins := []string{} + var enabledPlugins []string + var disabledPlugins []string for plugin, status := range node.GetPlugins() { switch status { case node.Disabled: @@ -68,8 +68,8 @@ func getInfo(c echo.Context) error { return c.JSON(http.StatusOK, Response{ Version: banner.AppVersion, - Identity: base58.Encode(local.GetInstance().Identity.ID().Bytes()), - PublicKey: base58.Encode(local.GetInstance().PublicKey().Bytes()), + IdentityID: local.GetInstance().Identity.ID().String(), + PublicKey: local.GetInstance().PublicKey().String(), EnabledPlugins: enabledPlugins, DisabledPlugins: disabledPlugins, }) @@ -79,8 +79,8 @@ func getInfo(c echo.Context) error { type Response struct { // version of GoShimmer Version string `json:"version,omitempty"` - // identity of the node encoded in base58 - Identity string `json:"identity,omitempty"` + // identity ID of the node encoded in hex and truncated to its first 8 bytes + IdentityID string `json:"identityID,omitempty"` // public key of the node encoded in base58 PublicKey string `json:"publickey,omitempty"` // list of enabled plugins