org.fisco.bcos.web3j.abi.datatypes.Type Java Examples

The following examples show how to use org.fisco.bcos.web3j.abi.datatypes.Type. 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: Utils.java    From web3sdk with Apache License 2.0 6 votes vote down vote up
public static <T, R extends Type<T>> List<R> typeMap(List<T> input, Class<R> destType)
        throws TypeMappingException {

    List<R> result = new ArrayList<R>(input.size());

    if (!input.isEmpty()) {
        try {
            Constructor<R> constructor =
                    destType.getDeclaredConstructor(input.get(0).getClass());
            for (T value : input) {
                result.add(constructor.newInstance(value));
            }
        } catch (NoSuchMethodException
                | IllegalAccessException
                | InvocationTargetException
                | InstantiationException e) {
            throw new TypeMappingException(e);
        }
    }
    return result;
}
 
Example #2
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 #3
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 #4
Source File: Topic.java    From WeEvent with Apache License 2.0 6 votes vote down vote up
public void flushSnapshot(List<String> topicName, List<BigInteger> lastSequence, List<BigInteger> lastBlock,
                          List<BigInteger> lastTimestamp, List<String> lastSender, TransactionSucCallback callback) {
    final Function function = new Function(
            FUNC_FLUSHSNAPSHOT, 
            Arrays.<Type>asList(topicName.isEmpty()?org.fisco.bcos.web3j.abi.datatypes.DynamicArray.empty("string[]"):
                    new org.fisco.bcos.web3j.abi.datatypes.DynamicArray<org.fisco.bcos.web3j.abi.datatypes.Utf8String>(
                    org.fisco.bcos.web3j.abi.Utils.typeMap(topicName, org.fisco.bcos.web3j.abi.datatypes.Utf8String.class)), 
            lastSequence.isEmpty()?org.fisco.bcos.web3j.abi.datatypes.DynamicArray.empty("uint256[]"):
                new org.fisco.bcos.web3j.abi.datatypes.DynamicArray<org.fisco.bcos.web3j.abi.datatypes.generated.Uint256>(
                    org.fisco.bcos.web3j.abi.Utils.typeMap(lastSequence, org.fisco.bcos.web3j.abi.datatypes.generated.Uint256.class)), 
            lastBlock.isEmpty()?org.fisco.bcos.web3j.abi.datatypes.DynamicArray.empty("uint256[]"):
                new org.fisco.bcos.web3j.abi.datatypes.DynamicArray<org.fisco.bcos.web3j.abi.datatypes.generated.Uint256>(
                    org.fisco.bcos.web3j.abi.Utils.typeMap(lastBlock, org.fisco.bcos.web3j.abi.datatypes.generated.Uint256.class)), 
            lastTimestamp.isEmpty()?org.fisco.bcos.web3j.abi.datatypes.DynamicArray.empty("uint256[]"):
                new org.fisco.bcos.web3j.abi.datatypes.DynamicArray<org.fisco.bcos.web3j.abi.datatypes.generated.Uint256>(
                    org.fisco.bcos.web3j.abi.Utils.typeMap(lastTimestamp, org.fisco.bcos.web3j.abi.datatypes.generated.Uint256.class)), 
            lastSender.isEmpty()?org.fisco.bcos.web3j.abi.datatypes.DynamicArray.empty("address[]"):
                new org.fisco.bcos.web3j.abi.datatypes.DynamicArray<org.fisco.bcos.web3j.abi.datatypes.Address>(
                    org.fisco.bcos.web3j.abi.Utils.typeMap(lastSender, org.fisco.bcos.web3j.abi.datatypes.Address.class))), 
            Collections.<TypeReference<?>>emptyList());
    asyncExecuteTransaction(function, callback);
}
 
Example #5
Source File: TopicController.java    From WeEvent with Apache License 2.0 6 votes vote down vote up
public RemoteCall<Tuple3<BigInteger, BigInteger, List<String>>> listTopicName(BigInteger pageIndex, BigInteger pageSize) {
    final Function function = new Function(FUNC_LISTTOPICNAME, 
            Arrays.<Type>asList(new org.fisco.bcos.web3j.abi.datatypes.generated.Uint256(pageIndex), 
            new org.fisco.bcos.web3j.abi.datatypes.generated.Uint256(pageSize)), 
            Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>() {}, new TypeReference<Uint256>() {}, new TypeReference<DynamicArray<Utf8String>>() {}));
    return new RemoteCall<Tuple3<BigInteger, BigInteger, List<String>>>(
            new Callable<Tuple3<BigInteger, BigInteger, List<String>>>() {
                @Override
                public Tuple3<BigInteger, BigInteger, List<String>> call() throws Exception {
                    List<Type> results = executeCallMultipleValueReturn(function);
                    return new Tuple3<BigInteger, BigInteger, List<String>>(
                            (BigInteger) results.get(0).getValue(), 
                            (BigInteger) results.get(1).getValue(), 
                            convertToNative((List<Utf8String>) results.get(2).getValue()));
                }
            });
}
 
Example #6
Source File: Topic.java    From WeEvent with Apache License 2.0 6 votes vote down vote up
public Tuple5<List<String>, List<BigInteger>, List<BigInteger>, List<BigInteger>, List<String>> getFlushSnapshotInput(TransactionReceipt transactionReceipt) {
    String data = transactionReceipt.getInput().substring(10);
    final Function function = new Function(FUNC_FLUSHSNAPSHOT, 
            Arrays.<Type>asList(), 
            Arrays.<TypeReference<?>>asList(
                new TypeReference<DynamicArray<Utf8String>>() {},
                new TypeReference<DynamicArray<Uint256>>() {},
                new TypeReference<DynamicArray<Uint256>>() {},
                new TypeReference<DynamicArray<Uint256>>() {},
                new TypeReference<DynamicArray<Address>>() {}));
    List<Type> results = FunctionReturnDecoder.decode(data, function.getOutputParameters());;
    return new Tuple5<List<String>, List<BigInteger>, List<BigInteger>, List<BigInteger>, List<String>>(

            convertToNative((List<Utf8String>) results.get(0).getValue()), 
            convertToNative((List<Uint256>) results.get(1).getValue()), 
            convertToNative((List<Uint256>) results.get(2).getValue()), 
            convertToNative((List<Uint256>) results.get(3).getValue()), 
            convertToNative((List<Address>) results.get(4).getValue())
            );
}
 
Example #7
Source File: EvidenceSignersData.java    From WeBASE-Front with Apache License 2.0 6 votes vote down vote up
public Tuple6<String, String, String, BigInteger, byte[], byte[]> getNewEvidenceInput(TransactionReceipt transactionReceipt) {
    String data = transactionReceipt.getInput().substring(10);
    final Function function = new Function(FUNC_NEWEVIDENCE, 
            Arrays.<Type>asList(), 
            Arrays.<TypeReference<?>>asList(new TypeReference<Utf8String>() {}, new TypeReference<Utf8String>() {}, new TypeReference<Utf8String>() {}, new TypeReference<Uint8>() {}, new TypeReference<Bytes32>() {}, new TypeReference<Bytes32>() {}));
    List<Type> results = FunctionReturnDecoder.decode(data, function.getOutputParameters());;
    return new Tuple6<String, String, String, BigInteger, byte[], byte[]>(

            (String) results.get(0).getValue(), 
            (String) results.get(1).getValue(), 
            (String) results.get(2).getValue(), 
            (BigInteger) results.get(3).getValue(), 
            (byte[]) results.get(4).getValue(), 
            (byte[]) results.get(5).getValue()
            );
}
 
Example #8
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 #9
Source File: CRUD.java    From web3sdk with Apache License 2.0 6 votes vote down vote up
public void update(
        String tableName,
        String key,
        String entry,
        String condition,
        String optional,
        TransactionSucCallback callback) {
    final Function function =
            new Function(
                    FUNC_UPDATE,
                    Arrays.<Type>asList(
                            new org.fisco.bcos.web3j.abi.datatypes.Utf8String(tableName),
                            new org.fisco.bcos.web3j.abi.datatypes.Utf8String(key),
                            new org.fisco.bcos.web3j.abi.datatypes.Utf8String(entry),
                            new org.fisco.bcos.web3j.abi.datatypes.Utf8String(condition),
                            new org.fisco.bcos.web3j.abi.datatypes.Utf8String(optional)),
                    Collections.<TypeReference<?>>emptyList());
    asyncExecuteTransaction(function, callback);
}
 
Example #10
Source File: TestRingSig.java    From group-signature-client with GNU General Public License v3.0 6 votes vote down vote up
@Deprecated
public static RemoteCall<TestRingSig> deploy(
        Web3j web3j,
        Credentials credentials,
        BigInteger gasPrice,
        BigInteger gasLimit,
        String _sig,
        String _message,
        String _param_info) {
    String encodedConstructor =
            FunctionEncoder.encodeConstructor(
                    Arrays.<Type>asList(
                            new Utf8String(_sig),
                            new Utf8String(_message),
                            new Utf8String(_param_info)));
    return deployRemoteCall(
            TestRingSig.class,
            web3j,
            credentials,
            gasPrice,
            gasLimit,
            BINARY,
            encodedConstructor);
}
 
Example #11
Source File: EvidenceVerify.java    From web3sdk with Apache License 2.0 6 votes vote down vote up
public String insertEvidenceSeq(
        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 createTransactionSeq(function);
}
 
Example #12
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 #13
Source File: TestRingSig.java    From group-signature-client with GNU General Public License v3.0 5 votes vote down vote up
public void verify_ring_sig(TransactionSucCallback callback) {
    final Function function =
            new Function(
                    FUNC_VERIFY_RING_SIG,
                    Arrays.<Type>asList(),
                    Collections.<TypeReference<?>>emptyList());
    asyncExecuteTransaction(function, callback);
}
 
Example #14
Source File: ParallelOk.java    From web3sdk with Apache License 2.0 5 votes vote down vote up
public String unregisterParallelFunctionSeq(String functionName) {
    final Function function =
            new Function(
                    FUNC_UNREGISTERPARALLELFUNCTION,
                    Arrays.<Type>asList(
                            new org.fisco.bcos.web3j.abi.datatypes.Utf8String(functionName)),
                    Collections.<TypeReference<?>>emptyList());
    return createTransactionSeq(function);
}
 
Example #15
Source File: HelloWorldGM.java    From WeBASE-Front with Apache License 2.0 5 votes vote down vote up
public Tuple1<String> getSetInput(TransactionReceipt transactionReceipt) {
    String data = transactionReceipt.getInput().substring(10);
    final Function function = new Function(FUNC_SET,
            Arrays.<Type>asList(),
            Arrays.<TypeReference<?>>asList(new TypeReference<Utf8String>() {}));
    List<Type> results = FunctionReturnDecoder.decode(data, function.getOutputParameters());;
    return new Tuple1<String>(

            (String) results.get(0).getValue()
    );
}
 
Example #16
Source File: ChainGovernance.java    From web3sdk with Apache License 2.0 5 votes vote down vote up
public Tuple1<BigInteger> getUpdateCommitteeMemberWeightOutput(
        TransactionReceipt transactionReceipt) {
    String data = transactionReceipt.getOutput();
    final Function function =
            new Function(
                    FUNC_UPDATECOMMITTEEMEMBERWEIGHT,
                    Arrays.<Type>asList(),
                    Arrays.<TypeReference<?>>asList(new TypeReference<Int256>() {}));
    List<Type> results = FunctionReturnDecoder.decode(data, function.getOutputParameters());
    ;
    return new Tuple1<BigInteger>((BigInteger) results.get(0).getValue());
}
 
Example #17
Source File: ChainGovernance.java    From web3sdk with Apache License 2.0 5 votes vote down vote up
public String revokeCommitteeMemberSeq(String user) {
    final Function function =
            new Function(
                    FUNC_REVOKECOMMITTEEMEMBER,
                    Arrays.<Type>asList(new org.fisco.bcos.web3j.abi.datatypes.Address(user)),
                    Collections.<TypeReference<?>>emptyList());
    return createTransactionSeq(function);
}
 
