Skip to content

Commit d932dea

Browse files
authored
Merge pull request #592 from reown-com/devin/1753723203-appkit-v1-7-17-docs-update
docs: Update documentation for AppKit v1.7.17 features
2 parents 03f0b42 + b10a647 commit d932dea

File tree

6 files changed

+263
-17
lines changed

6 files changed

+263
-17
lines changed

appkit/javascript/core/actions.mdx

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,41 @@ Change the string parameter `name` from `appKitWalletButton.connect(name)` in or
347347
| `solana` | Solana blockchain |
348348
| `bip122` | Bitcoin blockchain |
349349

350+
#### Enhanced Multichain Examples
351+
352+
The wallet button now supports enhanced multichain functionality with improved namespace targeting:
353+
354+
```javascript
355+
<script type="module">
356+
import { createAppKitWalletButton } from '@reown/appkit-wallet-button';
357+
358+
const wallets = [
359+
{ wallet: 'metamask', namespace: 'eip155', label: 'MetaMask EVM' },
360+
{ wallet: 'metamask', namespace: 'solana', label: 'MetaMask Solana' },
361+
{ wallet: 'phantom', namespace: 'bip122', label: 'Phantom Bitcoin' }
362+
];
363+
364+
wallets.forEach(({ wallet, namespace, label }) => {
365+
const walletButton = createAppKitWalletButton({ namespace });
366+
367+
walletButton.subscribeIsReady(({ isReady }) => {
368+
if (!isReady) return;
369+
370+
const button = document.querySelector(`[data-wallet="${wallet}-${namespace}"]`);
371+
if (button) {
372+
button.disabled = false;
373+
button.textContent = `Connect ${label}`;
374+
button.onclick = () => walletButton.connect(wallet);
375+
}
376+
});
377+
});
378+
</script>
379+
380+
<button data-wallet="metamask-eip155" disabled>Loading...</button>
381+
<button data-wallet="metamask-solana" disabled>Loading...</button>
382+
<button data-wallet="phantom-bip122" disabled>Loading...</button>
383+
```
384+
350385

351386
## themeVariables
352387

appkit/next/core/components.mdx

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,32 @@ You can specify a blockchain namespace to target specific chains:
6767
<appkit-wallet-button wallet="leather" namespace="bip122" />
6868
```
6969

70+
#### Enhanced Multichain Examples
71+
72+
The wallet button now supports enhanced multichain functionality with improved namespace targeting:
73+
74+
```tsx
75+
const wallets = [
76+
{ wallet: 'metamask', namespace: 'eip155', label: 'MetaMask EVM' },
77+
{ wallet: 'metamask', namespace: 'solana', label: 'MetaMask Solana' },
78+
{ wallet: 'phantom', namespace: 'bip122', label: 'Phantom Bitcoin' }
79+
]
80+
81+
export function WalletButtons() {
82+
return (
83+
<>
84+
{wallets.map(({ wallet, namespace, label }) => (
85+
<appkit-wallet-button
86+
key={`${wallet}-${namespace}`}
87+
wallet={wallet}
88+
namespace={namespace}
89+
/>
90+
))}
91+
</>
92+
)
93+
}
94+
```
95+
7096
#### Options for wallet property
7197

7298
| Type | Options |

appkit/react/core/components.mdx

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,41 @@ import Components from "/snippets/appkit/shared/components.mdx";
99

1010
<Components />
1111

12+
## React Components
13+
14+
AppKit provides React-specific components that integrate seamlessly with your React application. These components automatically reflect the AppKit state and provide a more React-native experience.
15+
16+
### `<AppKitButton />` and `<AppKitNetworkButton />`
17+
18+
These React components provide the same functionality as the web components but with better React integration and TypeScript support.
19+
20+
```jsx
21+
import { AppKitButton, AppKitNetworkButton } from '@reown/appkit/react'
22+
23+
export function AppKitButtons() {
24+
return (
25+
<div>
26+
{/* Default button */}
27+
<AppKitButton />
28+
29+
{/* Network selection button */}
30+
<AppKitNetworkButton />
31+
32+
{/* Button with specific namespace */}
33+
<AppKitButton namespace="eip155" />
34+
</div>
35+
)
36+
}
37+
```
38+
39+
#### Props
40+
41+
Both components accept the following optional props:
42+
43+
| Prop | Type | Description |
44+
|------|------|-------------|
45+
| `namespace` | `string` | Specify the blockchain namespace (`eip155`, `solana`, `bip122`) |
46+
1247
### `<appkit-wallet-button />`
1348

1449
<Frame>
@@ -68,6 +103,34 @@ You can specify a blockchain namespace to target specific chains:
68103
<appkit-wallet-button wallet="leather" namespace="bip122" />
69104
```
70105

106+
#### React Hook Integration
107+
108+
You can also use the `useAppKitWallet` hook for programmatic wallet connections with multichain support:
109+
110+
```tsx
111+
import { useAppKitWallet } from '@reown/appkit-wallet-button/react'
112+
113+
export function WalletConnector() {
114+
const { data, error, isPending, isSuccess, isError, connect } = useAppKitWallet({
115+
namespace: 'eip155', // Use 'solana' or 'bip122' for other chains
116+
onError: err => {
117+
console.error('Connection error:', err)
118+
},
119+
onSuccess: data => {
120+
console.log('Connected successfully:', data)
121+
}
122+
})
123+
124+
return (
125+
<>
126+
<button onClick={() => connect('walletConnect')}>Open QR modal</button>
127+
<button onClick={() => connect('metamask')}>Connect to MetaMask</button>
128+
<button onClick={() => connect('google')}>Connect to Google</button>
129+
</>
130+
)
131+
}
132+
```
133+
71134
#### Options for wallet property
72135

73136
| Type | Options |

appkit/react/core/hooks.mdx

Lines changed: 74 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,49 @@ AppKit supports the [top 32 wallets](https://github.com/reown-com/appkit/blob/ma
260260
| Social logins | google, github, apple, facebook, x, discord and farcaster |
261261
| Email | email |
262262

263+
#### Enhanced Multichain Examples
264+
265+
The `useAppKitWallet` hook now supports enhanced multichain functionality with the namespace prop:
266+
267+
```tsx
268+
import { useAppKitWallet } from '@reown/appkit-wallet-button/react'
269+
270+
// Multiple wallet connections for different chains
271+
export function MultichainWalletConnector() {
272+
// Ethereum/EVM connection
273+
const { connect: connectEVM } = useAppKitWallet({
274+
namespace: 'eip155',
275+
onSuccess: (address) => console.log('Connected to EVM:', address)
276+
})
277+
278+
// Solana connection
279+
const { connect: connectSolana } = useAppKitWallet({
280+
namespace: 'solana',
281+
onSuccess: (address) => console.log('Connected to Solana:', address)
282+
})
283+
284+
// Bitcoin connection
285+
const { connect: connectBitcoin } = useAppKitWallet({
286+
namespace: 'bip122',
287+
onSuccess: (address) => console.log('Connected to Bitcoin:', address)
288+
})
289+
290+
return (
291+
<div>
292+
<button onClick={() => connectEVM('metamask')}>
293+
Connect MetaMask (EVM)
294+
</button>
295+
<button onClick={() => connectSolana('phantom')}>
296+
Connect Phantom (Solana)
297+
</button>
298+
<button onClick={() => connectBitcoin('leather')}>
299+
Connect Leather (Bitcoin)
300+
</button>
301+
</div>
302+
)
303+
}
304+
```
305+
263306
#### Use Cases
264307

265308
`useAppKitWallet` enables:
@@ -291,24 +334,38 @@ AppKit supports the [top 32 wallets](https://github.com/reown-com/appkit/blob/ma
291334

292335
#### Multichain Examples
293336

337+
#### Integration with React Components
338+
339+
The `useAppKitWallet` hook works seamlessly with the new React components:
340+
294341
```tsx
295-
// Connect to Ethereum/EVM chains
296-
const { connect: connectEVM } = useAppKitWallet({
297-
namespace: 'eip155',
298-
onSuccess: (address) => console.log('Connected to EVM:', address)
299-
})
300-
301-
// Connect to Solana
302-
const { connect: connectSolana } = useAppKitWallet({
303-
namespace: 'solana',
304-
onSuccess: (address) => console.log('Connected to Solana:', address)
305-
})
306-
307-
// Connect to Bitcoin
308-
const { connect: connectBitcoin } = useAppKitWallet({
309-
namespace: 'bip122',
310-
onSuccess: (address) => console.log('Connected to Bitcoin:', address)
311-
})
342+
import { useAppKitWallet } from '@reown/appkit-wallet-button/react'
343+
import { AppKitButton, AppKitNetworkButton } from '@reown/appkit/react'
344+
345+
export function WalletInterface() {
346+
const { isReady, isPending, connect } = useAppKitWallet({
347+
namespace: 'eip155',
348+
onSuccess: (data) => {
349+
console.log('Wallet connected:', data)
350+
}
351+
})
352+
353+
return (
354+
<div>
355+
{/* React components for UI */}
356+
<AppKitButton />
357+
<AppKitNetworkButton />
358+
359+
{/* Programmatic wallet connections */}
360+
<button
361+
onClick={() => connect('metamask')}
362+
disabled={!isReady || isPending}
363+
>
364+
{isPending ? 'Connecting...' : 'Connect MetaMask'}
365+
</button>
366+
</div>
367+
)
368+
}
312369

313370
// Usage
314371
<Button onClick={() => connectEVM("metamask")}>Connect MetaMask (EVM)</Button>

appkit/react/core/installation.mdx

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,29 @@ Create a new project on Reown Dashboard at https://dashboard.reown.com and obtai
193193

194194
## Implementation
195195

196+
### AppKitProvider Component
197+
198+
AppKit now provides an `AppKitProvider` React component for easy integration in React applications. This component wraps your app and provides the AppKit context to all child components.
199+
200+
```tsx
201+
import { AppKitProvider } from '@reown/appkit/react'
202+
203+
function App() {
204+
return (
205+
<AppKitProvider
206+
projectId="YOUR_PROJECT_ID"
207+
networks={[
208+
/* Your Networks */
209+
]}
210+
>
211+
{/* Your App */}
212+
</AppKitProvider>
213+
)
214+
}
215+
```
216+
217+
### Framework-Specific Implementation
218+
196219
<Tabs>
197220
<Tab title="Wagmi">
198221
<Card title="wagmi Example" icon="github" href="https://github.com/reown-com/appkit-web-examples/tree/main/react/react-wagmi">

appkit/vue/core/wallet-buttons.mdx

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,3 +81,45 @@ onMounted(() => {
8181
| `eip155` | Ethereum and EVM-compatible chains |
8282
| `solana` | Solana blockchain |
8383
| `bip122` | Bitcoin blockchain |
84+
85+
#### Enhanced Multichain Examples
86+
87+
The wallet button now supports enhanced multichain functionality with improved namespace targeting:
88+
89+
```javascript
90+
<template>
91+
<div>
92+
<button
93+
v-for="wallet in wallets"
94+
:key="`${wallet.wallet}-${wallet.namespace}`"
95+
@click="() => connectWallet(wallet.wallet, wallet.namespace)"
96+
:disabled="!isReady"
97+
>
98+
{{ wallet.label }}
99+
</button>
100+
</div>
101+
</template>
102+
103+
<script setup>
104+
import { ref, onMounted } from 'vue'
105+
import { createAppKitWalletButton } from '@reown/appkit-wallet-button'
106+
107+
const wallets = [
108+
{ wallet: 'metamask', namespace: 'eip155', label: 'MetaMask EVM' },
109+
{ wallet: 'metamask', namespace: 'solana', label: 'MetaMask Solana' },
110+
{ wallet: 'phantom', namespace: 'bip122', label: 'Phantom Bitcoin' }
111+
]
112+
113+
const appKitWalletButton = createAppKitWalletButton()
114+
const isReady = ref(false)
115+
116+
const connectWallet = (wallet, namespace) => {
117+
const walletButton = createAppKitWalletButton({ namespace })
118+
walletButton.connect(wallet)
119+
}
120+
121+
onMounted(() => {
122+
isReady.value = appKitWalletButton.isReady()
123+
})
124+
</script>
125+
```

0 commit comments

Comments
 (0)