-
Notifications
You must be signed in to change notification settings - Fork 519
Add basenames page to wagmi section #320
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
Merged
Merged
Changes from 8 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
246e242
basenames wagmi guide
youssefea 881580d
add links
youssefea bbf335e
Update docs/base-account/framework-integrations/wagmi/basenames.mdx
youssefea bd3b387
update basenames
youssefea 0460154
update to viem
youssefea 3f07a1f
update
youssefea b072ff8
update to mainnet
youssefea d3b42aa
add tips and callouts
youssefea b30775c
Update docs/base-account/framework-integrations/wagmi/basenames.mdx
youssefea 0289423
Update docs/base-account/framework-integrations/wagmi/basenames.mdx
youssefea 22c8899
Update docs/base-account/framework-integrations/wagmi/basenames.mdx
youssefea 7e9c87d
update to private URL
youssefea File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
52 changes: 52 additions & 0 deletions
52
docs/base-account/framework-integrations/wagmi/basenames.mdx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| --- | ||
| title: "Basenames" | ||
| description: "Add support for Base names in your application using Wagmi and Viem" | ||
| --- | ||
|
|
||
|
|
||
|
|
||
| ## Overview | ||
|
|
||
| Basenames are human-readable names for addresses on Base. | ||
| They are built on top of the ENS protocol and comply with [ENSIP-19](https://docs.ens.domains/ensip/19/). | ||
| To learn more about Basenames, check out the [Basenames FAQ](/base-account/basenames/basenames-faq). | ||
|
|
||
| This guide will show you how to add support for Basenames to your application using [Viem](https://viem.sh/). | ||
|
|
||
| ## Usage | ||
|
|
||
| Use `getEnsName` to retrieve the primary ENS name for an address on Base: | ||
|
|
||
| ```ts | ||
| import { createPublicClient, http, toCoinType } from 'viem' | ||
| import { base } from 'viem/chains' | ||
|
|
||
| const client = createPublicClient({ | ||
| chain: mainnet, | ||
| transport: http(), | ||
| }) | ||
|
|
||
| const name = await client.getEnsName({ | ||
| address: '0x179A862703a4adfb29896552DF9e307980D19285', | ||
| coinType: toCoinType(base.id), | ||
| }) | ||
| ``` | ||
|
|
||
| <Tip> | ||
|
|
||
| It's best to use a private RPC provider to get the Basename for an address quickly and reliably by using the following pattern: | ||
youssefea marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ```ts | ||
| const client = createPublicClient({ | ||
| chain: mainnet, | ||
| transport: http(YOUR_PRIVATE_RPC_URL), | ||
| }) | ||
| ``` | ||
| </Tip> | ||
|
|
||
| <Warning> | ||
|
|
||
| You might face latency issues when using getEnsName with wagmi for newly registered Basenames. | ||
youssefea marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| </Warning> | ||
|
|
||
| [Learn more about getEnsName →](https://viem.sh/docs/ens/actions/getEnsName) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.