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());
}
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)));
}
Aggregations