Skip to content

Add CAP-46 NFT (Soroban token) indexing #58

@Miracle656

Description

@Miracle656

Background

Wraith currently indexes fungible token transfers. CAP-46 NFT contracts on Soroban emit similar transfer events but with a token_id discriminator. Indexing them turns Wraith into the only Stellar NFT activity explorer.

What to build

Detect NFT contracts by ABI sniff (presence of metadata/owner_of functions), parse transfer(from, to, token_id) events, and store them in a new nft_transfers table alongside cached metadata.

Key files

  • wraith/src/ingester/ — event handler dispatch
  • New: wraith/src/ingester/nft.ts
  • New: migration adding nft_transfers and nft_metadata

Suggested execution

git checkout -b feat/nft-indexing
  1. After fetching a contract's events, sniff its ABI to decide token type (fungible vs NFT)
  2. For NFT contracts, decode transfer(from, to, token_id) events
  3. Lazy-load metadata via metadata(token_id) call when first seen — cache it
  4. Expose /nfts/transfers?contract=…&token_id=… and /nfts/owners/:contract/:token_id
  5. Add tests with a known NFT contract on testnet

Example commit message:
feat(ingester): add CAP-46 NFT indexing with metadata caching

Acceptance criteria

  • NFT contracts auto-detected
  • Transfers persisted with token_id
  • Metadata cached after first fetch
  • Two new REST endpoints work end-to-end
  • Tests pass against testnet

Drips Wave · Complexity: High · 200 points
Comment below to request assignment. PR must include Closes #[this issue].

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions