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
89
network:Function, // Called with the current network id the users' wallet is connected to [Number]
@@ -87,14 +92,14 @@ const options = {
87
92
},
88
93
modules: {
89
94
walletSelect: {
90
-
heading:String,
91
-
description:String,
95
+
heading:String,// The heading for the wallet select modal
96
+
description:String,// The description for the wallet select modal
92
97
wallets: {
93
-
mobile:Array,
94
-
desktop:Array
98
+
mobile:Array,// array of mobile wallet modules
99
+
desktop:Array// array of desktop wallet modules
95
100
}
96
101
},
97
-
walletReady:Array
102
+
walletReady:Array// array of wallet readiness modules
98
103
}
99
104
}
100
105
```
@@ -136,7 +141,7 @@ Once a wallet is selected, you will want to make sure that the user's wallet is
136
141
constreadyToTransact=awaitonboard.walletReady()
137
142
// returns a Promise that:
138
143
// resolves with true if user is ready to transact
139
-
// resolves with false if user exited before completing all prepare wallet modules
144
+
// resolves with false if user exited before completing all wallet readiness modules
140
145
```
141
146
142
147
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.
@@ -156,3 +161,165 @@ Available parameters that you can edit are:
156
161
darkMode:Boolean, // (default: false)
157
162
}
158
163
```
164
+
165
+
## Modules
166
+
167
+
### Wallet Select Modules
168
+
169
+
The wallet select modules are functions that return a wallet object. The following modules are currently available:
170
+
171
+
-`defaults`: A meta module that quickly initializes all of the default modules into the correct format (requires initialization object)
172
+
173
+
#### Desktop Wallets
174
+
175
+
-`metamask`
176
+
-`dapper`
177
+
-`walletConnect`
178
+
-`portis` (requires initialization)
179
+
-`fortmatic` (requires initialization)
180
+
181
+
#### Mobile Wallets
182
+
183
+
-`trust`
184
+
-`coinbase`
185
+
-`walletConnect`
186
+
-`portis` (requires initialization)
187
+
-`fortmatic` (requires initialization)
188
+
189
+
`defaults` Initialization:
190
+
191
+
```javascript
192
+
modules.select.defaults({
193
+
heading:String, // Override the default heading [optional]
194
+
description:String, // Override the default description [optional]
195
+
networkId:Number, // Required if you want the Portis or Fortmatic modules to be included
196
+
portisInit:Object, // initialization object for Portis module (see below)
197
+
fortmaticInit:Object// initialization object for Fortmatic module (see below)
198
+
})
199
+
```
200
+
201
+
`portis` Initialization:
202
+
203
+
```javascript
204
+
portis({
205
+
apiKey:String, // your Portis api key
206
+
network:String// the name of network you want to connect to
207
+
})
208
+
```
209
+
210
+
`fortmatic` Initialization:
211
+
212
+
```javascript
213
+
fortmatic({
214
+
apiKey:String, // your Portis api key
215
+
network:String// the name of the network you want to connect to
The wallet ready modules are functions that return a function that will be called with the current user state. The module will return a modal object if that state is invalid or `undefined` if the state is valid. The following default modules are available:
267
+
268
+
-`defaults`: A meta module that quickly initializes all of the default modules into the correct format (requires initialization object)
269
+
-`connect`: Checks that the dapp has access to accounts and fires the connect function if the selected wallet has one
270
+
-`network`: Checks that the users' wallet is connected to the desired network (requires initialization argument)
271
+
-`balance`: Checks that the users' account has enough balance as defined when initialized (requires initialization argument)
272
+
273
+
`defaults` Initialization:
274
+
275
+
```javascript
276
+
modules.ready.defaults({
277
+
networkId:Number, // The network id your dapp runs on
278
+
minimumBalance:String// the minimum balance in wei required to interact with your dapp
279
+
})
280
+
```
281
+
282
+
`network` Initialization:
283
+
284
+
```javascript
285
+
network(Number) // the network id your dapp runs on
286
+
```
287
+
288
+
`balance` Initialization:
289
+
290
+
```javascript
291
+
balance(String) // the minimum balance in wei required to interact with your dapp
0 commit comments