Implementation
Uint8List previousSignaturePayload() {
final Uint8List bufCodeSize = encodeInt32(data!.code!.length);
final Uint8List bufContentSize = encodeInt32(data!.content!.length);
final Uint8List bufSecretSize = encodeInt32(data!.keys!.secret!.length);
Uint8List? authorizedKeysBuffers = Uint8List(0);
data!.keys!.authorizedKeys!.forEach((publicKey, authorizedKey) {
authorizedKeysBuffers = concatUint8List(
[hexToUint8List(publicKey), data!.keys!.authorizedKeys![publicKey]]);
});
Uint8List? ucoTransfersBuffers = Uint8List(0);
if (data!.ledger!.uco!.transfers!.isNotEmpty) {
ucoTransfersBuffers = concatUint8List([
data!.ledger!.uco!.transfers![0].to!,
encodeFloat64(data!.ledger!.uco!.transfers![0].amount!)
]);
}
Uint8List? nftTransfersBuffers = Uint8List(0);
if (data!.ledger!.nft!.transfers!.isNotEmpty) {
nftTransfersBuffers = concatUint8List([
data!.ledger!.nft!.transfers![0].nft!,
data!.ledger!.nft!.transfers![0].to!,
encodeFloat64(data!.ledger!.nft!.transfers![0].amount!)
]);
}
return concatUint8List([
encodeInt32(version!),
address!,
Uint8List.fromList([txTypes[type]!]),
bufCodeSize,
data!.code!,
bufContentSize,
data!.content!,
bufSecretSize,
data!.keys!.secret!,
Uint8List.fromList([data!.keys!.authorizedKeys!.length]),
authorizedKeysBuffers!,
Uint8List.fromList([data!.ledger!.uco!.transfers!.length]),
ucoTransfersBuffers,
Uint8List.fromList([data!.ledger!.nft!.transfers!.length]),
nftTransfersBuffers,
Uint8List.fromList([data!.recipients!.length]),
concatUint8List(data!.recipients!)
]);
}