Java Code Examples for org.fisco.bcos.web3j.abi.FunctionEncoder#encodeConstructor()

The following examples show how to use org.fisco.bcos.web3j.abi.FunctionEncoder#encodeConstructor() . 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: ContractService.java    From WeBASE-Front with Apache License 2.0 6 votes vote down vote up
/**
 * encode constructor function
 */
private static String constructorEncoded(String contractName,
        ContractAbiUtil.VersionEvent versionEvent, List<Object> params) throws FrontException {
    // Constructor encoded
    String encodedConstructor = "";
    String functionName = contractName;
    // input handle
    List<String> funcInputTypes = versionEvent.getFuncInputs().get(functionName);

    if (funcInputTypes != null && funcInputTypes.size() > 0) {
        if (funcInputTypes.size() == params.size()) {
            List<Type> finalInputs = AbiUtil.inputFormat(funcInputTypes, params);
            encodedConstructor = FunctionEncoder.encodeConstructor(finalInputs);
            log.info("deploy encodedConstructor:{}", encodedConstructor);
        } else {
            log.warn("deploy fail. funcInputTypes:{}, params:{}", funcInputTypes, params);
            throw new FrontException(ConstantCode.IN_FUNCPARAM_ERROR);
        }
    }
    return encodedConstructor;
}
 
Example 2
Source File: TestGroupSig.java    From group-signature-client with GNU General Public License v3.0 6 votes vote down vote up
public static RemoteCall<TestGroupSig> deploy(
        Web3j web3j,
        Credentials credentials,
        ContractGasProvider contractGasProvider,
        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,
            contractGasProvider,
            BINARY,
            encodedConstructor);
}
 
Example 3
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,
        TransactionManager transactionManager,
        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,
            transactionManager,
            gasPrice,
            gasLimit,
            BINARY,
            encodedConstructor);
}
 
Example 4
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 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,
        TransactionManager transactionManager,
        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,
            transactionManager,
            gasPrice,
            gasLimit,
            BINARY,
            encodedConstructor);
}
 
Example 6
Source File: ContractService.java    From WeBASE-Front with Apache License 2.0 6 votes vote down vote up
public static String constructorEncodedByContractNameAndVersion(String contractName,
        String version, List<Object> params) throws FrontException {
    // Constructor encoded
    String encodedConstructor = "";
    String functionName = contractName;
    // input handle
    List<String> funcInputTypes =
            ContractAbiUtil.getFuncInputType(contractName, functionName, version);
    if (funcInputTypes != null && funcInputTypes.size() > 0) {
        if (funcInputTypes.size() == params.size()) {
            List<Type> finalInputs = AbiUtil.inputFormat(funcInputTypes, params);
            encodedConstructor = FunctionEncoder.encodeConstructor(finalInputs);
            log.info("deploy encodedConstructor:{}", encodedConstructor);
        } else {
            log.warn("deploy fail. funcInputTypes:{}, params:{}", funcInputTypes, params);
            throw new FrontException(ConstantCode.IN_FUNCPARAM_ERROR);
        }
    }
    return encodedConstructor;
}
 
Example 7
Source File: Evidence.java    From WeBASE-Front with Apache License 2.0 5 votes vote down vote up
public static RemoteCall<Evidence> deploy(Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider, String evi, String info, String id, BigInteger v, byte[] r, byte[] s, String addr, String sender) {
    String encodedConstructor = FunctionEncoder.encodeConstructor(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.generated.Uint8(v), 
            new org.fisco.bcos.web3j.abi.datatypes.generated.Bytes32(r), 
            new org.fisco.bcos.web3j.abi.datatypes.generated.Bytes32(s), 
            new org.fisco.bcos.web3j.abi.datatypes.Address(addr), 
            new org.fisco.bcos.web3j.abi.datatypes.Address(sender)));
    return deployRemoteCall(Evidence.class, web3j, credentials, contractGasProvider, BINARY, encodedConstructor);
}
 
Example 8
Source File: Evidence.java    From WeBASE-Front with Apache License 2.0 5 votes vote down vote up
public static RemoteCall<Evidence> deploy(Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider, String evi, String info, String id, BigInteger v, byte[] r, byte[] s, String addr, String sender) {
    String encodedConstructor = FunctionEncoder.encodeConstructor(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.generated.Uint8(v), 
            new org.fisco.bcos.web3j.abi.datatypes.generated.Bytes32(r), 
            new org.fisco.bcos.web3j.abi.datatypes.generated.Bytes32(s), 
            new org.fisco.bcos.web3j.abi.datatypes.Address(addr), 
            new org.fisco.bcos.web3j.abi.datatypes.Address(sender)));
    return deployRemoteCall(Evidence.class, web3j, transactionManager, contractGasProvider, BINARY, encodedConstructor);
}
 
