Skip to content

feat(keys): add auction, metadata & staking endpoints; extend holders with staked/liquid quantities - #859

Open
devJaja wants to merge 1 commit into
accesslayerorg:mainfrom
devJaja:feat/844-845-846-847-key-endpoints
Open

feat(keys): add auction, metadata & staking endpoints; extend holders with staked/liquid quantities#859
devJaja wants to merge 1 commit into
accesslayerorg:mainfrom
devJaja:feat/844-845-846-847-key-endpoints

Conversation

@devJaja

@devJaja devJaja commented Aug 31, 2026

Copy link
Copy Markdown

Closes #844
Closes #845
Closes #846
Closes #847

Summary

This PR adds four key-related endpoints and extends the holders endpoint with staking data.

#844 — Auction state endpoint

  • GET /api/v1/keys/:keyId/auction (no auth)
  • Returns auctionPrice, auctionSupply, auctionSold, and auctionStatus (not_configured | active | completed)
  • Reads auction state from persistent contract storage via Soroban RPC
  • 30s Redis cache; invalidated after each auction buy
  • 404 for unknown key IDs

#845 — Key metadata endpoint

  • GET /api/v1/keys/:keyId/metadata (no auth)
  • Returns name, bio, avatarUri, and creatorAddress from on-chain storage via Soroban RPC
  • 5-minute Redis cache; invalidated on metadata_updated events
  • 404 when no metadata has been initialised or for unknown key IDs

#846 — Holder registry with staked/liquid balance

  • Extends GET /api/v1/creators/:id/holders with stakedQuantity and liquidQuantity per holder
  • liquidQuantity = key_balance - stakedQuantity
  • Staking positions read from the staking_positions persistent map, each holder cached in Redis for 30s
  • Backward compatible — existing fields unchanged

#847 — Staking pool stats endpoint

  • GET /api/v1/keys/:keyId/staking (no auth)
  • Returns stakingPoolBalance, totalStaked, recentFeeInflow (sum of fees in the past 30 days), and stakerCount
  • Read from on-chain contract storage via Soroban RPC
  • 60s Redis cache; invalidated on stake, unstake, or fee collection events
  • 404 for unknown key IDs

Tests

Added unit tests for all new services. Build and lint pass.

…ers with staked/liquid quantities

- Add GET /keys/:keyId/auction returning auctionPrice, auctionSupply,
  auctionSold, and auctionStatus (not_configured/active/completed) with
  30s Redis cache and invalidation after auction buys (accesslayerorg#844)
- Add GET /keys/:keyId/metadata returning on-chain name, bio, avatar_uri,
  and creator address with 5-minute Redis cache, invalidated on
  metadata_updated events; 404 when uninitialised or unknown (accesslayerorg#845)
- Add GET /keys/:keyId/staking returning stakingPoolBalance, totalStaked,
  recentFeeInflow (30-day sum), and stakerCount with 60s Redis cache,
  invalidated on stake/unstake/fee events; 404 for unknown keys (accesslayerorg#847)
- Extend GET /creators/:id/holders with stakedQuantity and liquidQuantity
  per holder derived from the staking_positions contract, cached per holder
  in Redis for 30s; backward compatible (accesslayerorg#846)
@drips-wave

drips-wave Bot commented Aug 31, 2026

Copy link
Copy Markdown

@devJaja 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

@Chucks1093

Copy link
Copy Markdown
Member

❌ CI Failed — verify (Server CI)

The verify check is failing on this PR.

Likely causes:

  • TypeScript compile error from a type mismatch or missing property
  • Test is failing due to a mock not being set up for the new service method
  • ESLint rule violation (e.g., no-explicit-any, no-unused-vars)

Steps to fix:

  1. Run npm run build locally and fix all TypeScript errors
  2. Run npm test and fix any failing tests
  3. Run npm run lint to catch ESLint issues
  4. Push

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment