Search in sources :

Example 1 with TransactionInfoDTO

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

the class TransactionMapperVertxTest method shouldCreateStandaloneSecretLockTransaction.

@Test
void shouldCreateStandaloneSecretLockTransaction() {
    TransactionInfoDTO secretLockTransactionDTO = TestHelperVertx.loadTransactionInfoDTO("standaloneSecretLockTransaction.json");
    Transaction secretLockTransaction = map(secretLockTransactionDTO);
    validateStandaloneTransaction(secretLockTransaction, secretLockTransactionDTO);
}
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) TransactionInfoDTO(io.nem.symbol.sdk.openapi.vertx.model.TransactionInfoDTO) Test(org.junit.jupiter.api.Test)

Example 2 with TransactionInfoDTO

use of io.nem.symbol.sdk.openapi.vertx.model.TransactionInfoDTO 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)

Example 3 with TransactionInfoDTO

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

the class TransactionMapperVertxTest method shouldCreateAggregateLockFundsTransaction.

@Test
void shouldCreateAggregateLockFundsTransaction() {
    TransactionInfoDTO aggregateLockFundsTransactionDTO = TestHelperVertx.loadTransactionInfoDTO("aggregateLockFundsTransaction.json");
    Transaction lockFundsTransaction = map(aggregateLockFundsTransactionDTO);
    validateAggregateTransaction((AggregateTransaction) lockFundsTransaction, aggregateLockFundsTransactionDTO);
}
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) TransactionInfoDTO(io.nem.symbol.sdk.openapi.vertx.model.TransactionInfoDTO) Test(org.junit.jupiter.api.Test)

Example 4 with TransactionInfoDTO

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

the class TransactionMapperVertxTest method shouldCreateStandaloneMosaicSupplyChangeTransaction.

@Test
void shouldCreateStandaloneMosaicSupplyChangeTransaction() {
    TransactionInfoDTO mosaicSupplyChangeTransactionDTO = TestHelperVertx.loadTransactionInfoDTO("standaloneMosaicSupplyChangeTransaction.json");
    Transaction mosaicSupplyChangeTransaction = map(mosaicSupplyChangeTransactionDTO);
    validateStandaloneTransaction(mosaicSupplyChangeTransaction, mosaicSupplyChangeTransactionDTO);
}
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) TransactionInfoDTO(io.nem.symbol.sdk.openapi.vertx.model.TransactionInfoDTO) Test(org.junit.jupiter.api.Test)

Example 5 with TransactionInfoDTO

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

the class TransactionMapperVertxTest method shouldCreateAggregateAccountMetadataTransaction.

@Test
void shouldCreateAggregateAccountMetadataTransaction() {
    TransactionInfoDTO aggregateTransferTransactionDTO = TestHelperVertx.loadTransactionInfoDTO("aggregateAccountMetadataTransaction.json");
    AggregateTransaction aggregateTransferTransaction = (AggregateTransaction) map(aggregateTransferTransactionDTO);
    validateAggregateTransaction(aggregateTransferTransaction, aggregateTransferTransactionDTO);
    AccountMetadataTransaction transaction = (AccountMetadataTransaction) aggregateTransferTransaction.getInnerTransactions().get(0);
    Assertions.assertEquals("90E6FF7755A80B6AA935A5C31B6D3D0CFAF82E06BF2B9CC9", transaction.getTargetAddress().encoded(transaction.getNetworkType()));
    Assertions.assertEquals(-1, transaction.getValueSizeDelta());
    Assertions.assertEquals(new BigInteger("11529215046069664444"), transaction.getScopedMetadataKey());
    Assertions.assertArrayEquals(StringEncoder.getBytes("This is the message for this account! 汉字89664"), transaction.getValue());
}
Also used : AccountMetadataTransaction(io.nem.symbol.sdk.model.transaction.AccountMetadataTransaction) TransactionInfoDTO(io.nem.symbol.sdk.openapi.vertx.model.TransactionInfoDTO) AggregateTransaction(io.nem.symbol.sdk.model.transaction.AggregateTransaction) BigInteger(java.math.BigInteger) Test(org.junit.jupiter.api.Test)

Aggregations

TransactionInfoDTO (io.nem.symbol.sdk.openapi.vertx.model.TransactionInfoDTO)55 Test (org.junit.jupiter.api.Test)46 Transaction (io.nem.symbol.sdk.model.transaction.Transaction)40 TransferTransaction (io.nem.symbol.sdk.model.transaction.TransferTransaction)36 AggregateTransaction (io.nem.symbol.sdk.model.transaction.AggregateTransaction)32 AccountAddressRestrictionTransaction (io.nem.symbol.sdk.model.transaction.AccountAddressRestrictionTransaction)28 AccountMetadataTransaction (io.nem.symbol.sdk.model.transaction.AccountMetadataTransaction)28 AccountMosaicRestrictionTransaction (io.nem.symbol.sdk.model.transaction.AccountMosaicRestrictionTransaction)28 AccountOperationRestrictionTransaction (io.nem.symbol.sdk.model.transaction.AccountOperationRestrictionTransaction)28 MosaicMetadataTransaction (io.nem.symbol.sdk.model.transaction.MosaicMetadataTransaction)28 NamespaceMetadataTransaction (io.nem.symbol.sdk.model.transaction.NamespaceMetadataTransaction)28 AccountKeyLinkTransaction (io.nem.symbol.sdk.model.transaction.AccountKeyLinkTransaction)27 AddressAliasTransaction (io.nem.symbol.sdk.model.transaction.AddressAliasTransaction)27 HashLockTransaction (io.nem.symbol.sdk.model.transaction.HashLockTransaction)27 MosaicAliasTransaction (io.nem.symbol.sdk.model.transaction.MosaicAliasTransaction)27 MosaicDefinitionTransaction (io.nem.symbol.sdk.model.transaction.MosaicDefinitionTransaction)27 MosaicSupplyChangeTransaction (io.nem.symbol.sdk.model.transaction.MosaicSupplyChangeTransaction)27 MultisigAccountModificationTransaction (io.nem.symbol.sdk.model.transaction.MultisigAccountModificationTransaction)27 NamespaceRegistrationTransaction (io.nem.symbol.sdk.model.transaction.NamespaceRegistrationTransaction)27 SecretLockTransaction (io.nem.symbol.sdk.model.transaction.SecretLockTransaction)27