feat: implement on-chain synchronization for escrow intents - #95
Open
Mrwicks00 wants to merge 1 commit into
Open
feat: implement on-chain synchronization for escrow intents#95Mrwicks00 wants to merge 1 commit into
Mrwicks00 wants to merge 1 commit into
Conversation
Adds POST /api/relayer/escrow/:id/sync, an internal/webhook callback that bridges an EscrowIntent's DB record with the outcome of its on-chain transaction: on a reported SUCCESS it stamps the intent with the resolved Soroban escrow id and transitions status from PENDING to LOCKED. Duplicate delivery of the same event is a no-op, and a conflicting escrow id on an already-locked intent is rejected, so records are never corrupted or double-updated.
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.
PR title: feat: implement on-chain synchronization for escrow intents
PR description (copy-paste when opening the PR):
Summary
Implements Issue #58 — a synchronization service/webhook handler that bridges the off-chain EscrowIntent DB record with the on-chain truth once a transaction completes.
Scope note: dependency Issue #17 (stellar.service.js + horizon.service.js + status.parser.js, already in main) handles transaction submission and status normalization, but none of it decodes the Soroban contract's return value (the new on-chain escrow id lives in resultMetaXdr, which nothing in this codebase parses yet). Per the issue's explicit out-of-scope note ("assume a webhook or internal callback triggers this" / no direct polling), this service takes the on-chain escrow id as an already-resolved input — its job is purely the deterministic DB-side bridge, not XDR parsing.
Changes
Out of scope
Test plan
Closes #58