Search in sources :

Example 1 with EthChainId

use of com.quorum.gauge.ext.EthChainId in project quorum-acceptance-tests by ConsenSys.

the class MultiTenancy method deployPublicContract.

@Step("`<clientName>` deploys a <contractId> public contract, named <contractName>, by sending a transaction to `<node>`")
public void deployPublicContract(String clientName, String contractId, String contractName, QuorumNetworkProperty.Node node) {
    Contract contract = requestAccessToken(clientName).flatMap(accessToken -> rpcService.call(node, "eth_chainId", Collections.emptyList(), EthChainId.class)).flatMap(ethChainId -> rawContractService.createRawSimplePublicContract(42, networkProperty.getWallets().get("Wallet1"), node, ethChainId.getChainId())).doOnTerminate(Context::removeAccessToken).doOnNext(c -> {
        if (c == null || !c.getTransactionReceipt().isPresent()) {
            throw new RuntimeException("contract not deployed");
        }
    }).blockingFirst();
    logger.debug("Saving contract address {} with name {}", contract.getContractAddress(), contractName);
    DataStoreFactory.getScenarioDataStore().put(contractName, contract);
}
Also used : AbstractSpecImplementation(com.quorum.gauge.core.AbstractSpecImplementation) StringUtils(org.apache.commons.lang.StringUtils) java.util(java.util) EthChainId(com.quorum.gauge.ext.EthChainId) TransactionException(org.web3j.protocol.exceptions.TransactionException) PrivacyFlag(com.quorum.gauge.common.PrivacyFlag) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) LoggerFactory(org.slf4j.LoggerFactory) Autowired(org.springframework.beans.factory.annotation.Autowired) Response(org.web3j.protocol.core.Response) AtomicReference(java.util.concurrent.atomic.AtomicReference) Credentials(org.web3j.crypto.Credentials) ExtensionService(com.quorum.gauge.services.ExtensionService) Assertions.assertThatThrownBy(org.assertj.core.api.Assertions.assertThatThrownBy) DataStore(com.thoughtworks.gauge.datastore.DataStore) Context(com.quorum.gauge.common.Context) Service(org.springframework.stereotype.Service) WalletUtils(org.web3j.crypto.WalletUtils) Observable(io.reactivex.Observable) BigInteger(java.math.BigInteger) DataStoreFactory(com.thoughtworks.gauge.datastore.DataStoreFactory) Node(com.quorum.gauge.common.QuorumNetworkProperty.Node) Contract(org.web3j.tx.Contract) Step(com.thoughtworks.gauge.Step) Logger(org.slf4j.Logger) QuorumNode(com.quorum.gauge.common.QuorumNode) QuorumNetworkProperty(com.quorum.gauge.common.QuorumNetworkProperty) Ints(com.google.common.primitives.Ints) Collectors(java.util.stream.Collectors) Consumer(java.util.function.Consumer) Stream(java.util.stream.Stream) WalletData(com.quorum.gauge.common.config.WalletData) org.web3j.protocol.core.methods.response(org.web3j.protocol.core.methods.response) Table(com.thoughtworks.gauge.Table) Context(com.quorum.gauge.common.Context) EthChainId(com.quorum.gauge.ext.EthChainId) Contract(org.web3j.tx.Contract) Step(com.thoughtworks.gauge.Step)

Aggregations

Ints (com.google.common.primitives.Ints)1 Context (com.quorum.gauge.common.Context)1 PrivacyFlag (com.quorum.gauge.common.PrivacyFlag)1 QuorumNetworkProperty (com.quorum.gauge.common.QuorumNetworkProperty)1 Node (com.quorum.gauge.common.QuorumNetworkProperty.Node)1 QuorumNode (com.quorum.gauge.common.QuorumNode)1 WalletData (com.quorum.gauge.common.config.WalletData)1 AbstractSpecImplementation (com.quorum.gauge.core.AbstractSpecImplementation)1 EthChainId (com.quorum.gauge.ext.EthChainId)1 ExtensionService (com.quorum.gauge.services.ExtensionService)1 Step (com.thoughtworks.gauge.Step)1 Table (com.thoughtworks.gauge.Table)1 DataStore (com.thoughtworks.gauge.datastore.DataStore)1 DataStoreFactory (com.thoughtworks.gauge.datastore.DataStoreFactory)1 Observable (io.reactivex.Observable)1 BigInteger (java.math.BigInteger)1 java.util (java.util)1 AtomicReference (java.util.concurrent.atomic.AtomicReference)1 Consumer (java.util.function.Consumer)1 Collectors (java.util.stream.Collectors)1