Skip to content

feat(demo,contracts): add testnet demo seed endpoints and contract read-only views (#509, #439)#519

Open
phertyameen wants to merge 3 commits into
Pulsefy:mainfrom
phertyameen:feat/checkDemo_CcontractReadOnlyViews
Open

feat(demo,contracts): add testnet demo seed endpoints and contract read-only views (#509, #439)#519
phertyameen wants to merge 3 commits into
Pulsefy:mainfrom
phertyameen:feat/checkDemo_CcontractReadOnlyViews

Conversation

@phertyameen
Copy link
Copy Markdown

feat: testnet demo mode + contract read-only views

Closes #509, closes #439

#509 - Testnet Demo Mode

Adds DemoModule with seed/clear/status endpoints under POST|DELETE|GET /v1/demo. Demo data is deterministic (fixed IDs, addresses, amounts) and idempotent across runs. Network guard in DemoService throws 403 DEMO_MODE_UNAVAILABLE when NETWORK !== "testnet" - enforced at the service layer, not just middleware.

Files: src/demo/demo.fixtures.ts, demo.service.ts, demo.controller.ts, demo.module.ts
Action required: add DemoModule to AppModule baseImports alongside DeveloperModule.

#439 - Contract Read-Only Views

Adds five public view endpoints under GET /v1/contracts/views/ - fee config, pause state, contract metadata, escrow summary, and link summary. All views simulate read-only Soroban calls (throwaway keypair, no signing), cache results for 15 s, and return typed 404s with error codes when records are missing or TTL-expired. Falls back to safe defaults when QUICKEX_CONTRACT_ID is unset.

Files: src/contracts/views/contract-views.service.ts, contract-views.controller.ts + updated contracts.module.ts

Tests

Unit tests mock simulateContractView directly - no real RPC needed. Covers parsed responses, RPC failures, missing/expired records, caching, and no privileged data leakage.

…ad-only views (Pulsefy#509, Pulsefy#439)

- DemoModule: POST /v1/demo/seed, DELETE /v1/demo, GET /v1/demo/status
  - Deterministic fixtures (links + transactions); idempotent upserts
  - Hard 403 guard when NETWORK !== testnet
- ContractViewsModule: GET /v1/contracts/views/{fee-config,pause-state,metadata,escrow/:id,link/:id}
  - Read-only Soroban simulation, 15 s TTL cache, typed 404 on missing/expired records
  - Safe defaults when QUICKEX_CONTRACT_ID unset
- Unit tests for both services; no real RPC or DB required
@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented May 31, 2026

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

@Cedarich
Copy link
Copy Markdown
Contributor

@phertyameen

@phertyameen
Copy link
Copy Markdown
Author

@Cedarich lint fixed

@Cedarich
Copy link
Copy Markdown
Contributor

@phertyameen

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.

BE-50: Testnet Demo Mode (Seed Links + Deterministic Fixtures) 39. Contract Read-Only Views for Clients (State + Limits + Fees)

2 participants