rpc: move getaccountstate/getunspents RPCs to a separate func
This commit is contained in:
parent
2ec5b9f08a
commit
969ed6e6e1
1 changed files with 11 additions and 3 deletions
|
@ -210,7 +210,7 @@ func (s *Server) methodHandler(w http.ResponseWriter, req *request.In, reqParams
|
||||||
results, resultsErr = s.getAssetState(reqParams)
|
results, resultsErr = s.getAssetState(reqParams)
|
||||||
|
|
||||||
case "getaccountstate":
|
case "getaccountstate":
|
||||||
results, resultsErr = s.getAccountState(reqParams, false)
|
results, resultsErr = s.getAccountState(reqParams)
|
||||||
|
|
||||||
case "getcontractstate":
|
case "getcontractstate":
|
||||||
results, resultsErr = s.getContractState(reqParams)
|
results, resultsErr = s.getContractState(reqParams)
|
||||||
|
@ -228,7 +228,7 @@ func (s *Server) methodHandler(w http.ResponseWriter, req *request.In, reqParams
|
||||||
results, resultsErr = s.getUnclaimed(reqParams)
|
results, resultsErr = s.getUnclaimed(reqParams)
|
||||||
|
|
||||||
case "getunspents":
|
case "getunspents":
|
||||||
results, resultsErr = s.getAccountState(reqParams, true)
|
results, resultsErr = s.getUnspents(reqParams)
|
||||||
|
|
||||||
case "invoke":
|
case "invoke":
|
||||||
results, resultsErr = s.invoke(reqParams)
|
results, resultsErr = s.invoke(reqParams)
|
||||||
|
@ -720,8 +720,16 @@ func (s *Server) getContractState(reqParams request.Params) (interface{}, error)
|
||||||
return results, nil
|
return results, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *Server) getAccountState(ps request.Params) (interface{}, error) {
|
||||||
|
return s.getAccountStateAux(ps, false)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *Server) getUnspents(ps request.Params) (interface{}, error) {
|
||||||
|
return s.getAccountStateAux(ps, true)
|
||||||
|
}
|
||||||
|
|
||||||
// getAccountState returns account state either in short or full (unspents included) form.
|
// getAccountState returns account state either in short or full (unspents included) form.
|
||||||
func (s *Server) getAccountState(reqParams request.Params, unspents bool) (interface{}, error) {
|
func (s *Server) getAccountStateAux(reqParams request.Params, unspents bool) (interface{}, error) {
|
||||||
var resultsErr error
|
var resultsErr error
|
||||||
var results interface{}
|
var results interface{}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue