diff --git a/routes/admin_transaction.go b/routes/admin_transaction.go index dc7c634f..2ef9bbf3 100644 --- a/routes/admin_transaction.go +++ b/routes/admin_transaction.go @@ -92,6 +92,22 @@ func (fes *APIServer) GetGlobalParams(ww http.ResponseWriter, req *http.Request) } } +func (fes *APIServer) GetAllGlobalParams(ww http.ResponseWriter, req *http.Request) { + // Get a view + utxoView, err := fes.backendServer.GetMempool().GetAugmentedUniversalView() + if err != nil { + _AddBadRequestError(ww, fmt.Sprintf("GetAllGlobalParams: Error getting utxoView: %v", err)) + return + } + globalParamsEntry := utxoView.GetCurrentGlobalParamsEntry() + // Return all the data associated with the transaction in the response + res := globalParamsEntry + if err = json.NewEncoder(ww).Encode(res); err != nil { + _AddBadRequestError(ww, fmt.Sprintf("GetAllGlobalParams: Problem encoding response as JSON: %v", err)) + return + } +} + // UpdateGlobalParamsRequest ... type UpdateGlobalParamsRequest struct { UpdaterPublicKeyBase58Check string `safeForLogging:"true"` diff --git a/routes/server.go b/routes/server.go index 5f87b787..c3e27f96 100644 --- a/routes/server.go +++ b/routes/server.go @@ -209,6 +209,7 @@ const ( // admin_transaction.go RoutePathGetGlobalParams = "/api/v0/get-global-params" + RoutePathGetAllGlobalParams = "/api/v0/get-all-global-params" RoutePathTestSignTransactionWithDerivedKey = "/api/v0/admin/test-sign-transaction-with-derived-key" // Eventually we will deprecate the admin endpoint since it does not need to be protected. @@ -667,6 +668,13 @@ func (fes *APIServer) NewRouter() *muxtrace.Router { fes.GetGlobalParams, PublicAccess, }, + { + "GetAllGlobalParams", + []string{"GET"}, + RoutePathGetAllGlobalParams, + fes.GetAllGlobalParams, + PublicAccess, + }, // Route for sending DeSo { "SendDeSo",