Documentation ¶
Index ¶
Constants ¶
View Source
const ( BtcAddrRegex = `^(bc1|[13]|tb1|[2mn])[a-zA-HJ-NP-Z0-9]{25,64}$` BtcTestnetAddrRegex = `^(tb1|[2mn])[a-zA-HJ-NP-Z0-9]{25,64}$` BtcMainnetRegex = `^(bc1|[13])[a-zA-HJ-NP-Z0-9]{25,64}$` )
View Source
const (
EthAddrRegex = `^0x[0-9|a-f|A-F]{40}$`
)
Variables ¶
View Source
var (
ErrInvalidEthAddr = errors.New("invalid ethereum address")
)
Functions ¶
func CheckValidSecp256k1PubKey ¶
CheckValidSecp256k1PubKey checks if a given public key hex is a valid secp256k1 public key
func GetValidBtcAddr ¶
GetValidBtcAddr returns a valid Bitcoin address or an error if the address is invalid.
func GetValidEthAddr ¶
GetValidEthAddr returns a valid Ethereum address or an error if the address is invalid. will add the 0x prefix if it's missing, and lowercase the input.
func IsBitcoinMainnet ¶
IsBitcoinMainnet checks if a BTC address is a mainnet address
func IsBitcoinTestnet ¶
IsBitcoinTestnet checks if a BTC address is a testnet address
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.