Skip to content

feat: add performance bond status API for creator keys - #1210

Open
Chinko21 wants to merge 2 commits into
accesslayerorg:mainfrom
Chinko21:fix/issue-1062-build-performance-bond-status-api-for-creator-r2
Open

Chinko21 wants to merge 2 commits into
accesslayerorg:mainfrom
Chinko21:fix/issue-1062-build-performance-bond-status-api-for-creator-r2

Conversation

@Chinko21

Copy link
Copy Markdown

Overview

This PR adds REST endpoints that expose the performance bond status for creator keys, including the deposited amount, current lifecycle state, creator, and forfeiture history. Bond state is read from the bond contract via get_bond_status with a 60s cache, and BondForfeited events are indexed into a forfeiture history table.

Related Issue

Closes #[issue number]

Changes

🔐 Performance Bond Status API

  • [MODIFY] src/modules/creator/creator.routes.ts

    • Registers GET /keys/:key_id/bond and GET /keys/:key_id/bond/history.
  • [MODIFY] src/modules/creator/creator.controllers.ts

    • getKeyBond returns amount, state (deposited/released/forfeited), and creator; returns 404 when the key has no bond record.
    • getKeyBondHistory returns forfeiture records with reason and timestamp, ordered descending.
  • [MODIFY] src/clients/soroban.client.ts

    • Adds the get_bond_status contract call used to fetch live bond state, wrapped with a 60s stale-while-revalidate cache.
  • [MODIFY] src/indexer/event-processor.ts

    • Handles BondForfeited events and writes them to the forfeiture history table with reason and timestamp.
  • [MODIFY] prisma/schema/creator.prisma

    • Adds the bond record and forfeiture history models needed by the endpoints and indexer.
  • [MODIFY] src/constants/creator.constants.ts

    • Adds bond state constants and cache TTL configuration.

Verification Results

No automated tests were added in this change. Acceptance criteria are listed below for reviewer validation.

Acceptance Criteria Status
Bond status returns correct amount, state, and creator for all lifecycle stages ⬜ To be verified by reviewer
BondForfeited events indexed with correct reason and timestamp ⬜ To be verified by reviewer
Forfeiture history returns accurate records in desc order ⬜ To be verified by reviewer
Cache correctly returns stale-while-revalidate on bond state ⬜ To be verified by reviewer
404 returned correctly for keys without bonds ⬜ To be verified by reviewer

Closes #1062

Chinko21 added a commit to Chinko21/accesslayer-server that referenced this pull request Oct 24, 2026
Chinko21 added a commit to Chinko21/accesslayer-server that referenced this pull request Oct 24, 2026
@Chinko21
Chinko21 force-pushed the fix/issue-1062-build-performance-bond-status-api-for-creator-r2 branch from ebe3611 to 935b239 Compare October 24, 2026 10:15
@Chinko21
Chinko21 force-pushed the fix/issue-1062-build-performance-bond-status-api-for-creator-r2 branch from 935b239 to 3b9c56c Compare October 24, 2026 10:15
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.

Build performance bond status API for creator key accountability

1 participant