org.web3j.abi.datatypes.generated.Bytes32 Java Examples

The following examples show how to use org.web3j.abi.datatypes.generated.Bytes32. 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: DepositContract.java    From teku with Apache License 2.0 6 votes vote down vote up
public RemoteFunctionCall<TransactionReceipt> deposit(
    byte[] pubkey,
    byte[] withdrawal_credentials,
    byte[] signature,
    byte[] deposit_data_root,
    BigInteger weiValue) {
  final org.web3j.abi.datatypes.Function function =
      new org.web3j.abi.datatypes.Function(
          FUNC_DEPOSIT,
          Arrays.<Type>asList(
              new org.web3j.abi.datatypes.DynamicBytes(pubkey),
              new org.web3j.abi.datatypes.DynamicBytes(withdrawal_credentials),
              new org.web3j.abi.datatypes.DynamicBytes(signature),
              new org.web3j.abi.datatypes.generated.Bytes32(deposit_data_root)),
          Collections.<TypeReference<?>>emptyList());
  return executeRemoteCallTransaction(function, weiValue);
}
 
Example #2
Source File: ENS.java    From etherscan-explorer with GNU General Public License v3.0 6 votes vote down vote up
public Observable<NewResolverEventResponse> newResolverEventObservable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
    final Event event = new Event("NewResolver", 
            Arrays.<TypeReference<?>>asList(new TypeReference<Bytes32>() {}),
            Arrays.<TypeReference<?>>asList(new TypeReference<Address>() {}));
    EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress());
    filter.addSingleTopic(EventEncoder.encode(event));
    return web3j.ethLogObservable(filter).map(new Func1<Log, NewResolverEventResponse>() {
        @Override
        public NewResolverEventResponse call(Log log) {
            EventValues eventValues = extractEventParameters(event, log);
            NewResolverEventResponse typedResponse = new NewResolverEventResponse();
            typedResponse.node = (byte[]) eventValues.getIndexedValues().get(0).getValue();
            typedResponse.resolver = (String) eventValues.getNonIndexedValues().get(0).getValue();
            return typedResponse;
        }
    });
}
 
Example #3
Source File: ENS.java    From etherscan-explorer with GNU General Public License v3.0 6 votes vote down vote up
public Observable<NewTTLEventResponse> newTTLEventObservable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
    final Event event = new Event("NewTTL", 
            Arrays.<TypeReference<?>>asList(new TypeReference<Bytes32>() {}),
            Arrays.<TypeReference<?>>asList(new TypeReference<Uint64>() {}));
    EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress());
    filter.addSingleTopic(EventEncoder.encode(event));
    return web3j.ethLogObservable(filter).map(new Func1<Log, NewTTLEventResponse>() {
        @Override
        public NewTTLEventResponse call(Log log) {
            EventValues eventValues = extractEventParameters(event, log);
            NewTTLEventResponse typedResponse = new NewTTLEventResponse();
            typedResponse.node = (byte[]) eventValues.getIndexedValues().get(0).getValue();
            typedResponse.ttl = (BigInteger) eventValues.getNonIndexedValues().get(0).getValue();
            return typedResponse;
        }
    });
}
 
Example #4
Source File: SolidityFunctionWrapperTest.java    From etherscan-explorer with GNU General Public License v3.0 6 votes vote down vote up
@Test
public void testGetNativeType() {
    assertThat(getNativeType(TypeName.get(Address.class)),
            equalTo(TypeName.get(String.class)));
    assertThat(getNativeType(TypeName.get(Uint256.class)),
            equalTo(TypeName.get(BigInteger.class)));
    assertThat(getNativeType(TypeName.get(Int256.class)),
            equalTo(TypeName.get(BigInteger.class)));
    assertThat(getNativeType(TypeName.get(Utf8String.class)),
            equalTo(TypeName.get(String.class)));
    assertThat(getNativeType(TypeName.get(Bool.class)),
            equalTo(TypeName.get(Boolean.class)));
    assertThat(getNativeType(TypeName.get(Bytes32.class)),
            equalTo(TypeName.get(byte[].class)));
    assertThat(getNativeType(TypeName.get(DynamicBytes.class)),
            equalTo(TypeName.get(byte[].class)));
}
 
Example #5
Source File: BlindAuction.java    From web3j with Apache License 2.0 6 votes vote down vote up
public RemoteCall<Tuple2<byte[], BigInteger>> bids(String param0, BigInteger param1) {
    final Function function = new Function(FUNC_BIDS,
            Arrays.<Type>asList(new org.web3j.abi.datatypes.Address(param0),
            new org.web3j.abi.datatypes.generated.Uint256(param1)), 
            Arrays.<TypeReference<?>>asList(new TypeReference<Bytes32>() {}, new TypeReference<Uint256>() {}));
    return new RemoteCall<Tuple2<byte[], BigInteger>>(
            new Callable<Tuple2<byte[], BigInteger>>() {
                @Override
                public Tuple2<byte[], BigInteger> call() throws Exception {
                    List<Type> results = executeCallMultipleValueReturn(function);
                    return new Tuple2<byte[], BigInteger>(
                            (byte[]) results.get(0).getValue(), 
                            (BigInteger) results.get(1).getValue());
                }
            });
}
 
Example #6
Source File: ENS.java    From etherscan-explorer with GNU General Public License v3.0 6 votes vote down vote up
public Observable<TransferEventResponse> transferEventObservable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
    final Event event = new Event("Transfer", 
            Arrays.<TypeReference<?>>asList(new TypeReference<Bytes32>() {}),
            Arrays.<TypeReference<?>>asList(new TypeReference<Address>() {}));
    EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress());
    filter.addSingleTopic(EventEncoder.encode(event));
    return web3j.ethLogObservable(filter).map(new Func1<Log, TransferEventResponse>() {
        @Override
        public TransferEventResponse call(Log log) {
            EventValues eventValues = extractEventParameters(event, log);
            TransferEventResponse typedResponse = new TransferEventResponse();
            typedResponse.node = (byte[]) eventValues.getIndexedValues().get(0).getValue();
            typedResponse.owner = (String) eventValues.getNonIndexedValues().get(0).getValue();
            return typedResponse;
        }
    });
}
 
Example #7
Source File: PublicResolver.java    From etherscan-explorer with GNU General Public License v3.0 6 votes vote down vote up
public Observable<ContentChangedEventResponse> contentChangedEventObservable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
    final Event event = new Event("ContentChanged", 
            Arrays.<TypeReference<?>>asList(new TypeReference<Bytes32>() {}),
            Arrays.<TypeReference<?>>asList(new TypeReference<Bytes32>() {}));
    EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress());
    filter.addSingleTopic(EventEncoder.encode(event));
    return web3j.ethLogObservable(filter).map(new Func1<Log, ContentChangedEventResponse>() {
        @Override
        public ContentChangedEventResponse call(Log log) {
            EventValues eventValues = extractEventParameters(event, log);
            ContentChangedEventResponse typedResponse = new ContentChangedEventResponse();
            typedResponse.node = (byte[]) eventValues.getIndexedValues().get(0).getValue();
            typedResponse.hash = (byte[]) eventValues.getNonIndexedValues().get(0).getValue();
            return typedResponse;
        }
    });
}
 
Example #8
Source File: PublicResolver.java    From etherscan-explorer with GNU General Public License v3.0 6 votes vote down vote up
public Observable<NameChangedEventResponse> nameChangedEventObservable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
    final Event event = new Event("NameChanged", 
            Arrays.<TypeReference<?>>asList(new TypeReference<Bytes32>() {}),
            Arrays.<TypeReference<?>>asList(new TypeReference<Utf8String>() {}));
    EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress());
    filter.addSingleTopic(EventEncoder.encode(event));
    return web3j.ethLogObservable(filter).map(new Func1<Log, NameChangedEventResponse>() {
        @Override
        public NameChangedEventResponse call(Log log) {
            EventValues eventValues = extractEventParameters(event, log);
            NameChangedEventResponse typedResponse = new NameChangedEventResponse();
            typedResponse.node = (byte[]) eventValues.getIndexedValues().get(0).getValue();
            typedResponse.name = (String) eventValues.getNonIndexedValues().get(0).getValue();
            return typedResponse;
        }
    });
}
 
