lbryschema.go/address/decode.go
Mark Beamer Jr 9159c7602d
added support for proto3 metadata definitions
added signing capabilities
all with unit tests
2019-04-07 00:29:12 -04:00

19 lines
478 B
Go

package address
import (
"github.com/lbryio/lbry.go/extras/errors"
"github.com/lbryio/lbryschema.go/address/base58"
)
func DecodeAddress(address string, blockchainName string) ([addressLength]byte, error) {
decoded, err := base58.DecodeBase58(address, addressLength)
if err != nil {
return [addressLength]byte{}, errors.Err("failed to decode")
}
buf := [addressLength]byte{}
for i, b := range decoded {
buf[i] = b
}
return ValidateAddress(buf, blockchainName)
}