Skip to content

feat: SAC detection on transfers and Python SDK client#140

Merged
Miracle656 merged 1 commit into
Miracle656:mainfrom
BigNathan1:feat/sac-detection-and-python-sdk
Jun 26, 2026
Merged

feat: SAC detection on transfers and Python SDK client#140
Miracle656 merged 1 commit into
Miracle656:mainfrom
BigNathan1:feat/sac-detection-and-python-sdk

Conversation

@BigNathan1

Copy link
Copy Markdown
Contributor

Summary

Adds SAC (Stellar Asset Contract) detection on transfers and a Python REST client.

closes #136
closes #139

#136 — SAC detection

  • New src/indexer/sac-detect.ts classifies a contract as a SAC by reading its
    contract-instance ledger entry and checking whether the executable is the
    built-in ContractExecutableStellarAsset (a SAC wrapping a classic asset)
    rather than uploaded Wasm (a native Soroban token).
  • Native XLM SACs are treated as known SACs to avoid an RPC round-trip; results
    are cached per contract since SAC status is immutable; the instance fetcher is
    injectable for testing.
  • isSac is exposed as a column on TokenTransfer (new Prisma field +
    migration) and is selectable via the transfers API. The indexer tags each
    transfer during ingest as a best-effort step that never blocks indexing.
  • Note: the IndexerCheckpoint model on main was missing its closing brace, so
    the Prisma schema did not validate and no client could be generated. Closing
    that model was required to ship the new column.

#139 — Python SDK client

  • New clients/python/ package wraith-py wrapping the REST API in typed
    dataclasses (Transfer, TransferPage, AccountSummary, AssetHolding,
    PopularAssets, PopularAsset). Amounts are kept as strings to preserve full
    i128 precision.
  • WraithClient covers transfers (incoming/outgoing/address/tx),
    accounts (summary/transfers), and assets (popular). Non-2xx responses
    raise WraithAPIError. Ships a py.typed marker for PEP 561.
  • Packaging via pyproject.toml plus a publish-python-sdk.yml workflow that
    tests then publishes to PyPI via OIDC trusted publishing on pyclient-v* tags.

Testing

  • npx tsc --noEmit — clean
  • npx jest — all unit suites pass; new sacDetect suite added
  • pytest (clients/python) — 7 passing

@drips-wave

drips-wave Bot commented Jun 26, 2026

Copy link
Copy Markdown

@BigNathan1 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 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.

Reviewed — excellent PR, and thank you for catching the broken schema. Confirmed: IndexerCheckpoint on main was missing its closing brace + @@schema (a bad auto-merge when #133 landed), leaving the Prisma schema invalid. This PR restores it (verified: braces balance, all 11 models closed).

SAC detection (#136): sound approach — executableIsSac checks ContractExecutableStellarAsset vs Wasm, native-XLM SAC IDs are hardcoded to skip an RPC round-trip, status is cached per contract (immutable), and the instance fetcher is injectable for tests. The indexer tagging is correctly best-effort/non-blocking (.catch → defaults false, never blocks ingest). isSac column + migration look right.

Python client (#139): typed dataclasses, string amounts to preserve i128 precision, WraithAPIError on non-2xx, py.typed, and OIDC trusted-publishing workflow. Complete.

Closes #136 and #139. Merging.

@Miracle656 Miracle656 merged commit 4108ef2 into Miracle656:main Jun 26, 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.

Python SDK client SAC (Stellar Asset Contract) detection

2 participants