Search in sources :

Example 1 with GeneralTransactionMapper

use of io.nem.symbol.sdk.infrastructure.okhttp.mappers.GeneralTransactionMapper in project nem2-sdk-java by nemtech.

the class OkHttpCosignatureTransactionTest method createACosignatureTransactionViaConstructor.

@Test
void createACosignatureTransactionViaConstructor() {
    TransactionInfoDTO transactionInfoDTO = TestHelperOkHttp.loadTransactionInfoDTO("cosignatureTransactionViaConstructor.json");
    AggregateTransaction aggregateTransaction = (AggregateTransaction) new GeneralTransactionMapper(jsonHelper).mapFromDto(transactionInfoDTO);
    CosignatureTransaction cosignatureTransaction = CosignatureTransaction.create(aggregateTransaction);
    CosignatureSignedTransaction cosignatureSignedTransaction = account.signCosignatureTransaction(cosignatureTransaction);
    assertTrue(aggregateTransaction.getTransactionInfo().get().getHash().isPresent());
    assertEquals(aggregateTransaction.getTransactionInfo().get().getHash().get(), cosignatureSignedTransaction.getParentHash());
    assertEquals("5EA75D1A2C8AD25DA4F400C1BD2DA84449FAF583AFD813E1179E72AF0CDF5AC1C0F7404AF6FC7268EE416204240DD3D5B11420D80215F19AA314FC86D6E03E0D", cosignatureSignedTransaction.getSignature());
    assertEquals("671653C94E2254F2A23EFEDB15D67C38332AED1FBD24B063C0A8E675582B6A96", cosignatureTransaction.getTransactionToCosign().getTransactionInfo().get().getHash().get());
}
Also used : CosignatureSignedTransaction(io.nem.symbol.sdk.model.transaction.CosignatureSignedTransaction) GeneralTransactionMapper(io.nem.symbol.sdk.infrastructure.okhttp.mappers.GeneralTransactionMapper) TransactionInfoDTO(io.nem.symbol.sdk.openapi.okhttp_gson.model.TransactionInfoDTO) AggregateTransaction(io.nem.symbol.sdk.model.transaction.AggregateTransaction) CosignatureTransaction(io.nem.symbol.sdk.model.transaction.CosignatureTransaction) Test(org.junit.jupiter.api.Test)

Example 2 with GeneralTransactionMapper

use of io.nem.symbol.sdk.infrastructure.okhttp.mappers.GeneralTransactionMapper in project nem2-sdk-java by nemtech.

the class OkHttpAggregateTransactionTest method shouldFindAccountInAsASignerOfTheTransaction.

@Test
void shouldFindAccountInAsASignerOfTheTransaction() {
    TransactionInfoDTO aggregateTransferTransactionDTO = TestHelperOkHttp.loadTransactionInfoDTO("accountInAsASignerOfTheTransaction.json");
    AggregateTransaction aggregateTransferTransaction = (AggregateTransaction) new GeneralTransactionMapper(jsonHelper).mapFromDto(aggregateTransferTransactionDTO);
    assertTrue(aggregateTransferTransaction.signedByAccount(PublicAccount.createFromPublicKey("A5F82EC8EBB341427B6785C8111906CD0DF18838FB11B51CE0E18B5E79DFF630", networkType)));
    assertTrue(aggregateTransferTransaction.signedByAccount(PublicAccount.createFromPublicKey("7681ED5023141D9CDCF184E5A7B60B7D466739918ED5DA30F7E71EA7B86EFF2D", networkType)));
    assertFalse(aggregateTransferTransaction.signedByAccount(PublicAccount.createFromPublicKey("B4F12E7C9F6946091E2CB8B6D3A12B50D17CCBBF646386EA27CE2946A7423DCF", networkType)));
}
Also used : GeneralTransactionMapper(io.nem.symbol.sdk.infrastructure.okhttp.mappers.GeneralTransactionMapper) TransactionInfoDTO(io.nem.symbol.sdk.openapi.okhttp_gson.model.TransactionInfoDTO) AggregateTransaction(io.nem.symbol.sdk.model.transaction.AggregateTransaction) Test(org.junit.jupiter.api.Test)

Aggregations

GeneralTransactionMapper (io.nem.symbol.sdk.infrastructure.okhttp.mappers.GeneralTransactionMapper)2 AggregateTransaction (io.nem.symbol.sdk.model.transaction.AggregateTransaction)2 TransactionInfoDTO (io.nem.symbol.sdk.openapi.okhttp_gson.model.TransactionInfoDTO)2 Test (org.junit.jupiter.api.Test)2 CosignatureSignedTransaction (io.nem.symbol.sdk.model.transaction.CosignatureSignedTransaction)1 CosignatureTransaction (io.nem.symbol.sdk.model.transaction.CosignatureTransaction)1