neoneo-go/pkg/rpc/wrappers/validate_address.go
Roman Khimov a9b9c9226d *: add/fix godoc comments to satisfy golint
Fixes things like:
 * exported type/method/function X should have comment or be unexported
 * comment on exported type/method/function X should be of the form "X ..."
   (with optional leading article)

Refs. #213.
2019-09-03 17:57:51 +03:00

22 lines
663 B
Go

package wrappers
import (
"github.com/CityOfZion/neo-go/pkg/crypto"
)
// ValidateAddressResponse represents response to validate address call.
type ValidateAddressResponse struct {
Address interface{} `json:"address"`
IsValid bool `json:"isvalid"`
}
// 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(address interface{}) ValidateAddressResponse {
resp := ValidateAddressResponse{Address: address}
if address, ok := address.(string); ok {
_, err := crypto.Uint160DecodeAddress(address)
resp.IsValid = err == nil
}
return resp
}