🟡 Priority: High
Difficulty: Hard
Estimated Effort: 2-3 days
Relevant Files: src/services/stellar.service.ts, src/services/message-processor.service.ts
Labels: enhancement, priority:high, stellar, ux
Requirements
-
Dynamic Fee Estimation
- Before executing any Stellar transaction, estimate the fee:
- Call
server.fetchBaseFee() for the current network base fee
- Call
server.feeStats() for fee percentile data
- Use the
p70 (70th percentile) fee for standard transactions
- Use the
p90 (90th percentile) fee for time-sensitive transactions (payouts)
- Display the estimated fee to the user before they confirm:
📊 Transaction Summary:
Amount: 50.00 USDC
Network Fee: ~0.00001 XLM ($0.0001)
Total: 50.00 USDC + 0.00001 XLM fee
Reply CONFIRM to proceed or CANCEL to abort.
-
Confirmation Flow
- Create a
PendingTransaction model in Redis (not Prisma — ephemeral):
- Key:
pending_tx:{userId}:{txType}
- Value: serialized transaction details (amount, recipient, fee, etc.)
- TTL: 5 minutes
- When the user replies
CONFIRM, look up the pending transaction and execute it
- When the user replies
CANCEL, delete the pending transaction
- If the pending transaction expires, notify: "⏰ Your transaction has expired. Please try again."
-
Insufficient Fee Detection
- Before submitting, verify the user has enough XLM to cover:
- The transaction fee
- The minimum account balance (1 XLM + 0.5 per trustline + 0.5 per offer)
- If insufficient, inform: "⚠️ You need at least {amount} XLM to cover the network fee. Your XLM balance is {balance}."
-
Fee Surge Protection
- If the current base fee is >10x the normal base fee (100 stroops), warn the user:
"⚠️ Network fees are unusually high right now ({fee} XLM). Consider waiting and trying again later."
- Allow the user to proceed anyway by replying
CONFIRM ANYWAY
-
Fee History Caching
- Cache fee stats in Redis with a 1-minute TTL
- Don't call
feeStats() for every transaction — reuse cached values
-
Testing
- Unit test: fee estimation picks correct percentile
- Unit test: confirmation flow works (CONFIRM, CANCEL, expiry)
- Unit test: insufficient fee detection
- Unit test: fee surge warning triggers at correct threshold
- Integration test: submit a transaction with estimated fee on testnet
- Target: >85% coverage
🟡 Priority: High
Difficulty: Hard
Estimated Effort: 2-3 days
Relevant Files:
src/services/stellar.service.ts,src/services/message-processor.service.tsLabels:
enhancement,priority:high,stellar,uxRequirements
Dynamic Fee Estimation
server.fetchBaseFee()for the current network base feeserver.feeStats()for fee percentile datap70(70th percentile) fee for standard transactionsp90(90th percentile) fee for time-sensitive transactions (payouts)Confirmation Flow
PendingTransactionmodel in Redis (not Prisma — ephemeral):pending_tx:{userId}:{txType}CONFIRM, look up the pending transaction and execute itCANCEL, delete the pending transactionInsufficient Fee Detection
Fee Surge Protection
"
CONFIRM ANYWAYFee History Caching
feeStats()for every transaction — reuse cached valuesTesting