Check to see if an extended public key is of the correct prefix for the network
this can be used in conjunction with convertExtendedPublicKey to attempt to automatically convert
Parameters
extendedPublicKey: string
the extended public key to check
network: string
the bitcoin network
Returns string
a validation message or empty if valid
Example
import {validateExtendedPublicKeyForNetwork} from"@caravan/bitcoin"; console.log(validateExtendedPublicKeyForNetwork('xpub...', MAINNET)) // empty console.log(validateExtendedPublicKeyForNetwork('tpub...', MAINNET)) // "Extended public key must begin with ...."
Check to see if an extended public key is of the correct prefix for the network this can be used in conjunction with convertExtendedPublicKey to attempt to automatically convert