Example #9
Source File: ENS.java    From etherscan-explorer with GNU General Public License v3.0 6 votes vote down vote up
public Observable<NewOwnerEventResponse> newOwnerEventObservable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
    final Event event = new Event("NewOwner", 
            Arrays.<TypeReference<?>>asList(new TypeReference<Bytes32>() {}, new TypeReference<Bytes32>() {}),
            Arrays.<TypeReference<?>>asList(new TypeReference<Address>() {}));
    EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress());
    filter.addSingleTopic(EventEncoder.encode(event));
    return web3j.ethLogObservable(filter).map(new Func1<Log, NewOwnerEventResponse>() {
        @Override
        public NewOwnerEventResponse call(Log log) {
            EventValues eventValues = extractEventParameters(event, log);
            NewOwnerEventResponse typedResponse = new NewOwnerEventResponse();
            typedResponse.node = (byte[]) eventValues.getIndexedValues().get(0).getValue();
            typedResponse.label = (byte[]) eventValues.getIndexedValues().get(1).getValue();
            typedResponse.owner = (String) eventValues.getNonIndexedValues().get(0).getValue();
            return typedResponse;
        }
    });
}
 
Example #10
Source File: PublicResolver.java    From etherscan-explorer with GNU General Public License v3.0 6 votes vote down vote up
public Observable<ABIChangedEventResponse> aBIChangedEventObservable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
    final Event event = new Event("ABIChanged", 
            Arrays.<TypeReference<?>>asList(new TypeReference<Bytes32>() {}, new TypeReference<Uint256>() {}),
            Arrays.<TypeReference<?>>asList());
    EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress());
    filter.addSingleTopic(EventEncoder.encode(event));
    return web3j.ethLogObservable(filter).map(new Func1<Log, ABIChangedEventResponse>() {
        @Override
        public ABIChangedEventResponse call(Log log) {
            EventValues eventValues = extractEventParameters(event, log);
            ABIChangedEventResponse typedResponse = new ABIChangedEventResponse();
            typedResponse.node = (byte[]) eventValues.getIndexedValues().get(0).getValue();
            typedResponse.contentType = (BigInteger) eventValues.getIndexedValues().get(1).getValue();
            return typedResponse;
        }
    });
}
 
Example #11
Source File: ShipIt.java    From web3j with Apache License 2.0 6 votes vote down vote up
public RemoteCall<Tuple8<String, String, BigInteger, BigInteger, BigInteger, BigInteger, String, byte[]>> shipments(String param0) {
    final Function function = new Function(FUNC_SHIPMENTS, 
            Arrays.<Type>asList(new org.web3j.abi.datatypes.Address(param0)), 
            Arrays.<TypeReference<?>>asList(new TypeReference<Address>() {}, new TypeReference<Address>() {}, new TypeReference<Uint256>() {}, new TypeReference<Uint256>() {}, new TypeReference<Uint8>() {}, new TypeReference<Uint256>() {}, new TypeReference<Utf8String>() {}, new TypeReference<Bytes32>() {}));
    return new RemoteCall<Tuple8<String, String, BigInteger, BigInteger, BigInteger, BigInteger, String, byte[]>>(
            new Callable<Tuple8<String, String, BigInteger, BigInteger, BigInteger, BigInteger, String, byte[]>>() {
                @Override
                public Tuple8<String, String, BigInteger, BigInteger, BigInteger, BigInteger, String, byte[]> call() throws Exception {
                    List<Type> results = executeCallMultipleValueReturn(function);
                    return new Tuple8<String, String, BigInteger, BigInteger, BigInteger, BigInteger, String, byte[]>(
                            (String) results.get(0).getValue(), 
                            (String) results.get(1).getValue(), 
                            (BigInteger) results.get(2).getValue(), 
                            (BigInteger) results.get(3).getValue(), 
                            (BigInteger) results.get(4).getValue(), 
                            (BigInteger) results.get(5).getValue(), 
                            (String) results.get(6).getValue(), 
                            (byte[]) results.get(7).getValue());
                }
            });
}
 
