Skip to content

feat: implement allowance expiry alert script (#78) - #730

Merged
orunganiekan merged 2 commits into
SiLioLabs:masterfrom
Abdullahi-Code9:feat/allowance-expiry-alert
Jul 31, 2026
Merged

feat: implement allowance expiry alert script (#78)#730
orunganiekan merged 2 commits into
SiLioLabs:masterfrom
Abdullahi-Code9:feat/allowance-expiry-alert

Conversation

@Abdullahi-Code9

Copy link
Copy Markdown
Contributor

Closes #584

📝 Description

This PR introduces scripts/alert-expiring-allowances.ts, a proactive alerting system for expiring Stellar token allowances. By inspecting Soroban ledger keys directly, it detects upcoming allowance expiries before charges fail, generates structured reports, supports webhook dispatching, and provides an actionable exit code for CI/cron execution.

🚀 Changes Made

1. Allowance Expiry Detection & Script

  • scripts/alert-expiring-allowances.ts: Implemented a new script that queries active subscribers and inspects their underlying ContractData ledger entries (liveUntilLedgerSeq) to identify allowances expiring within a configurable ledger window (ALERT_WINDOW_LEDGERS).

2. Subscriber Optimization & Filtering

  • Filtered out inactive/paused subscribers and non-expiring allowances (liveUntilLedgerSeq = 0) to prevent false alarms.
  • Reused SIM_SOURCE for simulation sources to remove unnecessary RPC round-trips per subscriber check.

3. Webhook Delivery & Automation Output

  • Configured JSON reporting to stdout with dry-run support (--dry-run).
  • Integrated optional WEBHOOK_URL POST alerts while maintaining exit code 1 whenever expiring allowances are detected (allowing for CI pipeline integration).

4. Compiler Bug Fixes

  • scripts/health-check.ts: Updated top-level import to include Account from @stellar/stellar-sdk instead of an invalid non-async dynamic import.
  • scripts/export-merchant-report.ts: Updated ledgerCloseTime to Date.parse(event.ledgerClosedAt) to match the @stellar/stellar-sdk API update.

🧪 Verification & Testing

Type Safety Verification

Verified strict TypeScript types across scripts without compiler errors:

npx tsc --noEmit

@drips-wave

drips-wave Bot commented Jul 25, 2026

Copy link
Copy Markdown

@Abdullahi-Code9 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! 🚀

Learn more about application limits

@Abdullahi-Code9
Abdullahi-Code9 force-pushed the feat/allowance-expiry-alert branch from e287f45 to d214648 Compare July 31, 2026 12:43
@Abdullahi-Code9
Abdullahi-Code9 force-pushed the feat/allowance-expiry-alert branch from d214648 to b895410 Compare July 31, 2026 13:17
@orunganiekan
orunganiekan merged commit 09e7858 into SiLioLabs:master Jul 31, 2026
0 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

## Issue #78: Implement Allowance Expiry Alert Script

2 participants