org.fisco.bcos.web3j.protocol.core.RemoteCall Java Examples

The following examples show how to use org.fisco.bcos.web3j.protocol.core.RemoteCall. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MixContract.java    From web3sdk with Apache License 2.0 6 votes vote down vote up
public RemoteCall<Tuple3<List<byte[]>, List<BigInteger>, List<byte[]>>> read(String name) {
    final Function function =
            new Function(
                    FUNC_READ,
                    Arrays.<Type>asList(
                            new org.fisco.bcos.web3j.abi.datatypes.Utf8String(name)),
                    Arrays.<TypeReference<?>>asList(
                            new TypeReference<DynamicArray<Bytes32>>() {},
                            new TypeReference<DynamicArray<Int256>>() {},
                            new TypeReference<DynamicArray<Bytes32>>() {}));
    return new RemoteCall<Tuple3<List<byte[]>, List<BigInteger>, List<byte[]>>>(
            new Callable<Tuple3<List<byte[]>, List<BigInteger>, List<byte[]>>>() {
                @Override
                public Tuple3<List<byte[]>, List<BigInteger>, List<byte[]>> call()
                        throws Exception {
                    List<Type> results = executeCallMultipleValueReturn(function);
                    return new Tuple3<List<byte[]>, List<BigInteger>, List<byte[]>>(
                            convertToNative((List<Bytes32>) results.get(0).getValue()),
                            convertToNative((List<Int256>) results.get(1).getValue()),
                            convertToNative((List<Bytes32>) results.get(2).getValue()));
                }
            });
}
 
Example #2
Source File: Evidence.java    From WeBASE-Front with Apache License 2.0 6 votes vote down vote up
public RemoteCall<Tuple7<String, String, String, List<BigInteger>, List<byte[]>, List<byte[]>, List<String>>> getEvidence() {
    final Function function = new Function(FUNC_GETEVIDENCE, 
            Arrays.<Type>asList(), 
            Arrays.<TypeReference<?>>asList(new TypeReference<Utf8String>() {}, new TypeReference<Utf8String>() {}, new TypeReference<Utf8String>() {}, new TypeReference<DynamicArray<Uint8>>() {}, new TypeReference<DynamicArray<Bytes32>>() {}, new TypeReference<DynamicArray<Bytes32>>() {}, new TypeReference<DynamicArray<Address>>() {}));
    return new RemoteCall<Tuple7<String, String, String, List<BigInteger>, List<byte[]>, List<byte[]>, List<String>>>(
            new Callable<Tuple7<String, String, String, List<BigInteger>, List<byte[]>, List<byte[]>, List<String>>>() {
                @Override
                public Tuple7<String, String, String, List<BigInteger>, List<byte[]>, List<byte[]>, List<String>> call() throws Exception {
                    List<Type> results = executeCallMultipleValueReturn(function);
                    return new Tuple7<String, String, String, List<BigInteger>, List<byte[]>, List<byte[]>, List<String>>(
                            (String) results.get(0).getValue(), 
                            (String) results.get(1).getValue(), 
                            (String) results.get(2).getValue(), 
                            convertToNative((List<Uint8>) results.get(3).getValue()), 
                            convertToNative((List<Bytes32>) results.get(4).getValue()), 
                            convertToNative((List<Bytes32>) results.get(5).getValue()), 
                            convertToNative((List<Address>) results.get(6).getValue()));
                }
            });
}
 
Example #3
Source File: TableTest.java    From web3sdk with Apache License 2.0 6 votes vote down vote up
public RemoteCall<Tuple3<List<byte[]>, List<BigInteger>, List<byte[]>>> select(String name) {
    final Function function =
            new Function(
                    FUNC_SELECT,
                    Arrays.<Type>asList(
                            new org.fisco.bcos.web3j.abi.datatypes.Utf8String(name)),
                    Arrays.<TypeReference<?>>asList(
                            new TypeReference<DynamicArray<Bytes32>>() {},
                            new TypeReference<DynamicArray<Int256>>() {},
                            new TypeReference<DynamicArray<Bytes32>>() {}));
    return new RemoteCall<Tuple3<List<byte[]>, List<BigInteger>, List<byte[]>>>(
            new Callable<Tuple3<List<byte[]>, List<BigInteger>, List<byte[]>>>() {
                @Override
                public Tuple3<List<byte[]>, List<BigInteger>, List<byte[]>> call()
                        throws Exception {
                    List<Type> results = executeCallMultipleValueReturn(function);
                    return new Tuple3<List<byte[]>, List<BigInteger>, List<byte[]>>(
                            convertToNative((List<Bytes32>) results.get(0).getValue()),
                            convertToNative((List<Int256>) results.get(1).getValue()),
                            convertToNative((List<Bytes32>) results.get(2).getValue()));
                }
            });
}
 