Example 9
Source File: Evidence.java    From WeBASE-Front with Apache License 2.0 5 votes vote down vote up
@Deprecated
public static RemoteCall<Evidence> deploy(Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit, String evi, String info, String id, BigInteger v, byte[] r, byte[] s, String addr, String sender) {
    String encodedConstructor = FunctionEncoder.encodeConstructor(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.generated.Uint8(v), 
            new org.fisco.bcos.web3j.abi.datatypes.generated.Bytes32(r), 
            new org.fisco.bcos.web3j.abi.datatypes.generated.Bytes32(s), 
            new org.fisco.bcos.web3j.abi.datatypes.Address(addr), 
            new org.fisco.bcos.web3j.abi.datatypes.Address(sender)));
    return deployRemoteCall(Evidence.class, web3j, credentials, gasPrice, gasLimit, BINARY, encodedConstructor);
}
 
Example 10
Source File: Evidence.java    From WeBASE-Front with Apache License 2.0 5 votes vote down vote up
@Deprecated
public static RemoteCall<Evidence> deploy(Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit, String evi, String info, String id, BigInteger v, byte[] r, byte[] s, String addr, String sender) {
    String encodedConstructor = FunctionEncoder.encodeConstructor(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.generated.Uint8(v), 
            new org.fisco.bcos.web3j.abi.datatypes.generated.Bytes32(r), 
            new org.fisco.bcos.web3j.abi.datatypes.generated.Bytes32(s), 
            new org.fisco.bcos.web3j.abi.datatypes.Address(addr), 
            new org.fisco.bcos.web3j.abi.datatypes.Address(sender)));
    return deployRemoteCall(Evidence.class, web3j, transactionManager, gasPrice, gasLimit, BINARY, encodedConstructor);
}
 
Example 11
Source File: Evidence.java    From evidenceSample with Apache License 2.0 5 votes vote down vote up
@Deprecated
public static RemoteCall<Evidence> deploy(Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit, String evi, String info, String id, BigInteger v, byte[] r, byte[] s, String addr, String sender) {
    String encodedConstructor = FunctionEncoder.encodeConstructor(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.generated.Uint8(v), 
            new org.fisco.bcos.web3j.abi.datatypes.generated.Bytes32(r), 
            new org.fisco.bcos.web3j.abi.datatypes.generated.Bytes32(s), 
            new org.fisco.bcos.web3j.abi.datatypes.Address(addr), 
            new org.fisco.bcos.web3j.abi.datatypes.Address(sender)));
    return deployRemoteCall(Evidence.class, web3j, credentials, gasPrice, gasLimit, BINARY, encodedConstructor);
}
 
Example 12
Source File: Evidence.java    From evidenceSample with Apache License 2.0 5 votes vote down vote up
public static RemoteCall<Evidence> deploy(Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider, String evi, String info, String id, BigInteger v, byte[] r, byte[] s, String addr, String sender) {
    String encodedConstructor = FunctionEncoder.encodeConstructor(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.generated.Uint8(v), 
            new org.fisco.bcos.web3j.abi.datatypes.generated.Bytes32(r), 
            new org.fisco.bcos.web3j.abi.datatypes.generated.Bytes32(s), 
            new org.fisco.bcos.web3j.abi.datatypes.Address(addr), 
            new org.fisco.bcos.web3j.abi.datatypes.Address(sender)));
    return deployRemoteCall(Evidence.class, web3j, credentials, contractGasProvider, BINARY, encodedConstructor);
}
 
Example 13
Source File: Evidence.java    From evidenceSample with Apache License 2.0 5 votes vote down vote up
public static RemoteCall<Evidence> deploy(Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider, String evi, String info, String id, BigInteger v, byte[] r, byte[] s, String addr, String sender) {
    String encodedConstructor = FunctionEncoder.encodeConstructor(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.generated.Uint8(v), 
            new org.fisco.bcos.web3j.abi.datatypes.generated.Bytes32(r), 
            new org.fisco.bcos.web3j.abi.datatypes.generated.Bytes32(s), 
            new org.fisco.bcos.web3j.abi.datatypes.Address(addr), 
            new org.fisco.bcos.web3j.abi.datatypes.Address(sender)));
    return deployRemoteCall(Evidence.class, web3j, transactionManager, contractGasProvider, BINARY, encodedConstructor);
}
 
