Skip to content

Commit a68b4b9

Browse files
authored
Fix - Metamask sdk version bump, small patch to fix autoconnecting issue, docs update (#1988)
* Update docs causing build errors * yarn docs * Fix metamask sdk with patch on local store item causing issues * Add null check for MMSDK
1 parent 9b90ed1 commit a68b4b9

File tree

10 files changed

+49
-30
lines changed

10 files changed

+49
-30
lines changed

docs/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
"@web3-onboard/keystone": "^2.3.7",
7171
"@web3-onboard/ledger": "^2.5.1",
7272
"@web3-onboard/magic": "^2.1.7",
73-
"@web3-onboard/metamask": "^2.0.0-alpha.1",
73+
"@web3-onboard/metamask": "^2.0.1-alpha.1",
7474
"@web3-onboard/mew-wallet": "^2.0.4",
7575
"@web3-onboard/phantom": "^2.0.3",
7676
"@web3-onboard/portis": "^2.1.7",

docs/src/routes/docs/[...1]overview/[...1]introduction/+page.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ We recommend you add the [Core Repo](../../modules/core.md#install) and consider
170170
**SDK Wallets**
171171

172172
- [Arcana Auth](../../wallets/arcana.md#install)
173-
- [Blocto](../../docs/wallets/blocto.md#install)
173+
- [Blocto](../../wallets/blocto.md#install)
174174
- [Coinbase](../../wallets/coinbase.md#install)
175175
- [Fortmatic](../../wallets/fortmatic.md#install)
176176
- [Frame](../../wallets/frame.md#install)

docs/src/routes/docs/[...3]modules/[...4]solid/+page.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ if (connectedWallet) {
7878

7979
### `init`
8080

81-
The `init` function initializes `web3-onboard` and makes it available to the `useOnboard()` composable. For references check out the [initialization docs for `@web3-onboard/core`](../core/README.md#initialization)
81+
The `init` function initializes `web3-onboard` and makes it available to the `useOnboard()` composable. For references check out the [initialization docs for `@web3-onboard/core`](/docs/modules/core#initialization)
8282

8383
#### Example usage
8484

@@ -126,7 +126,7 @@ const {
126126

127127
### `connectWallet`
128128

129-
Function to open the onboard modal and connect to a wallet provider. For reference check out the [connecting a wallet for `@web3-onboard/core`](../core/README.md#connecting-a-wallet)
129+
Function to open the onboard modal and connect to a wallet provider. For reference check out the [connecting a wallet for `@web3-onboard/core`](/docs/modules/core#connecting-a-wallet)
130130

131131
#### Example usage
132132

docs/src/routes/docs/[...4]wallets/[...18]metamask/+page.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ title: MetaMask
99
The MetaMask Web3-Onboard module provides a reliable, secure, and seamless connection from your dapp to the MetaMask browser extension and MetaMask Mobile.
1010
See [MetaMask SDK Developer Docs](https://github.com/MetaMask/metamask-sdk)
1111

12+
:::admonition type=tip
13+
When utilizing this package alongside the `@web3-onboard/injected-wallets` module, ensure to list this package prior to the initialized injected-wallets module within the wallets list of the Web3-Onboard init.
14+
15+
This order prioritizes the SDK when a MetaMask browser wallet is detected, allowing the SDK to take precedence.
1216
:::
1317

1418
## Install
@@ -36,14 +40,14 @@ npm install @web3-onboard/metamask
3640
// For a complete list of options check https://github.com/MetaMask/metamask-sdk
3741
interface MetaMaskSDKOptions {
3842
dappMetadata: {
39-
url?: string;
40-
name?: string;
41-
base64Icon?: string;
42-
},
43+
url?: string
44+
name?: string
45+
base64Icon?: string
46+
}
4347
/**
4448
* If MetaMask browser extension is detected, directly use it without prompting the user.
4549
*/
46-
extensionOnly?: boolean;
50+
extensionOnly?: boolean
4751
}
4852
```
4953

@@ -66,6 +70,8 @@ const onboard = Onboard({
6670
wallets: [
6771
metamaskSDKWallet
6872
//... other wallets
73+
// Make sure to pass in before or above the injected-wallets module
74+
injectedWalletModule
6975
]
7076
})
7177

docs/yarn.lock

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2504,9 +2504,9 @@
25042504
integrity sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw==
25052505

25062506
"@react-native-async-storage/async-storage@^1.17.11":
2507-
version "1.19.3"
2508-
resolved "https://registry.yarnpkg.com/@react-native-async-storage/async-storage/-/async-storage-1.19.3.tgz#ad5fe3ed0a82d4624aa4500321c1e09c02daeb46"
2509-
integrity sha512-CwGfoHCWdPOTPS+2fW6YRE1fFBpT9++ahLEroX5hkgwyoQ+TkmjOaUxixdEIoVua9Pz5EF2pGOIJzqOTMWfBlA==
2507+
version "1.19.4"
2508+
resolved "https://registry.yarnpkg.com/@react-native-async-storage/async-storage/-/async-storage-1.19.4.tgz#f3c8648fa6d06f085e30f68f0810ea8e53165ace"
2509+
integrity sha512-Stj6Q1v5knTMaYOinEEJl030SzJWEhqW+IYI5uA9Nl9Olo+vDUecmQXqpIxELucwOGDJ8KwvI0UL22UHudwZeQ==
25102510
dependencies:
25112511
merge-options "^3.0.4"
25122512

@@ -4314,10 +4314,10 @@
43144314
magic-sdk "^8.1.0"
43154315
rxjs "^7.5.2"
43164316

4317-
"@web3-onboard/metamask@^2.0.0-alpha.1":
4318-
version "2.0.0"
4319-
resolved "https://registry.yarnpkg.com/@web3-onboard/metamask/-/metamask-2.0.0.tgz#c2dae6413611e530bfe904335750e25728db0779"
4320-
integrity sha512-tZSGa1p9yRScGK0qSAjtvZK8pAZOL6B5j+OutAYLs5WpEFZiXxiJUkJwiEhlL0YI78RMA5K3/4GhY6GTC6ruiA==
4317+
"@web3-onboard/metamask@^2.0.1-alpha.1":
4318+
version "2.0.1-alpha.2"
4319+
resolved "https://registry.yarnpkg.com/@web3-onboard/metamask/-/metamask-2.0.1-alpha.2.tgz#b5371a55f43ba7ef70a73e8febf7d252bd47322e"
4320+
integrity sha512-KUcblErwCRpL4LvM8PJvKHND1ePmiDbphiizdmwiOpNxEQ6VGR3S0eIZq1iKv2hxkImdMtprHni426W4w7Q8RA==
43214321
dependencies:
43224322
"@metamask/sdk" "^0.10.0"
43234323
"@web3-onboard/common" "^2.3.3"

packages/demo/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
"@web3-onboard/keystone": "^2.3.7",
4747
"@web3-onboard/ledger": "^2.5.2",
4848
"@web3-onboard/magic": "^2.1.6",
49-
"@web3-onboard/metamask": "^2.0.1-alpha.1",
49+
"@web3-onboard/metamask": "^2.0.1-alpha.3",
5050
"@web3-onboard/mew-wallet": "^2.0.3",
5151
"@web3-onboard/phantom": "^2.0.3",
5252
"@web3-onboard/portis": "^2.1.6",

packages/metamask/README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ See [MetaMask SDK Developer Docs](https://github.com/MetaMask/metamask-sdk)
88

99
`npm i @web3-onboard/metamask`
1010

11+
### If using this package with the `@web3-onboard/injected-wallets` module
12+
_When utilizing this package alongside the `@web3-onboard/injected-wallets` module, ensure to list this package prior to the initialized injected-wallets module within the wallets list of the Web3-Onboard init._
13+
_This order prioritizes the SDK when a MetaMask browser wallet is detected, allowing the SDK to take precedence._
14+
1115
## Options
1216

1317
```typescript
@@ -42,8 +46,10 @@ const metamaskSDKWallet = metamaskSDK({options: {
4246
const onboard = Onboard({
4347
// ... other Onboard options
4448
wallets: [
45-
metamaskSDKWallet
49+
metamaskSDKWallet,
4650
//... other wallets
51+
// Make sure to pass in before or above the injected-wallets module
52+
injectedWalletModule
4753
]
4854
})
4955

packages/metamask/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@web3-onboard/metamask",
3-
"version": "2.0.1-alpha.2",
3+
"version": "2.0.1-alpha.3",
44
"description": "MetaMask SDK wallet module for connecting to Web3-Onboard. Web3-Onboard makes it simple to connect Ethereum hardware and software wallets to your dapp. Features standardised 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.",
55
"keywords": [
66
"Ethereum",
@@ -60,7 +60,7 @@
6060
"typescript": "^5.2.2"
6161
},
6262
"dependencies": {
63-
"@metamask/sdk": "^0.10.0",
63+
"@metamask/sdk": "^0.10.1",
6464
"@web3-onboard/common": "^2.3.3"
6565
}
6666
}

packages/metamask/src/index.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import type { MetaMaskSDKOptions } from '@metamask/sdk'
22
import type { WalletInit } from '@web3-onboard/common'
3+
export type { MetaMaskSDKOptions } from '@metamask/sdk'
34

45
function metamask({
56
options
@@ -17,15 +18,21 @@ function metamask({
1718
const { createEIP1193Provider } = await import('@web3-onboard/common')
1819
const { default: metaMask, MetaMaskSDK } = await import('@metamask/sdk')
1920

20-
let MetaMaskSDKConstructor
21+
// Patch issue with MetaMask SDK, remove after SDK is fixed
22+
localStorage.removeItem('providerType')
2123

24+
let MetaMaskSDKConstructor
2225
if (!MetaMaskSDK) {
2326
// @ts-ignore
2427
MetaMaskSDKConstructor = metaMask.MetaMaskSDK
2528
} else {
2629
MetaMaskSDKConstructor = MetaMaskSDK
2730
}
2831

32+
if (!MetaMaskSDKConstructor) {
33+
throw new Error('Error importing and initializing MetaMask SDK')
34+
}
35+
2936
const sdk = new MetaMaskSDKConstructor({
3037
...options,
3138
dappMetadata: {

yarn.lock

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2197,10 +2197,10 @@
21972197
resolved "https://registry.yarnpkg.com/@metamask/safe-event-emitter/-/safe-event-emitter-3.0.0.tgz#8c2b9073fe0722d48693143b0dc8448840daa3bd"
21982198
integrity sha512-j6Z47VOmVyGMlnKXZmL0fyvWfEYtKWCA9yGZkU3FCsGZUT5lHGmvaV9JA5F2Y+010y7+ROtR3WMXIkvl/nVzqQ==
21992199

2200-
"@metamask/[email protected].0":
2201-
version "0.10.0"
2202-
resolved "https://registry.yarnpkg.com/@metamask/sdk-communication-layer/-/sdk-communication-layer-0.10.0.tgz#897ed0e1b881517e09d40a3e9c9a323c1a9b11b5"
2203-
integrity sha512-Hi8sySaP+dyjd9+SQUtTnmYFRjKWgNo371yWcfOx1vogpP5YwD4VaHDbPQr5rWKDGXb/x1wai6UzPkMqHbllwQ==
2200+
"@metamask/[email protected].1":
2201+
version "0.10.1"
2202+
resolved "https://registry.yarnpkg.com/@metamask/sdk-communication-layer/-/sdk-communication-layer-0.10.1.tgz#95c6a1786dcd7a64c54a8e5cbd11489aa708b074"
2203+
integrity sha512-lWeh1PUq114h1/44llZgBcG51uOEi5dHjnNHlcYK9Sjq/iJ4s3mp0y39DGXHEs2r6rJQRyQpryoYyPsQTF2Imw==
22042204
dependencies:
22052205
cross-fetch "^3.1.5"
22062206
date-fns "^2.29.3"
@@ -2222,15 +2222,15 @@
22222222
react-dom "^18.2.0"
22232223
react-i18next "^13.2.2"
22242224

2225-
"@metamask/sdk@^0.10.0":
2226-
version "0.10.0"
2227-
resolved "https://registry.yarnpkg.com/@metamask/sdk/-/sdk-0.10.0.tgz#3eb169ee07e95e232ebf3f3ef27906e28423fdaa"
2228-
integrity sha512-a6H51cKjiWd2gb4ugjl4zP+6ZRtcSc8cwtXUSiKKlXwa//54nnx7OzCNOjbPJFnnqT51rs3v9kSoRhOgS04ezQ==
2225+
"@metamask/sdk@^0.10.1":
2226+
version "0.10.1"
2227+
resolved "https://registry.yarnpkg.com/@metamask/sdk/-/sdk-0.10.1.tgz#3a9d029d5b16684de59d6ee34401d1165dc1a740"
2228+
integrity sha512-cxTWnniZG0cmvaFxf/WAf4SqPw4lHrt16cMMiefAJAsNyL3aPUh8M26fh29EdftIhUXytT9ErNGW+Nf5V4EsCQ==
22292229
dependencies:
22302230
"@metamask/onboarding" "^1.0.1"
22312231
"@metamask/post-message-stream" "^6.1.0"
22322232
"@metamask/providers" "^10.2.1"
2233-
"@metamask/sdk-communication-layer" "0.10.0"
2233+
"@metamask/sdk-communication-layer" "0.10.1"
22342234
"@metamask/sdk-install-modal-web" "0.10.0"
22352235
"@react-native-async-storage/async-storage" "^1.17.11"
22362236
"@types/dom-screen-wake-lock" "^1.0.0"

0 commit comments

Comments
 (0)