feat(rewards): send wallet address with benefit impression#30914
feat(rewards): send wallet address with benefit impression#30914jeremytsng wants to merge 3 commits into
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. |
Include the currently selected account address in the POST /benefits/impression request body so the rewards backend can attribute each impression to a wallet. Thread an optional walletAddress through RewardsController.postBenefitImpression and the rewards data service; it is omitted from the body when no account is selected, preserving existing behaviour. Update unit tests for the data service, controller, and BenefitFullView.
Adds the walletAddress @param line emitted by messenger-generate-action-types now that postBenefitImpression accepts it. Fixes the lint job's generate-method-action-types:check diff.
3333301 to
9280115
Compare
PR template — items to address before "Ready for review"Warnings — informational, address before merging:
See docs/readme/ready-for-review.md for the full Definition of Ready for Review. |
The impression wallet must match the wallet the click is attributed to. Reading the selected internal account picked the wrong wallet whenever a benefit targeted an account other than the first in the list, and its async hydration re-fired the effect, posting a second impression. Derive walletAddress from the 'wallet' query param on benefit.url, which makes it a pure function of the route param: one impression per view.
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection:
No E2E tests exist for the Rewards/Benefits feature - confirmed by searching No shared components are affected - the changes are isolated to the Rewards feature module and don't touch TabBar, Browser, Confirmations, navigation, or any other shared infrastructure. Risk is low because:
Performance Test Selection: |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit aac3efa. Configure here.
| ) | ||
| .catch(); | ||
| }, [benefit, subscriptionId]); | ||
| }, [benefit, subscriptionId, walletAddress]); |
There was a problem hiding this comment.
Wallet omitted without URL param
Medium Severity
Benefit impressions now take walletAddress only from the wallet query param on benefit.url, but opening a benefit from BenefitCard passes the API benefit unchanged and nothing in the rewards flow adds that param. With a selected account and a typical claim URL, impressions still omit walletAddress, so per-wallet attribution does not match the PR’s selected-account behavior.
Reviewed by Cursor Bugbot for commit aac3efa. Configure here.
There was a problem hiding this comment.
we no longer use selected-account
|





Description
Benefit-impression events sent to the rewards backend identified which benefit was viewed but not which wallet viewed it, so there was no per-wallet visibility into benefit engagement.
This adds the currently selected account's address to the
POST /benefits/impressionrequest body. The address is threaded throughRewardsController.postBenefitImpressionand the rewards data service, and is omitted from the body when no account is selected so existing behaviour is preserved. The rewards backend then attributes the impression to that wallet.Changelog
CHANGELOG entry: null
Related issues
Fixes:
Manual testing steps
Screenshots/Recordings
Before
After
Pre-merge author checklist
Performance checks (if applicable)
trace()for usage andaddTokenfor an exampleFor performance guidelines and tooling, see the Performance Guide.
Pre-merge reviewer checklist
Note
Low Risk
Additive optional API field and URL parsing only; no auth or payment logic changes, though wallet addresses are sent to the rewards backend when present in the benefit URL.
Overview
Benefit impressions can now be attributed to a wallet by sending an optional
walletAddressonPOST /benefits/impression.When the user opens BenefitFullView, the app parses the benefit’s
urlfor awalletquery parameter and passes that value throughRewardsController:postBenefitImpressioninto the rewards data service. The field is omitted from the JSON body when the URL is missing, empty, or has nowalletparam, so callers without a URL still behave like before.Controller, messenger action types, and service tests were updated to forward or serialize
walletAddress; BenefitFullView tests cover URL parsing, missing wallet, and a single impression after subscription hydration.Reviewed by Cursor Bugbot for commit aac3efa. Bugbot is set up for automated code reviews on this repo. Configure here.