toWif method
returns as WIFC (compressed) or WIF format (string)
Implementation
String toWif({bool compressed = true, NetworkInfo? networkType}) {
final network = networkType ?? NetworkInfo.BITCOIN;
Uint8List bytes = Uint8List.fromList([network.wif, ...toBytes()]);
if (compressed) {
bytes = Uint8List.fromList([...bytes, 0x01]);
}
Uint8List hash = doubleHash(bytes);
hash = Uint8List.fromList(
[bytes, hash.sublist(0, 4)].expand((i) => i).toList(growable: false));
return bs58.base58.encode(hash);
}