Skip to content

feat(sdk): add transaction retry with fee bumping and nonce management#190

Open
jerrymusaga wants to merge 1 commit into
BCPathway:mainfrom
jerrymusaga:feat/transaction-retry-fee-bumping
Open

feat(sdk): add transaction retry with fee bumping and nonce management#190
jerrymusaga wants to merge 1 commit into
BCPathway:mainfrom
jerrymusaga:feat/transaction-retry-fee-bumping

Conversation

@jerrymusaga
Copy link
Copy Markdown

Closes #171

Summary

  • RetryPolicy configmaxAttempts, feeBumpMultiplier, maxFeeStroops, exponential backoff params; merged into bcForgeClientConfig
  • Fee bumping — on tx_insufficient_fee, bumps the inclusion fee by the configured multiplier (default ×1.5) up to a hard cap (default 1 XLM)
  • Nonce management — on tx_bad_seq, re-fetches the account (fresh sequence number) before rebuilding the transaction
  • tx_too_late handling — rebuilds with a fresh timeout/ledger bounds and retries with back-off
  • Transient RPC errors — exponential back-off retry on network-level failures (ECONNRESET, 503, 429, etc.)
  • Fee estimationestimateBaseFee() uses the RPC getFeeStats p99 inclusion fee as the starting fee for each write transaction
  • Idempotency trackingIdempotencyTracker records submitted tx hashes within a retry session so timed-out transactions can be re-checked before a fresh submission
  • Error taxonomyTxTooLateError, InsufficientFeeError, BadSequenceError, MaxRetriesExceededError, FeeLimitExceededError (all exported)

Test plan

  • classifyTxError maps all three error codes + unknown/undefined cases
  • bumpFee multiplies, rounds up, caps, and throws at the limit
  • calculateBackoffDelay exponential growth capped at maxDelayMs
  • isTransientError classifies RPCError and network error message patterns
  • IdempotencyTracker records and queries submitted hashes
  • executeWithRetry success on first attempt, fee-bump retry, back-off retries, exhausted attempts, fee cap, non-retryable errors, idempotency recording, custom initial fee
  • All 42 tests pass (npm test)
  • TypeScript strict mode (tsc --noEmit) — no errors

@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented May 30, 2026

@jerrymusaga 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

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.

Implement automatic transaction retry with fee bumping and nonce management

1 participant