Example #18
Source File: FunctionTest.java    From WeBASE-Collect-Bee with Apache License 2.0 5 votes vote down vote up
@Test
public void testInput() throws IOException, BaseException {
    BigInteger bigBlockHeight = new BigInteger(Integer.toString(8));
    Block block = ethClient.getBlock(bigBlockHeight);
    List<TransactionResult> transactionResults = block.getTransactions();
    log.info("transactionResults.size:{}", transactionResults.size());
    for (TransactionResult result : transactionResults) {
        BcosTransactionReceipt ethGetTransactionReceipt = web3j.getTransactionReceipt((String) result.get()).send();
        Optional<TransactionReceipt> opt = ethGetTransactionReceipt.getTransactionReceipt();
        if (opt.isPresent()) {
            log.info("TransactionReceipt hash: {}", opt.get().getTransactionHash());
            Optional<Transaction> optt =
                    web3j.getTransactionByHash(opt.get().getTransactionHash()).send().getTransaction();
            if (optt.isPresent()) {
                String rawInput = optt.get().getInput();

                log.info("input : {}", optt.get().getInput());
                List<TypeReference<Type>> referencesTypeList = new ArrayList<>(1);
                TypeReference exScore = TypeReferenceUtils.getTypeRef("uint128");
                referencesTypeList.add(exScore);
                TypeReference operationType = TypeReferenceUtils.getTypeRef("uint8");
                referencesTypeList.add(operationType);

                List<Type> listT = FunctionReturnDecoder.decode(rawInput.substring(10), referencesTypeList);
                for (Type type : listT) {
                    log.info("type value : {}", type.getValue());
                }
                log.info("type info : {}", JacksonUtils.toJson(listT));
            }
        }
    }
}
 
Example #19
Source File: ParallelOk.java    From web3sdk with Apache License 2.0 5 votes vote down vote up
public void disableParallel(TransactionSucCallback callback) {
    final Function function =
            new Function(
                    FUNC_DISABLEPARALLEL,
                    Arrays.<Type>asList(),
                    Collections.<TypeReference<?>>emptyList());
    asyncExecuteTransaction(function, callback);
}
 
Example #20
Source File: Topic.java    From WeEvent with Apache License 2.0 5 votes vote down vote up
public RemoteCall<TransactionReceipt> addOperator(String topicName, String operatorAddress) {
    final Function function = new Function(
            FUNC_ADDOPERATOR, 
            Arrays.<Type>asList(new org.fisco.bcos.web3j.abi.datatypes.Utf8String(topicName), 
            new org.fisco.bcos.web3j.abi.datatypes.Address(operatorAddress)), 
            Collections.<TypeReference<?>>emptyList());
    return executeRemoteCallTransaction(function);
}
 
Example #21
Source File: ContractLifeCyclePrecompiled.java    From web3sdk with Apache License 2.0 5 votes vote down vote up
public void grantManager(
        String contractAddr, String userAddr, TransactionSucCallback callback) {
    final Function function =
            new Function(
                    FUNC_GRANTMANAGER,
                    Arrays.<Type>asList(
                            new org.fisco.bcos.web3j.abi.datatypes.Address(contractAddr),
                            new org.fisco.bcos.web3j.abi.datatypes.Address(userAddr)),
                    Collections.<TypeReference<?>>emptyList());
    asyncExecuteTransaction(function, callback);
}
 
Example #22
Source File: Topic.java    From WeEvent with Apache License 2.0 5 votes vote down vote up
public RemoteCall<TransactionReceipt> addTopicACL(String topicName, String ownerAddress) {
    final Function function = new Function(
            FUNC_ADDTOPICACL, 
            Arrays.<Type>asList(new org.fisco.bcos.web3j.abi.datatypes.Utf8String(topicName), 
            new org.fisco.bcos.web3j.abi.datatypes.Address(ownerAddress)), 
            Collections.<TypeReference<?>>emptyList());
    return executeRemoteCallTransaction(function);
}
 
Example #23
Source File: DagTransfer.java    From web3sdk with Apache License 2.0 5 votes vote down vote up
public String userDrawSeq(String user, BigInteger balance) {
    final Function function =
            new Function(
                    FUNC_USERDRAW,
                    Arrays.<Type>asList(
                            new org.fisco.bcos.web3j.abi.datatypes.Utf8String(user),
                            new org.fisco.bcos.web3j.abi.datatypes.generated.Uint256(balance)),
                    Collections.<TypeReference<?>>emptyList());
    return createTransactionSeq(function);
}
 
