-
Notifications
You must be signed in to change notification settings - Fork 192
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
274 additions
and
71 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
--- | ||
title: Reporting a bug | ||
title: Reporting a bug · OnchainKit | ||
description: Help us make OnchainKit better | ||
--- | ||
|
||
|
This file contains 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
This file contains 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,99 @@ | ||
--- | ||
title: Use Basename · OnchainKit | ||
description: Integrate Basenames into your onchain app, in just a few steps. | ||
--- | ||
import { Avatar, Name } from '@coinbase/onchainkit/identity'; | ||
import App from '../../components/App'; | ||
import { base } from 'viem/chains'; | ||
|
||
# Use Basename | ||
|
||
Basenames are an essential onchain building block that empowers builders to establish their identity on Base by registering human-readable names for their wallet addresses. | ||
|
||
They operate entirely onchain, utilizing the same technology as ENS names, and are deployed on Base. | ||
|
||
You can integrate [Basenames](https://www.base.org/names) into your app with few these steps. | ||
|
||
::::steps | ||
|
||
### New to OnchainKit? | ||
|
||
Follow the [Getting Started](/getting-started) guide to install the package. | ||
|
||
### Already using OnchainKit? | ||
|
||
Update to the latest version and choose from the following steps: a React component approach, a React hook, or a pure TypeScript utility function. | ||
|
||
:::: | ||
|
||
## React components with `<Avatar>` and `<Name>` | ||
|
||
Use the [`<Avatar>`](/identity/avatar) and [`<Name>`](/identity/name) components to display Basenames associated with Ethereum addresses. | ||
|
||
The `chain` prop is optional and setting to Base, it's what makes the components switch from ENS to Basenames. | ||
|
||
```tsx | ||
import { Name } from '@coinbase/onchainkit/identity'; | ||
import { base } from 'viem/chains'; | ||
|
||
const address = '0x02feeb0AdE57b6adEEdE5A4EEea6Cf8c21BeB6B1'; | ||
|
||
// omitted component code for brevity | ||
<Avatar address={address} chain={base} /> | ||
<Name address={address} chain={base} /> | ||
``` | ||
|
||
<App> | ||
<Avatar address="0x02feeb0AdE57b6adEEdE5A4EEea6Cf8c21BeB6B1" chain={base}/> | ||
<Name address="0x02feeb0AdE57b6adEEdE5A4EEea6Cf8c21BeB6B1" chain={base}/> | ||
</App> | ||
|
||
## React hooks with `useAvatar` and `useName` | ||
|
||
Use the [`useAvatar`](/identity/use-avatar) and [`useName`](/identity/use-name) hooks to get Basenames associated with Ethereum addresses. | ||
|
||
The hooks are incredibly useful for building custom components while leveraging OnchainKit for efficient data fetching. | ||
|
||
:::code-group | ||
|
||
```tsx [code] | ||
import { useAvatar, useName } from '@coinbase/onchainkit/identity'; | ||
import { base } from 'viem/chains'; | ||
|
||
const address = '0x02feeb0AdE57b6adEEdE5A4EEea6Cf8c21BeB6B1'; | ||
const basename = 'zizzamia.base.eth'; | ||
const { data: avatar, isLoading } = await useAvatar({ ensName: basename, chain: base }); | ||
const { data: name, isLoading } = await useName({ address, chain: base }); | ||
``` | ||
|
||
```ts [return value] | ||
{ data: 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzAwMCIgaGVpZ2h0PSIzMDAwIiB2aWV3Qm94PSIwIDAgMzAwMCAzMDAwIiBmaWxsPSJub25lIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMF81NTY5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TUwMEMxNjA4LjEgMTM1Mi4xMSAxNjQwLjc2IDEyMTguMzggMTY5My40MSAxMTIxLjcyQzE3NDYuMTMgMTAyNC45NSAxODE4LjQ2IDk2NiAxODk3LjYzIDk2NkMxOTc2Ljc5IDk2NiAyMDQ5LjEyIDEwMjQuOTUgMjEwMS44NCAxMTIxLjcyQzIxNTQuNSAxMjE4LjM4IDIxODcuMTYgMTM1Mi4xMSAyMTg3LjE2IDE1MDBaIiBmaWxsPSIjMTU1REZEIiBzdHJva2U9IndoaXRlIiBzdHJva2Utd2lkdGg9IjYiLz48ZWxsaXBzZSBjeD0iMTg5Ni41OCIgY3k9IjExOTQuOTMiIHJ4PSIxMjYuNDE0IiByeT0iMjMxLjkzNCIgZmlsbD0id2hpdGUiLz48L2c+PGRlZnM+PGNsaXBQYXRoIGlkPSJjbGlwMF81NTY5XzcyODM1Ij48cmVjdCB3aWR0aD0iMzAwMCIgaGVpZ2h0PSIzMDAwIiBmaWxsPSJ3aGl0ZSIvPjwvY2xpcFBhdGg+PC9kZWZzPjwvc3ZnPg==', isLoading: false } | ||
{ data: 'zizzamia.base.eth', isLoading: false } | ||
``` | ||
|
||
::: | ||
|
||
## Typescript utility with `getAvatar` and `getName` | ||
|
||
Use the [`getAvatar`](/identity/get-name) and [`getName`](/identity/get-name) functions to get Basenames associated with Ethereum addresses. | ||
|
||
Being pure functions, it seamlessly integrates into any TypeScript project, including Vue, Angular, Svelte, or Node.js. | ||
|
||
:::code-group | ||
|
||
```tsx [code] | ||
import { getName } from '@coinbase/onchainkit/identity'; | ||
import { base } from 'viem/chains'; | ||
|
||
const address = '0x02feeb0AdE57b6adEEdE5A4EEea6Cf8c21BeB6B1'; | ||
const basename = 'zizzamia.base.eth'; | ||
const avatar = await getAvatar({ ensName: basename, chain: base }); | ||
const name = await getName({ address, chain: base }); | ||
``` | ||
|
||
```ts [return value] | ||
data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzAwMCIgaGVpZ2h0PSIzMDAwIiB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Tg5Ny42MyAyMDM0QzE4MTguNDYgMjAzNCAxNzQ2LjEzIDE5NzUuMDUgMTY5My40MSAxODc4LjI4QzE2NDAuNzYgMTc4MS42MiAxNjA4LjEgMTY0Ny44OSAxNjA4LjEgMTUwMEMxNjA4LjEgMTM1Mi4xMSAxNjQwLjc2IDEyMTguMzggMTY5My40MSAxMTIxLjcyQzE3NDYuMTMgMTAyNC45NSAxODE4LjQ2IDk2NiAxODk3LjYzIDk2NkMxOTc2Ljc5IDk2NiAyMDQ5LjEyIDEwMjQuOTUgMjEwMS44NCAxMTIxLjcyQzIxNTQuNSAxMjE4LjM4IDIxODcuMTYgMTM1Mi4xMSAyMTg3LjE2IDE1MDBaIiBmaWxsPSIjMTU1REZEIiBzdHJva2U9IndoaXRlIiBzdHJva2Utd2lkdGg9IjYiLz48ZWxsaXBzZSBjeD0iMTg5Ni41OCIgY3k9IjExOTQuOTMiIHJ4PSIxMjYuNDE0IiByeT0iMjMxLjkzNCIgZmlsbD0id2hpdGUiLz48L2c+PGRlZnM+PGNsaXBQYXRoIGlkPSJjbGlwMF81NTY5XzcyODM1Ij48cmVjdCB3aWR0aD0iMzAwMCIgaGVpZ2h0PSIzMDAwIiBmaWxsPSJ3aGl0ZSIvPjwvY2xpcFBhdGg+PC9kZWZzPjwvc3ZnPg== | ||
zizzamia.base.eth; | ||
``` | ||
|
||
::: |
This file contains 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,45 @@ | ||
# `getAddress` | ||
|
||
The `getAddress` utility is designed to retrieve an address from an onchain identity provider for a given name. | ||
|
||
## Usage | ||
|
||
Get ENS Name from mainnet chain | ||
|
||
:::code-group | ||
```tsx [code] | ||
import { getAddress } from '@coinbase/onchainkit/identity'; | ||
|
||
const address = await getAddress({ name: 'zizzamia.eth' }); | ||
``` | ||
|
||
```ts [return value] | ||
0x02feeb0AdE57b6adEEdE5A4EEea6Cf8c21BeB6B1 | ||
``` | ||
|
||
::: | ||
|
||
Get Basename from base chain | ||
|
||
:::code-group | ||
|
||
```tsx [code] | ||
import { getAddress } from '@coinbase/onchainkit/identity'; | ||
import { base } from 'viem/chains'; | ||
|
||
const address = await getAddress({ name: 'zizzamia.base.eth', chain: base }); | ||
``` | ||
|
||
```ts [return value] | ||
0x02feeb0AdE57b6adEEdE5A4EEea6Cf8c21BeB6B1 | ||
``` | ||
|
||
::: | ||
|
||
## Returns | ||
|
||
[`Promise<GetAddressReturnType>`](/identity/types#getaddressreturntype) | ||
|
||
## Parameters | ||
|
||
[`GetAddress`](/identity/types#getaddress) |
This file contains 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
This file contains 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
This file contains 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
This file contains 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,20 @@ | ||
# `useAddress` | ||
|
||
The `useAddress` hook is used to get an address from an onchain identity provider for a given name. | ||
|
||
## Usage | ||
|
||
```tsx | ||
import { useAddress } from '@coinbase/onchainkit/identity'; | ||
|
||
const { data: address, isLoading } = useAddress({ name: 'zizzamia.base.eth' }); | ||
``` | ||
|
||
## Returns | ||
|
||
[`useQuery<Promise<GetAddressReturnType>>`](/identity/types#getaddressreturntype) | ||
|
||
## Parameters | ||
|
||
[`UseAddressOptions`](/identity/types#useaddressoptions) | ||
[`UseQueryOptions`](/identity/types#usequeryoptions) |
This file contains 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
Oops, something went wrong.