use of io.nem.symbol.catapult.builders.TimestampDto in project nem2-sdk-java by nemtech.
the class BinarySerializationImpl method getTransactionBuilder.
/**
* Gets the top level {@link TransactionBuilder} for the given transaction
*
* @param transaction the transaction
* @return the top level {@link TransactionBuilder}
*/
private TransactionBuilder getTransactionBuilder(Transaction transaction) {
final SignatureDto signatureDto = transaction.getSignature().map(SerializationUtils::toSignatureDto).orElseGet(() -> new SignatureDto(ByteBuffer.allocate(64)));
final ByteBuffer signerBuffer = transaction.getSigner().map(SerializationUtils::toByteBuffer).orElseGet(() -> ByteBuffer.allocate(32));
int networkTypeValue = transaction.getNetworkType().getValue();
int typeValue = transaction.getType().getValue();
byte version = transaction.getVersion().byteValue();
return TransactionBuilder.create(signatureDto, new KeyDto(signerBuffer), version, NetworkTypeDto.rawValueOf((byte) networkTypeValue), EntityTypeDto.rawValueOf((short) typeValue), SerializationUtils.toAmount(transaction.getMaxFee()), new TimestampDto(transaction.getDeadline().getValue()));
}
Aggregations