From b34cd1eeee5af73c33ca1639eab64365dede4ef9 Mon Sep 17 00:00:00 2001 From: nkramer44 Date: Sat, 9 Nov 2024 10:23:04 -0500 Subject: [PATCH] rename MPTokenHolder to Holder --- .../xrpl4j/codec/binary/types/AmountType.java | 3 +- .../src/main/resources/definitions.json | 2 +- .../binary/types/BaseSerializerTypeTest.java | 5 ++-- .../src/test/resources/data-driven-tests.json | 30 ------------------- 4 files changed, 6 insertions(+), 34 deletions(-) diff --git a/xrpl4j-core/src/main/java/org/xrpl/xrpl4j/codec/binary/types/AmountType.java b/xrpl4j-core/src/main/java/org/xrpl/xrpl4j/codec/binary/types/AmountType.java index 29fc61968..75d44533e 100644 --- a/xrpl4j-core/src/main/java/org/xrpl/xrpl4j/codec/binary/types/AmountType.java +++ b/xrpl4j-core/src/main/java/org/xrpl/xrpl4j/codec/binary/types/AmountType.java @@ -24,6 +24,7 @@ import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.node.TextNode; +import com.google.common.base.Strings; import com.google.common.primitives.UnsignedLong; import org.xrpl.xrpl4j.codec.addresses.ByteUtils; import org.xrpl.xrpl4j.codec.addresses.UnsignedByte; @@ -319,7 +320,7 @@ public boolean isMpt() { */ public boolean isPositive() { // 2nd bit in 1st byte is set to 1 for positive amounts - return toHex().startsWith("00000000000000", 2) || (toBytes()[0] & 0x40) > 0; + return (toBytes()[0] & 0x40) > 0; } } diff --git a/xrpl4j-core/src/main/resources/definitions.json b/xrpl4j-core/src/main/resources/definitions.json index daa6bb1fc..6e2257e8d 100644 --- a/xrpl4j-core/src/main/resources/definitions.json +++ b/xrpl4j-core/src/main/resources/definitions.json @@ -2143,7 +2143,7 @@ } ], [ - "MPTokenHolder", + "Holder", { "nth": 11, "isVLEncoded": true, diff --git a/xrpl4j-core/src/test/java/org/xrpl/xrpl4j/codec/binary/types/BaseSerializerTypeTest.java b/xrpl4j-core/src/test/java/org/xrpl/xrpl4j/codec/binary/types/BaseSerializerTypeTest.java index 6ce484063..6416aa979 100644 --- a/xrpl4j-core/src/test/java/org/xrpl/xrpl4j/codec/binary/types/BaseSerializerTypeTest.java +++ b/xrpl4j-core/src/test/java/org/xrpl/xrpl4j/codec/binary/types/BaseSerializerTypeTest.java @@ -57,8 +57,9 @@ void fixtureTests(ValueTest fixture) throws IOException { } else { SerializedType serialized = serializedType.fromJson(value); if (fixture.type().equals("Amount")) { - assertThat(((AmountType) serialized).isPositive()).isEqualTo(!fixture.isNegative()); - assertThat(((AmountType) serialized).isNative()).isEqualTo(fixture.isNative()); + AmountType amountType = (AmountType) serialized; + assertThat(amountType.isPositive()).isEqualTo(!fixture.isNegative()); + assertThat(amountType.isNative()).isEqualTo(fixture.isNative()); } assertThat(serialized.toHex()).isEqualTo(fixture.expectedHex()); } diff --git a/xrpl4j-core/src/test/resources/data-driven-tests.json b/xrpl4j-core/src/test/resources/data-driven-tests.json index 99260f8e5..745eb7a28 100644 --- a/xrpl4j-core/src/test/resources/data-driven-tests.json +++ b/xrpl4j-core/src/test/resources/data-driven-tests.json @@ -2524,21 +2524,6 @@ "is_negative": false, "exponent": -15 }, - { - "test_json": { - "currency": "USD", - "value": "0", - "issuer": "rrrrrrrrrrrrrrrrrrrrBZbvji" - }, - "significant_digits": 1, - "type_id": 6, - "is_native": false, - "mantissa": "0000000000000000", - "type": "Amount", - "expected_hex": "800000000000000000000000000000000000000055534400000000000000000000000000000000000000000000000001", - "is_negative": false, - "exponent": -15 - }, { "test_json": { "currency": "USD", @@ -2569,21 +2554,6 @@ "is_negative": false, "exponent": -15 }, - { - "test_json": { - "currency": "USD", - "value": "0.0", - "issuer": "rrrrrrrrrrrrrrrrrrrrBZbvji" - }, - "significant_digits": 1, - "type_id": 6, - "is_native": false, - "mantissa": "0000000000000000", - "type": "Amount", - "expected_hex": "800000000000000000000000000000000000000055534400000000000000000000000000000000000000000000000001", - "is_negative": false, - "exponent": -15 - }, { "test_json": { "currency": "USD",