Search in sources :

Example 1 with Tuple2

use of org.fisco.bcos.web3j.tuples.generated.Tuple2 in project web3sdk by FISCO-BCOS.

the class ChannelConnections method heartbeat.

public void heartbeat() {
    List<Tuple2<String, ChannelHandlerContext>> tuple2List = new ArrayList<>();
    for (Map.Entry<String, ChannelHandlerContext> entry : networkConnections.entrySet()) {
        String peer = entry.getKey();
        ChannelHandlerContext ctx = entry.getValue();
        if (Objects.nonNull(ctx) && ctx.channel().isActive() && ChannelHandlerContextHelper.isChannelAvailable(ctx)) {
            tuple2List.add(new Tuple2<>(peer, ctx));
        }
    }
    for (Tuple2<String, ChannelHandlerContext> tuple2 : tuple2List) {
        logger.trace(" send heart beat to {}", tuple2.getValue1());
        callback.sendHeartbeat(tuple2.getValue2());
    }
}
Also used : Tuple2(org.fisco.bcos.web3j.tuples.generated.Tuple2) ArrayList(java.util.ArrayList) ChannelHandlerContext(io.netty.channel.ChannelHandlerContext) Map(java.util.Map) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap)

Example 2 with Tuple2

use of org.fisco.bcos.web3j.tuples.generated.Tuple2 in project web3sdk by FISCO-BCOS.

the class ChainGovernance method getUpdateCommitteeMemberWeightInput.

public Tuple2<String, BigInteger> getUpdateCommitteeMemberWeightInput(TransactionReceipt transactionReceipt) {
    String data = transactionReceipt.getInput().substring(10);
    final Function function = new Function(FUNC_UPDATECOMMITTEEMEMBERWEIGHT, Arrays.<Type>asList(), Arrays.<TypeReference<?>>asList(new TypeReference<Address>() {
    }, new TypeReference<Int256>() {
    }));
    List<Type> results = FunctionReturnDecoder.decode(data, function.getOutputParameters());
    ;
    return new Tuple2<String, BigInteger>((String) results.get(0).getValue(), (BigInteger) results.get(1).getValue());
}
Also used : Function(org.fisco.bcos.web3j.abi.datatypes.Function) Type(org.fisco.bcos.web3j.abi.datatypes.Type) Tuple2(org.fisco.bcos.web3j.tuples.generated.Tuple2) Utf8String(org.fisco.bcos.web3j.abi.datatypes.Utf8String) TypeReference(org.fisco.bcos.web3j.abi.TypeReference)

Example 3 with Tuple2

use of org.fisco.bcos.web3j.tuples.generated.Tuple2 in project web3sdk by FISCO-BCOS.

the class Permission method getRemoveInput.

public Tuple2<String, String> getRemoveInput(TransactionReceipt transactionReceipt) {
    String data = transactionReceipt.getInput().substring(10);
    final Function function = new Function(FUNC_REMOVE, Arrays.<Type>asList(), Arrays.<TypeReference<?>>asList(new TypeReference<Utf8String>() {
    }, new TypeReference<Utf8String>() {
    }));
    List<Type> results = FunctionReturnDecoder.decode(data, function.getOutputParameters());
    ;
    return new Tuple2<String, String>((String) results.get(0).getValue(), (String) results.get(1).getValue());
}
Also used : Function(org.fisco.bcos.web3j.abi.datatypes.Function) Type(org.fisco.bcos.web3j.abi.datatypes.Type) EncryptType(org.fisco.bcos.web3j.crypto.EncryptType) Tuple2(org.fisco.bcos.web3j.tuples.generated.Tuple2) Utf8String(org.fisco.bcos.web3j.abi.datatypes.Utf8String) TypeReference(org.fisco.bcos.web3j.abi.TypeReference)

Example 4 with Tuple2

use of org.fisco.bcos.web3j.tuples.generated.Tuple2 in project web3sdk by FISCO-BCOS.

the class Permission method getGrantWriteInput.

public Tuple2<String, String> getGrantWriteInput(TransactionReceipt transactionReceipt) {
    String data = transactionReceipt.getInput().substring(10);
    final Function function = new Function(FUNC_GRANTWRITE, 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());
}
Also used : Function(org.fisco.bcos.web3j.abi.datatypes.Function) Type(org.fisco.bcos.web3j.abi.datatypes.Type) EncryptType(org.fisco.bcos.web3j.crypto.EncryptType) Tuple2(org.fisco.bcos.web3j.tuples.generated.Tuple2) Utf8String(org.fisco.bcos.web3j.abi.datatypes.Utf8String) TypeReference(org.fisco.bcos.web3j.abi.TypeReference)

Example 5 with Tuple2

use of org.fisco.bcos.web3j.tuples.generated.Tuple2 in project web3sdk by FISCO-BCOS.

the class ContractLifeCyclePrecompiled method getGrantManagerInput.

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());
}
Also used : Function(org.fisco.bcos.web3j.abi.datatypes.Function) Type(org.fisco.bcos.web3j.abi.datatypes.Type) Tuple2(org.fisco.bcos.web3j.tuples.generated.Tuple2) Utf8String(org.fisco.bcos.web3j.abi.datatypes.Utf8String) TypeReference(org.fisco.bcos.web3j.abi.TypeReference)

Aggregations

Tuple2 (org.fisco.bcos.web3j.tuples.generated.Tuple2)11 Type (org.fisco.bcos.web3j.abi.datatypes.Type)8 TypeReference (org.fisco.bcos.web3j.abi.TypeReference)7 Function (org.fisco.bcos.web3j.abi.datatypes.Function)7 Utf8String (org.fisco.bcos.web3j.abi.datatypes.Utf8String)7 EncryptType (org.fisco.bcos.web3j.crypto.EncryptType)4 ArrayList (java.util.ArrayList)3 RateLimiter (com.google.common.util.concurrent.RateLimiter)2 BigInteger (java.math.BigInteger)2 Map (java.util.Map)2 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)2 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 CollectionType (com.fasterxml.jackson.databind.type.CollectionType)1 ChannelHandlerContext (io.netty.channel.ChannelHandlerContext)1 BufferedReader (java.io.BufferedReader)1 BufferedWriter (java.io.BufferedWriter)1 File (java.io.File)1 FileReader (java.io.FileReader)1 FileWriter (java.io.FileWriter)1