Skip to content

Commit b1b137d

Browse files
authored
fix: fix handling of transaction metadata versioning in AssembledTransaction class. (#723)
Ensure compatibility with both V3 and V4 by checking for null values before accessing Soroban metadata.
1 parent 0f7932b commit b1b137d

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
- feat: add `isValidSignedPayload` to `StrKey` class, this function can be used to validate the ed25519 signed payload. ([#712](https://github.com/stellar/java-stellar-sdk/pull/712))
77
- feat: add `signExtraSignersPayload` to sign extra signers payloads in `Transaction` class. ([#713](https://github.com/stellar/java-stellar-sdk/pull/713))
88
- refactor: add balance id validation. ([#722](https://github.com/stellar/java-stellar-sdk/pull/722))
9+
- fix: fix handling of transaction metadata versioning in `AssembledTransaction` class. ([#723](https://github.com/stellar/java-stellar-sdk/pull/723))
910

1011
### Breaking changes:
1112
- feat: add `org.stellar.sdk.SignerKey` for enhanced signer key handling. ([#712](https://github.com/stellar/java-stellar-sdk/pull/712))

src/main/java/org/stellar/sdk/contract/AssembledTransaction.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,12 @@ public T submit() {
379379
throw new IllegalArgumentException(
380380
"Unable to convert transaction meta to TransactionMeta", e);
381381
}
382-
SCVal resultVal = transactionMeta.getV3().getSorobanMeta().getReturnValue();
382+
SCVal resultVal;
383+
if (transactionMeta.getV3() != null) {
384+
resultVal = transactionMeta.getV3().getSorobanMeta().getReturnValue();
385+
} else {
386+
resultVal = transactionMeta.getV4().getSorobanMeta().getReturnValue();
387+
}
383388
return parseResultXdrFn != null ? parseResultXdrFn.apply(resultVal) : (T) resultVal;
384389
}
385390

0 commit comments

Comments
 (0)