Implement a Read-Only Cross-Chain Timelock State Simulator#197
Implement a Read-Only Cross-Chain Timelock State Simulator#197Damilorlar wants to merge 1 commit into
Conversation
- Add simulateRefund() to SDK state-machine returning phase (claimable/waiting/refundable), per-leg timelock info, claim/refund parties, and human-readable summary - Add 10 unit tests covering all three phases, both directions, mixed expiry, default now, and readonly marker - Add RefundSimulator frontend component with disclaimer, phase badge, leg cards, live clock tick, and expandable summary - Add 11 frontend unit tests covering all phases and metadata - No changes to existing RefundDialog or refund execution paths
|
@Damilorlar is attempting to deploy a commit to the karagoz's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
@Damilorlar 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! 🚀 |
|
Thanks for the refund simulator work. The SDK side looks good in focused checks:
I cannot merge yet because the frontend test suite fails:
The new
Please update the component tests to use scoped queries, |
##closed #165
The application currently lacks a clear way for users and developers to understand the state of a cross-chain swap based on its timelock configuration. This enhancement introduces a frontend or SDK helper that simulates the lifecycle of a swap using the source chain direction and lock timestamps, without performing or submitting any blockchain transactions.
The simulator should provide a clear, read-only explanation of the swap's current state by displaying the source and destination timelock expiry times, identifying who is eligible to claim before expiry, who can refund after expiry, and whether the current simulated state is claimable, refundable, or waiting. The feature should support both ETH → XLM and XLM → ETH swap scenarios and clearly indicate that the output is a simulation intended for informational purposes only.
Implementation should be placed within the SDK or frontend components where appropriate, promoting code reuse and avoiding changes to existing refund execution logic.
##Acceptance Criteria
Implement a read-only helper in the SDK or frontend to simulate swap state based on source direction and lock timestamps.
Display:
Source timelock expiry.
Destination timelock expiry.
Who can claim before expiry.
Who can refund after expiry.
Current simulated state (Waiting, Claimable, or Refundable).
Support simulation for both ETH → XLM and XLM → ETH flows.
Clearly indicate that the feature is a simulation and does not execute blockchain transactions.
Reuse RefundDialog.tsx only if integration is clean and maintainable.
Add unit tests covering at least:
Waiting state.
Claimable state.
Refundable state.
Ensure no existing refund execution behavior or transaction logic is modified.