Java Code Examples for org.fisco.bcos.web3j.abi.datatypes.Address

The following examples show how to use org.fisco.bcos.web3j.abi.datatypes.Address. These examples are extracted from open source projects. 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 Project: WeBASE-Node-Manager   Source File: ContractController.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * send transaction.
 */
@PostMapping(value = "/transaction")
@PreAuthorize(ConstantProperties.HAS_ROLE_ADMIN)
public BaseResponse sendTransaction(@RequestBody @Valid TransactionInputParam param,
    BindingResult result) throws NodeMgrException {
    checkBindResult(result);
    // 0x0000000000000000000000000000000000000000 address is invalid
    if (Address.DEFAULT.toString().equals(param.getContractAddress())) {
        throw new NodeMgrException(ConstantCode.CONTRACT_ADDRESS_INVALID);
    }
    Instant startTime = Instant.now();
    log.info("start sendTransaction startTime:{} param:{}", startTime.toEpochMilli(),
        JsonTools.toJSONString(param));
    BaseResponse baseResponse = new BaseResponse(ConstantCode.SUCCESS);
    Object transRsp = contractService.sendTransaction(param);
    baseResponse.setData(transRsp);
    log.info("end sendTransaction useTime:{} result:{}",
        Duration.between(startTime, Instant.now()).toMillis(), JsonTools.toJSONString(baseResponse));

    return baseResponse;
}
 
Example 2
Source Project: evidenceSample   Source File: BcosApp.java    License: Apache License 2.0 6 votes vote down vote up
public Address deployContract(String keyStoreFileName,String keyStorePassword, String keyPassword) throws Exception {
	if (web3j == null )
		return null;
	Credentials credentials=loadkey(keyStoreFileName,keyStorePassword,keyPassword);
	if(credentials==null){
		return null;
	}
    //Service service = context.getBean(Service.class);
    //service.run();
    PublicAddressConf conf = context.getBean(PublicAddressConf.class);
       ConcurrentHashMap<String, String> addressConf = conf.getAllPublicAddress();
       List<String> arrayList = addressConf.values().stream().map(String::new).collect(Collectors.toCollection(ArrayList::new));
       try {
           evidenceSignersData = EvidenceSignersData.deploy(web3j, credentials, new StaticGasProvider(gasPrice, gasLimited), arrayList).send();
       } catch (Exception e) {
           e.printStackTrace();
       }
       return new Address(evidenceSignersData.getContractAddress());
	        
}
 
Example 3
Source Project: evidenceSample   Source File: Evidence.java    License: 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 4
Source Project: WeEvent   Source File: Topic.java    License: 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 5
Source Project: web3sdk   Source File: EvidenceVerify.java    License: 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 6
Source Project: web3sdk   Source File: EventEncoderTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testEventbuildMethodSignature8() {
    Event event =
            new Event(
                    "test8",
                    Arrays.<TypeReference<?>>asList(
                            new TypeReference<Utf8String>() {},
                            new TypeReference<Address>() {},
                            new TypeReference<Uint256>() {},
                            new TypeReference<Int256>() {}));

    assertThat(
            EventEncoder.buildMethodSignature(event.getName(), event.getParameters()),
            is("test8(string,address,uint256,int256)"));

    assertThat(
            EventEncoder.encode(event),
            is("0xfa3d7a982eb00eec003de55d3e9266fa4b9ccd6a3a067b75b24ef6b4cb9b12c4"));
    assertThat(
            EventEncoder.buildEventSignature("test8(string,address,uint256,int256)"),
            is("0xfa3d7a982eb00eec003de55d3e9266fa4b9ccd6a3a067b75b24ef6b4cb9b12c4"));
}
 
Example 7
Source Project: web3sdk   Source File: EvidenceVerify.java    License: Apache License 2.0 6 votes vote down vote up
public void insertEvidence(
        String evi,
        String info,
        String id,
        String signAddr,
        byte[] message,
        BigInteger v,
        byte[] r,
        byte[] s,
        TransactionSucCallback callback) {
    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());
    asyncExecuteTransaction(function, callback);
}
 
Example 8
Source Project: web3sdk   Source File: ChainGovernance.java    License: 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 9
Source Project: web3sdk   Source File: ContractLifeCyclePrecompiled.java    License: Apache License 2.0 5 votes vote down vote up
public RemoteCall<TransactionReceipt> grantManager(String contractAddr, String userAddr) {
    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());
    return executeRemoteCallTransaction(function);
}
 
Example 10
Source Project: web3sdk   Source File: ChainGovernance.java    License: 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 11
Source Project: evidenceSample   Source File: Evidence.java    License: Apache License 2.0 5 votes vote down vote up
public RemoteCall<List> getSigners() {
    final Function function = new Function(FUNC_GETSIGNERS, 
            Arrays.<Type>asList(), 
            Arrays.<TypeReference<?>>asList(new TypeReference<DynamicArray<Address>>() {}));
    return new RemoteCall<List>(
            new Callable<List>() {
                @Override
                @SuppressWarnings("unchecked")
                public List call() throws Exception {
                    List<Type> result = (List<Type>) executeCallSingleValueReturn(function, List.class);
                    return convertToNative(result);
                }
            });
}
 
Example 12
Source Project: WeBASE-Front   Source File: EvidenceSignersData.java    License: Apache License 2.0 5 votes vote down vote up
public Tuple1<String> getNewEvidenceOutput(TransactionReceipt transactionReceipt) {
    String data = transactionReceipt.getOutput();
    final Function function = new Function(FUNC_NEWEVIDENCE, 
            Arrays.<Type>asList(), 
            Arrays.<TypeReference<?>>asList(new TypeReference<Address>() {}));
    List<Type> results = FunctionReturnDecoder.decode(data, function.getOutputParameters());;
    return new Tuple1<String>(

            (String) results.get(0).getValue()
            );
}
 
Example 13
Source Project: web3sdk   Source File: ChainGovernance.java    License: Apache License 2.0 5 votes vote down vote up
public String grantCommitteeMemberSeq(String user) {
    final Function function =
            new Function(
                    FUNC_GRANTCOMMITTEEMEMBER,
                    Arrays.<Type>asList(new org.fisco.bcos.web3j.abi.datatypes.Address(user)),
                    Collections.<TypeReference<?>>emptyList());
    return createTransactionSeq(function);
}
 
Example 14
Source Project: evidenceSample   Source File: BcosApp.java    License: Apache License 2.0 5 votes vote down vote up
public Address newEvidence(String keyStoreFileName,String keyStorePassword, String keyPassword,String address,String evidenceId,String evidenceHash) throws Exception {
	Credentials credentials=loadkey(keyStoreFileName,keyStorePassword,keyPassword);
	if(credentials==null){
		return null;
	}
	if (web3j == null)
		return null;
	
	if (address != null) {
		evidenceSignersData = EvidenceSignersData.load(address.toString(), web3j,  credentials, new StaticGasProvider(gasPrice, gasLimited));
	}
	String evidence_id=evidenceId;
	String evidence_hash=evidenceHash;
	//通过hash和key算出一个用户机构签名数据
	Sign.SignatureData data = Sign.getSignInterface().signMessage(evidence_hash.getBytes(), credentials.getEcKeyPair());
	String sign_data=Tools.signatureDataToString(data);
	TransactionReceipt receipt = null;
	try {
		Sign.SignatureData signatureData = Tools.stringToSignatureData(sign_data);
		System.out.println("正在执行!");
		receipt = evidenceSignersData.newEvidence(evidence_hash, evidence_id,evidence_id, BigInteger.valueOf(signatureData.getV()),signatureData.getR(),signatureData.getS()).sendAsync().get();
		List<EvidenceSignersData.NewEvidenceEventEventResponse> newEvidenceList = evidenceSignersData.getNewEvidenceEventEvents(receipt);
		if (newEvidenceList.size() > 0) {
               return new Address(newEvidenceList.get(0).addr);
        } else {
               return null;
        }
	} catch (InterruptedException | ExecutionException e) {
		throw e;
	}
	
}
 
Example 15
Source Project: web3sdk   Source File: ChainGovernance.java    License: Apache License 2.0 5 votes vote down vote up
public RemoteCall<TransactionReceipt> revokeOperator(String user) {
    final Function function =
            new Function(
                    FUNC_REVOKEOPERATOR,
                    Arrays.<Type>asList(new org.fisco.bcos.web3j.abi.datatypes.Address(user)),
                    Collections.<TypeReference<?>>emptyList());
    return executeRemoteCallTransaction(function);
}
 
Example 16
Source Project: web3sdk   Source File: ContractLifeCyclePrecompiled.java    License: Apache License 2.0 5 votes vote down vote up
public Tuple2<String, String> getGrantManagerInput(TransactionReceipt transactionReceipt) {
    String data = transactionReceipt.getInput().substring(10);
    final Function function =
            new Function(
                    FUNC_GRANTMANAGER,
                    Arrays.<Type>asList(),
                    Arrays.<TypeReference<?>>asList(
                            new TypeReference<Address>() {}, new TypeReference<Address>() {}));
    List<Type> results = FunctionReturnDecoder.decode(data, function.getOutputParameters());
    ;
    return new Tuple2<String, String>(
            (String) results.get(0).getValue(), (String) results.get(1).getValue());
}
 
Example 17
Source Project: web3sdk   Source File: ContractLifeCyclePrecompiled.java    License: Apache License 2.0 5 votes vote down vote up
public RemoteCall<TransactionReceipt> unfreeze(String addr) {
    final Function function =
            new Function(
                    FUNC_UNFREEZE,
                    Arrays.<Type>asList(new org.fisco.bcos.web3j.abi.datatypes.Address(addr)),
                    Collections.<TypeReference<?>>emptyList());
    return executeRemoteCallTransaction(function);
}
 
Example 18
Source Project: web3sdk   Source File: Permission.java    License: Apache License 2.0 5 votes vote down vote up
public RemoteCall<String> queryPermission(String contractAddr) {
    final Function function =
            new Function(
                    FUNC_QUERYPERMISSION,
                    Arrays.<Type>asList(
                            new org.fisco.bcos.web3j.abi.datatypes.Address(contractAddr)),
                    Arrays.<TypeReference<?>>asList(new TypeReference<Utf8String>() {}));
    return executeRemoteCallSingleValueReturn(function, String.class);
}
 
Example 19
Source Project: web3sdk   Source File: ChainGovernance.java    License: Apache License 2.0 5 votes vote down vote up
public RemoteCall<TransactionReceipt> grantCommitteeMember(String user) {
    final Function function =
            new Function(
                    FUNC_GRANTCOMMITTEEMEMBER,
                    Arrays.<Type>asList(new org.fisco.bcos.web3j.abi.datatypes.Address(user)),
                    Collections.<TypeReference<?>>emptyList());
    return executeRemoteCallTransaction(function);
}
 
Example 20
Source Project: WeBASE-Front   Source File: Evidence.java    License: 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 21
Source Project: evidenceSample   Source File: Evidence.java    License: 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 22
Source Project: WeBASE-Collect-Bee   Source File: AddressListUtils.java    License: Apache License 2.0 5 votes vote down vote up
public static List<String> addressToStrList(List<Address> adressList) {
    if (adressList.isEmpty()) {
        return new ArrayList<String>();
    } else {
        return adressList.stream().map(addr -> {
            return addr.toString().trim();
        }).collect(Collectors.toList());
    }
}
 
Example 23
Source Project: web3sdk   Source File: ChainGovernance.java    License: Apache License 2.0 5 votes vote down vote up
public Tuple1<String> getGrantOperatorInput(TransactionReceipt transactionReceipt) {
    String data = transactionReceipt.getInput().substring(10);
    final Function function =
            new Function(
                    FUNC_GRANTOPERATOR,
                    Arrays.<Type>asList(),
                    Arrays.<TypeReference<?>>asList(new TypeReference<Address>() {}));
    List<Type> results = FunctionReturnDecoder.decode(data, function.getOutputParameters());
    ;
    return new Tuple1<String>((String) results.get(0).getValue());
}
 
