2017-09-12 18:02:30 +02:00
|
|
|
package address
|
|
|
|
|
|
|
|
import (
|
|
|
|
"./base58"
|
2017-11-20 19:44:19 +01:00
|
|
|
"errors"
|
2017-09-12 18:02:30 +02:00
|
|
|
)
|
|
|
|
|
2017-11-20 19:44:19 +01:00
|
|
|
func DecodeAddress(address string, blockchainName string) ([address_length]byte, error) {
|
2017-09-12 18:02:30 +02:00
|
|
|
decoded, err := base58.DecodeBase58(address, address_length)
|
|
|
|
if err != nil {
|
|
|
|
return [address_length]byte{}, errors.New("failed to decode")
|
|
|
|
}
|
|
|
|
buf := [address_length]byte{}
|
|
|
|
for i, b := range decoded {
|
|
|
|
buf[i] = b
|
|
|
|
}
|
2017-11-27 16:24:10 +01:00
|
|
|
|
2017-11-20 19:44:19 +01:00
|
|
|
return ValidateAddress(buf, blockchainName)
|
2017-09-12 18:02:30 +02:00
|
|
|
}
|