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

Activity details loading #1519

Merged
merged 4 commits into from Apr 30, 2024
Merged

Activity details loading #1519

merged 4 commits into from Apr 30, 2024

Conversation

greg-schrammel
Copy link
Contributor

Fixes BX-####
Figma link (if any):

What changed (plus any additional context for devs)

  • activity details sheet insta shows on clicking an activity (before was waiting for loading), now it shows with the data we got and updates as more data comes
  • removed testnetMode from the consolidatedTransactionsQueryKey as it was not used in the query itself and I didn't find a reason to have it in the query key lmk if Im mistaken
  • refactored a lil bit the useTransaction hook, aggregated into a single useQuery for either supported or unsupported BE networks and added some more info we could find when fetching the tx data from the provider

Screen recordings / screenshots

What to test

Copy link

Here's the packed extension for this build:
rainbowbx-ff12e232c595b2d0d4c8200199c2263cc13b8c5d.zip

@@ -52,6 +51,14 @@ export const fetchTransaction = async ({
currency: SupportedCurrencyKey;
chainId: ChainId;
}) => {
if (!SUPPORTED_CHAIN_IDS.includes(chainId)) {
Copy link
Member

Choose a reason for hiding this comment

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

did you find any case where we pass unsopperted chainids?

all of the instances are using chains coming from useBackendSupportedChains hook like this https://github.com/rainbow-me/browser-extension/blob/master/src/entries/popup/hooks/useTransactionListForPendingTxs.ts#L32 or from that constant https://github.com/rainbow-me/browser-extension/blob/master/src/entries/popup/pages/home/Approvals/Approvals.tsx#L342

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 consolidated the other hooks into useTransaction (from outside this file everything works the same) to handle the transaction metadata no matter where that data is coming from
so I check if it's supported by the backend in the this fetch to decide if it's gonna fetch from our api ou the provider

Copy link
Member

Choose a reason for hiding this comment

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

okok it makes sense

};
}

const type = await guessTransactionType(provider, transaction);
Copy link
Member

Choose a reason for hiding this comment

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

why await?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Im fetching data from the provider to guess the type
like transaction.to has code (provider.getCode) means it's probably a transaction interacting with a contract

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hmm idk whats the expected behavior on smart wallets

Copy link
Member

Choose a reason for hiding this comment

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

oh wow i missed the getCode part, nvmm

return getCustomNetworkTransactions({ address }).find(
(tx) => tx.hash === hash && tx.chainId === chainId,
);
},
Copy link
Member

Choose a reason for hiding this comment

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

i don't follow why this is mixing txs supported by backend and the ones from customNetworkTransactionsStore, there are separate stores and we're using them separately

Copy link

Here's the packed extension for this build:
rainbowbx-761c528239f287c43ab843e0942eb2ec975f4c73.zip

Copy link
Member

@estebanmino estebanmino left a comment

Choose a reason for hiding this comment

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

lgtm 🚀

@DanielSinclair DanielSinclair added this pull request to the merge queue Apr 30, 2024
Merged via the queue into master with commit 2e2915e Apr 30, 2024
17 checks passed
@DanielSinclair DanielSinclair deleted the better-activity-details branch April 30, 2024 19:06
Copy link

Here's the packed extension for this build:
rainbowbx-2e2915e9afde90784b301fb23eefbf6e5fc6e41f.zip

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

4 participants