toTxRequest method
Implementation
TxRequest toTxRequest({bool? checkOnly}) {
if (_signature == null) {
throw Exception("Unsigned transaction cannot be converted to TxRequest");
}
final signerInfo = _signature!.signerInfo;
TxRequest txRequest = TxRequest();
txRequest.checkOnly = checkOnly ?? false;
txRequest.isEnvelope = false;
txRequest.origin = _header.principal.toString();
txRequest.signer = {
"url": signerInfo!.url.toString(),
"publicKey": HEX.encode(signerInfo.publicKey!.toList()),
"version": signerInfo.version,
"timestamp": _header.timestamp,
"signatureType": "${SignatureType().marshalJSON(signerInfo.type!)}",
"useSimpleHash": true
};
txRequest.signature = HEX.encode(_signature!.signature!.toList());
txRequest.txHash = HEX.encode(_hash!.toList());
txRequest.payload = HEX.encode(_payloadBinary.toList());
if (_header._memo != null) {
txRequest.memo = _header._memo!;
}
if (_header._metadata != null) {
txRequest.metadata = HEX.encode(_header.metadata!.toList());
}
return txRequest;
}