Search in sources :

Example 6 with CryptoTransferTransactionBody

use of com.hederahashgraph.api.proto.java.CryptoTransferTransactionBody in project hedera-services by hashgraph.

the class FeesAndRatesProvider method defaultPayerSponsored.

private Transaction defaultPayerSponsored(long queryFee) throws Throwable {
    TransferList transfers = asTransferList(tinyBarsFromTo(queryFee, setup.defaultPayer(), setup.defaultNode()));
    CryptoTransferTransactionBody opBody = txns.<CryptoTransferTransactionBody, CryptoTransferTransactionBody.Builder>body(CryptoTransferTransactionBody.class, b -> b.setTransfers(transfers));
    Transaction.Builder txnBuilder = txns.getReadyToSign(b -> b.setCryptoTransfer(opBody));
    return keys.signWithFullPrefixEd25519Keys(txnBuilder, List.of(flattenedMaybeList(registry.getKey(setup.defaultPayerName()))));
}
Also used : Transaction(com.hederahashgraph.api.proto.java.Transaction) TxnUtils.asTransferList(com.hedera.services.bdd.spec.transactions.TxnUtils.asTransferList) TransferList(com.hederahashgraph.api.proto.java.TransferList) CryptoTransferTransactionBody(com.hederahashgraph.api.proto.java.CryptoTransferTransactionBody)

Example 7 with CryptoTransferTransactionBody

use of com.hederahashgraph.api.proto.java.CryptoTransferTransactionBody in project hedera-mirror-node by hashgraph.

the class RecordFileParserTest method recordItem.

private RecordItem recordItem(long timestamp) {
    CryptoTransferTransactionBody cryptoTransfer = CryptoTransferTransactionBody.newBuilder().build();
    TransactionBody transactionBody = TransactionBody.newBuilder().setCryptoTransfer(cryptoTransfer).build();
    SignedTransaction signedTransaction = SignedTransaction.newBuilder().setBodyBytes(transactionBody.toByteString()).setSigMap(SignatureMap.newBuilder().build()).build();
    Transaction transaction = Transaction.newBuilder().setSignedTransactionBytes(signedTransaction.toByteString()).build();
    TransactionRecord transactionRecord = TransactionRecord.newBuilder().setConsensusTimestamp(Timestamp.newBuilder().setNanos((int) timestamp)).build();
    return new RecordItem(transaction, transactionRecord);
}
Also used : TransactionBody(com.hederahashgraph.api.proto.java.TransactionBody) CryptoTransferTransactionBody(com.hederahashgraph.api.proto.java.CryptoTransferTransactionBody) Transaction(com.hederahashgraph.api.proto.java.Transaction) SignedTransaction(com.hederahashgraph.api.proto.java.SignedTransaction) TransactionRecord(com.hederahashgraph.api.proto.java.TransactionRecord) SignedTransaction(com.hederahashgraph.api.proto.java.SignedTransaction) RecordItem(com.hedera.mirror.common.domain.transaction.RecordItem) CryptoTransferTransactionBody(com.hederahashgraph.api.proto.java.CryptoTransferTransactionBody)

Example 8 with CryptoTransferTransactionBody

use of com.hederahashgraph.api.proto.java.CryptoTransferTransactionBody in project hedera-mirror-node by hashgraph.

the class PubSubRecordItemListenerTest method testNonRetryableError.

@Test
void testNonRetryableError() {
    // when
    CryptoTransferTransactionBody cryptoTransfer = CryptoTransferTransactionBody.newBuilder().setTransfers(TransferList.newBuilder().build()).build();
    Transaction transaction = buildTransaction(builder -> builder.setCryptoTransfer(cryptoTransfer));
    // when
    when(messageChannel.send(any())).thenThrow(RuntimeException.class);
    // then
    assertThatThrownBy(() -> pubSubRecordItemListener.onItem(new RecordItem(transaction, DEFAULT_RECORD))).isInstanceOf(ParserException.class).hasMessageContaining("Error sending transaction to pubsub");
    verify(messageChannel, times(1)).send(any());
}
Also used : ParserException(com.hedera.mirror.importer.exception.ParserException) Transaction(com.hederahashgraph.api.proto.java.Transaction) SignedTransaction(com.hederahashgraph.api.proto.java.SignedTransaction) RecordItem(com.hedera.mirror.common.domain.transaction.RecordItem) CryptoTransferTransactionBody(com.hederahashgraph.api.proto.java.CryptoTransferTransactionBody) Test(org.junit.jupiter.api.Test)

