From 4f3ee9ca28befa0beec68627c0edb248867298cb Mon Sep 17 00:00:00 2001 From: Nischal Sharma Date: Wed, 1 May 2024 12:08:50 +0530 Subject: [PATCH] release/4.11.3 Signed-off-by: Nischal Sharma --- README.md | 4 ++-- abi/src/main/java/org/web3j/abi/TypeEncoder.java | 10 ++++++---- .../web3j/abi/DefaultFunctionEncoderTest.java | 4 ++-- .../org/web3j/abi/TypeEncoderPackedTest.java | 16 ++++------------ gradle.properties | 2 +- 5 files changed, 15 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index 9419959b0..84364c8f9 100644 --- a/README.md +++ b/README.md @@ -118,7 +118,7 @@ Java: org.web3j core - 4.11.2 + 4.11.3 ``` @@ -138,7 +138,7 @@ Gradle Java: ```groovy -implementation ('org.web3j:core:4.11.2') +implementation ('org.web3j:core:4.11.3') ``` Android: diff --git a/abi/src/main/java/org/web3j/abi/TypeEncoder.java b/abi/src/main/java/org/web3j/abi/TypeEncoder.java index c0fbe1bc4..f5bc8a3b3 100644 --- a/abi/src/main/java/org/web3j/abi/TypeEncoder.java +++ b/abi/src/main/java/org/web3j/abi/TypeEncoder.java @@ -101,10 +101,11 @@ public static String encode(Type parameter) { */ public static String encodePacked(Type parameter) { if (parameter instanceof Utf8String) { - //removePadding can also be used, but is not necessary - return Numeric.toHexStringNoPrefix(((Utf8String) parameter).getValue().getBytes(StandardCharsets.UTF_8)); + // removePadding can also be used, but is not necessary + return Numeric.toHexStringNoPrefix( + ((Utf8String) parameter).getValue().getBytes(StandardCharsets.UTF_8)); } else if (parameter instanceof DynamicBytes) { - //removePadding can also be used, but is not necessary + // removePadding can also be used, but is not necessary return Numeric.toHexStringNoPrefix(((DynamicBytes) parameter).getValue()); } else if (parameter instanceof DynamicArray) { return arrayEncodePacked((DynamicArray) parameter); @@ -144,7 +145,8 @@ static String removePadding(String encodedValue, Type parameter) { return encodedValue.substring(64, 64 + length * 2); } if (parameter instanceof DynamicBytes) { - return encodedValue.substring(64, 64 + ((DynamicBytes) parameter).getValue().length * 2); + return encodedValue.substring( + 64, 64 + ((DynamicBytes) parameter).getValue().length * 2); } else { throw new UnsupportedOperationException( "Type cannot be encoded: " + parameter.getClass()); diff --git a/abi/src/test/java/org/web3j/abi/DefaultFunctionEncoderTest.java b/abi/src/test/java/org/web3j/abi/DefaultFunctionEncoderTest.java index f676ba747..e07631a65 100644 --- a/abi/src/test/java/org/web3j/abi/DefaultFunctionEncoderTest.java +++ b/abi/src/test/java/org/web3j/abi/DefaultFunctionEncoderTest.java @@ -158,13 +158,13 @@ public void testEncodeConstructorPacked_multipleParameters() { Arrays.asList( new Uint32(BigInteger.valueOf(69)), new Bool(true), - new DynamicBytes((new byte[]{0, 1, 2, 3, 4, 5}))))); + new DynamicBytes((new byte[] {0, 1, 2, 3, 4, 5}))))); assertEquals( "12000102030405", FunctionEncoder.encodeConstructorPacked( Arrays.asList( new DynamicBytes(Numeric.hexStringToByteArray("0x12")), - new DynamicBytes((new byte[]{0, 1, 2, 3, 4, 5}))))); + new DynamicBytes((new byte[] {0, 1, 2, 3, 4, 5}))))); } @Test diff --git a/abi/src/test/java/org/web3j/abi/TypeEncoderPackedTest.java b/abi/src/test/java/org/web3j/abi/TypeEncoderPackedTest.java index 2184ebbbe..3704584ce 100644 --- a/abi/src/test/java/org/web3j/abi/TypeEncoderPackedTest.java +++ b/abi/src/test/java/org/web3j/abi/TypeEncoderPackedTest.java @@ -904,24 +904,16 @@ public void testStaticArrayEncodePacked() { @Test public void testDynamicBytesEncodePacked() { DynamicBytes dynamicBytes = new DynamicBytes(new byte[] {0, 1, 2, 3, 4, 5}); - assertEquals( - "000102030405", - TypeEncoder.encodePacked(dynamicBytes)); + assertEquals("000102030405", TypeEncoder.encodePacked(dynamicBytes)); DynamicBytes zero = new DynamicBytes(new byte[] {0}); - assertEquals( - "00", - TypeEncoder.encodePacked(zero)); + assertEquals("00", TypeEncoder.encodePacked(zero)); DynamicBytes empty = new DynamicBytes(new byte[] {}); - assertEquals( - "", - TypeEncoder.encodePacked(empty)); + assertEquals("", TypeEncoder.encodePacked(empty)); DynamicBytes dave = new DynamicBytes("dave".getBytes()); - assertEquals( - "64617665", - TypeEncoder.encodePacked(dave)); + assertEquals("64617665", TypeEncoder.encodePacked(dave)); DynamicBytes loremIpsum = new DynamicBytes( diff --git a/gradle.properties b/gradle.properties index 32350a2e9..f4392e093 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,2 +1,2 @@ group=org.web3j -version=4.11.3-SNAPSHOT +version=4.11.3