feat(demo,contracts): add testnet demo seed endpoints and contract read-only views (#509, #439)#519
Open
phertyameen wants to merge 3 commits into
Open
Conversation
…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
|
@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! 🚀 |
Contributor
Author
|
@Cedarich lint fixed |
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
feat: testnet demo mode + contract read-only views
Closes #509, closes #439
#509 - Testnet Demo Mode
Adds
DemoModulewith seed/clear/status endpoints underPOST|DELETE|GET /v1/demo. Demo data is deterministic (fixed IDs, addresses, amounts) and idempotent across runs. Network guard inDemoServicethrows403 DEMO_MODE_UNAVAILABLEwhenNETWORK !== "testnet"- enforced at the service layer, not just middleware.Files:
src/demo/demo.fixtures.ts,demo.service.ts,demo.controller.ts,demo.module.tsAction required: add
DemoModuletoAppModulebaseImports alongsideDeveloperModule.#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 whenQUICKEX_CONTRACT_IDis unset.Files:
src/contracts/views/contract-views.service.ts,contract-views.controller.ts+ updatedcontracts.module.tsTests
Unit tests mock
simulateContractViewdirectly - no real RPC needed. Covers parsed responses, RPC failures, missing/expired records, caching, and no privileged data leakage.