Skip to content

Commit

Permalink
Get all global params (#662)
Browse files Browse the repository at this point in the history
  • Loading branch information
lazynina authored Aug 2, 2024
1 parent b0b2a44 commit 499b51d
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
16 changes: 16 additions & 0 deletions routes/admin_transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down
8 changes: 8 additions & 0 deletions routes/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,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.
Expand Down Expand Up @@ -669,6 +670,13 @@ func (fes *APIServer) NewRouter() *muxtrace.Router {
fes.GetGlobalParams,
PublicAccess,
},
{
"GetAllGlobalParams",
[]string{"GET"},
RoutePathGetAllGlobalParams,
fes.GetAllGlobalParams,
PublicAccess,
},
// Route for sending DeSo
{
"SendDeSo",
Expand Down

0 comments on commit 499b51d

Please sign in to comment.