forked from TrueCloudLab/neoneo-go
rpc: move validateaddress RPC to a separate func
This commit is contained in:
parent
70eb0b175a
commit
4e25c9121b
1 changed files with 9 additions and 6 deletions
|
@ -269,12 +269,7 @@ Methods:
|
||||||
results, resultsErr = s.getStorage(reqParams)
|
results, resultsErr = s.getStorage(reqParams)
|
||||||
|
|
||||||
case "validateaddress":
|
case "validateaddress":
|
||||||
param, ok := reqParams.Value(0)
|
results, resultsErr = s.validateAddress(reqParams)
|
||||||
if !ok {
|
|
||||||
resultsErr = response.ErrInvalidParams
|
|
||||||
break Methods
|
|
||||||
}
|
|
||||||
results = validateAddress(param.Value)
|
|
||||||
|
|
||||||
case "getassetstate":
|
case "getassetstate":
|
||||||
results, resultsErr = s.getAssetState(reqParams)
|
results, resultsErr = s.getAssetState(reqParams)
|
||||||
|
@ -327,6 +322,14 @@ Methods:
|
||||||
s.WriteResponse(req, w, results)
|
s.WriteResponse(req, w, results)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *Server) validateAddress(reqParams request.Params) (interface{}, error) {
|
||||||
|
param, ok := reqParams.Value(0)
|
||||||
|
if !ok {
|
||||||
|
return nil, response.ErrInvalidParams
|
||||||
|
}
|
||||||
|
return validateAddress(param.Value), nil
|
||||||
|
}
|
||||||
|
|
||||||
func (s *Server) getAssetState(reqParams request.Params) (interface{}, error) {
|
func (s *Server) getAssetState(reqParams request.Params) (interface{}, error) {
|
||||||
param, ok := reqParams.ValueWithType(0, request.StringT)
|
param, ok := reqParams.ValueWithType(0, request.StringT)
|
||||||
if !ok {
|
if !ok {
|
||||||
|
|
Loading…
Reference in a new issue