Example 24
Source Project: WeEvent   Source File: TopicController.java    License: Apache License 2.0 5 votes vote down vote up
public RemoteCall<TransactionReceipt> flushTopicInfo(List<String> topicName, List<String> topicSender,
                                                     List<BigInteger> topicTimestamp, List<BigInteger> topicBlock,
                                                     List<BigInteger> lastSequence, List<BigInteger> lastBlock,
                                                     List<BigInteger> lastTimestamp, List<String> lastSender) {
    final Function function = new Function(
            FUNC_FLUSHTOPICINFO, 
            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)), 
            topicSender.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(topicSender, org.fisco.bcos.web3j.abi.datatypes.Address.class)), 
            topicTimestamp.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(topicTimestamp, org.fisco.bcos.web3j.abi.datatypes.generated.Uint256.class)), 
            topicBlock.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(topicBlock, org.fisco.bcos.web3j.abi.datatypes.generated.Uint256.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());
    return executeRemoteCallTransaction(function);
}
 
Example 25
Source Project: web3sdk   Source File: ContractLifeCyclePrecompiled.java    License: Apache License 2.0 5 votes vote down vote up
public void unfreeze(String addr, TransactionSucCallback callback) {
    final Function function =
            new Function(
                    FUNC_UNFREEZE,
                    Arrays.<Type>asList(new org.fisco.bcos.web3j.abi.datatypes.Address(addr)),
                    Collections.<TypeReference<?>>emptyList());
    asyncExecuteTransaction(function, callback);
}
 
Example 26
Source Project: WeEvent   Source File: TopicController.java    License: Apache License 2.0 5 votes vote down vote up
public Tuple8<List<String>, List<String>, List<BigInteger>, List<BigInteger>, List<BigInteger>, List<BigInteger>, List<BigInteger>, List<String>> getFlushTopicInfoInput(
    TransactionReceipt transactionReceipt) {
    String data = transactionReceipt.getInput().substring(10);
    final Function function = new Function(FUNC_FLUSHTOPICINFO, 
            Arrays.<Type>asList(), 
            Arrays.<TypeReference<?>>asList(
                new TypeReference<DynamicArray<Utf8String>>() {},
                new TypeReference<DynamicArray<Address>>() {},
                new TypeReference<DynamicArray<Uint256>>() {},
                new TypeReference<DynamicArray<Uint256>>() {},
                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 Tuple8<List<String>, List<String>, List<BigInteger>, List<BigInteger>, List<BigInteger>, List<BigInteger>, List<BigInteger>, List<String>>(

            convertToNative((List<Utf8String>) results.get(0).getValue()), 
            convertToNative((List<Address>) results.get(1).getValue()), 
            convertToNative((List<Uint256>) results.get(2).getValue()), 
            convertToNative((List<Uint256>) results.get(3).getValue()), 
            convertToNative((List<Uint256>) results.get(4).getValue()), 
            convertToNative((List<Uint256>) results.get(5).getValue()), 
            convertToNative((List<Uint256>) results.get(6).getValue()), 
            convertToNative((List<Address>) results.get(7).getValue())
            );
}
 
Example 27
Source Project: evidenceSample   Source File: Evidence.java    License: 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 28
Source Project: web3sdk   Source File: ChainGovernance.java    License: Apache License 2.0 5 votes vote down vote up
public RemoteCall<TransactionReceipt> freezeAccount(String account) {
    final Function function =
            new Function(
                    FUNC_FREEZEACCOUNT,
                    Arrays.<Type>asList(
                            new org.fisco.bcos.web3j.abi.datatypes.Address(account)),
                    Collections.<TypeReference<?>>emptyList());
    return executeRemoteCallTransaction(function);
}
 
Example 29
Source Project: WeEvent   Source File: Topic.java    License: 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 30
Source Project: web3sdk   Source File: ContractLifeCyclePrecompiled.java    License: Apache License 2.0 5 votes vote down vote up
public void freeze(String addr, TransactionSucCallback callback) {
    final Function function =
            new Function(
                    FUNC_FREEZE,
                    Arrays.<Type>asList(new org.fisco.bcos.web3j.abi.datatypes.Address(addr)),
                    Collections.<TypeReference<?>>emptyList());
    asyncExecuteTransaction(function, callback);
}