-
Notifications
You must be signed in to change notification settings - Fork 409
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(thirdweb): adds useChainMetadata hook to retrieve metadata for a chain #3857
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
🦋 Changeset detectedLatest commit: d5e5467 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
9c20b49
to
6bcb9d0
Compare
Graphite Automations"If PR for SDK -> Tag Joaquim, Jonas and Greg" took an action on this PR • (07/29/24)1 reviewer was added to this PR based on Kien Ngo's automation. |
This stack of pull requests is managed by Graphite. Learn more about stacking. Join @gregfromstl and the rest of your teammates on Graphite |
Your org requires the Graphite merge queue for merging into mainAdd the label “merge-queue” to the PR and Graphite will automatically add it to the merge queue when it’s ready to merge. Or use the label “hotfix” to add to the merge queue as a hot fix. You must have a Graphite account and log in to Graphite in order to use the merge queue. Sign up using this link. |
CodSpeed Performance ReportMerging #3857 will not alter performanceComparing Summary
|
size-limit report 📦
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3857 +/- ##
==========================================
+ Coverage 61.51% 61.52% +0.01%
==========================================
Files 962 962
Lines 76559 76578 +19
Branches 3792 3787 -5
==========================================
+ Hits 47092 47112 +20
+ Misses 28782 28781 -1
Partials 685 685
*This pull request uses carry forward flags. Click here to find out more.
|
* | ||
* @chain | ||
*/ | ||
export const useChainMetadata = useChainQuery; |
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.
We are already exporting the getChainMetadata
- I don't think we also need to export a hook version of it to keep the number of wrapper hooks at minimum
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.
Deferring the final call to @jnsdls
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.
personally don't think it hurts but yeah unsure if we need it
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.
Needed this for the wallet UI
* | ||
* @chain | ||
*/ | ||
export const useChainMetadata = useChainQuery; |
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.
personally don't think it hurts but yeah unsure if we need it
@@ -8,9 +8,9 @@ export type DownloadOptions = Prettify< | |||
} | |||
>; | |||
|
|||
/** @import { createThirdwebClient } from "../client/client.js" */ |
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.
what does this do?
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.
Let's us link the type without needing to import it in the actual code
https://devblogs.microsoft.com/typescript/announcing-typescript-5-5-beta/
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.
Isn't this just for type imports though? + when you want to use that imported type in JSDoc
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.
oh interesting - wonder how its gonna render on docs.
one simple thing we can do is just link to https://portal.thirdwerb.com/references/typescript/v5/<theFunction>
with markdown, that i know renders well on portal
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.
Yeah let's do that for now. I was afraid of broken links that way but should be fine
6bcb9d0
to
f7fa48a
Compare
f7fa48a
to
b879ae7
Compare
Merge activity
|
… chain (#3857) ### TL;DR This PR adds a new hook, `useChainMetadata`, to the thirdweb library. The hook allows developers to retrieve metadata for a specific blockchain, such as name, icon, available faucets, and block explorers. ### What changed? - Added `useChainMetadata` hook in `thirdweb/react`. - Deprecated `useChainQuery` hook. - Updated documentation to reflect the new hook. ### How to test? 1. Import the `useChainMetadata` from `thirdweb/react`. 2. Call the hook with a chain defined using `defineChain`. 3. Check the returned metadata for correctness. ### Why make this change? This change provides a more intuitive and documented way to retrieve chain metadata, replacing the deprecated `useChainQuery` hook. It enhances developer experience by offering a straightforward API to access chain-related information. --- <!-- start pr-codex --> --- ## PR-Codex overview This PR adds a new hook `useChainMetadata` to retrieve chain metadata in Thirdweb React. It also updates the `useChainQuery` hook to `useChainMetadata`. ### Detailed summary - Added `useChainMetadata` hook to retrieve chain metadata - Updated `useChainQuery` to `useChainMetadata` - Improved documentation for `useChainMetadata` > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` <!-- end pr-codex -->
b879ae7
to
d5e5467
Compare
TL;DR
This PR adds a new hook,
useChainMetadata
, to the thirdweb library. The hook allows developers to retrieve metadata for a specific blockchain, such as name, icon, available faucets, and block explorers.What changed?
useChainMetadata
hook inthirdweb/react
.useChainQuery
hook.How to test?
useChainMetadata
fromthirdweb/react
.defineChain
.Why make this change?
This change provides a more intuitive and documented way to retrieve chain metadata, replacing the deprecated
useChainQuery
hook. It enhances developer experience by offering a straightforward API to access chain-related information.PR-Codex overview
This PR adds a new
useChainMetadata
hook to retrieve chain metadata in thethirdweb
package and updates related components to use this hook.Detailed summary
useChainMetadata
hook to retrieve chain metadatauseChainMetadata
instead ofuseChainQuery