You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/src/routes/docs/[...3]modules/[...1]core/+page.md
+55Lines changed: 55 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -108,6 +108,10 @@ type InitOptions {
108
108
wallets: WalletInit[]
109
109
chains: Chain[]
110
110
appMetadata?: AppMetadata
111
+
/** Web3-Onboard module to add Wagmi support
112
+
* see https://www.npmjs.com/package/@web3-onboard/wagmi
113
+
*/
114
+
wagmi?: typeof wagmi
111
115
i18n?: i18nOptions
112
116
accountCenter?: AccountCenterOptions
113
117
apiKey?: string
@@ -388,6 +392,57 @@ It will allow you to customize the look and feel of Web3 Onboard, try different
388
392
389
393
---
390
394
395
+
#### wagmi
396
+
397
+
To add [WAGMI API](https://wagmi.sh/core/getting-started) support to your project you can simply install `web3-onboard/wagmi` import and pass in the [wagmi package](/docs/modules/wagmi) export directly into your onboard configuration. After doing so you can use all of the native WAGMI API functions directly from `@web3-onboard/wagmi`. This will give access to all WAGMI function available on or before `@wagmi/core` version `2.10.4`.
398
+
After initialization an up-to-date WAGMI config will will be available from the onboard state object `onboard.state.get().wagmiConfig` which will need to be passed as the first prop of most [@wagmi/core](https://wagmi.sh/core/getting-started) methods. Wallets will also have a [wagmiConnector](#state) prop within the onboard state object which will allow you to target specific wallets for interactions. This can also be bi-passed if the primary or most recently connected wallet is the wallet meant for the transactions.
399
+
The config and connectors can be used with the WAGMI API returned from this module or an external WAGMI instance.
400
+
401
+
Full documentation for the `@web3-onboard/wagmi` module can be found [here](/docs/modules/wagmi).
402
+
403
+
```typescript
404
+
importOnboardfrom'@web3-onboard/core'
405
+
importwagmifrom'@web3-onboard/wagmi'
406
+
import {
407
+
sendTransactionaswagmiSendTransaction,
408
+
switchChain,
409
+
disconnect,
410
+
getConnectors
411
+
} from'@web3-onboard/wagmi'
412
+
413
+
const injected =injectedModule()
414
+
415
+
const onboard =Onboard({
416
+
// This javascript object is unordered meaning props do not require a certain order
const result =awaitwagmiSendTransaction(wagmiConfig, {
436
+
to: toAddress,
437
+
// desired connector to send txn from
438
+
connector: wagmiConnector,
439
+
value: parseEther('0.001')
440
+
})
441
+
console.log(result)
442
+
}
443
+
```
444
+
---
445
+
391
446
#### disableFontDownload
392
447
393
448
If set to `true` the default `Inter` font will not be imported and instead the web based `sans-serif` font will be used if a font is not defined through the `Theme` or exposed css variable.
Copy file name to clipboardExpand all lines: docs/src/routes/docs/[...3]modules/[...3]react/+page.md
+64-64Lines changed: 64 additions & 64 deletions
Original file line number
Diff line number
Diff line change
@@ -137,11 +137,11 @@ function MyApp({ Component, pageProps }) {
137
137
exportdefaultMyApp
138
138
```
139
139
140
-
## `init`
140
+
## init
141
141
142
142
The `init` function must be called before any hooks can be used. The `init` function just initializes `web3-onboard` and makes it available for all hooks to use. For reference check out the [initialization docs for `@web3-onboard/core`](../../modules/core.md#initialization)
143
143
144
-
## `useConnectWallet`
144
+
## useConnectWallet
145
145
146
146
This hook allows you to connect the user's wallet and track the state of the connection status and the wallet that is connected.
This hook allows you to set the chain of a user's connected wallet, keep track of the current chain the user is connected to and the status of setting the chain. Passing in a wallet label will operate on that connected wallet, otherwise it will default to the last connected wallet. If a chain was instantiated without an rpcUrl, token, or label, add these options for wallets that require this information for adding a new chain.
209
209
@@ -243,7 +243,64 @@ const [
243
243
] =useSetChain()
244
244
```
245
245
246
-
## `useNotifications`
246
+
## useWagmiConfig
247
+
248
+
This hook allows you to get the WagmiConfig (Config from the Wagmi project) from @web3-onboard/core if W3O has been initialized with the [WAGMI property imported and passing into the web3-onboard/core config](../../modules/wagmi.md#usage).
This hook allows the dev to access all notifications if enabled, send custom notifications, and update notify <enable/disable & update transactionHandler function>
249
306
**note** This requires an API key be added to the initialization, enabled by default if an API key exists
This hook allows you to track the state of all the currently connected wallets:
416
473
@@ -422,7 +479,7 @@ type UseWallets = (): WalletState[]
422
479
const connectedWallets =useWallets()
423
480
```
424
481
425
-
## `useAccountCenter`
482
+
## useAccountCenter
426
483
427
484
This hook allows you to track and update the state of the Account Center:
428
485
@@ -449,7 +506,7 @@ type AccountCenter = {
449
506
const updateAccountCenter =useAccountCenter()
450
507
```
451
508
452
-
## `useSetLocale`
509
+
## useSetLocale
453
510
454
511
This hook allows you to set the locale of your application to allow language updates associated with the i18n config:
455
512
@@ -725,60 +782,3 @@ export default {
725
782
}
726
783
}
727
784
```
728
-
729
-
## `useWagmiConfig`
730
-
731
-
This hook allows you to get the WagmiConfig (Config from the Wagmi project) from @web3-onboard/core if W3O has been initialized with the [WAGMI property imported and passing into the web3-onboard/core config](../../modules/wagmi.md#usage).
This example assumes you have already setup web3-onboard to connect wallets to your dapp.
31
-
For more information see [web3-onboard docs](https://onboard.blocknative.com/docs/modules/core#install).
30
+
To add [WAGMI API](https://wagmi.sh/core/getting-started) support to your project you can simply install `web3-onboard/wagmi` import and pass in the WAGMI package default export directly into your onboard configuration. After doing so you can use all of the native WAGMI API functions directly from `@web3-onboard/wagmi`. This will give access to all WAGMI function available on or before `@wagmi/core` version `2.10.4`.
31
+
32
+
Full documentation for `wagmi/core` API functions can be found [here](https://wagmi.sh/core/getting-started).
33
+
34
+
### wagmiConfig
32
35
33
-
### `wagmiConnector` and Connectors
36
+
After initialization an up-to-date WAGMI config will will be available from the onboard state object `onboard.state.get().wagmiConfig` which will need to be passed as the first prop of most [@wagmi/core](https://wagmi.sh/core/getting-started) methods.
34
37
35
-
`wagmiConnector` is a property returned as part of the wallet state object and can be used to interact with
36
-
the WAGMI API returned from this module or an external WAGMI instance. Please see examples below...
38
+
### wagmiConnector and Connectors
39
+
Wallets will also have a `wagmiConnector` prop within the onboard state object which will allow you to target specific wallets for interactions. This can also be bi-passed if the primary or most recently connected wallet is the wallet meant for the transactions.
40
+
The config and connectors can be used with the WAGMI API returned from this module or an external WAGMI instance.
41
+
42
+
## WAGMI Example
43
+
44
+
This example assumes you have already setup web3-onboard to connect wallets to your dapp.
45
+
For more information see [web3-onboard docs](https://onboard.blocknative.com/docs/modules/core#install).
0 commit comments