Example 9 with CryptoTransferTransactionBody

use of com.hederahashgraph.api.proto.java.CryptoTransferTransactionBody in project hedera-mirror-node by hashgraph.

the class RecordFileParserTest method cryptoTransferRecordItem.

private RecordItem cryptoTransferRecordItem(long timestamp) {
    CryptoTransferTransactionBody cryptoTransfer = CryptoTransferTransactionBody.newBuilder().build();
    TransactionBody transactionBody = TransactionBody.newBuilder().setCryptoTransfer(cryptoTransfer).build();
    TransactionRecord transactionRecord = TransactionRecord.newBuilder().setConsensusTimestamp(Timestamp.newBuilder().setNanos((int) timestamp)).build();
    SignedTransaction signedTransaction = SignedTransaction.newBuilder().setBodyBytes(transactionBody.toByteString()).setSigMap(SignatureMap.newBuilder().build()).build();
    Transaction transaction = Transaction.newBuilder().setSignedTransactionBytes(signedTransaction.toByteString()).build();
    return RecordItem.builder().record(transactionRecord).transactionBytes(transaction.toByteArray()).build();
}
Also used : TransactionBody(com.hederahashgraph.api.proto.java.TransactionBody) CryptoTransferTransactionBody(com.hederahashgraph.api.proto.java.CryptoTransferTransactionBody) Transaction(com.hederahashgraph.api.proto.java.Transaction) SignedTransaction(com.hederahashgraph.api.proto.java.SignedTransaction) TransactionRecord(com.hederahashgraph.api.proto.java.TransactionRecord) SignedTransaction(com.hederahashgraph.api.proto.java.SignedTransaction) CryptoTransferTransactionBody(com.hederahashgraph.api.proto.java.CryptoTransferTransactionBody)

Aggregations

CryptoTransferTransactionBody (com.hederahashgraph.api.proto.java.CryptoTransferTransactionBody)9 Transaction (com.hederahashgraph.api.proto.java.Transaction)7 SignedTransaction (com.hederahashgraph.api.proto.java.SignedTransaction)5 TransactionBody (com.hederahashgraph.api.proto.java.TransactionBody)5 RecordItem (com.hedera.mirror.common.domain.transaction.RecordItem)4 Test (org.junit.jupiter.api.Test)3 ByteString (com.google.protobuf.ByteString)2 TxnUtils.asTransferList (com.hedera.services.bdd.spec.transactions.TxnUtils.asTransferList)2 ContractCallTransactionBody (com.hederahashgraph.api.proto.java.ContractCallTransactionBody)2 ContractCreateTransactionBody (com.hederahashgraph.api.proto.java.ContractCreateTransactionBody)2 ContractUpdateTransactionBody (com.hederahashgraph.api.proto.java.ContractUpdateTransactionBody)2 CryptoCreateTransactionBody (com.hederahashgraph.api.proto.java.CryptoCreateTransactionBody)2 CryptoUpdateTransactionBody (com.hederahashgraph.api.proto.java.CryptoUpdateTransactionBody)2 FileAppendTransactionBody (com.hederahashgraph.api.proto.java.FileAppendTransactionBody)2 FileCreateTransactionBody (com.hederahashgraph.api.proto.java.FileCreateTransactionBody)2 FileDeleteTransactionBody (com.hederahashgraph.api.proto.java.FileDeleteTransactionBody)2 FileUpdateTransactionBody (com.hederahashgraph.api.proto.java.FileUpdateTransactionBody)2 TransactionRecord (com.hederahashgraph.api.proto.java.TransactionRecord)2 ParserException (com.hedera.mirror.importer.exception.ParserException)1 HapiApiSpec (com.hedera.services.bdd.spec.HapiApiSpec)1