Example 14
Source File: EvidenceSignersData.java    From WeBASE-Front with Apache License 2.0 4 votes vote down vote up
@Deprecated
public static RemoteCall<EvidenceSignersData> deploy(Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit, List<String> evidenceSigners) {
    String encodedConstructor = FunctionEncoder.encodeConstructor(Arrays.<Type>asList(evidenceSigners.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(evidenceSigners, org.fisco.bcos.web3j.abi.datatypes.Address.class))));
    return deployRemoteCall(EvidenceSignersData.class, web3j, transactionManager, gasPrice, gasLimit, BINARY, encodedConstructor);
}
 
Example 15
Source File: TopicController.java    From WeEvent with Apache License 2.0 4 votes vote down vote up
public static RemoteCall<TopicController> deploy(Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider, String topicAddress) {
    String encodedConstructor = FunctionEncoder.encodeConstructor(Arrays.<Type>asList(new org.fisco.bcos.web3j.abi.datatypes.Address(topicAddress)));
    return deployRemoteCall(TopicController.class, web3j, transactionManager, contractGasProvider, getBinary(), encodedConstructor);
}
 
Example 16
Source File: EvidenceSignersData.java    From evidenceSample with Apache License 2.0 4 votes vote down vote up
public static RemoteCall<EvidenceSignersData> deploy(Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider, List<String> evidenceSigners) {
    String encodedConstructor = FunctionEncoder.encodeConstructor(Arrays.<Type>asList(new org.fisco.bcos.web3j.abi.datatypes.DynamicArray<org.fisco.bcos.web3j.abi.datatypes.Address>(
                    org.fisco.bcos.web3j.abi.Utils.typeMap(evidenceSigners, org.fisco.bcos.web3j.abi.datatypes.Address.class))));
    return deployRemoteCall(EvidenceSignersData.class, web3j, credentials, contractGasProvider, BINARY, encodedConstructor);
}
 
Example 17
Source File: EvidenceSignersData.java    From evidenceSample with Apache License 2.0 4 votes vote down vote up
@Deprecated
public static RemoteCall<EvidenceSignersData> deploy(Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit, List<String> evidenceSigners) {
    String encodedConstructor = FunctionEncoder.encodeConstructor(Arrays.<Type>asList(new org.fisco.bcos.web3j.abi.datatypes.DynamicArray<org.fisco.bcos.web3j.abi.datatypes.Address>(
                    org.fisco.bcos.web3j.abi.Utils.typeMap(evidenceSigners, org.fisco.bcos.web3j.abi.datatypes.Address.class))));
    return deployRemoteCall(EvidenceSignersData.class, web3j, credentials, gasPrice, gasLimit, BINARY, encodedConstructor);
}
 
Example 18
Source File: EvidenceSignersData.java    From WeBASE-Front with Apache License 2.0 4 votes vote down vote up
@Deprecated
public static RemoteCall<EvidenceSignersData> deploy(Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit, List<String> evidenceSigners) {
    String encodedConstructor = FunctionEncoder.encodeConstructor(Arrays.<Type>asList(evidenceSigners.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(evidenceSigners, org.fisco.bcos.web3j.abi.datatypes.Address.class))));
    return deployRemoteCall(EvidenceSignersData.class, web3j, credentials, gasPrice, gasLimit, BINARY, encodedConstructor);
}
 
Example 19
Source File: EvidenceSignersData.java    From WeBASE-Front with Apache License 2.0 4 votes vote down vote up
public static RemoteCall<EvidenceSignersData> deploy(Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider, List<String> evidenceSigners) {
    String encodedConstructor = FunctionEncoder.encodeConstructor(Arrays.<Type>asList(evidenceSigners.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(evidenceSigners, org.fisco.bcos.web3j.abi.datatypes.Address.class))));
    return deployRemoteCall(EvidenceSignersData.class, web3j, transactionManager, contractGasProvider, BINARY, encodedConstructor);
}
 
Example 20
Source File: EvidenceSignersData.java    From WeBASE-Front with Apache License 2.0 4 votes vote down vote up
public static RemoteCall<EvidenceSignersData> deploy(Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider, List<String> evidenceSigners) {
    String encodedConstructor = FunctionEncoder.encodeConstructor(Arrays.<Type>asList(evidenceSigners.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(evidenceSigners, org.fisco.bcos.web3j.abi.datatypes.Address.class))));
    return deployRemoteCall(EvidenceSignersData.class, web3j, credentials, contractGasProvider, BINARY, encodedConstructor);
}