Search in sources :

Example 1 with ScheduleInfo

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

the class HapiScheduleSign method feeFor.

@Override
protected long feeFor(HapiApiSpec spec, Transaction txn, int numPayerKeys) throws Throwable {
    try {
        final ScheduleInfo info = ScheduleFeeUtils.lookupInfo(spec, schedule, loggingOff);
        FeeCalculator.ActivityMetrics metricsCalc = (_txn, svo) -> scheduleOpsUsage.scheduleSignUsage(_txn, suFrom(svo), info.getExpirationTime().getSeconds());
        return spec.fees().forActivityBasedOp(HederaFunctionality.ScheduleSign, metricsCalc, txn, numPayerKeys);
    } catch (Throwable ignore) {
        return HapiApiSuite.ONE_HBAR;
    }
}
Also used : Transaction(com.hederahashgraph.api.proto.java.Transaction) ScheduleID(com.hederahashgraph.api.proto.java.ScheduleID) TxnUtils.asScheduleId(com.hedera.services.bdd.spec.transactions.TxnUtils.asScheduleId) ScheduleSign(com.hederahashgraph.api.proto.java.HederaFunctionality.ScheduleSign) HapiTxnOp(com.hedera.services.bdd.spec.transactions.HapiTxnOp) MoreObjects(com.google.common.base.MoreObjects) HapiScheduleCreate.correspondingScheduledTxnId(com.hedera.services.bdd.spec.transactions.schedule.HapiScheduleCreate.correspondingScheduledTxnId) SUCCESS(com.hederahashgraph.api.proto.java.ResponseCodeEnum.SUCCESS) Function(java.util.function.Function) ScheduleSignTransactionBody(com.hederahashgraph.api.proto.java.ScheduleSignTransactionBody) ArrayList(java.util.ArrayList) Consumer(java.util.function.Consumer) Key(com.hederahashgraph.api.proto.java.Key) List(java.util.List) TransactionBody(com.hederahashgraph.api.proto.java.TransactionBody) HapiApiSuite(com.hedera.services.bdd.suites.HapiApiSuite) HederaFunctionality(com.hederahashgraph.api.proto.java.HederaFunctionality) TxnUtils.suFrom(com.hedera.services.bdd.spec.transactions.TxnUtils.suFrom) FeeCalculator(com.hedera.services.bdd.spec.fees.FeeCalculator) TransactionResponse(com.hederahashgraph.api.proto.java.TransactionResponse) RegistryNotFound(com.hedera.services.bdd.spec.infrastructure.RegistryNotFound) ScheduleInfo(com.hederahashgraph.api.proto.java.ScheduleInfo) HapiApiSpec(com.hedera.services.bdd.spec.HapiApiSpec) Collections(java.util.Collections) FeeCalculator(com.hedera.services.bdd.spec.fees.FeeCalculator) ScheduleInfo(com.hederahashgraph.api.proto.java.ScheduleInfo)

Example 2 with ScheduleInfo

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

the class HapiScheduleDelete method feeFor.

@Override
protected long feeFor(HapiApiSpec spec, Transaction txn, int numPayerKeys) throws Throwable {
    try {
        final ScheduleInfo info = ScheduleFeeUtils.lookupInfo(spec, schedule, loggingOff);
        FeeCalculator.ActivityMetrics metricsCalc = (_txn, svo) -> scheduleOpsUsage.scheduleDeleteUsage(_txn, suFrom(svo), info.getExpirationTime().getSeconds());
        return spec.fees().forActivityBasedOp(HederaFunctionality.ScheduleDelete, metricsCalc, txn, numPayerKeys);
    } catch (Throwable ignore) {
        return HapiApiSuite.ONE_HBAR;
    }
}
Also used : Transaction(com.hederahashgraph.api.proto.java.Transaction) HapiTxnOp(com.hedera.services.bdd.spec.transactions.HapiTxnOp) MoreObjects(com.google.common.base.MoreObjects) Function(java.util.function.Function) Consumer(java.util.function.Consumer) Key(com.hederahashgraph.api.proto.java.Key) List(java.util.List) Logger(org.apache.logging.log4j.Logger) TxnUtils(com.hedera.services.bdd.spec.transactions.TxnUtils) TransactionBody(com.hederahashgraph.api.proto.java.TransactionBody) HapiApiSuite(com.hedera.services.bdd.suites.HapiApiSuite) ScheduleDeleteTransactionBody(com.hederahashgraph.api.proto.java.ScheduleDeleteTransactionBody) HederaFunctionality(com.hederahashgraph.api.proto.java.HederaFunctionality) TxnUtils.suFrom(com.hedera.services.bdd.spec.transactions.TxnUtils.suFrom) FeeCalculator(com.hedera.services.bdd.spec.fees.FeeCalculator) TransactionResponse(com.hederahashgraph.api.proto.java.TransactionResponse) ScheduleInfo(com.hederahashgraph.api.proto.java.ScheduleInfo) HapiApiSpec(com.hedera.services.bdd.spec.HapiApiSpec) LogManager(org.apache.logging.log4j.LogManager) FeeCalculator(com.hedera.services.bdd.spec.fees.FeeCalculator) ScheduleInfo(com.hederahashgraph.api.proto.java.ScheduleInfo)

Aggregations

MoreObjects (com.google.common.base.MoreObjects)2 HapiApiSpec (com.hedera.services.bdd.spec.HapiApiSpec)2 FeeCalculator (com.hedera.services.bdd.spec.fees.FeeCalculator)2 HapiTxnOp (com.hedera.services.bdd.spec.transactions.HapiTxnOp)2 TxnUtils.suFrom (com.hedera.services.bdd.spec.transactions.TxnUtils.suFrom)2 HapiApiSuite (com.hedera.services.bdd.suites.HapiApiSuite)2 HederaFunctionality (com.hederahashgraph.api.proto.java.HederaFunctionality)2 Key (com.hederahashgraph.api.proto.java.Key)2 ScheduleInfo (com.hederahashgraph.api.proto.java.ScheduleInfo)2 Transaction (com.hederahashgraph.api.proto.java.Transaction)2 TransactionBody (com.hederahashgraph.api.proto.java.TransactionBody)2 TransactionResponse (com.hederahashgraph.api.proto.java.TransactionResponse)2 List (java.util.List)2 Consumer (java.util.function.Consumer)2 Function (java.util.function.Function)2 RegistryNotFound (com.hedera.services.bdd.spec.infrastructure.RegistryNotFound)1 TxnUtils (com.hedera.services.bdd.spec.transactions.TxnUtils)1 TxnUtils.asScheduleId (com.hedera.services.bdd.spec.transactions.TxnUtils.asScheduleId)1 HapiScheduleCreate.correspondingScheduledTxnId (com.hedera.services.bdd.spec.transactions.schedule.HapiScheduleCreate.correspondingScheduledTxnId)1 ScheduleSign (com.hederahashgraph.api.proto.java.HederaFunctionality.ScheduleSign)1