Example #4
Source File: ChainGovernance.java    From web3sdk with Apache License 2.0 6 votes vote down vote up
public RemoteCall<Tuple2<Boolean, BigInteger>> queryCommitteeMemberWeight(String user) {
    final Function function =
            new Function(
                    FUNC_QUERYCOMMITTEEMEMBERWEIGHT,
                    Arrays.<Type>asList(new org.fisco.bcos.web3j.abi.datatypes.Address(user)),
                    Arrays.<TypeReference<?>>asList(
                            new TypeReference<Bool>() {}, new TypeReference<Int256>() {}));
    return new RemoteCall<Tuple2<Boolean, BigInteger>>(
            new Callable<Tuple2<Boolean, BigInteger>>() {
                @Override
                public Tuple2<Boolean, BigInteger> call() throws Exception {
                    List<Type> results = executeCallMultipleValueReturn(function);
                    return new Tuple2<Boolean, BigInteger>(
                            (Boolean) results.get(0).getValue(),
                            (BigInteger) results.get(1).getValue());
                }
            });
}
 
Example #5
Source File: TestGroupSig.java    From group-signature-client with GNU General Public License v3.0 6 votes vote down vote up
@Deprecated
public static RemoteCall<TestGroupSig> deploy(
        Web3j web3j,
        Credentials credentials,
        BigInteger gasPrice,
        BigInteger gasLimit,
        String _sig,
        String _message,
        String _gpk_info,
        String _pbc_param_info) {
    String encodedConstructor =
            FunctionEncoder.encodeConstructor(
                    Arrays.<Type>asList(
                            new Utf8String(_sig),
                            new Utf8String(_message),
                            new Utf8String(_gpk_info),
                            new Utf8String(_pbc_param_info)));
    return deployRemoteCall(
            TestGroupSig.class,
            web3j,
            credentials,
            gasPrice,
            gasLimit,
            BINARY,
            encodedConstructor);
}
 
Example #6
Source File: EvidenceVerify.java    From web3sdk with Apache License 2.0 6 votes vote down vote up
public RemoteCall<TransactionReceipt> insertEvidence(
        String evi,
        String info,
        String id,
        String signAddr,
        byte[] message,
        BigInteger v,
        byte[] r,
        byte[] s) {
    final Function function =
            new Function(
                    FUNC_INSERTEVIDENCE,
                    Arrays.<Type>asList(
                            new org.fisco.bcos.web3j.abi.datatypes.Utf8String(evi),
                            new org.fisco.bcos.web3j.abi.datatypes.Utf8String(info),
                            new org.fisco.bcos.web3j.abi.datatypes.Utf8String(id),
                            new org.fisco.bcos.web3j.abi.datatypes.Address(signAddr),
                            new org.fisco.bcos.web3j.abi.datatypes.generated.Bytes32(message),
                            new org.fisco.bcos.web3j.abi.datatypes.generated.Uint8(v),
                            new org.fisco.bcos.web3j.abi.datatypes.generated.Bytes32(r),
                            new org.fisco.bcos.web3j.abi.datatypes.generated.Bytes32(s)),
                    Collections.<TypeReference<?>>emptyList());
    return executeRemoteCallTransaction(function);
}
 
