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
address:Function, // Called with the current account address of the user [String]
84
+
network:Function, // Called with the current network id the users' wallet is connected to [Number]
85
+
balance:Function, // Called with the current balance in `wei` of the users' current account address [String]
86
+
wallet:Function// Called with the users' current selected wallet [Object]: {provider: Object, name: String}
87
+
},
88
+
modules: {
89
+
walletSelect: {
90
+
heading:String,
91
+
description:String,
92
+
wallets: {
93
+
mobile:Array,
94
+
desktop:Array
95
+
}
96
+
},
97
+
walletReady:Array
98
+
}
99
+
}
100
+
```
101
+
102
+
#### `dappId` - [REQUIRED]
103
+
104
+
Your unique apiKey that identifies your application. You can generate a dappId by visiting the [Blocknative account page](https://account.blocknative.com/) and create a free account.
105
+
106
+
#### `networkId` - [REQUIRED]
107
+
108
+
The Ethereum network id that your application runs on. The following values are valid:
109
+
110
+
-`1` Main Network
111
+
-`3` Ropsten Test Network
112
+
-`4` Rinkeby Test Network
113
+
-`5` Goerli Test Network
114
+
-`42` Kovan Test Network
115
+
116
+
## API
117
+
118
+
### `walletSelect`
68
119
69
-
To get a user to select a wallet to use with your dapp call the `selectWallet` function:
120
+
When you are ready to start onboarding a user, call the `walletSelect` function to prompt them to display the wallet select UI:
70
121
71
122
```javascript
72
-
constwalletSelected=awaitonboard.selectWallet()
123
+
constwalletSelected=awaitonboard.walletSelect()
124
+
// returns a Promise that:
73
125
// resolves with true if user selected a wallet and provider is good to go
74
-
// resolves with false if user exited from select wallet modal
126
+
// resolves with false if user exited from wallet select modal
75
127
```
76
128
77
-
This function will show a modal that displays buttons for all of the wallets that you initialized onboard with. It will guide the user through the process of connecting to the wallet that they select. Once the process is successful the function will resolve with `true`. This means that the `provider` subscription will have been called with the provider of the selected wallet and you can go ahead and instantiate contracts.
129
+
This function will show a modal that displays buttons for all of the wallets that you initialized onboard with. It will guide the user through the process of connecting to the wallet that they select. Once the process is successful the function will resolve with `true`. This means that the `provider` subscription will have been called with the provider of the selected wallet and you can go ahead and instantiate your web3 library with the provider and also instantiate your contracts.
78
130
79
-
### Prepare Wallet
131
+
### `walletReady`
80
132
81
-
Once a wallet is selected, you will want to make sure that the user's wallet is prepared and ready to transact by calling the `prepareWallet` function:
133
+
Once a wallet is selected, you will want to make sure that the user's wallet is prepared and ready to transact by calling the `walletReady` function:
82
134
83
135
```javascript
84
-
constreadyToTransact=awaitonboard.prepareWallet()
136
+
constreadyToTransact=awaitonboard.walletReady()
137
+
// returns a Promise that:
85
138
// resolves with true if user is ready to transact
86
139
// resolves with false if user exited before completing all prepare wallet modules
87
140
```
88
141
89
142
This function will run through the onboarding modules sequentially, making sure the user has passed the condition contained in each module and eventually resolves with `true` if the user completed the sequence. This means that the user is ready to transact. This function is useful to call before every transaction to make sure that nothing has changed since the last time it was called.
90
143
91
-
### Config
144
+
### `config`
92
145
93
-
You can update configuration parameters via the `config` function:
146
+
You can update configuration parameters by passing a config object in to the `config` function:
94
147
95
148
```javascript
96
149
onboard.config({ darkMode:true })
@@ -101,6 +154,5 @@ Available parameters that you can edit are:
101
154
```javascript
102
155
{
103
156
darkMode:Boolean, // (default: false)
104
-
networkId:Number// as set with initialization of onboard
0 commit comments