Example #12
Source File: DefaultFunctionReturnDecoder.java    From web3j with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("unchecked")
public <T extends Type> Type decodeEventParameter(
        String rawInput, TypeReference<T> typeReference) {

    String input = Numeric.cleanHexPrefix(rawInput);

    try {
        Class<T> type = typeReference.getClassType();

        if (Bytes.class.isAssignableFrom(type)) {
            Class<Bytes> bytesClass = (Class<Bytes>) Class.forName(type.getName());
            return TypeDecoder.decodeBytes(input, bytesClass);
        } else if (Array.class.isAssignableFrom(type)
                || BytesType.class.isAssignableFrom(type)
                || Utf8String.class.isAssignableFrom(type)) {
            return TypeDecoder.decodeBytes(input, Bytes32.class);
        } else {
            return TypeDecoder.decode(input, type);
        }
    } catch (ClassNotFoundException e) {
        throw new UnsupportedOperationException("Invalid class reference provided", e);
    }
}
 
Example #13
Source File: PublicResolver.java    From etherscan-explorer with GNU General Public License v3.0 6 votes vote down vote up
public Observable<PubkeyChangedEventResponse> pubkeyChangedEventObservable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
    final Event event = new Event("PubkeyChanged", 
            Arrays.<TypeReference<?>>asList(new TypeReference<Bytes32>() {}),
            Arrays.<TypeReference<?>>asList(new TypeReference<Bytes32>() {}, new TypeReference<Bytes32>() {}));
    EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress());
    filter.addSingleTopic(EventEncoder.encode(event));
    return web3j.ethLogObservable(filter).map(new Func1<Log, PubkeyChangedEventResponse>() {
        @Override
        public PubkeyChangedEventResponse call(Log log) {
            EventValues eventValues = extractEventParameters(event, log);
            PubkeyChangedEventResponse typedResponse = new PubkeyChangedEventResponse();
            typedResponse.node = (byte[]) eventValues.getIndexedValues().get(0).getValue();
            typedResponse.x = (byte[]) eventValues.getNonIndexedValues().get(0).getValue();
            typedResponse.y = (byte[]) eventValues.getNonIndexedValues().get(1).getValue();
            return typedResponse;
        }
    });
}
 
Example #14
Source File: PublicResolver.java    From etherscan-explorer with GNU General Public License v3.0 6 votes vote down vote up
public RemoteCall<Tuple2<BigInteger, byte[]>> ABI(byte[] node, BigInteger contentTypes) {
    final Function function = new Function("ABI",
            Arrays.<Type>asList(new org.web3j.abi.datatypes.generated.Bytes32(node),
            new org.web3j.abi.datatypes.generated.Uint256(contentTypes)),
            Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>() {}, new TypeReference<DynamicBytes>() {}));
    return new RemoteCall<Tuple2<BigInteger, byte[]>>(
            new Callable<Tuple2<BigInteger, byte[]>>() {
                @Override
                public Tuple2<BigInteger, byte[]> call() throws Exception {
                    List<Type> results = executeCallMultipleValueReturn(function);;
                    return new Tuple2<BigInteger, byte[]>(
                            (BigInteger) results.get(0).getValue(),
                            (byte[]) results.get(1).getValue());
                }
            });
}
 
Example #15
Source File: DefaultOnChainPrivacyGroupManagementContract.java    From besu with Apache License 2.0 6 votes vote down vote up
public RemoteFunctionCall<List> getParticipants(byte[] _enclaveKey) {
  final org.web3j.abi.datatypes.Function function =
      new org.web3j.abi.datatypes.Function(
          FUNC_GETPARTICIPANTS,
          Arrays.<Type>asList(new org.web3j.abi.datatypes.generated.Bytes32(_enclaveKey)),
          Arrays.<TypeReference<?>>asList(new TypeReference<DynamicArray<Bytes32>>() {}));
  return new RemoteFunctionCall<List>(
      function,
      new Callable<List>() {
        @Override
        @SuppressWarnings("unchecked")
        public List call() throws Exception {
          List<Type> result = (List<Type>) executeCallSingleValueReturn(function, List.class);
          return convertToNative(result);
        }
      });
}
 
Example #16
Source File: Ballot.java    From web3j with Apache License 2.0 5 votes vote down vote up
public RemoteCall<Tuple2<byte[], BigInteger>> proposals(BigInteger param0) {
    final Function function = new Function(FUNC_PROPOSALS,
            Arrays.<Type>asList(new org.web3j.abi.datatypes.generated.Uint256(param0)),
            Arrays.<TypeReference<?>>asList(new TypeReference<Bytes32>() {}, new TypeReference<Uint256>() {}));
    return new RemoteCall<Tuple2<byte[], BigInteger>>(
            new Callable<Tuple2<byte[], BigInteger>>() {
                @Override
                public Tuple2<byte[], BigInteger> call() throws Exception {
                    List<Type> results = executeCallMultipleValueReturn(function);
                    return new Tuple2<byte[], BigInteger>(
                            (byte[]) results.get(0).getValue(), 
                            (BigInteger) results.get(1).getValue());
                }
            });
}
 
Example #17
Source File: FunctionReturnDecoderTest.java    From web3j with Apache License 2.0 5 votes vote down vote up
@Test
public void testDecodeIndexedStringValue() {
    Utf8String string = new Utf8String("some text");
    String encoded = TypeEncoder.encodeString(string);
    String hash = Hash.sha3(encoded);

    assertEquals(
            FunctionReturnDecoder.decodeIndexedValue(hash, new TypeReference<Utf8String>() {}),
            (new Bytes32(Numeric.hexStringToByteArray(hash))));
}
 
Example #18
Source File: DepositContract.java    From teku with Apache License 2.0 5 votes vote down vote up
public RemoteFunctionCall<byte[]> get_deposit_root() {
  final org.web3j.abi.datatypes.Function function =
      new org.web3j.abi.datatypes.Function(
          FUNC_GET_DEPOSIT_ROOT,
          Arrays.<Type>asList(),
          Arrays.<TypeReference<?>>asList(new TypeReference<Bytes32>() {}));
  return executeRemoteCallSingleValueReturn(function, byte[].class);
}
 
Example #19
Source File: FunctionReturnDecoderTest.java    From web3j with Apache License 2.0 5 votes vote down vote up
@Test
public void testDecodeIndexedBytes32Value() {
    String rawInput = "0x1234567890123456789012345678901234567890123456789012345678901234";
    byte[] rawInputBytes = Numeric.hexStringToByteArray(rawInput);

    assertEquals(
            FunctionReturnDecoder.decodeIndexedValue(rawInput, new TypeReference<Bytes32>() {}),
            (new Bytes32(rawInputBytes)));
}
 
Example #20
Source File: FunctionReturnDecoderTest.java    From web3j with Apache License 2.0 5 votes vote down vote up
@Test
public void testDecodeIndexedDynamicBytesValue() {
    DynamicBytes bytes = new DynamicBytes(new byte[] {1, 2, 3, 4, 5});
    String encoded = TypeEncoder.encodeDynamicBytes(bytes);
    String hash = Hash.sha3(encoded);

    assertEquals(
            FunctionReturnDecoder.decodeIndexedValue(
                    hash, new TypeReference<DynamicBytes>() {}),
            (new Bytes32(Numeric.hexStringToByteArray(hash))));
}
 
Example #21
Source File: OnChainPrivacyTransactionBuilder.java    From web3j with Apache License 2.0 5 votes vote down vote up
public static String getEncodedAddToGroupFunction(
        Base64String enclaveKey, List<byte[]> participants) {
    final Function function =
            new Function(
                    "addParticipants",
                    Arrays.asList(
                            new Bytes32(enclaveKey.raw()),
                            new DynamicArray<>(
                                    Bytes32.class, Utils.typeMap(participants, Bytes32.class))),
                    Collections.emptyList());
    return FunctionEncoder.encode(function);
}
 
Example #22
Source File: FunctionReturnDecoderTest.java    From web3j with Apache License 2.0 5 votes vote down vote up
@Test
public void testDecodeIndexedDynamicArrayValue() {
    DynamicArray<Uint256> array =
            new DynamicArray<>(Uint256.class, new Uint256(BigInteger.TEN));

    String encoded = TypeEncoder.encodeDynamicArray(array);
    String hash = Hash.sha3(encoded);

    assertEquals(
            FunctionReturnDecoder.decodeIndexedValue(
                    hash, new TypeReference<DynamicArray>() {}),
            (new Bytes32(Numeric.hexStringToByteArray(hash))));
}
 
Example #23
Source File: PublicResolver.java    From etherscan-explorer with GNU General Public License v3.0 5 votes vote down vote up
public RemoteCall<String> text(byte[] node, String key) {
    Function function = new Function("text",
            Arrays.<Type>asList(new org.web3j.abi.datatypes.generated.Bytes32(node),
            new org.web3j.abi.datatypes.Utf8String(key)),
            Arrays.<TypeReference<?>>asList(new TypeReference<Utf8String>() {}));
    return executeRemoteCallSingleValueReturn(function, String.class);
}
 
Example #24
Source File: ENS.java    From etherscan-explorer with GNU General Public License v3.0 5 votes vote down vote up
public List<NewResolverEventResponse> getNewResolverEvents(TransactionReceipt transactionReceipt) {
    final Event event = new Event("NewResolver", 
            Arrays.<TypeReference<?>>asList(new TypeReference<Bytes32>() {}),
            Arrays.<TypeReference<?>>asList(new TypeReference<Address>() {}));
    List<EventValues> valueList = extractEventParameters(event, transactionReceipt);
    ArrayList<NewResolverEventResponse> responses = new ArrayList<NewResolverEventResponse>(valueList.size());
    for (EventValues eventValues : valueList) {
        NewResolverEventResponse typedResponse = new NewResolverEventResponse();
        typedResponse.node = (byte[]) eventValues.getIndexedValues().get(0).getValue();
        typedResponse.resolver = (String) eventValues.getNonIndexedValues().get(0).getValue();
        responses.add(typedResponse);
    }
    return responses;
}
 
Example #25
Source File: ENS.java    From web3j with Apache License 2.0 5 votes vote down vote up
public RemoteCall<TransactionReceipt> setSubnodeOwner(byte[] node, byte[] label, String owner) {
    final Function function = new Function(
            FUNC_SETSUBNODEOWNER, 
            Arrays.<Type>asList(new org.web3j.abi.datatypes.generated.Bytes32(node), 
            new org.web3j.abi.datatypes.generated.Bytes32(label), 
            new org.web3j.abi.datatypes.Address(owner)), 
            Collections.<TypeReference<?>>emptyList());
    return executeRemoteCallTransaction(function);
}
 