Example #7
Source File: Contract.java    From web3sdk with Apache License 2.0 6 votes vote down vote up
public static <T extends Contract> RemoteCall<T> deployRemoteCall(
        Class<T> type,
        Web3j web3j,
        Credentials credentials,
        ContractGasProvider contractGasProvider,
        String binary,
        String encodedConstructor,
        BigInteger value) {
    return new RemoteCall<>(
            () ->
                    deploy(
                            type,
                            web3j,
                            credentials,
                            contractGasProvider,
                            binary,
                            encodedConstructor,
                            value));
}
 
Example #8
Source File: Ok.java    From web3sdk with Apache License 2.0 5 votes vote down vote up
public RemoteCall<TransactionReceipt> trans(BigInteger num) {
    final Function function = new Function(
            FUNC_TRANS, 
            Arrays.<Type>asList(new org.fisco.bcos.web3j.abi.datatypes.generated.Uint256(num)), 
            Collections.<TypeReference<?>>emptyList());
    return executeRemoteCallTransaction(function);
}
 
Example #9
Source File: Ok.java    From WeBASE-Front with Apache License 2.0 5 votes vote down vote up
@Deprecated
public static RemoteCall<Ok> deploy(
    Web3j web3j,
    TransactionManager transactionManager,
    BigInteger gasPrice,
    BigInteger gasLimit) {
  return deployRemoteCall(Ok.class, web3j, transactionManager, gasPrice, gasLimit, BINARY, "");
}
 
Example #10
Source File: Ok.java    From web3sdk with Apache License 2.0 5 votes vote down vote up
public static RemoteCall<Ok> deploy(
        Web3j web3j,
        TransactionManager transactionManager,
        ContractGasProvider contractGasProvider) {
    return deployRemoteCall(
            Ok.class, web3j, transactionManager, contractGasProvider, BINARY, "");
}
 
Example #11
Source File: HelloWorld.java    From WeBASE-Codegen-Monkey with Apache License 2.0 5 votes vote down vote up
public RemoteCall<TransactionReceipt> set(String n) {
    final Function function = new Function(
            FUNC_SET, 
            Arrays.<Type>asList(new org.fisco.bcos.web3j.abi.datatypes.Utf8String(n)), 
            Collections.<TypeReference<?>>emptyList());
    return executeRemoteCallTransaction(function);
}
 
Example #12
Source File: Web3SDK2Wrapper.java    From WeEvent with Apache License 2.0 5 votes vote down vote up
public static String deployTopicControl(Web3j web3j, Credentials credentials, int timeout) throws BrokerException {
    log.info("begin deploy topic control");

    try {
        // deploy Topic.sol in highest version(Web3SDK2Wrapper.nowVersion)
        RemoteCall<Topic> f1 = Topic.deploy(web3j, credentials, gasProvider);
        Topic topic = f1.sendAsync().get(timeout, TimeUnit.MILLISECONDS);
        log.info("topic contract address: {}", topic.getContractAddress());
        if (topic.getContractAddress().equals(WeEventConstants.ADDRESS_EMPTY)) {
            log.error("contract address is empty after Topic.deploy(...)");
            throw new BrokerException(ErrorCode.DEPLOY_CONTRACT_ERROR);
        }

        // deploy TopicController.sol in nowVersion
        RemoteCall<TopicController> f2 = TopicController.deploy(web3j, credentials, gasProvider, topic.getContractAddress());
        TopicController topicController = f2.sendAsync().get(timeout, TimeUnit.MILLISECONDS);
        log.info("topic control contract address: {}", topicController.getContractAddress());
        if (topicController.getContractAddress().equals(WeEventConstants.ADDRESS_EMPTY)) {
            log.error("contract address is empty after TopicController.deploy(...)");
            throw new BrokerException(ErrorCode.DEPLOY_CONTRACT_ERROR);
        }

        log.info("deploy topic control success");
        return topicController.getContractAddress();
    } catch (InterruptedException | ExecutionException | TimeoutException e) {
        log.error("deploy contract failed", e);
        throw new BrokerException(ErrorCode.DEPLOY_CONTRACT_ERROR);
    }
}
 
Example #13
Source File: OkD.java    From web3sdk with Apache License 2.0 5 votes vote down vote up
public RemoteCall<BigInteger> get() {
    final Function function =
            new Function(
                    FUNC_GET,
                    Arrays.<Type>asList(),
                    Arrays.<TypeReference<?>>asList(new TypeReference<Int256>() {}));
    return executeRemoteCallSingleValueReturn(function, BigInteger.class);
}
 
