toBytes method
Implementation
@override
Uint8List toBytes() {
_ensureSections();
final globalKvs = <PsbtKeyValue>[];
if (_unsignedTx != null) {
globalKvs.add(PsbtKeyValue(
key: Uint8List.fromList([PsbtGlobal.unsignedTx.keyType]),
value: _unsignedTx!.toBytes(),
));
}
if (_sections.isNotEmpty) {
for (final kv in _sections[0]) {
if (kv.key.isNotEmpty &&
kv.key[0] != PsbtGlobal.unsignedTx.keyType) {
globalKvs.add(kv);
}
}
}
_sections[0] = globalKvs;
return PsbtCodec.encode(_sections);
}