psbtToBytes static method
Implementation
static Uint8List psbtToBytes(String psbtBase64) {
Uint8List psbtBytes;
if (psbtBase64.contains("=") || psbtBase64.contains("/")) {
psbtBytes = base64Decode(psbtBase64);
} else {
psbtBytes = Uint8List.fromList(HEX.decode(psbtBase64));
}
final version = psbtBytes.sublist(0, 5);
if (version[0] != 0x70 ||
version[1] != 0x73 ||
version[2] != 0x62 ||
version[3] != 0x74 ||
version[4] != 0xff) {
throw Exception('Invalid PSBT');
}
return psbtBytes;
}