Example #14
Source File: NewSolTest.java    From web3sdk with Apache License 2.0 5 votes vote down vote up
public RemoteCall<String> newOwner() {
    final Function function =
            new Function(
                    FUNC_NEWOWNER,
                    Arrays.<Type>asList(),
                    Arrays.<TypeReference<?>>asList(new TypeReference<Address>() {}));
    return executeRemoteCallSingleValueReturn(function, String.class);
}
 
Example #15
Source File: ContractLifeCyclePrecompiled.java    From web3sdk with Apache License 2.0 5 votes vote down vote up
@Deprecated
public static RemoteCall<ContractLifeCyclePrecompiled> deploy(
        Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) {
    return deployRemoteCall(
            ContractLifeCyclePrecompiled.class,
            web3j,
            credentials,
            gasPrice,
            gasLimit,
            BINARY,
            "");
}
 
Example #16
Source File: TestRingSig.java    From group-signature-client with GNU General Public License v3.0 5 votes vote down vote up
public RemoteCall<TransactionReceipt> update_ring_sig_data(
        String new_sig, String new_message, String new_param_info) {
    final Function function =
            new Function(
                    FUNC_UPDATE_RING_SIG_DATA,
                    Arrays.<Type>asList(
                            new Utf8String(new_sig),
                            new Utf8String(new_message),
                            new Utf8String(new_param_info)),
                    Collections.<TypeReference<?>>emptyList());
    return executeRemoteCallTransaction(function);
}
 
Example #17
Source File: MixContract.java    From web3sdk with Apache License 2.0 5 votes vote down vote up
public RemoteCall<TransactionReceipt> insert(
        String name, BigInteger item_id, String item_name) {
    final Function function =
            new Function(
                    FUNC_INSERT,
                    Arrays.<Type>asList(
                            new org.fisco.bcos.web3j.abi.datatypes.Utf8String(name),
                            new org.fisco.bcos.web3j.abi.datatypes.generated.Int256(item_id),
                            new org.fisco.bcos.web3j.abi.datatypes.Utf8String(item_name)),
                    Collections.<TypeReference<?>>emptyList());
    return executeRemoteCallTransaction(function);
}
 
Example #18
Source File: NewSolTest.java    From web3sdk with Apache License 2.0 5 votes vote down vote up
public static RemoteCall<NewSolTest> deploy(
        Web3j web3j,
        TransactionManager transactionManager,
        ContractGasProvider contractGasProvider) {
    return deployRemoteCall(
            NewSolTest.class, web3j, transactionManager, contractGasProvider, BINARY, "");
}
 
Example #19
Source File: NewSolTest.java    From web3sdk with Apache License 2.0 5 votes vote down vote up
public RemoteCall<TransactionReceipt> acceptOwnership() {
    final Function function =
            new Function(
                    FUNC_ACCEPTOWNERSHIP,
                    Arrays.<Type>asList(),
                    Collections.<TypeReference<?>>emptyList());
    return executeRemoteCallTransaction(function);
}
 
Example #20
Source File: ChainGovernance.java    From web3sdk with Apache License 2.0 5 votes vote down vote up
public RemoteCall<String> getAccountStatus(String account) {
    final Function function =
            new Function(
                    FUNC_GETACCOUNTSTATUS,
                    Arrays.<Type>asList(
                            new org.fisco.bcos.web3j.abi.datatypes.Address(account)),
                    Arrays.<TypeReference<?>>asList(new TypeReference<Utf8String>() {}));
    return executeRemoteCallSingleValueReturn(function, String.class);
}
 
Example #21
Source File: Consensus.java    From web3sdk with Apache License 2.0 5 votes vote down vote up
public RemoteCall<TransactionReceipt> remove(String nodeID) {
    final Function function =
            new Function(
                    FUNC_REMOVE,
                    Arrays.<Type>asList(
                            new org.fisco.bcos.web3j.abi.datatypes.Utf8String(nodeID)),
                    Collections.<TypeReference<?>>emptyList());
    return executeRemoteCallTransaction(function);
}
 
