ENG-2376: make solana tx building work#518
Conversation
|
📝 WalkthroughWalkthroughThis PR introduces shared Solana transaction decoding utilities that normalize raw transaction strings and attempt multiple encoding candidates (hex and base64), replacing inline deserialization logic in the connector's ChangesSolana Transaction Deserialization Utilities
🎯 3 (Moderate) | ⏱️ ~20 minutes
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/widget/src/providers/misc/solana-connector.ts`:
- Around line 39-55: The current logic pushes both a hex DecodingCandidate and
an unconditional base64 candidate, causing hex inputs
(normalizedTx/withoutHexPrefix detected by isHexString) to also be reinterpreted
as base64; change the branch so that when isHexString(withoutHexPrefix) is true
you push only the hex candidate into candidates and skip adding the base64
candidate, and add a unit test asserting that an input starting with "0x" yields
exactly one candidate (encoding "hex") and no base64 fallback; update
references: normalizedTx, withoutHexPrefix, isHexString, DecodingCandidate, and
the candidates array.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 7b2c23f9-f16a-4b2e-b9fb-fd254c1fc2d2
📒 Files selected for processing (2)
packages/widget/src/providers/misc/solana-connector.tspackages/widget/tests/use-cases/solana-connector.test.ts
|
This pull request is automatically being deployed by Amplify Hosting (learn more). |
|
This pull request is automatically being deployed by Amplify Hosting (learn more). |
Added
Description of new functionality, feature, or content that has been added in this pull request.
Changed
Updated the Solana connector to make transaction decoding deterministic and safer:
getSolanaTxDecodingCandidates() now chooses one encoding path:
hex only when the input is valid hex (including 0x...)
otherwise base64 only
This prevents hex payloads from also being (incorrectly) retried as base64.
Also tightened tests for this behavior:
Added assertion that a 0x hex input produces exactly one candidate, with encoding "hex".
Kept validation coverage for base64, error messaging, and adapter pass-through.
Verified with pnpm lint and the connector test file (all passing).
Summary by CodeRabbit
Bug Fixes
Tests