From 4da8f8120aed245180142d4a3c7a4873b14d9a46 Mon Sep 17 00:00:00 2001 From: overcat <4catcode@gmail.com> Date: Mon, 14 Aug 2023 23:20:33 +0800 Subject: [PATCH] remove setFootprint --- .../org/stellar/sdk/SorobanDataBuilder.java | 27 ------------------- .../stellar/sdk/SorobanDataBuilderTest.java | 26 ++---------------- 2 files changed, 2 insertions(+), 51 deletions(-) diff --git a/src/main/java/org/stellar/sdk/SorobanDataBuilder.java b/src/main/java/org/stellar/sdk/SorobanDataBuilder.java index faf9b0cf2..acfcc8a35 100644 --- a/src/main/java/org/stellar/sdk/SorobanDataBuilder.java +++ b/src/main/java/org/stellar/sdk/SorobanDataBuilder.java @@ -103,33 +103,6 @@ public SorobanDataBuilder setResources( return this; } - /** - * Sets the storage access footprint to be a certain set of ledger keys. - * - *

You can also set each field explicitly via {@link - * SorobanDataBuilder#setReadOnly(Collection)} and {@link - * SorobanDataBuilder#setReadWrite(Collection)}. - * - *

Passing {@code null} to either parameter will leave that portion of the footprint untouched. - * If you want to clear a portion of the footprint, pass an empty collection. - * - * @param readOnly the set of ledger keys to set in the read-only portion of the transaction's - * sorobanData - * @param readWrite the set of ledger keys to set in the read-write portion of the transaction's - * sorobanData - * @return this builder instance - */ - public SorobanDataBuilder setFootprint( - @Nullable Collection readOnly, @Nullable Collection readWrite) { - if (readOnly != null) { - data.getResources().getFootprint().setReadOnly(readOnly.toArray(new LedgerKey[0])); - } - if (readWrite != null) { - data.getResources().getFootprint().setReadWrite(readWrite.toArray(new LedgerKey[0])); - } - return this; - } - /** * Sets the read-only portion of the storage access footprint to be a certain set of ledger keys. * diff --git a/src/test/java/org/stellar/sdk/SorobanDataBuilderTest.java b/src/test/java/org/stellar/sdk/SorobanDataBuilderTest.java index dc12f0e88..6d616d78d 100644 --- a/src/test/java/org/stellar/sdk/SorobanDataBuilderTest.java +++ b/src/test/java/org/stellar/sdk/SorobanDataBuilderTest.java @@ -99,22 +99,14 @@ public void testConstructorFromSorobanTransactionData() { @Test public void testSetProperties() { - SorobanTransactionData actualData0 = + SorobanTransactionData actualData = new SorobanDataBuilder() .setReadOnly(of(readOnly)) .setReadWrite(of(readWrite)) .setRefundableFee(5) .setResources(1, 2, 3, 4) .build(); - assertEquals(presetSorobanData, actualData0); - - SorobanTransactionData actualData1 = - new SorobanDataBuilder() - .setFootprint(of(readOnly), of(readWrite)) - .setRefundableFee(5) - .setResources(1, 2, 3, 4) - .build(); - assertEquals(presetSorobanData, actualData1); + assertEquals(presetSorobanData, actualData); } @Test @@ -136,20 +128,6 @@ public void testLeavesUntouchedFootprintsUntouched() { SorobanTransactionData data4 = new SorobanDataBuilder(presetSorobanData).setReadWrite(new ArrayList<>()).build(); assertArrayEquals(new LedgerKey[] {}, data4.getResources().getFootprint().getReadWrite()); - - SorobanTransactionData data5 = - new SorobanDataBuilder(presetSorobanData).setFootprint(null, null).build(); - assertArrayEquals( - new LedgerKey[] {readOnly}, data5.getResources().getFootprint().getReadOnly()); - assertArrayEquals( - new LedgerKey[] {readWrite}, data5.getResources().getFootprint().getReadWrite()); - - SorobanTransactionData data6 = - new SorobanDataBuilder(presetSorobanData) - .setFootprint(new ArrayList<>(), new ArrayList<>()) - .build(); - assertArrayEquals(new LedgerKey[] {}, data6.getResources().getFootprint().getReadOnly()); - assertArrayEquals(new LedgerKey[] {}, data6.getResources().getFootprint().getReadWrite()); } @Test