Example #22
Source File: Ok.java    From web3sdk with Apache License 2.0 5 votes vote down vote up
public static RemoteCall<Ok> deploy(
        Web3j web3j,
        TransactionManager transactionManager,
        ContractGasProvider contractGasProvider) {
    return deployRemoteCall(
            Ok.class, web3j, transactionManager, contractGasProvider, BINARY, "");
}
 
Example #23
Source File: ChainGovernance.java    From web3sdk with Apache License 2.0 5 votes vote down vote up
public RemoteCall<TransactionReceipt> unfreezeAccount(String account) {
    final Function function =
            new Function(
                    FUNC_UNFREEZEACCOUNT,
                    Arrays.<Type>asList(
                            new org.fisco.bcos.web3j.abi.datatypes.Address(account)),
                    Collections.<TypeReference<?>>emptyList());
    return executeRemoteCallTransaction(function);
}
 
Example #24
Source File: Permission.java    From web3sdk with Apache License 2.0 5 votes vote down vote up
public RemoteCall<TransactionReceipt> remove(String table_name, String addr) {
    final Function function =
            new Function(
                    FUNC_REMOVE,
                    Arrays.<Type>asList(
                            new org.fisco.bcos.web3j.abi.datatypes.Utf8String(table_name),
                            new org.fisco.bcos.web3j.abi.datatypes.Utf8String(addr)),
                    Collections.<TypeReference<?>>emptyList());
    return executeRemoteCallTransaction(function);
}
 
Example #25
Source File: RingSigPrecompiled.java    From group-signature-client with GNU General Public License v3.0 5 votes vote down vote up
public static RemoteCall<RingSigPrecompiled> deploy(
        Web3j web3j,
        TransactionManager transactionManager,
        ContractGasProvider contractGasProvider) {
    return deployRemoteCall(
            RingSigPrecompiled.class,
            web3j,
            transactionManager,
            contractGasProvider,
            BINARY,
            "");
}
 
Example #26
Source File: MixContract.java    From web3sdk with Apache License 2.0 5 votes vote down vote up
public RemoteCall<TransactionReceipt> create() {
    final Function function =
            new Function(
                    FUNC_CREATE,
                    Arrays.<Type>asList(),
                    Collections.<TypeReference<?>>emptyList());
    return executeRemoteCallTransaction(function);
}
 
Example #27
Source File: Ok.java    From web3sdk with Apache License 2.0 5 votes vote down vote up
public RemoteCall<BigInteger> get() {
    final Function function =
            new Function(
                    FUNC_GET,
                    Arrays.<Type>asList(),
                    Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>() {}));
    return executeRemoteCallSingleValueReturn(function, BigInteger.class);
}
 
Example #28
Source File: ContractLifeCyclePrecompiled.java    From web3sdk with Apache License 2.0 5 votes vote down vote up
public static RemoteCall<ContractLifeCyclePrecompiled> deploy(
        Web3j web3j,
        TransactionManager transactionManager,
        ContractGasProvider contractGasProvider) {
    return deployRemoteCall(
            ContractLifeCyclePrecompiled.class,
            web3j,
            transactionManager,
            contractGasProvider,
            BINARY,
            "");
}
 
Example #29
Source File: NewSolTest.java    From web3sdk with Apache License 2.0 5 votes vote down vote up
public RemoteCall<BigInteger> allowance(String tokenOwner, String spender) {
    final Function function =
            new Function(
                    FUNC_ALLOWANCE,
                    Arrays.<Type>asList(new Address(tokenOwner), new Address(spender)),
                    Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>() {}));
    return executeRemoteCallSingleValueReturn(function, BigInteger.class);
}
 
Example #30
Source File: ChainGovernance.java    From web3sdk with Apache License 2.0 5 votes vote down vote up
public RemoteCall<BigInteger> queryThreshold() {
    final Function function =
            new Function(
                    FUNC_QUERYTHRESHOLD,
                    Arrays.<Type>asList(),
                    Arrays.<TypeReference<?>>asList(new TypeReference<Int256>() {}));
    return executeRemoteCallSingleValueReturn(function, BigInteger.class);
}