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
* Working display all wallets
* Variable name changes
* Filter out undefined wallet modules
* Add examples of how to use new config options
* Refactor filter and map to be a combined reduce
* Add documentation
* Increment versions
* Fix import
* Make it a minor change rather than a bugfix
Co-authored-by: Adam Carpenter <[email protected]>
* Update core version in react and vue packages
* Bump package versions
* Increment package versions
* Add documentation to new features to docs site
Co-authored-by: Adam Carpenter <[email protected]>
You may want to display injected wallets that are not currently available to the user and you can use the `displayUnavailable` option to do that:
168
+
169
+
```javascript
170
+
constinjected=injectedModule({
171
+
displayUnavailable:true
172
+
})
173
+
```
174
+
175
+
This will render every injected wallet as regardless of whether it has been detected in the window, happy days.
176
+
Then the issue of the order of wallets displayed becomes apparent when you have 21 injected wallets at the top of the wallets list. To solve this, all injected wallets are sorted alphabetically by default and there is an additional `sort` parameter which receives the final list of wallets and then returns the list to be rendered. This allows for example setting MetaMask and Coinbase first and then just the rest alphabetically:
177
+
178
+
```javascript
179
+
constinjected=injectedModule({
180
+
// display all wallets even if they are unavailable
181
+
displayUnavailable:true,
182
+
// do a manual sort of injected wallets so that MetaMask and Coinbase are ordered first
You may want to display all wallets, but filter out specific wallets based on their availability. For example I may want to display all unavailable wallets except when Binance and Bitski wallet is unavailable, then don't show them, but if they are available, then do show them. To do this, the filters value has been extended to have a new value: `'unavailable'`, as in; remove this wallet if it is unavailable, even though `displayUnavailable` wallets is set:
203
+
204
+
```javascript
205
+
constinjected=injectedModule({
206
+
// display all wallets even if they are unavailable
207
+
displayUnavailable:true,
208
+
// but only show Binance and Bitski wallet if they are available
209
+
filter: {
210
+
[ProviderLabel.Binance]:'unavailable',
211
+
[ProviderLabel.Bitski]:'unavailable'
212
+
},
213
+
// do a manual sort of injected wallets so that MetaMask and Coinbase are ordered first
If a wallet is selected, but is not available the default error message is: `Please install or enable ${walletName} to continue`. You may want to customise that message, so there is the `walletUnavailableMessage` parameter which is a function that takes the wallet object that is unavailable and returns a string which is the message to display:
234
+
235
+
```javascript
236
+
constinjected=injectedModule({
237
+
custom: [
238
+
// include custom (not natively supported) injected wallet modules here
239
+
],
240
+
// display all wallets even if they are unavailable
241
+
displayUnavailable:true,
242
+
// but only show Binance and Bitski wallet if they are available
243
+
filter: {
244
+
[ProviderLabel.Binance]:'unavailable',
245
+
[ProviderLabel.Bitski]:'unavailable'
246
+
},
247
+
// do a manual sort of injected wallets so that MetaMask and Coinbase are ordered first
Copy file name to clipboardExpand all lines: packages/core/package.json
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
{
2
2
"name": "@web3-onboard/core",
3
-
"version": "2.13.1-alpha.1",
3
+
"version": "2.13.1-alpha.2",
4
4
"description": "Web3-Onboard makes it simple to connect Ethereum hardware and software wallets to your dapp. Features standardized spec compliant web3 providers for all supported wallets, framework agnostic modern javascript UI with code splitting, CSS customization, multi-chain and multi-account support, reactive wallet state subscriptions and real-time transaction state change notifications.",
0 commit comments