convertIfXpub function

String convertIfXpub(
  1. String hdPubKey
)

Implementation

String convertIfXpub(String hdPubKey) {
  if (hdPubKey.startsWith('xpub')) {
    try {
      final bip32 = BIP32.fromBase58(hdPubKey);
      bip32.network = networkTypeForNetwork(KaspaNetwork.mainnet);
      return bip32.toBase58();
    } catch (_) {}
  }
  return hdPubKey;
}