Skip to content

feat(config): document paired per-network SAC and NFT watch-list env vars (#162) - #174

Merged
Miracle656 merged 1 commit into
Miracle656:mainfrom
kaylachi:feat/per-network-watchlists-162
Sep 1, 2026
Merged

feat(config): document paired per-network SAC and NFT watch-list env vars (#162)#174
Miracle656 merged 1 commit into
Miracle656:mainfrom
kaylachi:feat/per-network-watchlists-162

Conversation

@kaylachi

Copy link
Copy Markdown
Contributor

Closes #162

Summary of Changes

Adds documentation and verification for paired per-network SAC and NFT watch-list environment variables (SAC_CONTRACT_IDS_TESTNET, SAC_CONTRACT_IDS_MAINNET, NFT_CONTRACT_IDS_TESTNET, NFT_CONTRACT_IDS_MAINNET), enabling dual-network and single-network deployments to configure distinct watch-lists per chain with backwards-compatible single-variable and per-network default fallbacks.

Key Changes

  1. Configuration & Documentation (.env.example):

    • Documented SAC_CONTRACT_IDS_TESTNET and SAC_CONTRACT_IDS_MAINNET with native XLM SAC defaults for testnet and mainnet.
    • Documented NFT_CONTRACT_IDS_TESTNET and NFT_CONTRACT_IDS_MAINNET for explicit CAP-46 NFT tracking per network.
  2. Resolution Logic & Fallback Order (src/indexer.ts):

    • resolveSacContractIds(network): Resolves SAC_CONTRACT_IDS_${NETWORK} -> SAC_CONTRACT_IDS -> legacy CONTRACT_IDS -> network default native XLM SAC (DEFAULT_XLM_SAC_MAINNET / DEFAULT_XLM_SAC_TESTNET).
    • resolveNftContractIds(network): Resolves NFT_CONTRACT_IDS_${NETWORK} -> NFT_CONTRACT_IDS -> empty array.
  3. Test Suite (src/__tests__/multiNetworkIndexer.test.ts):

    • Validates per-network SAC and NFT watch-list resolution and priority order.

Verification Status

  • npm test: All 13 test suites and 124 unit tests passing cleanly.
  • PR opened by: kaylachi.
  • Commit author: kaylachi <309505611+kaylachi@users.noreply.github.com>.

@drips-wave

drips-wave Bot commented Aug 30, 2026

Copy link
Copy Markdown

@kaylachi Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

Miracle656 pushed a commit that referenced this pull request Sep 1, 2026
…e shared var

resolveNftContractIds used ?? , which only skips undefined. #174 adds
NFT_CONTRACT_IDS_TESTNET= / _MAINNET= to .env.example as blank
placeholders, so anyone copying that file and setting only the shared
NFT_CONTRACT_IDS would have had it shadowed by the empty string and
indexed no explicitly-watched NFT contracts at all.

resolveSacContractIds already used || and was unaffected.

@Miracle656 Miracle656 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved and merging.

The code half of #162 landed in #171; this closes it out with the .env.example half, and the pairing is documented in the right place — beside the shared var, with a worked mainnet/testnet example rather than an abstract note.

One thing this PR exposed, now fixed on main in 3a43c43. Declaring the per-network vars as blank placeholders is the correct thing for an example file, but resolveNftContractIds read them with ??, which only skips undefined:

process.env.NFT_CONTRACT_IDS_TESTNET ?? process.env.NFT_CONTRACT_IDS  // => ""

So anyone who copied .env.example and filled in only the shared NFT_CONTRACT_IDS would have had it shadowed by the empty string and watched no NFT contracts at all — with no error, just an indexer that quietly finds nothing. resolveSacContractIds already used || and was unaffected, which is why the asymmetry survived review in the first place.

Fixed to || with a regression test asserting an empty per-network var falls back to the shared one. Not your bug — your PR is what made it reachable, which is a good reason to have written the docs.

Thanks!

@Miracle656
Miracle656 merged commit ad60f54 into Miracle656:main Sep 1, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Per-network SAC / NFT watch-lists via env

2 participants