Search in sources :

Example 1 with AggregateTransactionBodyExtendedDTO

use of io.nem.symbol.sdk.openapi.vertx.model.AggregateTransactionBodyExtendedDTO in project nem2-sdk-java by nemtech.

the class TransactionMapperVertxTest method validateAggregateTransaction.

void validateAggregateTransaction(AggregateTransaction aggregateTransaction, TransactionInfoDTO transactionDTO) {
    AggregateTransactionBodyExtendedDTO aggregateTransactionBodyDTO = jsonHelper.convert(transactionDTO.getTransaction(), AggregateTransactionBodyExtendedDTO.class);
    TransactionMetaDTO meta = jsonHelper.convert(transactionDTO.getMeta(), TransactionMetaDTO.class);
    if (aggregateTransaction.getTransactionInfo().isPresent()) {
        TransactionInfo transactionInfo = aggregateTransaction.getTransactionInfo().get();
        assertEquals(meta.getHeight(), transactionInfo.getHeight());
        if (transactionInfo.getHash().isPresent()) {
            assertEquals(meta.getHash(), transactionInfo.getHash().get());
        }
        if (transactionInfo.getMerkleComponentHash().isPresent()) {
            assertEquals(meta.getMerkleComponentHash(), transactionInfo.getMerkleComponentHash().get());
        }
        if (transactionInfo.getIndex().isPresent()) {
            assertEquals(transactionInfo.getIndex().get(), meta.getIndex());
        }
    }
    // if (aggregateTransaction.getTransactionInfo().get().getId().isPresent()) {
    // assertEquals(
    // transactionDTO.getMeta().getId(),
    // aggregateTransaction.getTransactionInfo().get().getId().get());
    // }
    assertEquals(jsonHelper.getString(transactionDTO.getTransaction(), "signature"), aggregateTransaction.getSignature().get());
    assertEquals(jsonHelper.getString(transactionDTO.getTransaction(), "signerPublicKey"), aggregateTransaction.getSigner().get().getPublicKey().toHex());
    int version = jsonHelper.getInteger(transactionDTO.getTransaction(), "version");
    assertEquals((int) aggregateTransaction.getVersion(), version);
    int networkType = jsonHelper.getInteger(transactionDTO.getTransaction(), "network");
    assertEquals(aggregateTransaction.getNetworkType().getValue(), networkType);
    assertEquals(aggregateTransaction.getType().getValue(), (int) jsonHelper.getInteger(transactionDTO.getTransaction(), "type"));
    assertEquals(jsonHelper.getBigInteger(transactionDTO.getTransaction(), "maxFee"), aggregateTransaction.getMaxFee());
    assertNotNull(aggregateTransaction.getDeadline());
    assertEquals(aggregateTransactionBodyDTO.getCosignatures().get(0).getSignature(), aggregateTransaction.getCosignatures().get(0).getSignature());
    assertEquals(aggregateTransactionBodyDTO.getCosignatures().get(0).getSignerPublicKey(), aggregateTransaction.getCosignatures().get(0).getSigner().getPublicKey().toHex());
    Transaction innerTransaction = aggregateTransaction.getInnerTransactions().get(0);
    validateStandaloneTransaction(innerTransaction, jsonHelper.convert(aggregateTransactionBodyDTO.getTransactions().get(0), TransactionInfoDTO.class), transactionDTO);
}
Also used : SecretProofTransaction(io.nem.symbol.sdk.model.transaction.SecretProofTransaction) HashLockTransaction(io.nem.symbol.sdk.model.transaction.HashLockTransaction) AccountOperationRestrictionTransaction(io.nem.symbol.sdk.model.transaction.AccountOperationRestrictionTransaction) AccountAddressRestrictionTransaction(io.nem.symbol.sdk.model.transaction.AccountAddressRestrictionTransaction) AggregateTransaction(io.nem.symbol.sdk.model.transaction.AggregateTransaction) NamespaceRegistrationTransaction(io.nem.symbol.sdk.model.transaction.NamespaceRegistrationTransaction) TransferTransaction(io.nem.symbol.sdk.model.transaction.TransferTransaction) MosaicDefinitionTransaction(io.nem.symbol.sdk.model.transaction.MosaicDefinitionTransaction) MultisigAccountModificationTransaction(io.nem.symbol.sdk.model.transaction.MultisigAccountModificationTransaction) AccountMosaicRestrictionTransaction(io.nem.symbol.sdk.model.transaction.AccountMosaicRestrictionTransaction) MosaicMetadataTransaction(io.nem.symbol.sdk.model.transaction.MosaicMetadataTransaction) Transaction(io.nem.symbol.sdk.model.transaction.Transaction) AccountKeyLinkTransaction(io.nem.symbol.sdk.model.transaction.AccountKeyLinkTransaction) NamespaceMetadataTransaction(io.nem.symbol.sdk.model.transaction.NamespaceMetadataTransaction) AccountMetadataTransaction(io.nem.symbol.sdk.model.transaction.AccountMetadataTransaction) AddressAliasTransaction(io.nem.symbol.sdk.model.transaction.AddressAliasTransaction) MosaicAliasTransaction(io.nem.symbol.sdk.model.transaction.MosaicAliasTransaction) MosaicSupplyChangeTransaction(io.nem.symbol.sdk.model.transaction.MosaicSupplyChangeTransaction) SecretLockTransaction(io.nem.symbol.sdk.model.transaction.SecretLockTransaction) AggregateTransactionBodyExtendedDTO(io.nem.symbol.sdk.openapi.vertx.model.AggregateTransactionBodyExtendedDTO) TransactionInfoDTO(io.nem.symbol.sdk.openapi.vertx.model.TransactionInfoDTO) TransactionInfo(io.nem.symbol.sdk.model.transaction.TransactionInfo) TransactionMetaDTO(io.nem.symbol.sdk.openapi.vertx.model.TransactionMetaDTO)

