-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(jumpstart): Adding jumpstart transaction detection #5120
Conversation
1 build increased size
Celo (test) 1.81.0 (146)
|
Item | Install Size Change |
---|---|
📝 splashBackground@3x.jpg | ⬆️ 600.2 kB |
📝 background@3x.jpg | ⬆️ 368.6 kB |
📝 boost-rewards@3x.png | ⬆️ 188.4 kB |
📝 background@2x.jpg | ⬆️ 176.1 kB |
📝 boost-rewards@2x.png | ⬆️ 90.1 kB |
🛸 Powered by Emerge Tools
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #5120 +/- ##
==========================================
+ Coverage 85.70% 85.71% +0.01%
==========================================
Files 729 729
Lines 29834 29854 +20
Branches 5155 5160 +5
==========================================
+ Hits 25568 25589 +21
+ Misses 4031 4030 -1
Partials 235 235
... and 1 file with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looking great!! ✨
src/jumpstart/selectors.ts
Outdated
@@ -11,3 +15,8 @@ export const showJumstartClaimError = (state: RootState) => { | |||
export const jumpstartSendStatusSelector = (state: RootState) => { | |||
return state.jumpstart.depositStatus | |||
} | |||
|
|||
export const getJumpstartContractAddress = (networkId: NetworkId) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this feels a little out of place in a selector file since it doesn't relate to redux. i see it is only used in the utils file, can we remove this function here and use the logic directly in the util?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I can move this function.
I saw this example:
wallet/src/tokens/selectors.ts
Line 522 in 409ace7
const getJumpstartEnabledNetworkIds = () => |
So I thought it was ok to leave this method here.
src/jumpstart/utils.ts
Outdated
@@ -0,0 +1,7 @@ | |||
import { getJumpstartContractAddress } from 'src/jumpstart/selectors' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think we are trying to not create more general "utils" files because they become a dumping ground for random functions (sometimes poorly thought out abstractions). perhaps we can rename this file to something like "transactionClassificationHelpers" or something? or perhaps we can add to the mess in the transactions folder, there is already a utils file there that this function might make sense in :)
const { amount, type } = transfer | ||
|
||
const openTransferDetails = () => { | ||
navigate(Screens.TransactionDetailsScreen, { transaction: transfer }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since we already know that this transaction is a jumpstart transaction here, can we add this information as a nav parameter? then the TransactionDetailsScreen would already receive this information as a boolean, and wouldn't need to call isJumpstartTransaction
at all. (and then isJumpstartTransaction
would only need to be called once in the TransactionFeed, and perhaps can live as an unexported function in that file.
? t('feedItemJumpstartReceivedSubtitle') | ||
: t('feedItemJumpstartSentSubtitle') | ||
|
||
return ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reading this component, it is so similar to the existing TransferFeedItem...did you consider sharing code between the components? in particular, i think the whole render block could be shared? it seems like the only areas of customisation are the image, title, and subtitle?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes! I considered it but the code was a bit ugly because how the TransactionFeedItemImage
was used.
And I went with the quick solution, but now I changed TransactionFeedItemImage
implementation, so I think I can merge this feed item to the transfer one.
Thanks for the call out!
|
||
jest.mock('src/jumpstart/utils') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
perhaps we can mock the return value of statsig rather than mocking this module? there are no unit tests for this module so kind of nice to not exclude this file intentionally
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!! i didn't really look at the changes in the TransactionDetailsScreen / TransactionDetailsScreen.tests though since it looks like the changes are reverted in the next PRs. it'd be nice to remove the unnecessary changes from this PR before merging? i think it's okay if the tx details screen for jumpstart just shows as payment sent / recieved
@@ -123,6 +123,7 @@ export function useTransferFeedDetails(transfer: FeedTokenTransfer) { | |||
const tokenInfo = useTokenInfoByAddress(transfer.amount.tokenAddress) | |||
const coinbasePaySenders = useSelector(coinbasePaySendersSelector) | |||
const fcTransferDisplayInfo = useFiatConnectTransferDisplayInfo(transfer) | |||
const isJumpstart = isJumpstartTransaction(transfer) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const isJumpstart = isJumpstartTransaction(transfer) | |
const isJumpstartTransaction = isJumpstartTransaction(transfer) |
super nit 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't use that name, because the function is called like that. 😅
I hope leaving isJumpstart
is fine.
cd9d904
to
95e638e
Compare
95e638e
to
cf02ff1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀
) ### Description This PR handles jumpstart transaction home feed and common details screen. ### Test plan Unit test + emulator ### Related issues - Fixes RET-996 ### Backwards compatibility Y ### Video recording https://github.com/valora-inc/wallet/assets/12504748/4686fa6d-0bca-4268-be92-6d60c9b098e8
Description
This PR handles jumpstart transaction home feed and common details screen.
Test plan
Unit test + emulator
Related issues
Backwards compatibility
Y
Video recording
Simulator.Screen.Recording.-.iPhone.SE.3rd.generation.-.2024-03-18.at.10.03.23.mp4