mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-12-25 13:56:35 +00:00
b246653f62
Make them more clear to understand.
22 lines
654 B
Go
22 lines
654 B
Go
package wrappers
|
|
|
|
import (
|
|
"github.com/CityOfZion/neo-go/pkg/encoding/address"
|
|
)
|
|
|
|
// 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(addr interface{}) ValidateAddressResponse {
|
|
resp := ValidateAddressResponse{Address: addr}
|
|
if addr, ok := addr.(string); ok {
|
|
_, err := address.StringToUint160(addr)
|
|
resp.IsValid = err == nil
|
|
}
|
|
return resp
|
|
}
|