Skip to content
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

Merged
merged 17 commits into from
Mar 21, 2024

Conversation

dievazqu
Copy link
Contributor

@dievazqu dievazqu commented Mar 18, 2024

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

Copy link

emerge-tools bot commented Mar 18, 2024

1 build increased size

Name Version Download Change Install Change Approval
⚠️ Celo (test)
org.celo.mobile.test
1.81.0 (146) 26.6 MB ⬆️ 2.4 MB (9.8%) 63.1 MB ⬆️ 2.7 MB (4.45%) N/A

Celo (test) 1.81.0 (146)
org.celo.mobile.test

⚖️ Compare build
📦 Install build
⏱️ Analyze build performance

Total install size change: ⬆️ 2.7 MB (4.45%)
Total download size change: ⬆️ 2.4 MB (9.8%)

Largest size changes

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
View Treemap

Image of diff


🛸 Powered by Emerge Tools

Copy link

codecov bot commented Mar 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 85.71%. Comparing base (6118c1e) to head (49d943e).

Additional details and impacted files

Impacted file tree graph

@@            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              
Files Coverage Δ
src/transactions/feed/TransactionFeed.tsx 93.10% <100.00%> (ø)
src/transactions/feed/TransactionFeedItemImage.tsx 93.10% <100.00%> (+0.79%) ⬆️
src/transactions/feed/TransferFeedItem.tsx 94.44% <100.00%> (+0.15%) ⬆️
src/transactions/transferFeedUtils.ts 88.34% <100.00%> (+0.60%) ⬆️
src/transactions/utils.ts 100.00% <100.00%> (ø)
test/values.ts 100.00% <100.00%> (ø)

... and 1 file with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6118c1e...49d943e. Read the comment docs.

Copy link
Collaborator

@kathaypacific kathaypacific left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looking great!! ✨

@@ -11,3 +15,8 @@ export const showJumstartClaimError = (state: RootState) => {
export const jumpstartSendStatusSelector = (state: RootState) => {
return state.jumpstart.depositStatus
}

export const getJumpstartContractAddress = (networkId: NetworkId) => {
Copy link
Collaborator

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?

Copy link
Contributor Author

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:

const getJumpstartEnabledNetworkIds = () =>

So I thought it was ok to leave this method here.

@@ -0,0 +1,7 @@
import { getJumpstartContractAddress } from 'src/jumpstart/selectors'
Copy link
Collaborator

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 })
Copy link
Collaborator

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 (
Copy link
Collaborator

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?

Copy link
Contributor Author

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')
Copy link
Collaborator

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

Copy link
Collaborator

@kathaypacific kathaypacific left a 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)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const isJumpstart = isJumpstartTransaction(transfer)
const isJumpstartTransaction = isJumpstartTransaction(transfer)

super nit 😅

Copy link
Contributor Author

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.

Copy link
Collaborator

@kathaypacific kathaypacific left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

@dievazqu dievazqu enabled auto-merge March 21, 2024 16:26
@dievazqu dievazqu added this pull request to the merge queue Mar 21, 2024
Merged via the queue into main with commit bf0b169 Mar 21, 2024
16 checks passed
@dievazqu dievazqu deleted the diego/jumpstart-feed-items branch March 21, 2024 17:00
shottah pushed a commit to zed-io/kolektivo that referenced this pull request May 15, 2024
)

### 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants