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