Example #26
Source File: ENS.java    From etherscan-explorer with GNU General Public License v3.0 5 votes vote down vote up
public List<NewOwnerEventResponse> getNewOwnerEvents(TransactionReceipt transactionReceipt) {
    final Event event = new Event("NewOwner", 
            Arrays.<TypeReference<?>>asList(new TypeReference<Bytes32>() {}, new TypeReference<Bytes32>() {}),
            Arrays.<TypeReference<?>>asList(new TypeReference<Address>() {}));
    List<EventValues> valueList = extractEventParameters(event, transactionReceipt);
    ArrayList<NewOwnerEventResponse> responses = new ArrayList<NewOwnerEventResponse>(valueList.size());
    for (EventValues eventValues : valueList) {
        NewOwnerEventResponse typedResponse = new NewOwnerEventResponse();
        typedResponse.node = (byte[]) eventValues.getIndexedValues().get(0).getValue();
        typedResponse.label = (byte[]) eventValues.getIndexedValues().get(1).getValue();
        typedResponse.owner = (String) eventValues.getNonIndexedValues().get(0).getValue();
        responses.add(typedResponse);
    }
    return responses;
}
 
Example #27
Source File: PublicResolver.java    From etherscan-explorer with GNU General Public License v3.0 5 votes vote down vote up
public RemoteCall<Tuple2<byte[], byte[]>> pubkey(byte[] node) {
    final Function function = new Function("pubkey",
            Arrays.<Type>asList(new org.web3j.abi.datatypes.generated.Bytes32(node)),
            Arrays.<TypeReference<?>>asList(new TypeReference<Bytes32>() {}, new TypeReference<Bytes32>() {}));
    return new RemoteCall<Tuple2<byte[], byte[]>>(
            new Callable<Tuple2<byte[], byte[]>>() {
                @Override
                public Tuple2<byte[], byte[]> call() throws Exception {
                    List<Type> results = executeCallMultipleValueReturn(function);;
                    return new Tuple2<byte[], byte[]>(
                            (byte[]) results.get(0).getValue(),
                            (byte[]) results.get(1).getValue());
                }
            });
}
 
Example #28
Source File: PublicResolver.java    From etherscan-explorer with GNU General Public License v3.0 5 votes vote down vote up
public RemoteCall<TransactionReceipt> setContent(byte[] node, byte[] hash) {
    Function function = new Function(
            "setContent",
            Arrays.<Type>asList(new org.web3j.abi.datatypes.generated.Bytes32(node),
            new org.web3j.abi.datatypes.generated.Bytes32(hash)),
            Collections.<TypeReference<?>>emptyList());
    return executeRemoteCallTransaction(function);
}
 
Example #29
Source File: PublicResolver.java    From etherscan-explorer with GNU General Public License v3.0 5 votes vote down vote up
public RemoteCall<TransactionReceipt> setABI(byte[] node, BigInteger contentType, byte[] data) {
    Function function = new Function(
            "setABI",
            Arrays.<Type>asList(new org.web3j.abi.datatypes.generated.Bytes32(node),
            new org.web3j.abi.datatypes.generated.Uint256(contentType),
            new org.web3j.abi.datatypes.DynamicBytes(data)),
            Collections.<TypeReference<?>>emptyList());
    return executeRemoteCallTransaction(function);
}
 
Example #30
Source File: SolidityFunctionWrapperTest.java    From web3j with Apache License 2.0 5 votes vote down vote up
@Test
public void testGetNativeType() {
    assertEquals(getNativeType(TypeName.get(Address.class)), (TypeName.get(String.class)));
    assertEquals(getNativeType(TypeName.get(Uint256.class)), (TypeName.get(BigInteger.class)));
    assertEquals(getNativeType(TypeName.get(Int256.class)), (TypeName.get(BigInteger.class)));
    assertEquals(getNativeType(TypeName.get(Utf8String.class)), (TypeName.get(String.class)));
    assertEquals(getNativeType(TypeName.get(Bool.class)), (TypeName.get(Boolean.class)));
    assertEquals(getNativeType(TypeName.get(Bytes32.class)), (TypeName.get(byte[].class)));
    assertEquals(getNativeType(TypeName.get(DynamicBytes.class)), (TypeName.get(byte[].class)));
}