fix(sdk-provider-solana): preserve Solana RPC error details on TransactionError cause#387
Open
chybisov wants to merge 3 commits into
Open
fix(sdk-provider-solana): preserve Solana RPC error details on TransactionError cause#387chybisov wants to merge 3 commits into
chybisov wants to merge 3 commits into
Conversation
…ctionError cause
Three throw sites in the Solana provider stringified the structured Solana
result into a message and discarded the original payload — notably the
`logs` array, the most actionable field for diagnosing program failures.
Introduces SolanaTransactionDetailsError, a minimal Error subclass that
exposes `err` and `logs` as own readonly properties, and applies it
uniformly at:
- SolanaStandardWaitForTransactionTask preflight simulation (was nesting
details two levels deep via Error(msg, { cause: { err, logs } }))
- SolanaStandardWaitForTransactionTask post-send signatureResult.err
(previously dropped on the floor)
- SolanaJitoWaitForTransactionTask bundle failedResult.err (previously
dropped on the floor and missing bigint-safe JSON.stringify)
Consumers can now read `error.cause.err` and `error.cause.logs` directly,
one level deep. Public surface (TransactionError code and message
prefixes) is unchanged.
Closes #385
Supersedes #386
…ackage root Let consumers narrow `error.cause` with `instanceof SolanaTransactionDetailsError` for typed access to `err` and `logs`, without reaching into a deep import path.
effie-ms
approved these changes
May 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
SolanaTransactionDetailsError, a minimalErrorsubclass exposingerrandlogsas own readonly properties — exported from the package root so consumers caninstanceofand type-narrow.error.cause.erranderror.cause.logsdirectly, one level deep — without re-simulating the transaction.Credit
Big thanks to @samsamtrum for surfacing the issue in #385 and shipping the first-pass fix in #386 — this PR builds directly on that diagnosis. It supersedes #386 by flattening the cause shape and extending the same fix to two sibling sites.
Why
Closes #385.
Supersedes #386 — please close it after this lands.
The Solana provider has three RPC-driven failure paths. Each one used to stringify the structured Solana result into a message and lose the rest:
SolanaStandardWaitForTransactionTaskpreflight simulationcausewasnew Error(msg, { cause: { err, logs } })(nested two levels)causeisSolanaTransactionDetailsErrorwith.errand.logsSolanaStandardWaitForTransactionTaskpost-sendsignatureResult.errcauseat allcauseisSolanaTransactionDetailsErrorwith.errSolanaJitoWaitForTransactionTaskbundlefailedResult.errcause, no bigint-safeJSON.stringify(latent bug iferrcontains bigints)causeisSolanaTransactionDetailsErrorwith.err; bigint payloads now serialize safelyBigint-safe
JSON.stringifyis now a single helper (safeStringifyBigInt), replacing three near-duplicate inline copies.Public surface
TransactionError.codeand message prefixes (Transaction simulation failed: …,Transaction failed: …) are preserved verbatim.error.causeis strictly more informative; was a wrapperErrororundefinedbefore.SolanaTransactionDetailsErroris exported from@lifi/sdk-provider-solanafor typed consumer access:Test plan
pnpm check(biome) — cleanpnpm check:types— clean (all 6 packages)pnpm check:circular-deps— cleanpnpm knip:check— cleanpnpm --filter @lifi/sdk-provider-solana test:unit— 49 passed (16 new)pnpm test:unit(monorepo) — all packages greenpnpm build(monorepo) — all packages built;SolanaTransactionDetailsErrorappears indist/esm/index.d.tsNew unit tests:
solanaErrorCause.unit.spec.ts—safeStringifyBigInt+SolanaTransactionDetailsErrorbehaviourSolanaStandardWaitForTransactionTask.unit.spec.ts— simulation failure, post-send failure, bigint payload safetySolanaJitoWaitForTransactionTask.unit.spec.ts— bundle failure, bigint regression coverageLinear
EMB-390