Search in sources :

Example 1 with TimestampDto

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()));
}
Also used : VotingKeyDto(io.nem.symbol.catapult.builders.VotingKeyDto) KeyDto(io.nem.symbol.catapult.builders.KeyDto) TimestampDto(io.nem.symbol.catapult.builders.TimestampDto) SignatureDto(io.nem.symbol.catapult.builders.SignatureDto) ByteBuffer(java.nio.ByteBuffer)

Aggregations

KeyDto (io.nem.symbol.catapult.builders.KeyDto)1 SignatureDto (io.nem.symbol.catapult.builders.SignatureDto)1 TimestampDto (io.nem.symbol.catapult.builders.TimestampDto)1 VotingKeyDto (io.nem.symbol.catapult.builders.VotingKeyDto)1 ByteBuffer (java.nio.ByteBuffer)1