Aggregations

AccountAddressRestrictionTransaction (io.nem.symbol.sdk.model.transaction.AccountAddressRestrictionTransaction)1 AccountKeyLinkTransaction (io.nem.symbol.sdk.model.transaction.AccountKeyLinkTransaction)1 AccountMetadataTransaction (io.nem.symbol.sdk.model.transaction.AccountMetadataTransaction)1 AccountMosaicRestrictionTransaction (io.nem.symbol.sdk.model.transaction.AccountMosaicRestrictionTransaction)1 AccountOperationRestrictionTransaction (io.nem.symbol.sdk.model.transaction.AccountOperationRestrictionTransaction)1 AddressAliasTransaction (io.nem.symbol.sdk.model.transaction.AddressAliasTransaction)1 AggregateTransaction (io.nem.symbol.sdk.model.transaction.AggregateTransaction)1 HashLockTransaction (io.nem.symbol.sdk.model.transaction.HashLockTransaction)1 MosaicAliasTransaction (io.nem.symbol.sdk.model.transaction.MosaicAliasTransaction)1 MosaicDefinitionTransaction (io.nem.symbol.sdk.model.transaction.MosaicDefinitionTransaction)1 MosaicMetadataTransaction (io.nem.symbol.sdk.model.transaction.MosaicMetadataTransaction)1 MosaicSupplyChangeTransaction (io.nem.symbol.sdk.model.transaction.MosaicSupplyChangeTransaction)1 MultisigAccountModificationTransaction (io.nem.symbol.sdk.model.transaction.MultisigAccountModificationTransaction)1 NamespaceMetadataTransaction (io.nem.symbol.sdk.model.transaction.NamespaceMetadataTransaction)1 NamespaceRegistrationTransaction (io.nem.symbol.sdk.model.transaction.NamespaceRegistrationTransaction)1 SecretLockTransaction (io.nem.symbol.sdk.model.transaction.SecretLockTransaction)1 SecretProofTransaction (io.nem.symbol.sdk.model.transaction.SecretProofTransaction)1 Transaction (io.nem.symbol.sdk.model.transaction.Transaction)1 TransactionInfo (io.nem.symbol.sdk.model.transaction.TransactionInfo)1 TransferTransaction (io.nem.symbol.sdk.model.transaction.TransferTransaction)1