forked from TrueCloudLab/neoneo-go
rpc: move ValidateAddress to the result package
Because it is a result of the RPC call.
This commit is contained in:
parent
bfa2d54e16
commit
c189062f40
4 changed files with 10 additions and 10 deletions
|
@ -1,9 +1,9 @@
|
|||
package wrappers
|
||||
package result
|
||||
|
||||
// ValidateAddressResponse represents response to validate address call. Notice
|
||||
// ValidateAddress represents result of the `validateaddress` call. Notice that
|
||||
// Address is an interface{} here because server echoes back whatever address
|
||||
// value user has sent to it, even if it's not a string.
|
||||
type ValidateAddressResponse struct {
|
||||
type ValidateAddress struct {
|
||||
Address interface{} `json:"address"`
|
||||
IsValid bool `json:"isvalid"`
|
||||
}
|
|
@ -555,8 +555,8 @@ func (s *Server) blockHeightFromParam(param *Param) (int, error) {
|
|||
|
||||
// validateAddress verifies that the address is a correct NEO address
|
||||
// see https://docs.neo.org/en-us/node/cli/2.9.4/api/validateaddress.html
|
||||
func validateAddress(addr interface{}) wrappers.ValidateAddressResponse {
|
||||
resp := wrappers.ValidateAddressResponse{Address: addr}
|
||||
func validateAddress(addr interface{}) result.ValidateAddress {
|
||||
resp := result.ValidateAddress{Address: addr}
|
||||
if addr, ok := addr.(string); ok {
|
||||
_, err := address.StringToUint160(addr)
|
||||
resp.IsValid = (err == nil)
|
||||
|
|
|
@ -50,9 +50,9 @@ type InvokeFunctionResponse struct {
|
|||
|
||||
// ValidateAddrResponse struct for testing.
|
||||
type ValidateAddrResponse struct {
|
||||
Jsonrpc string `json:"jsonrpc"`
|
||||
Result wrappers.ValidateAddressResponse `json:"result"`
|
||||
ID int `json:"id"`
|
||||
Jsonrpc string `json:"jsonrpc"`
|
||||
Result result.ValidateAddress `json:"result"`
|
||||
ID int `json:"id"`
|
||||
}
|
||||
|
||||
// GetPeersResponse struct for testing.
|
||||
|
|
|
@ -14,7 +14,7 @@ import (
|
|||
|
||||
"github.com/CityOfZion/neo-go/pkg/core"
|
||||
"github.com/CityOfZion/neo-go/pkg/core/transaction"
|
||||
"github.com/CityOfZion/neo-go/pkg/rpc/wrappers"
|
||||
"github.com/CityOfZion/neo-go/pkg/rpc/result"
|
||||
"github.com/CityOfZion/neo-go/pkg/util"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
@ -527,7 +527,7 @@ var rpcTestCases = map[string][]rpcTestCase{
|
|||
result: func(*executor) interface{} {
|
||||
return &ValidateAddrResponse{
|
||||
Jsonrpc: defaultJSONRPC,
|
||||
Result: wrappers.ValidateAddressResponse{
|
||||
Result: result.ValidateAddress{
|
||||
Address: float64(1),
|
||||
IsValid: false,
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue