Skip to content

feat: build, inspect, and export fee-bump transactions with inner-env… - #919

Merged
Nanle-code merged 2 commits into
Nanle-code:masterfrom
praizeD10:feat/fee-bump-builder-signer
Aug 31, 2026
Merged

feat: build, inspect, and export fee-bump transactions with inner-env…#919
Nanle-code merged 2 commits into
Nanle-code:masterfrom
praizeD10:feat/fee-bump-builder-signer

Conversation

@praizeD10

Copy link
Copy Markdown

closes #758

…elope details

Three things were broken for fee-bump transactions:

  1. Builder.tsx uses stellar.ts buildTransaction/simulateTransaction, which had no fee-bump support at all. A feeBump operation would silently skip during build and crash on simulate with a misleading error.

  2. TransactionSigner accepted any XDR but never inspected the envelope — pasting a FeeBumpTransaction gave no way to see what you were actually signing (inner source, operations, fee, signature count were all invisible).

  3. No utility existed to parse XDR and safely identify its type or surface inner-envelope details without throwing.

Changes:

src/utils/feeBumpInspector.ts (new)
Pure utility with no side effects. inspectEnvelope(xdr, network) returns a
typed discriminated union. For FeeBumpTransaction: outer hash, feeSource,
outer fee, and full inner envelope (hash, source, fee, sequence, signatures,
operation list). For plain Transaction: the same fields directly. Never
throws — callers check .ok before accessing .envelope.

src/components/dashboard/TransactionSigner.tsx

  • Added envelopeInfo state driven by inspectEnvelope on every XDR change.
  • handleXdrChange now also clears signedXdr and error on new input so stale state never lingers alongside a new paste.
  • EnvelopeDetails component renders below the textarea: for fee-bump it shows a nested two-panel layout (outer wrapper + inner transaction); for plain transactions it shows the standard field set.

src/lib/stellar.ts

  • buildTransaction return type widened to Transaction | FeeBumpTransaction. Fee-bump path added before the account-load path: validates feeSource, baseFee, innerTransaction XDR with explicit error messages, then calls TransactionBuilder.buildFeeBumpTransaction. Mixed fee-bump + other ops rejected with a clear error.
  • simulateTransaction: skips validateSimulationParams (which requires a sourceAccount) when the only operation is feeBump; uses instanceof FeeBumpTransaction to compute operationCount correctly (inner ops + 1); guards the Soroban simulation path with the same check.
  • exportTransactionXDR is unaffected — .toXDR() exists on both types.

tests/unit/lib/feeBumpInspector.test.js (new)
17 tests across 4 groups: primary fee-bump flow (type, feeSource, inner
details, hashes, fee ordering), plain transaction flow, boundary cases
(unsigned tx, whitespace input, unknown network), failure cases (empty
string, garbage, truncated XDR, null/non-string inputs — never throws).

…elope details

Three things were broken for fee-bump transactions:

1. Builder.tsx uses stellar.ts buildTransaction/simulateTransaction, which had
   no fee-bump support at all. A feeBump operation would silently skip during
   build and crash on simulate with a misleading error.

2. TransactionSigner accepted any XDR but never inspected the envelope — pasting
   a FeeBumpTransaction gave no way to see what you were actually signing (inner
   source, operations, fee, signature count were all invisible).

3. No utility existed to parse XDR and safely identify its type or surface
   inner-envelope details without throwing.

Changes:

src/utils/feeBumpInspector.ts (new)
  Pure utility with no side effects. inspectEnvelope(xdr, network) returns a
  typed discriminated union. For FeeBumpTransaction: outer hash, feeSource,
  outer fee, and full inner envelope (hash, source, fee, sequence, signatures,
  operation list). For plain Transaction: the same fields directly. Never
  throws — callers check .ok before accessing .envelope.

src/components/dashboard/TransactionSigner.tsx
  - Added envelopeInfo state driven by inspectEnvelope on every XDR change.
  - handleXdrChange now also clears signedXdr and error on new input so stale
    state never lingers alongside a new paste.
  - EnvelopeDetails component renders below the textarea: for fee-bump it shows
    a nested two-panel layout (outer wrapper + inner transaction); for plain
    transactions it shows the standard field set.

src/lib/stellar.ts
  - buildTransaction return type widened to Transaction | FeeBumpTransaction.
    Fee-bump path added before the account-load path: validates feeSource,
    baseFee, innerTransaction XDR with explicit error messages, then calls
    TransactionBuilder.buildFeeBumpTransaction. Mixed fee-bump + other ops
    rejected with a clear error.
  - simulateTransaction: skips validateSimulationParams (which requires a
    sourceAccount) when the only operation is feeBump; uses instanceof
    FeeBumpTransaction to compute operationCount correctly (inner ops + 1);
    guards the Soroban simulation path with the same check.
  - exportTransactionXDR is unaffected — .toXDR() exists on both types.

tests/unit/lib/feeBumpInspector.test.js (new)
  17 tests across 4 groups: primary fee-bump flow (type, feeSource, inner
  details, hashes, fee ordering), plain transaction flow, boundary cases
  (unsigned tx, whitespace input, unknown network), failure cases (empty
  string, garbage, truncated XDR, null/non-string inputs — never throws).
@vercel

vercel Bot commented Aug 26, 2026

Copy link
Copy Markdown

Someone is attempting to deploy a commit to the nanle-code's projects Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave

drips-wave Bot commented Aug 26, 2026

Copy link
Copy Markdown

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

@Manuelshub

Copy link
Copy Markdown
Collaborator

@praizeD10 Please fix all the CI checks failure!

@Manuelshub

Copy link
Copy Markdown
Collaborator

@praizeD10 Please resolve conflicts so I can merge!!

@Nanle-code
Nanle-code merged commit b789485 into Nanle-code:master Aug 31, 2026
1 check failed
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.

[2026 Transactions] Complete fee-bump envelope signing support

3 participants