Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update mm sdk #2192

Merged
merged 11 commits into from
May 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
"@web3-onboard/keystone": "^2.3.7",
"@web3-onboard/ledger": "^2.6.0",
"@web3-onboard/magic": "^2.1.7",
"@web3-onboard/metamask": "^2.0.6",
"@web3-onboard/metamask": "^2.0.7-alpha.1",
"@web3-onboard/mew-wallet": "^2.0.4",
"@web3-onboard/phantom": "^2.0.3",
"@web3-onboard/portis": "^2.1.7",
Expand Down
2 changes: 1 addition & 1 deletion packages/demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"@web3-onboard/keystone": "^2.3.8",
"@web3-onboard/ledger": "^2.6.0",
"@web3-onboard/magic": "^2.1.6",
"@web3-onboard/metamask": "^2.0.6",
"@web3-onboard/metamask": "^2.0.7-alpha.1",
"@web3-onboard/mew-wallet": "^2.0.3",
"@web3-onboard/phantom": "^2.0.3",
"@web3-onboard/portis": "^2.1.6",
Expand Down
4 changes: 2 additions & 2 deletions packages/metamask/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@web3-onboard/metamask",
"version": "2.0.6",
"version": "2.0.7-alpha-1",
"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.",
"keywords": [
"Ethereum",
Expand Down Expand Up @@ -60,7 +60,7 @@
"typescript": "^5.2.2"
},
"dependencies": {
"@metamask/sdk": "^0.18.6",
"@metamask/sdk": "^0.20.3",
"@web3-onboard/common": "^2.3.3"
},
"engines": {
Expand Down
20 changes: 8 additions & 12 deletions packages/metamask/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function metamask({
label: 'MetaMask',
getIcon: async () => (await import('./icon.js')).default,
getInterface: async ({ appMetadata }) => {
sdk = (window as any).mmsdk || sdk; // Prevent conflict with existing mmsdk instances
sdk = (window as any).mmsdk || sdk // Prevent conflict with existing mmsdk instances

if (sdk) {
// Prevent re-initializing instance as it causes issues with MetaMask sdk mobile provider.
Expand All @@ -57,14 +57,11 @@ function metamask({
const appLogoUrl = `data:image/svg+xml;base64,${base64}`
const imports = await importPromise

if (
!imports?.MetaMaskSDKConstructor ||
!imports?.createEIP1193Provider
) {
if (!imports?.MetaMaskSDKConstructor) {
throw new Error('Error importing and initializing MetaMask SDK')
}

const { createEIP1193Provider, MetaMaskSDKConstructor } = imports
const { MetaMaskSDKConstructor } = imports

sdk = new MetaMaskSDKConstructor({
...options,
Expand All @@ -76,13 +73,12 @@ function metamask({
_source: 'web3-onboard'
})

await sdk.init();
const provider = sdk.getProvider();
await sdk.init()
const provider = sdk.getProvider()

const _disconnect = sdk.disconnect
if(provider) {
(provider as any).disconnect = () => {
sdk?.terminate();
if (provider) {
;(provider as any).disconnect = () => {
sdk?.terminate()
}
}

Expand Down
28 changes: 14 additions & 14 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2363,10 +2363,10 @@
utf-8-validate "^6.0.3"
uuid "^8.3.2"

"@metamask/sdk-communication-layer@0.18.5":
version "0.18.5"
resolved "https://registry.yarnpkg.com/@metamask/sdk-communication-layer/-/sdk-communication-layer-0.18.5.tgz#4d153512172e6d0ff940f8ff6c50c2796ba49ceb"
integrity sha512-WMf9oJa3rAimjCXMAaaRVFPD0Q6dfZR0r9037KCpD5g9SlVh+TeMISfdQCEKAyhXP3d4CGxmp/Kib8C3mn2YLw==
"@metamask/sdk-communication-layer@0.20.2":
version "0.20.2"
resolved "https://registry.yarnpkg.com/@metamask/sdk-communication-layer/-/sdk-communication-layer-0.20.2.tgz#7f7fd334b2d26abd1a5a1ec1ffadf823a9589344"
integrity sha512-TN+whYbCClFSkx52Ild1RcjoRyz8YZgwNvZeooIcZIvCfBM6U9W5273KGiY7WLc/oO4KKmFk17d7vMO4gNvhhw==
dependencies:
bufferutil "^4.0.8"
date-fns "^2.29.3"
Expand All @@ -2387,10 +2387,10 @@
react-dom "^18.2.0"
react-i18next "^13.2.2"

"@metamask/sdk-install-modal-web@0.18.5":
version "0.18.5"
resolved "https://registry.yarnpkg.com/@metamask/sdk-install-modal-web/-/sdk-install-modal-web-0.18.5.tgz#f074f0c9a9c4d7272004ebf9792ce816418f13e0"
integrity sha512-Wygc0dgr1PwIA/Sg9WW9QWAsQr4G2GV6iveXt2xw8VKW/9cRORWqYukH1NZLr71hBKzi9AKYBU54Tk5Dfg41zg==
"@metamask/sdk-install-modal-web@0.20.2":
version "0.20.2"
resolved "https://registry.yarnpkg.com/@metamask/sdk-install-modal-web/-/sdk-install-modal-web-0.20.2.tgz#1cf0eb3c26291de7598190878fa9a893c4eb2d66"
integrity sha512-0QiaZhV15AGdN1zU2jfTI32eC3YkwEpzDfR9+oiZ9bd2G72c6lYBhTsmDGUd01aP6A+bqJR5PjI8Wh2AWtoLeA==
dependencies:
qr-code-styling "^1.6.0-rc.1"

Expand Down Expand Up @@ -2425,15 +2425,15 @@
util "^0.12.4"
uuid "^8.3.2"

"@metamask/sdk@^0.18.6":
version "0.18.6"
resolved "https://registry.yarnpkg.com/@metamask/sdk/-/sdk-0.18.6.tgz#ac6cfb80d35b179ee6efd9b2b2f6b67e27422e0a"
integrity sha512-ZT8e4BrcWrm44apLb412WR0fDsgeaS8UlI1c0wKRUPu1w/UntpXuUVO+EaY8WDlnOPAiAsjyqWKey64/DfvbXQ==
"@metamask/sdk@^0.20.3":
version "0.20.3"
resolved "https://registry.yarnpkg.com/@metamask/sdk/-/sdk-0.20.3.tgz#73851d68ffe5d45c1872c024182922530b187b7a"
integrity sha512-HZ9NwA+LxiXzuy0YWbWsuD4xejQtp85bhcCAf8UgpA/0dOyF3RS4dKDdBBXSyRgk3RWPjeJgHxioaH4CmBmiRA==
dependencies:
"@metamask/onboarding" "^1.0.1"
"@metamask/providers" "^15.0.0"
"@metamask/sdk-communication-layer" "0.18.5"
"@metamask/sdk-install-modal-web" "0.18.5"
"@metamask/sdk-communication-layer" "0.20.2"
"@metamask/sdk-install-modal-web" "0.20.2"
"@types/dom-screen-wake-lock" "^1.0.0"
bowser "^2.9.0"
cross-fetch "^4.0.0"
Expand Down
Loading