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(lld): add simplehash calls for ordis #7783

Merged
merged 1 commit into from
Sep 20, 2024
Merged

Conversation

LucasWerey
Copy link
Contributor

@LucasWerey LucasWerey commented Sep 10, 2024

✅ Checklist

  • npx changeset was attached.
  • Covered by automatic tests.
  • Impact of the changes:
    • BTC account
    • live-nft-react
    • inscriptions/rare Sats tables

📝 Description

This is the third PR of LIVE-12479
We can use the same API to fetch inscriptions and rare sats. For this we use utxo addresses from Account as it's a BitcoinAccount. After some manipulations we can separate rare sats and inscriptions to fill the two tables.

Inside live-nft-react we only remove all the common sats from the object and separate inscriptions and rare sats.
There is a restructuration inside Collectibles/Hooks of the object.

Since we use tanstack I've added an error message when the API respond with an error. It can be useful particularly because it's an external API

A tooltip is added when hovering specific rare sat icon in rare sats table and inscription table. Some of the rare sats don't have description.

Important

Some inscriptions have a canvas as media. In LLD / LLM we are currently not able to display them. A solution would be to use an iFrame but this can represents some risk since the API is from a partner. A solution would be to do as it has been done during hackathon by using magicEden endpoint but not sure we have the right 👀
it has been decided to prioritise safety so we will display fallback image for the moment
also utxo_size is removed of the table since no other platforms displays it and product is not sure about the utility of this information

Screen.Recording.2024-09-12.at.15.38.38.mov

image

❓ Context


🧐 Checklist for the PR Reviewers

  • The code aligns with the requirements described in the linked JIRA or GitHub issue.
  • The PR description clearly documents the changes made and explains any technical trade-offs or design decisions.
  • There are no undocumented trade-offs, technical debt, or maintainability issues.
  • The PR has been tested thoroughly, and any potential edge cases have been considered and handled.
  • Any new dependencies have been justified and documented.
  • Performance considerations have been taken into account. (changes have been profiled or benchmarked if necessary)

Copy link

vercel bot commented Sep 10, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
web-tools ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 19, 2024 3:58pm
4 Skipped Deployments
Name Status Preview Comments Updated (UTC)
ledger-live-docs ⬜️ Ignored (Inspect) Visit Preview Sep 19, 2024 3:58pm
ledger-live-github-bot ⬜️ Ignored (Inspect) Visit Preview Sep 19, 2024 3:58pm
native-ui-storybook ⬜️ Ignored (Inspect) Visit Preview Sep 19, 2024 3:58pm
react-ui-storybook ⬜️ Ignored (Inspect) Visit Preview Sep 19, 2024 3:58pm

@live-github-bot live-github-bot bot added the desktop Has changes in LLD label Sep 10, 2024
@live-github-bot live-github-bot bot added the translations Translation files have been touched label Sep 10, 2024
@LucasWerey LucasWerey force-pushed the feat/LIVE-12467-c branch 2 times, most recently from 9b9d88a to 9cd4895 Compare September 12, 2024 13:08
@LucasWerey LucasWerey marked this pull request as ready for review September 13, 2024 14:45
@LucasWerey LucasWerey requested review from a team as code owners September 13, 2024 14:45
@LucasWerey LucasWerey changed the title ✨feat(ui): add simplehash calls for ordis ✨feat(lld): add simplehash calls for ordis Sep 13, 2024
Comment on lines +38 to +42
useEffect(() => {
if (queryResult.hasNextPage && !queryResult.isFetchingNextPage) {
queryResult.fetchNextPage();
}
}, [queryResult, queryResult.hasNextPage, queryResult.isFetchingNextPage]);
Copy link
Contributor

Choose a reason for hiding this comment

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

why do you need useEffect ?

You try to fetch every pages without scrolling?

Copy link
Contributor Author

@LucasWerey LucasWerey Sep 16, 2024

Choose a reason for hiding this comment

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

The issue is that rare sats table doesn't load progressively but should displays everything once. And because I use the same call for Inscriptions and RareSats I need to fetch all pages but I agree not the best

Copy link
Contributor

Choose a reason for hiding this comment

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

You are right, I just wanted to know if this is expected to fetch "all pages" :)

but looks good and with useInfiniteQuery there is not a lot of solution to di it ^^

Copy link
Contributor

Choose a reason for hiding this comment

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

https://tanstack.com/query/latest/docs/framework/react/reference/useInfiniteQuery

maybe you can do something with getNextPageParam & allPages

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure I can do anything using allPages

@@ -220,7 +221,7 @@ const AccountPage = ({
)
) : null}
{isOrdinalsEnabled && account.type === "Account" && account.currency.id === "bitcoin" ? (
<OrdinalsAccount account={account} />
<OrdinalsAccount account={account as BitcoinAccount} />
Copy link
Contributor

Choose a reason for hiding this comment

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

Why force?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because I need to have the bitcoinRessources that are only inside BitcoinAccount and I thought it would be cleaner to do it this way to avoid ts error. I can add a utils to check if it's a btc account by checking if the account has bitcoinResources

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed for two type guards => one that checks if it's a fork of btc and one to check if that fork is a BTC account or a fork

Comment on lines 154 to 156
function isBitcoinAccount(account: BitcoinAccount): boolean {
return account.currency.id === "bitcoin";
}
Copy link
Contributor

Choose a reason for hiding this comment

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

could be moved outside in an helper ?

also you can just do account: Account

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added to common lib so I will be able to use it on LLM too

@LucasWerey LucasWerey merged commit e4b6647 into develop Sep 20, 2024
54 of 56 checks passed
@LucasWerey LucasWerey deleted the feat/LIVE-12467-c branch September 20, 2024 12:30
mcayuelas-ledger pushed a commit that referenced this pull request Sep 20, 2024
✨feat(ui): add simplehash calls for ordis
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
common Has changes in live-common desktop Has changes in LLD translations Translation files have been touched
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants