From 03430b98e2841b4f66e90998f294a8699242d288 Mon Sep 17 00:00:00 2001 From: michaeldiamant Date: Thu, 22 Sep 2022 09:59:35 -0400 Subject: [PATCH 1/3] Remove boxReferences from public Transaction constructor --- .../com/algorand/algosdk/transaction/Transaction.java | 9 --------- 1 file changed, 9 deletions(-) diff --git a/src/main/java/com/algorand/algosdk/transaction/Transaction.java b/src/main/java/com/algorand/algosdk/transaction/Transaction.java index c352b0f39..07242ba4b 100644 --- a/src/main/java/com/algorand/algosdk/transaction/Transaction.java +++ b/src/main/java/com/algorand/algosdk/transaction/Transaction.java @@ -302,7 +302,6 @@ public static Transaction createPaymentTransaction(Address sender, BigInteger fe null, null, null, - null, null); } @@ -407,7 +406,6 @@ public static Transaction createKeyRegistrationTransaction(Address sender, BigIn null, null, null, - null, null); } @@ -535,7 +533,6 @@ public static Transaction createAssetCreateTransaction(Address sender, BigIntege null, null, null, - null, null); } @@ -686,7 +683,6 @@ private Transaction(@JsonProperty("type") Type type, @JsonProperty("apat") List accounts, @JsonProperty("apfa") List foreignApps, @JsonProperty("apas") List foreignAssets, - @JsonProperty("apbx") List boxReferences, @JsonProperty("apgs") StateSchema globalStateSchema, @JsonProperty("apid") Long applicationId, @JsonProperty("apls") StateSchema localStateSchema, @@ -737,7 +733,6 @@ private Transaction(@JsonProperty("type") Type type, convertToAddressList(accounts), foreignApps, foreignAssets, - boxReferences, globalStateSchema, applicationId, localStateSchema, @@ -795,7 +790,6 @@ public Transaction( List
accounts, List foreignApps, List foreignAssets, - List boxReferences, StateSchema globalStateSchema, Long applicationId, StateSchema localStateSchema, @@ -846,7 +840,6 @@ public Transaction( accounts, foreignApps, foreignAssets, - boxReferences, globalStateSchema, applicationId, localStateSchema, @@ -905,7 +898,6 @@ public Transaction( List
accounts, List foreignApps, List foreignAssets, - List boxReferences, StateSchema globalStateSchema, Long applicationId, StateSchema localStateSchema, @@ -949,7 +941,6 @@ public Transaction( if (accounts != null) this.accounts = accounts; if (foreignApps != null) this.foreignApps = foreignApps; if (foreignAssets != null) this.foreignAssets = foreignAssets; - if (boxReferences != null) this.boxReferences = boxReferences; if (globalStateSchema != null) this.globalStateSchema = globalStateSchema; if (applicationId != null) this.applicationId = applicationId; if (localStateSchema != null) this.localStateSchema = globalStateSchema; From e88f8c97d55cca39fcd8395ab0a7ba941c3b4e37 Mon Sep 17 00:00:00 2001 From: michaeldiamant Date: Thu, 22 Sep 2022 11:10:44 -0400 Subject: [PATCH 2/3] Fix serialization by adding jackson annotation --- .../java/com/algorand/algosdk/transaction/Transaction.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/java/com/algorand/algosdk/transaction/Transaction.java b/src/main/java/com/algorand/algosdk/transaction/Transaction.java index 07242ba4b..0ff7e4de6 100644 --- a/src/main/java/com/algorand/algosdk/transaction/Transaction.java +++ b/src/main/java/com/algorand/algosdk/transaction/Transaction.java @@ -683,6 +683,7 @@ private Transaction(@JsonProperty("type") Type type, @JsonProperty("apat") List accounts, @JsonProperty("apfa") List foreignApps, @JsonProperty("apas") List foreignAssets, + @JsonProperty("apbx") List boxReferences, @JsonProperty("apgs") StateSchema globalStateSchema, @JsonProperty("apid") Long applicationId, @JsonProperty("apls") StateSchema localStateSchema, @@ -739,6 +740,10 @@ private Transaction(@JsonProperty("type") Type type, clearStateProgram == null ? null : new TEALProgram(clearStateProgram), extraPages ); + // Set fields _not_ exposed by public constructor. Needed because: + // * Adding parameters to a public constructor is a breaking API change. + // * To ensure JSON serialization (via Jackson's ObjectMapper) works, must add `@JsonProperty` to _a_ constructor. Using a private constructor here to maintain API backwards compatibility. + if (boxReferences != null) this.boxReferences = boxReferences; } /** From 6d49ef1f844390438960236c336c4798ae084edd Mon Sep 17 00:00:00 2001 From: michaeldiamant Date: Thu, 22 Sep 2022 11:14:46 -0400 Subject: [PATCH 3/3] Edit comment --- src/main/java/com/algorand/algosdk/transaction/Transaction.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/algorand/algosdk/transaction/Transaction.java b/src/main/java/com/algorand/algosdk/transaction/Transaction.java index 0ff7e4de6..6078c9e5d 100644 --- a/src/main/java/com/algorand/algosdk/transaction/Transaction.java +++ b/src/main/java/com/algorand/algosdk/transaction/Transaction.java @@ -742,7 +742,7 @@ private Transaction(@JsonProperty("type") Type type, ); // Set fields _not_ exposed by public constructor. Needed because: // * Adding parameters to a public constructor is a breaking API change. - // * To ensure JSON serialization (via Jackson's ObjectMapper) works, must add `@JsonProperty` to _a_ constructor. Using a private constructor here to maintain API backwards compatibility. + // * To ensure JSON/msgpack serialization (via Jackson's ObjectMapper) works, must add `@JsonProperty` to _a_ constructor. Using a private constructor here to maintain API backwards compatibility. if (boxReferences != null) this.boxReferences = boxReferences; }