Search in sources :

Example 6 with ContractGasProvider

use of org.fisco.bcos.web3j.tx.gas.ContractGasProvider in project web3sdk by FISCO-BCOS.

the class GMTableTestClient method testTableTest.

@SuppressWarnings({ "rawtypes", "unchecked" })
public static void testTableTest(String[] args) throws Exception {
    final Resource contractResource = new ClassPathResource("contract.properties");
    PropertiesConfiguration prop = new PropertiesConfiguration(contractResource.getFile());
    Object addressObj = prop.getProperty("crud_address");
    if (addressObj != null) {
        contractAddress = (String) addressObj;
    } else {
        deployTableTest();
    }
    ContractGasProvider contractGasProvider = new StaticGasProvider(gasPrice, gasLimit);
    TableTest tabletest = TableTest.load(contractAddress, web3j, credentials, contractGasProvider);
    // create table
    if ("create".equals(args[0])) {
        create(tabletest);
    } else // insert
    if ("insert".equals(args[0])) {
        insert(args, tabletest);
    } else // select
    if ("select".equals(args[0])) {
        select(args, tabletest);
    } else // update
    if ("update".equals(args[0])) {
        update(args, tabletest);
    } else // remove
    if ("remove".equals(args[0])) {
        remove(args, tabletest);
    } else {
        System.out.println("\nPlease choose follow commands:\n deploy, create, insert, select, update or remove");
    }
}
Also used : StaticGasProvider(org.fisco.bcos.web3j.tx.gas.StaticGasProvider) ClassPathResource(org.springframework.core.io.ClassPathResource) Resource(org.springframework.core.io.Resource) PropertiesConfiguration(org.apache.commons.configuration.PropertiesConfiguration) ContractGasProvider(org.fisco.bcos.web3j.tx.gas.ContractGasProvider) ClassPathResource(org.springframework.core.io.ClassPathResource)

Aggregations

ContractGasProvider (org.fisco.bcos.web3j.tx.gas.ContractGasProvider)6 StaticGasProvider (org.fisco.bcos.web3j.tx.gas.StaticGasProvider)6 BigInteger (java.math.BigInteger)4 PropertiesConfiguration (org.apache.commons.configuration.PropertiesConfiguration)4 ClassPathResource (org.springframework.core.io.ClassPathResource)4 Resource (org.springframework.core.io.Resource)4 TransactionReceipt (org.fisco.bcos.web3j.protocol.core.methods.response.TransactionReceipt)3 Service (org.fisco.bcos.channel.client.Service)2 Credentials (org.fisco.bcos.web3j.crypto.Credentials)2 EncryptType (org.fisco.bcos.web3j.crypto.EncryptType)2 Web3j (org.fisco.bcos.web3j.protocol.Web3j)2 ChannelEthereumService (org.fisco.bcos.web3j.protocol.channel.ChannelEthereumService)2 ApplicationContext (org.springframework.context.ApplicationContext)2 ClassPathXmlApplicationContext (org.springframework.context.support.ClassPathXmlApplicationContext)2 List (java.util.List)1 CreateResultEventResponse (org.fisco.bcos.channel.test.contract.MixContract.CreateResultEventResponse)1 InsertResultEventResponse (org.fisco.bcos.channel.test.contract.MixContract.InsertResultEventResponse)1 RemoveResultEventResponse (org.fisco.bcos.channel.test.contract.MixContract.RemoveResultEventResponse)1 UpdateResultEventResponse (org.fisco.bcos.channel.test.contract.MixContract.UpdateResultEventResponse)1 RemoteCall (org.fisco.bcos.web3j.protocol.core.RemoteCall)1