lbryschema.go/address/decode.go
Niko Storni 505d9d6212 update lbry.go dependency
add go mod
2020-09-01 19:09:06 +02:00

19 lines
481 B
Go

package address
import (
"github.com/lbryio/lbry.go/v2/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)
}