-
Notifications
You must be signed in to change notification settings - Fork 320
chore: update + cleanup wallet docs #1671
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 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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
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
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 |
---|---|---|
|
@@ -236,7 +236,9 @@ import { | |
</Wallet> | ||
</WalletComponents> | ||
|
||
### Customize Connect button text and style | ||
:::: | ||
|
||
## Customize Connect button text and style | ||
|
||
Each OnchainKit component offers the flexibility to customize `className` | ||
and adjust the style of the React components it represents. | ||
|
@@ -317,49 +319,23 @@ import { color } from '@coinbase/onchainkit/theme'; | |
</Wallet> | ||
</WalletComponents> | ||
|
||
### Implementing the Wallet Modal for wallet connection aggregation | ||
## Using Wallet Modal | ||
|
||
<img alt="Wallet Modal" | ||
src="https://onchainkit.xyz/assets/wallet-modal.gif" | ||
height="364"/> | ||
|
||
OnchainKit provides a built-in wallet modal that offers users multiple connection options. The modal automatically appears when users click the `ConnectWallet` component and provides three distinct connection paths: | ||
Wallet modal offers users multiple wallet connection options. The modal automatically appears when users click the `ConnectWallet` component and provides three distinct connection paths: | ||
|
||
1. Quickly create a new smart wallet for new users | ||
2. Coinbase Wallet connection (supporting both smart wallets and EOA) | ||
3. Other wallets via WalletConnect | ||
3. Other wallets via [WalletConnect](https://docs.walletconnect.org/) | ||
|
||
#### Setup Steps | ||
### Setup Steps | ||
|
||
1. Configure the wallet connectors in your Wagmi config: | ||
|
||
```tsx [wagmiConfig.ts] | ||
const wagmiConfig = createConfig({ | ||
chains: [base, baseSepolia], | ||
connectors: [ | ||
// Smart wallet support | ||
coinbaseWallet({ | ||
appName: 'Your App', | ||
preference: 'smartWalletOnly', | ||
}), | ||
// EOA wallet support | ||
coinbaseWallet({ | ||
appName: 'Your App', | ||
preference: 'eoaOnly', | ||
}), | ||
// Other wallets via WalletConnect | ||
walletConnect({ // [!code focus] | ||
projectId: process.env.WALLET_CONNECT_PROJECT_ID, // [!code focus] | ||
showQrModal: true, // [!code focus] | ||
metadata: { // [!code focus] | ||
name: 'Your App', // [!code focus] | ||
description: 'Your app description', // [!code focus] | ||
url: 'https://your-app.com', // [!code focus] | ||
icons: [], // [!code focus] | ||
}, | ||
}), | ||
], | ||
// ... other config | ||
}); | ||
``` | ||
::::steps | ||
|
||
2. Configure the `OnchainKitProvider` with modal settings: | ||
## Configure the `OnchainKitProvider` with modal settings: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the parent here is a three-hash ( |
||
|
||
```tsx [providers.tsx] | ||
<OnchainKitProvider | ||
|
@@ -383,7 +359,7 @@ const wagmiConfig = createConfig({ | |
</OnchainKitProvider> | ||
``` | ||
|
||
3. Use the `ConnectWallet` component in your UI: | ||
## Use the `ConnectWallet` component in your UI: | ||
|
||
```tsx [App.tsx] | ||
<Wallet> | ||
|
@@ -429,9 +405,11 @@ const wagmiConfig = createConfig({ | |
</div> | ||
</AppWithWalletModal> | ||
|
||
## Examples | ||
:::: | ||
|
||
## Example usage | ||
|
||
### With Sign In With Ethereum (SIWE) | ||
### Usage with Sign In With Ethereum (SIWE) | ||
|
||
To use [Sign In With Ethereum (SIWE)](https://docs.login.xyz/general-information/siwe-overview) with OnchainKit, you can use the `onConnect` prop in the `<ConnectWallet />` component. This will trigger the SIWE prompt when the user connects their wallet. | ||
|
||
|
@@ -466,6 +444,7 @@ The components are designed to work together hierarchically. For each component, | |
|
||
- `<Wallet />` - Serves as the main container for all wallet-related components. | ||
- `<ConnectWallet />` - Handles the wallet connection process. Place child components inside to customize the connect button appearance. | ||
- `<AppWithWalletModal />` - Enables a wallet aggregation experience. | ||
- `<WalletDropdown />` - Contains additional wallet information and options. Place inside the `<Wallet />` component. | ||
- `<Identity />` - Displays user identity information. Place inside `<WalletDropdown />` for a complete profile view. | ||
- `<WalletDropdownBasename />` - Displays the user's Basename within the dropdown. | ||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
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.
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.
typo — should be
Customize