convertToJSON method
Convert the transaction in JSON
Implementation
String convertToJSON() {
final String _json = jsonEncode({
'version': this.version,
'address': this.address!,
'type': this.type,
'data': {
'content': uint8ListToHex(
Uint8List.fromList(utf8.encode(this.data!.content!))),
'code': this.data!.code!,
'keys': {
'secret': this.data!.keys!.secret!,
'authorizedKeys': hexAuthorizedKeys(this.data!.keys!.authorizedKeys!)
},
'ledger': {
'uco': {
'transfers':
List<dynamic>.from(this.data!.ledger!.uco!.transfers!.map((x) {
return {
'to': x.to!,
'amount': x.amount,
};
}))
},
'nft': {
'transfers':
List<dynamic>.from(this.data!.ledger!.nft!.transfers!.map((x) {
return {'to': x.to!, 'amount': x.amount, 'nft': x.nft!};
}))
},
},
'recipients': List<dynamic>.from(this.data!.recipients!.map((x) => x)),
},
'previousPublicKey': this.previousPublicKey!,
'previousSignature': this.previousSignature!,
'originSignature': this.originSignature!
});
return _json;
}