org.web3j.abi.datatypes.generated.Bytes4 Java Examples
The following examples show how to use
org.web3j.abi.datatypes.generated.Bytes4.
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: TypeDecoderTest.java From client-sdk-java with Apache License 2.0 | 6 votes |
@Test public void testStaticBytes() { Bytes6 staticBytes = new Bytes6(new byte[] { 0, 1, 2, 3, 4, 5 }); assertThat(TypeDecoder.decodeBytes( "0001020304050000000000000000000000000000000000000000000000000000", Bytes6.class), is(staticBytes)); Bytes empty = new Bytes1(new byte[] { 0 }); assertThat(TypeDecoder.decodeBytes( "0000000000000000000000000000000000000000000000000000000000000000", Bytes1.class), is(empty)); Bytes dave = new Bytes4("dave".getBytes()); assertThat(TypeDecoder.decodeBytes( "6461766500000000000000000000000000000000000000000000000000000000", Bytes4.class), is(dave)); }
Example #2
Source File: TypeDecoderTest.java From etherscan-explorer with GNU General Public License v3.0 | 6 votes |
@Test public void testStaticBytes() { Bytes6 staticBytes = new Bytes6(new byte[] { 0, 1, 2, 3, 4, 5 }); assertThat(TypeDecoder.decodeBytes( "0001020304050000000000000000000000000000000000000000000000000000", Bytes6.class), is(staticBytes)); Bytes empty = new Bytes1(new byte[] { 0 }); assertThat(TypeDecoder.decodeBytes( "0000000000000000000000000000000000000000000000000000000000000000", Bytes1.class), is(empty)); Bytes dave = new Bytes4("dave".getBytes()); assertThat(TypeDecoder.decodeBytes( "6461766500000000000000000000000000000000000000000000000000000000", Bytes4.class), is(dave)); }
Example #3
Source File: TypeEncoderTest.java From web3j with Apache License 2.0 | 6 votes |
@Test public void testStaticBytes() { Bytes staticBytes = new Bytes6(new byte[] {0, 1, 2, 3, 4, 5}); assertEquals( TypeEncoder.encodeBytes(staticBytes), ("0001020304050000000000000000000000000000000000000000000000000000")); Bytes empty = new Bytes1(new byte[] {0}); assertEquals( TypeEncoder.encodeBytes(empty), ("0000000000000000000000000000000000000000000000000000000000000000")); Bytes ones = new Bytes1(new byte[] {127}); assertEquals( TypeEncoder.encodeBytes(ones), ("7f00000000000000000000000000000000000000000000000000000000000000")); Bytes dave = new Bytes4("dave".getBytes()); assertEquals( TypeEncoder.encodeBytes(dave), ("6461766500000000000000000000000000000000000000000000000000000000")); }
Example #4
Source File: TypeDecoderTest.java From web3j with Apache License 2.0 | 6 votes |
@Test public void testStaticBytes() throws Exception { byte[] testbytes = new byte[] {0, 1, 2, 3, 4, 5}; Bytes6 staticBytes = new Bytes6(testbytes); assertEquals( TypeDecoder.decodeBytes( "0001020304050000000000000000000000000000000000000000000000000000", Bytes6.class), (staticBytes)); Bytes empty = new Bytes1(new byte[] {0}); assertEquals( TypeDecoder.decodeBytes( "0000000000000000000000000000000000000000000000000000000000000000", Bytes1.class), (empty)); Bytes dave = new Bytes4("dave".getBytes()); assertEquals( TypeDecoder.decodeBytes( "6461766500000000000000000000000000000000000000000000000000000000", Bytes4.class), (dave)); assertEquals(TypeDecoder.instantiateType("bytes6", testbytes), (new Bytes6(testbytes))); }
Example #5
Source File: TypeEncoderTest.java From client-sdk-java with Apache License 2.0 | 5 votes |
@Test public void testStaticBytes() { Bytes staticBytes = new Bytes6(new byte[] { 0, 1, 2, 3, 4, 5 }); assertThat(TypeEncoder.encodeBytes(staticBytes), is("0001020304050000000000000000000000000000000000000000000000000000")); Bytes empty = new Bytes1(new byte[] { 0 }); assertThat(TypeEncoder.encodeBytes(empty), is("0000000000000000000000000000000000000000000000000000000000000000")); Bytes dave = new Bytes4("dave".getBytes()); assertThat(TypeEncoder.encodeBytes(dave), is("6461766500000000000000000000000000000000000000000000000000000000")); }
Example #6
Source File: TypeEncoderTest.java From etherscan-explorer with GNU General Public License v3.0 | 5 votes |
@Test public void testStaticBytes() { Bytes staticBytes = new Bytes6(new byte[] { 0, 1, 2, 3, 4, 5 }); assertThat(TypeEncoder.encodeBytes(staticBytes), is("0001020304050000000000000000000000000000000000000000000000000000")); Bytes empty = new Bytes1(new byte[] { 0 }); assertThat(TypeEncoder.encodeBytes(empty), is("0000000000000000000000000000000000000000000000000000000000000000")); Bytes dave = new Bytes4("dave".getBytes()); assertThat(TypeEncoder.encodeBytes(dave), is("6461766500000000000000000000000000000000000000000000000000000000")); }
Example #7
Source File: TokenRepository.java From alpha-wallet-android with MIT License | 4 votes |
private static Function supportsInterface(BigInteger value) { return new Function( "supportsInterface", Arrays.<Type>asList(new Bytes4(Numeric.toBytesPadded(value, 4))), Arrays.<TypeReference<?>>asList(new TypeReference<Bool>() {})); }