fix: prevent uncaught error from missing crypto object on order data cp-7.72.0#27884
Conversation
|
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
…order data Signed-off-by: Sébastien Van Eyck <sebastien.vaneyck@consensys.net>
a8a89fb to
062bca8
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
646686f to
bdd0b0f
Compare
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection: Performance Test Selection: |
|
✅ E2E Fixture Validation — Schema is up to date |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #27884 +/- ##
==========================================
+ Coverage 82.56% 82.59% +0.03%
==========================================
Files 4825 4841 +16
Lines 123955 124527 +572
Branches 27617 27768 +151
==========================================
+ Hits 102346 102858 +512
- Misses 14560 14595 +35
- Partials 7049 7074 +25 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|




Description
Summary
This PR addresses the recurring
Cannot read property "network" of undefinederror encountered by some users during the offramp flow.Context
The issue was identified via multiple user reports and there was already a previous fix for a similar issue. Users reported that after being redirected back from the provider's widget to the MetaMask app, the application crashed.
This issue is a blocker for users.
More info can be found on this Slack thread.
Changes
Added defensive checks to ensure the network object is properly initialized before access.
Next actions
Investigation is ongoing with providers to understand why
cryptoobject could be missing in some occasion on order data.Changelog
CHANGELOG entry: prevent app crash caused by missing crypto object from order data
Related issues
Fixes: https://consensyssoftware.atlassian.net/browse/TRAM-3393
Ongoing investigation: https://consensyssoftware.atlassian.net/browse/RAMP-451
Manual testing steps
Screenshots/Recordings
Before
After
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Low Risk
Low risk defensive null-checking in
SendTransactionplus tests; main behavior change is the screen and send action now no-op/return null when required crypto/network data is missing, which could hide the CTA for malformed orders but prevents crashes.Overview
Prevents the offramp
SendTransactionscreen from crashing when an order returns withoutcryptoCurrency(or missingcryptoCurrency.network).transactionAnalyticsPayloadnow uses optional chaining for provider/payment/currency fields, andhandleSendearly-returns ifchainIdis unavailable; the view also returnsnullwhencryptoCurrencyis missing.Adds/updates tests to cover missing/partial order data (including analytics assertions and ensuring
addTransactionis not invoked) and refreshes snapshots accordingly.Written by Cursor Bugbot for commit bdd0b0f. This will update automatically on new commits. Configure here.