Skip to content

feat: sponsored fee-bump transactions for low-XLM wallets#66

Merged
prodbycorne merged 1 commit into
SmartDropLabs:mainfrom
luciachizaram:feat/sponsored-fee-bump
Jun 28, 2026
Merged

feat: sponsored fee-bump transactions for low-XLM wallets#66
prodbycorne merged 1 commit into
SmartDropLabs:mainfrom
luciachizaram:feat/sponsored-fee-bump

Conversation

@luciachizaram

Copy link
Copy Markdown

Summary

Implements Issue #30 — sponsored fee-bump transaction support so users with < 1 XLM can still deposit into pools without paying transaction fees directly.

Changes

New Files

  • src/lib/stellar.tsfetchAccountBalances(publicKey) query utility (404-safe for unfunded accounts)
  • src/app/api/sign-fee-bump/route.tsPOST /api/sign-fee-bump Route Handler; wraps a user-signed inner tx in a sponsor fee-bump envelope signed with STELLAR_FEE_SPONSOR_SECRET
  • src/lib/soroban.feebump.test.ts — Unit tests for the fee-bump builder (2 tests)

Modified Files

  • src/lib/soroban.ts
    • buildFeeBumpTransaction(innerTx, sponsorPublicKey, networkPassphrase) helper using the correct SDK positional API: TransactionBuilder.buildFeeBumpTransaction(feeSource, baseFee, innerTx, networkPassphrase)
    • lockAssets — checks native XLM balance; if < 1.0 XLM and NEXT_PUBLIC_FEE_SPONSOR_PUBLIC_KEY is set, calls /api/sign-fee-bump and submits the wrapped envelope
    • unlockAssets — same sponsored flow
    • Fixed pre-existing getEvents pagination type error (moved limit to top level)
  • src/app/farm/page.tsx — adds isFeeSponsored detection and warning banner in the deposit modal
  • src/app/farm/[poolId]/PoolDetailClient.tsx — same sponsored banner in the pool detail deposit modal
  • src/components/UnlockModal/UnlockModal.tsx — fixed pre-existing duplicate isDisabled prop

Environment Variables Required

Variable Where Description
STELLAR_FEE_SPONSOR_SECRET Server-only (.env.local) Secret key of the fee sponsor account
NEXT_PUBLIC_FEE_SPONSOR_PUBLIC_KEY Public (.env.local) Public key of the sponsor — enables fee-bump mode in the UI

Testing

  • All 66 tests pass (npm run test)
  • Production build passes (npm run build)

Closes #30

- Add buildFeeBumpTransaction helper in src/lib/soroban.ts using the
  correct TransactionBuilder.buildFeeBumpTransaction(feeSource, baseFee,
  innerTx, networkPassphrase) positional API
- Add fetchAccountBalances utility in src/lib/stellar.ts (404-safe)
- Add POST /api/sign-fee-bump route handler that wraps and signs the
  inner transaction with STELLAR_FEE_SPONSOR_SECRET
- Integrate automatic fee-bump detection into lockAssets and unlockAssets:
  fetches native XLM balance, enables sponsor mode when balance < 1.0 XLM
  and NEXT_PUBLIC_FEE_SPONSOR_PUBLIC_KEY is configured
- Display sponsored warning banner in both deposit modals (farm list page
  and pool detail page) when fee-bump is active
- Fix pre-existing duplicate isDisabled prop in UnlockModal
- Fix pre-existing getEvents pagination type error in soroban.ts
- 2 new unit tests for buildFeeBumpTransaction (all 66 tests pass)

Closes SmartDropLabs#30
@prodbycorne prodbycorne merged commit 96b6152 into SmartDropLabs:main Jun 28, 2026
1 check passed
@prodbycorne

Copy link
Copy Markdown
Contributor

Good Job

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 fee-bump transaction support for sponsored accounts with zero XLM balance

3 participants