Search in sources :

Example 1 with HapiCryptoTransfer

use of com.hedera.services.bdd.spec.transactions.crypto.HapiCryptoTransfer in project hedera-services by hashgraph.

the class RandomTransfer method get.

@Override
public Optional<HapiSpecOperation> get() {
    final var involved = LookupUtils.twoDistinct(accounts);
    if (involved.isEmpty()) {
        return Optional.empty();
    }
    boolean shouldCreateRecord = r.nextDouble() < recordProb;
    long amount = shouldCreateRecord ? (SEND_THRESHOLD + 1) : 1;
    String from = involved.get().getKey(), to = involved.get().getValue();
    HapiCryptoTransfer op = cryptoTransfer(tinyBarsFromTo(from, to, amount)).hasPrecheckFrom(STANDARD_PERMISSIBLE_PRECHECKS).hasKnownStatusFrom(permissibleOutcomes).payingWith(UNIQUE_PAYER_ACCOUNT);
    return Optional.of(op);
}
Also used : HapiCryptoTransfer(com.hedera.services.bdd.spec.transactions.crypto.HapiCryptoTransfer)

Example 2 with HapiCryptoTransfer

use of com.hedera.services.bdd.spec.transactions.crypto.HapiCryptoTransfer in project hedera-services by hashgraph.

the class UtilVerbs method fundAnAccount.

public static HapiSpecOperation fundAnAccount(String account) {
    return withOpContext((spec, ctxLog) -> {
        if (!asId(account, spec).equals(asId(GENESIS, spec))) {
            HapiCryptoTransfer subOp = cryptoTransfer(tinyBarsFromTo(GENESIS, account, HapiApiSuite.ADEQUATE_FUNDS));
            CustomSpecAssert.allRunFor(spec, subOp);
        }
    });
}
Also used : HapiCryptoTransfer(com.hedera.services.bdd.spec.transactions.crypto.HapiCryptoTransfer)

Aggregations

HapiCryptoTransfer (com.hedera.services.bdd.spec.transactions.crypto.HapiCryptoTransfer)2