use of com.hederahashgraph.api.proto.java.TransferList in project hedera-services by hashgraph.
the class RequestBuilder method getHbarCryptoTransferRequestToAlias.
public static Transaction getHbarCryptoTransferRequestToAlias(Long payerAccountNum, Long payerRealmNum, Long payerShardNum, Long nodeAccountNum, Long nodeRealmNum, Long nodeShardNum, long transactionFee, Timestamp timestamp, Duration transactionDuration, boolean generateRecord, String memo, Long senderActNum, Long amountSend, ByteString receivingAlias, Long amountReceived) {
AccountAmount a1 = AccountAmount.newBuilder().setAccountID(getAccountIdBuild(senderActNum, 0l, 0l)).setAmount(amountSend).build();
AccountAmount a2 = AccountAmount.newBuilder().setAccountID(getAccountIdBuild(receivingAlias, 0l, 0l)).setAmount(amountReceived).build();
TransferList transferList = TransferList.newBuilder().addAccountAmounts(a1).addAccountAmounts(a2).build();
return getCryptoTransferRequest(payerAccountNum, payerRealmNum, payerShardNum, nodeAccountNum, nodeRealmNum, nodeShardNum, transactionFee, timestamp, transactionDuration, generateRecord, memo, transferList);
}
use of com.hederahashgraph.api.proto.java.TransferList in project hedera-services by hashgraph.
the class RequestBuilder method getCryptoTransferRequest.
public static Transaction getCryptoTransferRequest(Long payerAccountNum, Long payerRealmNum, Long payerShardNum, Long nodeAccountNum, Long nodeRealmNum, Long nodeShardNum, long transactionFee, Timestamp timestamp, Duration transactionDuration, boolean generateRecord, String memo, Long senderActNum, Long amountSend, Long receiverAcctNum, Long amountReceived) {
AccountAmount a1 = AccountAmount.newBuilder().setAccountID(getAccountIdBuild(senderActNum, 0l, 0l)).setAmount(amountSend).build();
AccountAmount a2 = AccountAmount.newBuilder().setAccountID(getAccountIdBuild(receiverAcctNum, 0l, 0l)).setAmount(amountReceived).build();
TransferList transferList = TransferList.newBuilder().addAccountAmounts(a1).addAccountAmounts(a2).build();
return getCryptoTransferRequest(payerAccountNum, payerRealmNum, payerShardNum, nodeAccountNum, nodeRealmNum, nodeShardNum, transactionFee, timestamp, transactionDuration, generateRecord, memo, transferList);
}
use of com.hederahashgraph.api.proto.java.TransferList in project hedera-services by hashgraph.
the class ContextOptionValidatorTest method allowsReasonableLength.
@Test
void allowsReasonableLength() {
// setup:
TransferList wrapper = withAdjustments(a, 2L, b, -3L, d, 1L);
given(dynamicProperties.maxTransferListSize()).willReturn(3);
// expect:
assertTrue(subject.isAcceptableTransfersLength(wrapper));
}
use of com.hederahashgraph.api.proto.java.TransferList 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()))));
}
Aggregations