Example #24
Source File: SolidityFunctionWrapper.java    From web3sdk with Apache License 2.0 5 votes vote down vote up
private void buildTransactionFunctionSeq(
        AbiDefinition functionDefinition, MethodSpec.Builder methodBuilder, String inputParams)
        throws ClassNotFoundException {

    if (functionDefinition.hasOutputs()) {
        // CHECKSTYLE:OFF
        reporter.report(
                String.format(
                        "Definition of the function %s returns a value but is not defined as a view function. "
                                + "Please ensure it contains the view modifier if you want to read the return value",
                        functionDefinition.getName()));
        // CHECKSTYLE:ON
    }

    if (functionDefinition.isPayable()) {
        methodBuilder.addParameter(BigInteger.class, WEI_VALUE);
    }

    String functionName = functionDefinition.getName();

    TypeName returnType = TypeName.get(String.class);
    methodBuilder.returns(returnType);

    methodBuilder.addStatement(
            "final $T function = new $T(\n$N, \n$T.<$T>asList($L), \n$T"
                    + ".<$T<?>>emptyList())",
            Function.class,
            Function.class,
            funcNameToConst(functionName),
            Arrays.class,
            Type.class,
            inputParams,
            Collections.class,
            TypeReference.class);

    methodBuilder.addStatement("return createTransactionSeq(function)");
}
 
Example #25
Source File: ChainGovernance.java    From web3sdk with Apache License 2.0 5 votes vote down vote up
public RemoteCall<String> listCommitteeMembers() {
    final Function function =
            new Function(
                    FUNC_LISTCOMMITTEEMEMBERS,
                    Arrays.<Type>asList(),
                    Arrays.<TypeReference<?>>asList(new TypeReference<Utf8String>() {}));
    return executeRemoteCallSingleValueReturn(function, String.class);
}
 
Example #26
Source File: ContractLifeCyclePrecompiled.java    From web3sdk with Apache License 2.0 5 votes vote down vote up
public Tuple1<BigInteger> getFreezeOutput(TransactionReceipt transactionReceipt) {
    String data = transactionReceipt.getOutput();
    final Function function =
            new Function(
                    FUNC_FREEZE,
                    Arrays.<Type>asList(),
                    Arrays.<TypeReference<?>>asList(new TypeReference<Int256>() {}));
    List<Type> results = FunctionReturnDecoder.decode(data, function.getOutputParameters());
    ;
    return new Tuple1<BigInteger>((BigInteger) results.get(0).getValue());
}
 
Example #27
Source File: HelloWorld.java    From WeBASE-Front with Apache License 2.0 5 votes vote down vote up
public String setSeq(List<BigInteger> _ua) {
    final Function function = new Function(
            FUNC_SET, 
            Arrays.<Type>asList(_ua.isEmpty()?org.fisco.bcos.web3j.abi.datatypes.DynamicArray.empty("uint256[]"):new org.fisco.bcos.web3j.abi.datatypes.DynamicArray<org.fisco.bcos.web3j.abi.datatypes.generated.Uint256>(
                    org.fisco.bcos.web3j.abi.Utils.typeMap(_ua, org.fisco.bcos.web3j.abi.datatypes.generated.Uint256.class))), 
            Collections.<TypeReference<?>>emptyList());
    return createTransactionSeq(function);
}
 
Example #28
Source File: HelloWorld.java    From WeBASE-Front with Apache License 2.0 5 votes vote down vote up
public void set(List<BigInteger> _ua, TransactionSucCallback callback) {
    final Function function = new Function(
            FUNC_SET, 
            Arrays.<Type>asList(_ua.isEmpty()?org.fisco.bcos.web3j.abi.datatypes.DynamicArray.empty("uint256[]"):new org.fisco.bcos.web3j.abi.datatypes.DynamicArray<org.fisco.bcos.web3j.abi.datatypes.generated.Uint256>(
                    org.fisco.bcos.web3j.abi.Utils.typeMap(_ua, org.fisco.bcos.web3j.abi.datatypes.generated.Uint256.class))), 
            Collections.<TypeReference<?>>emptyList());
    asyncExecuteTransaction(function, callback);
}
 
Example #29
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 #30
Source File: ChainGovernance.java    From web3sdk with Apache License 2.0 5 votes vote down vote up
public RemoteCall<String> listOperators() {
    final Function function =
            new Function(
                    FUNC_LISTOPERATORS,
                    Arrays.<Type>asList(),
                    Arrays.<TypeReference<?>>asList(new TypeReference<Utf8String>() {}));
    return executeRemoteCallSingleValueReturn(function, String.class);
}