fix(#307): replace hardcoded expiration ledger with live getLatestLed…#311
Merged
zachyo merged 1 commit intoJun 30, 2026
Merged
Conversation
…testLedger + 17280 ledgers/day - Import fetchCurrentLedger from @/lib/stellar into ApproveForm - Add shared getExpirationLedger helper used by both simulate and submit paths - Replace 1_000_000 + days * 10800 with currentLedger + days * 17280 - Add optional currentLedger prop to AllowanceList - Add ledgerToExpiryInfo helper to render human date + countdown per allowance
|
@Danielodingz 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
|
Hello @zachyo please review PR and merge. Thank You |
Contributor
Author
|
Hello @zachyo please review PR and merge. Thank you |
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.
Closes #307
fix(#307): ApproveForm — replace hardcoded expiration ledger with live ledger sequence
Problem
Both the simulate (
handleCheck) and submit (onSubmit) paths inApproveForm.tsxcomputed the SEP-41expiration_ledgerusing ahardcoded base of
1_000_000:This caused two compounding bugs:
1,000,000. The computed ledger was already in the past, so Sorobanrejected the allowance (or created one that expired immediately).
10800 ledgers/dayassumes ~8 s/ledger(
86400 / 10800 = 8). Soroban closes ledgers at ~5 s, so theallowance window was off by ~60%.
The vesting flow in
AdminPanelalready handles this correctly(
getLatestLedger().sequence + days * 17280).ApproveFormwas theoutlier.
Fix
frontend/components/forms/ApproveForm.tsxfetchCurrentLedgerfrom@/lib/stellar.getExpirationLedger(days)helper that callsfetchCurrentLedger(networkConfig)and returnscurrentLedger + parseInt(days) * 17280.handleCheck(simulate) andonSubmit(submit) now call thesame helper — they cannot drift.
frontend/components/AllowanceList.tsx(follow-on)currentLedger?: numberprop toAllowanceListProps.ledgerToExpiryInfo(expirationLedger)helper that converts aledger number to a human-readable expiry date and countdown string
(e.g.
Jun 30, 2026 · 364d 23h remaining/Expired) using5 s/ledgerarithmetic.currentLedgeris supplied (fully backwards-compatible — callers that don't pass the
prop see no change).
Testing
compute `sequence + 6,