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

The following examples show how to use org.web3j.abi.datatypes.generated.Bytes10. 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: FunctionEncoderTest.java    From client-sdk-java with Apache License 2.0 5 votes vote down vote up
@Test
public void testFunctionMDynamicArrayEncode2() {
    Function function = new Function(
            "f",
            Arrays.asList(
                new Uint(BigInteger.valueOf(0x123)),
                new DynamicArray<>(
                        new Uint32(BigInteger.valueOf(0x456)),
                        new Uint32(BigInteger.valueOf(0x789))
                ),
                new Bytes10("1234567890".getBytes()),
                new DynamicBytes("Hello, world!".getBytes())),
            Collections.<TypeReference<?>>emptyList()
    );

    assertThat(FunctionEncoder.encode(function),
            is("0x8be65246"
                    + "0000000000000000000000000000000000000000000000000000000000000123"
                    + "0000000000000000000000000000000000000000000000000000000000000080"
                    + "3132333435363738393000000000000000000000000000000000000000000000"
                    + "00000000000000000000000000000000000000000000000000000000000000e0"
                    + "0000000000000000000000000000000000000000000000000000000000000002"
                    + "0000000000000000000000000000000000000000000000000000000000000456"
                    + "0000000000000000000000000000000000000000000000000000000000000789"
                    + "000000000000000000000000000000000000000000000000000000000000000d"
                    + "48656c6c6f2c20776f726c642100000000000000000000000000000000000000"
            ));
}
 
Example #2
Source File: FunctionEncoderTest.java    From etherscan-explorer with GNU General Public License v3.0 5 votes vote down vote up
@Test
public void testFunctionMDynamicArrayEncode2() {
    Function function = new Function(
            "f",
            Arrays.asList(
                new Uint(BigInteger.valueOf(0x123)),
                new DynamicArray<>(
                        new Uint32(BigInteger.valueOf(0x456)),
                        new Uint32(BigInteger.valueOf(0x789))
                ),
                new Bytes10("1234567890".getBytes()),
                new DynamicBytes("Hello, world!".getBytes())),
            Collections.<TypeReference<?>>emptyList()
    );

    assertThat(FunctionEncoder.encode(function),
            is("0x8be65246"
                    + "0000000000000000000000000000000000000000000000000000000000000123"
                    + "0000000000000000000000000000000000000000000000000000000000000080"
                    + "3132333435363738393000000000000000000000000000000000000000000000"
                    + "00000000000000000000000000000000000000000000000000000000000000e0"
                    + "0000000000000000000000000000000000000000000000000000000000000002"
                    + "0000000000000000000000000000000000000000000000000000000000000456"
                    + "0000000000000000000000000000000000000000000000000000000000000789"
                    + "000000000000000000000000000000000000000000000000000000000000000d"
                    + "48656c6c6f2c20776f726c642100000000000000000000000000000000000000"
            ));
}
 
Example #3
Source File: DefaultFunctionEncoderTest.java    From web3j with Apache License 2.0 5 votes vote down vote up
@Test
public void testFunctionMDynamicArrayEncode2() {
    Function function =
            new Function(
                    "f",
                    Arrays.asList(
                            new Uint(BigInteger.valueOf(0x123)),
                            new DynamicArray<>(
                                    new Uint32(BigInteger.valueOf(0x456)),
                                    new Uint32(BigInteger.valueOf(0x789))),
                            new Bytes10("1234567890".getBytes()),
                            new DynamicBytes("Hello, world!".getBytes())),
                    Collections.emptyList());

    assertEquals(
            "0x8be65246"
                    + "0000000000000000000000000000000000000000000000000000000000000123"
                    + "0000000000000000000000000000000000000000000000000000000000000080"
                    + "3132333435363738393000000000000000000000000000000000000000000000"
                    + "00000000000000000000000000000000000000000000000000000000000000e0"
                    + "0000000000000000000000000000000000000000000000000000000000000002"
                    + "0000000000000000000000000000000000000000000000000000000000000456"
                    + "0000000000000000000000000000000000000000000000000000000000000789"
                    + "000000000000000000000000000000000000000000000000000000000000000d"
                    + "48656c6c6f2c20776f726c642100000000000000000000000000000000000000",
            FunctionEncoder.encode(function));
}