Repository navigation
feat(transaction): expose valid_contract and index - #11
Merged
Merged
Conversation
Nexus began serving both fields on GET /api/transactions/{hash} in
Gero-Labs/nexus#1081, verified live on mainnet against tx 4847714e...c6710d25
("valid_contract": true, "index": 5, both top-level).
valid_contract needs an explicit @JsonProperty because the client sets no global
naming strategy - the server emits mixed naming (txHash camelCase, block_hash
snake_case) - while index binds by field name.
valid_contract is transaction-level and distinct from
TxPlutusContract.validContract, which is per-script-execution. Both are boxed, so
a provider that does not report them leaves null rather than defaulting to
false/0.
These are what let upstream cardano-client-lib's NexusTransactionService replace
its two hardcoded nulls (tc.setIndex(null) / tc.setValidContract(null)).
3 tests: value mapping, index 0 not read as absent, and both staying null when
the payload omits them.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
edridudi
pushed a commit
that referenced
this pull request
Sep 23, 2026
Skips 1.3.0 deliberately. That number was already claimed by the pom on the unreleased feat/asset-holders branch, so anyone who built from that branch has a local 1.3.0 that is not what a released 1.3.0 would contain. Reusing it would repeat the ambiguity that let main and Maven Central diverge in the first place. Contents relative to the published 1.2.0: - valid_contract and index on Transaction (#11) - getAccountAssets, plus order and to on getAccountTransactions (#9), which 1.2.0 never carried because it was released from a branch that predates it Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds
valid_contractandindexto theTransactionmodel.Why now
Nexus began serving both fields on
GET /api/transactions/{hash}in Gero-Labs/nexus#1081, which is merged and deployed to production.Verified live on mainnet rather than assumed — tx
4847714e...c6710d25:Both appear before
plutus_contractsin the payload, which is what confirms they are the transaction-level fields rather than the per-scriptTxPlutusContract.validContractthat shares a name. A naive grep matches that nested field ten times on this transaction and would have been misleading.Two details worth knowing
valid_contractneeds its@JsonProperty;indexdoes not. This client sets no global naming strategy, because the server emits mixed naming —txHashcamelCase alongsideblock_hashsnake_case. So the annotation is load-bearing here, not decoration.Both are boxed. A provider that does not report them leaves null rather than defaulting to
false/0. That matters forindexin particular: it rides Nexus's best-effort enrichment path, so a network without the yaci datasource wired legitimately returns no value, and0is a real index (the first transaction in a block) rather than an absence.Tests
3 added, written before the fields existed and confirmed failing for the right reason (
cannot find symbol: getValidContract):index: 0is preserved, not read as absent44 tests pass,
BUILD SUCCESS, javadoc clean.What this unblocks
Upstream
cardano-client-lib'sNexusTransactionServicecurrently hardcodes:That comment stops being true once this ships. Replacing those two lines is the last step in making the CCL REST fallback shape 1:1 with the direct path — a PR to bloxbean/cardano-client-lib, which needs a released version of this client to depend on.
Release note
mainsits at1.3.0after #10 reconciled it with the branch 1.2.0 was actually released from. Publishing is tag-triggered (v*) and reads the pom version, so whichever number is chosen, this needs a tag to reach Maven Central before CCL can consume it.🤖 Generated with Claude Code