fix(stellar-wallet-snap): txn history with empty account - #255
fix(stellar-wallet-snap): txn history with empty account#255stanleyyconsensys wants to merge 4 commits into
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
parseContractEventsFromResultMeta contains a confirmed switch fallthrough bug that breaks V3 meta parsing and can cause valid contract events to be dropped.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR improves @metamask/stellar-wallet-snap transaction history mapping for Soroban invoke-host-function transactions by detecting wallet-credited SAC transfer contract events in result_meta_xdr, allowing these credits (native and classic CODE:ISSUER) to be surfaced as Receive transactions rather than Unknown.
Changes:
- Add generic parsing utilities to walk contract events from Horizon
result_meta_xdrand safely parse SACtransferevents credited to a given account. - Extend
TransactionMapperto map eligible invoke-host-function transactions as receives based on parsed contract events (native + classic assets). - Add fixtures and unit tests covering receive mapping for contract swap credits; update the package changelog.
File summaries
| File | Description |
|---|---|
| packages/stellar-wallet-snap/src/services/transaction/xdrParser.ts | Adds contract-event extraction from result_meta_xdr and a safe SAC transfer parser for receive detection. |
| packages/stellar-wallet-snap/src/services/transaction/xdrParser.test.ts | Adds unit tests for parsing credited SAC transfers from transaction meta. |
| packages/stellar-wallet-snap/src/services/transaction/TransactionMapper.ts | Adds invoke-host-function receive fallback mapping driven by meta contract events. |
| packages/stellar-wallet-snap/src/services/transaction/TransactionMapper.test.ts | Adds mapping coverage for native + USDC contract-swap receive scenarios. |
| packages/stellar-wallet-snap/src/services/transaction/mocks/horizon-transaction-responses.fixtures.ts | Introduces Horizon fixtures containing result_meta_xdr with SAC transfer events. |
| packages/stellar-wallet-snap/CHANGELOG.md | Adds an Unreleased “Fixed” entry describing the improved receive mapping. |
Review details
- Files reviewed: 6/6 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| describe('parseContractEventsFromResultMeta', () => { | ||
| it('accumulates native SAC transfers credited to the wallet', () => { | ||
| const results = parseContractEventsFromResultMeta({ |
There was a problem hiding this comment.
we cover it via fixture already
Explanation
This PR improves @metamask/stellar-wallet-snap transaction history mapping for Soroban invoke-host-function transactions by detecting wallet-credited SAC transfer contract events in result_meta_xdr, allowing these credits (native and classic CODE:ISSUER) to be surfaced as Receive transactions rather than Unknown.
Changes:
References
Checklist