feat: implement #217-220 – audit log, composite indexes, token resolu… - #336
Open
Blak-Codes wants to merge 1 commit into
Open
Conversation
…e indexes, token resolution, routing stellar-vortex-protocol#217 – Persist intent audit trail to intent_audit_log table - Add IntentAuditLog model to prisma/schema.prisma (FK → intents.intent_id, audit_log_intent_idx composite index on (intent_id, timestamp ASC)) - Migration: 20260828000002_intent_audit_log - IntentsService.appendAuditEntry() writes to DB via PrismaService (fire-and-forget; failure logs loudly but never blocks the caller) - IntentsService.getAuditLog() reads from in-memory log (fast path) - New endpoint: GET /api/v1/intents/:id/audit → full trail oldest-first - New endpoint: GET /api/v1/intents/:id/quote → persisted quotedDstAmount - Unit tests: append/read round-trip, DB write, DB failure resilience - e2e tests: cancel, expire, slash paths via audit-trail.e2e-spec.ts - DATABASE_INDEXES.md section 3 marked ✅ implemented stellar-vortex-protocol#218 – Add composite and partial Postgres indexes - Migration: 20260828000001_composite_partial_indexes - intents_user_created_idx ON intents (user, created_at DESC) - intents_state_created_idx ON intents (state, created_at DESC) - intents_open_partial_idx ON intents (created_at DESC) WHERE state = 'open' stellar-vortex-protocol#219 – Extract duplicated token-resolution logic out of IntentsController - TokensService.resolveSrcToken(chain, address) → ResolvedSrcToken | undefined - TokensService.resolveDstToken(contract) → ResolvedDstToken | undefined - Both methods fully typed (no any); discriminated kind: 'src' | 'dst' - IntentsController.create() and quote() now call the shared methods - Fixed pre-existing duplicate minDstAmount/deadline fragment in create() (was a merge artifact that caused object-literal drift between create/quote) - Unit tests: stellar, each EVM chain, not-found, empty-string cases - e2e tests extended for create with known/unknown token address stellar-vortex-protocol#220 – Wire RoutingService into quote flow - RoutingService.buildRoute() selects direct vs two-hop strategy - Direct route (1 step, type=transfer) when src/dst share same symbol (USDC→USDC) - Two-hop route (2 steps, swap+bridge via USDC intermediate) for non-stable pairs - RouteOptions interface keeps RoutingService stateless/pure (no cross-module calls) - QuoteResponseDto updated: QuoteDto.route: RouteDto with RouteStepDto[] - e2e tests: USDC→USDC direct (1 step), WETH→XLM two-hop (2 steps), step shape - Unit tests: createDirectRoute, createTwoHopRoute, buildRoute strategy selection Also: fix pre-existing syntax errors in test/intents.e2e-spec.ts (missing closing braces, undefined USER_KP/ALPHA_KP/BETA_KP/sign/build* imports) and add PrismaService mock to intents.gateway.spec.ts / intents-sweeper.service.spec.ts
|
@Blak-Codes 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! 🚀 |
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.
…tion, routing
closes #217 – Persist intent audit trail to intent_audit_log table
closes #218 – Add composite and partial Postgres indexes
closes #219 – Extract duplicated token-resolution logic out of IntentsController
closes #220 – Wire RoutingService into quote flow
Also: fix pre-existing syntax errors in test/intents.e2e-spec.ts (missing closing braces, undefined USER_KP/ALPHA_KP/BETA_KP/sign/build* imports) and add PrismaService mock to intents.gateway.spec.ts / intents-sweeper.service.spec.ts
Summary
Related issue
Type of change
Component
vortex-contract)vortex-backend)vortex-frontend)Checklist
Screenshots / notes