Search in sources :

Example 1 with ScheduleID

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

the class BaseHederaLedgerTestHelper method commonSetup.

protected void commonSetup() {
    sideEffectsTracker = mock(SideEffectsTracker.class);
    creator = mock(ExpiringCreations.class);
    historian = mock(AccountRecordsHistorian.class);
    ids = new EntityIdSource() {

        long nextId = NEXT_ID;

        @Override
        public TopicID newTopicId(final AccountID sponsor) {
            return TopicID.newBuilder().setTopicNum(nextId++).build();
        }

        @Override
        public AccountID newAccountId(AccountID newAccountSponsor) {
            return AccountID.newBuilder().setAccountNum(nextId++).build();
        }

        @Override
        public ContractID newContractId(AccountID newContractSponsor) {
            return ContractID.newBuilder().setContractNum(nextId++).build();
        }

        @Override
        public FileID newFileId(AccountID newFileSponsor) {
            return FileID.newBuilder().setFileNum(nextId++).build();
        }

        @Override
        public TokenID newTokenId(AccountID sponsor) {
            return TokenID.newBuilder().setTokenNum(nextId++).build();
        }

        @Override
        public ScheduleID newScheduleId(AccountID sponsor) {
            return ScheduleID.newBuilder().setScheduleNum(nextId++).build();
        }

        @Override
        public void reclaimLastId() {
            nextId--;
        }

        @Override
        public void reclaimProvisionalIds() {
        }

        @Override
        public void resetProvisionalIds() {
        }
    };
}
Also used : EntityIdSource(com.hedera.services.ledger.ids.EntityIdSource) AccountID(com.hederahashgraph.api.proto.java.AccountID) SideEffectsTracker(com.hedera.services.context.SideEffectsTracker) TopicID(com.hederahashgraph.api.proto.java.TopicID) FileID(com.hederahashgraph.api.proto.java.FileID) ContractID(com.hederahashgraph.api.proto.java.ContractID) ExpiringCreations(com.hedera.services.state.expiry.ExpiringCreations) TokenID(com.hederahashgraph.api.proto.java.TokenID) ScheduleID(com.hederahashgraph.api.proto.java.ScheduleID) AccountRecordsHistorian(com.hedera.services.records.AccountRecordsHistorian)

Example 2 with ScheduleID

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

the class HapiScheduleSign method opBodyDef.

@Override
protected Consumer<TransactionBody.Builder> opBodyDef(HapiApiSpec spec) throws Throwable {
    ScheduleSignTransactionBody opBody = spec.txns().<ScheduleSignTransactionBody, ScheduleSignTransactionBody.Builder>body(ScheduleSignTransactionBody.class, b -> {
        ScheduleID id;
        try {
            id = asScheduleId(schedule, spec);
            b.setScheduleID(id);
        } catch (RegistryNotFound e) {
            if (!ignoreMissing) {
                throw e;
            }
        }
    });
    return b -> b.setScheduleSign(opBody);
}
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) RegistryNotFound(com.hedera.services.bdd.spec.infrastructure.RegistryNotFound) ScheduleSignTransactionBody(com.hederahashgraph.api.proto.java.ScheduleSignTransactionBody) ScheduleID(com.hederahashgraph.api.proto.java.ScheduleID)

Aggregations

ScheduleID (com.hederahashgraph.api.proto.java.ScheduleID)2 MoreObjects (com.google.common.base.MoreObjects)1 HapiApiSpec (com.hedera.services.bdd.spec.HapiApiSpec)1 FeeCalculator (com.hedera.services.bdd.spec.fees.FeeCalculator)1 RegistryNotFound (com.hedera.services.bdd.spec.infrastructure.RegistryNotFound)1 HapiTxnOp (com.hedera.services.bdd.spec.transactions.HapiTxnOp)1 TxnUtils.asScheduleId (com.hedera.services.bdd.spec.transactions.TxnUtils.asScheduleId)1 TxnUtils.suFrom (com.hedera.services.bdd.spec.transactions.TxnUtils.suFrom)1 HapiScheduleCreate.correspondingScheduledTxnId (com.hedera.services.bdd.spec.transactions.schedule.HapiScheduleCreate.correspondingScheduledTxnId)1 HapiApiSuite (com.hedera.services.bdd.suites.HapiApiSuite)1 SideEffectsTracker (com.hedera.services.context.SideEffectsTracker)1 EntityIdSource (com.hedera.services.ledger.ids.EntityIdSource)1 AccountRecordsHistorian (com.hedera.services.records.AccountRecordsHistorian)1 ExpiringCreations (com.hedera.services.state.expiry.ExpiringCreations)1 AccountID (com.hederahashgraph.api.proto.java.AccountID)1 ContractID (com.hederahashgraph.api.proto.java.ContractID)1 FileID (com.hederahashgraph.api.proto.java.FileID)1 HederaFunctionality (com.hederahashgraph.api.proto.java.HederaFunctionality)1 ScheduleSign (com.hederahashgraph.api.proto.java.HederaFunctionality.ScheduleSign)1 Key (com.hederahashgraph.api.proto.java.Key)1