Skip to content

Commit 6514598

Browse files
authored
Merge branch 'develop' into dependabot/npm_and_yarn/packages/demo/braces-3.0.3
2 parents a3b553b + 59df5fc commit 6514598

File tree

12 files changed

+58
-42
lines changed

12 files changed

+58
-42
lines changed

packages/core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@web3-onboard/core",
3-
"version": "2.22.1",
3+
"version": "2.22.2-alpha.2",
44
"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.",
55
"keywords": [
66
"Ethereum",

packages/core/src/connect.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,9 @@ async function connect(
3131
'At least one chain must be set before attempting to connect a wallet'
3232
)
3333

34-
const { autoSelect } = options || {
35-
autoSelect: { label: '', disableModals: false }
34+
let { autoSelect } = options || {}
35+
if (!autoSelect) {
36+
autoSelect = { label: '', disableModals: false }
3637
}
3738

3839
// if auto selecting, wait until next event loop
@@ -44,7 +45,6 @@ async function connect(
4445
if (!state.get().walletModules.length) {
4546
setWalletModules(configuration.initialWalletInit)
4647
}
47-
4848
connectWallet$.next({
4949
autoSelect:
5050
typeof autoSelect === 'string'

packages/core/src/disconnect.ts

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -44,18 +44,25 @@ async function disconnect(options: DisconnectOptions): Promise<WalletState[]> {
4444
disconnectWallet$.next(label)
4545
removeWallet(label)
4646

47-
const labels = JSON.parse(
48-
getLocalStore(STORAGE_KEYS.LAST_CONNECTED_WALLET) || ''
49-
)
47+
const lastConnectedWallets = getLocalStore(STORAGE_KEYS.LAST_CONNECTED_WALLET)
48+
if (lastConnectedWallets) {
49+
try {
50+
const labels = JSON.parse(lastConnectedWallets)
5051

51-
if (Array.isArray(labels) && labels.indexOf(label) >= 0) {
52-
setLocalStore(
53-
STORAGE_KEYS.LAST_CONNECTED_WALLET,
54-
JSON.stringify(labels.filter(walletLabel => walletLabel !== label))
55-
)
56-
}
57-
if (typeof labels === 'string' && labels === label) {
58-
delLocalStore(STORAGE_KEYS.LAST_CONNECTED_WALLET)
52+
if (Array.isArray(labels) && labels.indexOf(label) >= 0) {
53+
setLocalStore(
54+
STORAGE_KEYS.LAST_CONNECTED_WALLET,
55+
JSON.stringify(labels.filter(walletLabel => walletLabel !== label))
56+
)
57+
}
58+
if (typeof labels === 'string' && labels === label) {
59+
delLocalStore(STORAGE_KEYS.LAST_CONNECTED_WALLET)
60+
}
61+
} catch (e) {
62+
console.error(
63+
`There was an error disconnecting the last connected wallet from localStorage - Error: ${e}`
64+
)
65+
}
5966
}
6067

6168
return state.get().wallets

packages/core/src/index.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,12 @@ function init(options: InitOptions): OnboardAPI {
290290
) {
291291
connectAllPreviousWallets(lastConnectedWalletsParsed, connect)
292292
}
293+
if (
294+
lastConnectedWalletsParsed &&
295+
typeof lastConnectedWalletsParsed === 'string'
296+
) {
297+
connectAllPreviousWallets([lastConnectedWalletsParsed], connect)
298+
}
293299
} catch (err) {
294300
// Handle for legacy single wallet approach
295301
// Above try will throw syntax error is local storage is not json
@@ -361,6 +367,7 @@ const connectAllPreviousWallets = async (
361367
}
362368
}
363369
}
370+
364371
setLocalStore(
365372
STORAGE_KEYS.LAST_CONNECTED_WALLET,
366373
JSON.stringify(activeWalletsList)

packages/core/src/views/account-center/AccountCenterPanel.svelte

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@
7272
const { device } = configuration
7373
7474
const enableProtectionRPC = async () => {
75+
if (!validAppChain) return
7576
try {
7677
await updateChainRPC(
7778
primaryWallet.provider,
@@ -461,7 +462,7 @@
461462
</div>
462463
</div>
463464
<!-- Only display on Eth Mainnet if protectedRpcUrl is not set per chain -->
464-
{#if !$accountCenter$.hideTransactionProtectionBtn && (primaryWalletOnMainnet || validAppChain.protectedRpcUrl)}
465+
{#if !$accountCenter$.hideTransactionProtectionBtn && (primaryWalletOnMainnet || (validAppChain && validAppChain.protectedRpcUrl))}
465466
<div
466467
on:click={() => (enableTransactionProtection = true)}
467468
class="protect action-container flex items-center pointer"

packages/demo/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@
3333
"@web3-onboard/blocto": "^2.1.1",
3434
"@web3-onboard/capsule": "2.2.0-alpha.1",
3535
"@web3-onboard/cede-store": "^2.3.1",
36+
"@web3-onboard/core": "2.22.2-alpha.2",
3637
"@web3-onboard/coinbase": "^2.4.1",
37-
"@web3-onboard/core": "2.22.1",
3838
"@web3-onboard/dcent": "^2.2.7",
3939
"@web3-onboard/enkrypt": "^2.1.1",
4040
"@web3-onboard/fortmatic": "^2.1.1",
@@ -48,7 +48,7 @@
4848
"@web3-onboard/keystone": "^2.3.8",
4949
"@web3-onboard/ledger": "^2.7.1",
5050
"@web3-onboard/magic": "^2.2.1",
51-
"@web3-onboard/metamask": "^2.1.1",
51+
"@web3-onboard/metamask": "^2.1.2-alpha.1",
5252
"@web3-onboard/mew-wallet": "^2.1.1",
5353
"@web3-onboard/okx": "2.0.0-alpha.1",
5454
"@web3-onboard/particle-network": "^2.1.1",

packages/demo/src/App.svelte

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@
281281
282282
const onboard = Onboard({
283283
wallets: [
284-
// metamaskSDKWallet,
284+
metamaskSDKWallet,
285285
coinbaseWallet,
286286
injected,
287287
ledger,
@@ -415,7 +415,8 @@
415415
connect: {
416416
// disableClose: true,
417417
// removeWhereIsMyWalletWarning: true,
418-
autoConnectAllPreviousWallet: true
418+
// autoConnectLastWallet: false,
419+
autoConnectAllPreviousWallet: true,
419420
},
420421
appMetadata: {
421422
name: 'Blocknative',

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.1.1",
3+
"version": "2.1.2-alpha.1",
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.20.3",
63+
"@metamask/sdk": "^0.20.5",
6464
"@web3-onboard/common": "^2.4.1"
6565
},
6666
"engines": {

packages/react/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/react",
3-
"version": "2.9.1",
3+
"version": "2.9.2-alpha.2",
44
"description": "A collection of React hooks for integrating Web3-Onboard in to React and Next.js projects. 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, 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",
@@ -61,7 +61,7 @@
6161
"typescript": "^5.4.5"
6262
},
6363
"dependencies": {
64-
"@web3-onboard/core": "2.22.1",
64+
"@web3-onboard/core": "2.22.2-alpha.2",
6565
"@web3-onboard/common": "^2.4.1",
6666
"use-sync-external-store": "1.0.0"
6767
},

packages/solid/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/solid",
3-
"version": "2.1.1",
3+
"version": "2.1.2-alpha.2",
44
"description": "A collection of solid Composables for integrating Web3-Onboard in to a Solid project. 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, 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",
@@ -63,7 +63,7 @@
6363
},
6464
"dependencies": {
6565
"@web3-onboard/common": "^2.4.1",
66-
"@web3-onboard/core": "2.22.1",
66+
"@web3-onboard/core": "2.22.2-alpha.2",
6767
"solid-js": "^1.8.1"
6868
}
6969
}

packages/vue/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/vue",
3-
"version": "2.8.1",
3+
"version": "2.8.2-alpha.2",
44
"description": "A collection of Vue Composables for integrating Web3-Onboard in to a Vue or Nuxt project. 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, 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",
@@ -62,7 +62,7 @@
6262
"@vueuse/core": "^8.4.2",
6363
"@vueuse/rxjs": "^8.2.0",
6464
"@web3-onboard/common": "^2.4.1",
65-
"@web3-onboard/core": "2.22.1",
65+
"@web3-onboard/core": "2.22.2-alpha.2",
6666
"vue-demi": "^0.12.4"
6767
},
6868
"peerDependencies": {

yarn.lock

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2247,10 +2247,10 @@
22472247
utf-8-validate "^6.0.3"
22482248
uuid "^8.3.2"
22492249

2250-
"@metamask/sdk-communication-layer@0.20.2":
2251-
version "0.20.2"
2252-
resolved "https://registry.yarnpkg.com/@metamask/sdk-communication-layer/-/sdk-communication-layer-0.20.2.tgz#7f7fd334b2d26abd1a5a1ec1ffadf823a9589344"
2253-
integrity sha512-TN+whYbCClFSkx52Ild1RcjoRyz8YZgwNvZeooIcZIvCfBM6U9W5273KGiY7WLc/oO4KKmFk17d7vMO4gNvhhw==
2250+
"@metamask/sdk-communication-layer@0.20.5":
2251+
version "0.20.5"
2252+
resolved "https://registry.yarnpkg.com/@metamask/sdk-communication-layer/-/sdk-communication-layer-0.20.5.tgz#b472fe223319a25a060155ea904f7c66062102b2"
2253+
integrity sha512-Y3pzg1GBB7tDUCUsyhvlhxQ+h/pDrTjO2yUwjCJj2S8Nx5OtdRv/foRGfbDHkfYt6Z9ANRfivWU2U6El17B24A==
22542254
dependencies:
22552255
bufferutil "^4.0.8"
22562256
date-fns "^2.29.3"
@@ -2271,10 +2271,10 @@
22712271
react-dom "^18.2.0"
22722272
react-i18next "^13.2.2"
22732273

2274-
"@metamask/sdk-install-modal-web@0.20.2":
2275-
version "0.20.2"
2276-
resolved "https://registry.yarnpkg.com/@metamask/sdk-install-modal-web/-/sdk-install-modal-web-0.20.2.tgz#1cf0eb3c26291de7598190878fa9a893c4eb2d66"
2277-
integrity sha512-0QiaZhV15AGdN1zU2jfTI32eC3YkwEpzDfR9+oiZ9bd2G72c6lYBhTsmDGUd01aP6A+bqJR5PjI8Wh2AWtoLeA==
2274+
"@metamask/sdk-install-modal-web@0.20.4":
2275+
version "0.20.4"
2276+
resolved "https://registry.yarnpkg.com/@metamask/sdk-install-modal-web/-/sdk-install-modal-web-0.20.4.tgz#50b97be4e3be17c3622281c2ad9fc49769e33216"
2277+
integrity sha512-AX3mTr0IDpS0ajV83okTaixG+2wIxTVbgvEuQgAj2Ed7PWAdiZ1aX93AVcaCgkOWhTf267z7mXCSuBDpBCje9g==
22782278
dependencies:
22792279
qr-code-styling "^1.6.0-rc.1"
22802280

@@ -2309,15 +2309,15 @@
23092309
util "^0.12.4"
23102310
uuid "^8.3.2"
23112311

2312-
"@metamask/sdk@^0.20.3":
2313-
version "0.20.3"
2314-
resolved "https://registry.yarnpkg.com/@metamask/sdk/-/sdk-0.20.3.tgz#73851d68ffe5d45c1872c024182922530b187b7a"
2315-
integrity sha512-HZ9NwA+LxiXzuy0YWbWsuD4xejQtp85bhcCAf8UgpA/0dOyF3RS4dKDdBBXSyRgk3RWPjeJgHxioaH4CmBmiRA==
2312+
"@metamask/sdk@^0.20.5":
2313+
version "0.20.5"
2314+
resolved "https://registry.yarnpkg.com/@metamask/sdk/-/sdk-0.20.5.tgz#ae90b4e5108f2a0e5f5536e66354c3e31b121af9"
2315+
integrity sha512-BEL3BKbb0O09QgOzvyPH5xUONl2uicS9WT1AYhZ8yR4ytz5fhyHWJzs8Q/cwgm1qIdn3eumnjXfgA6pKirWa3A==
23162316
dependencies:
23172317
"@metamask/onboarding" "^1.0.1"
23182318
"@metamask/providers" "^15.0.0"
2319-
"@metamask/sdk-communication-layer" "0.20.2"
2320-
"@metamask/sdk-install-modal-web" "0.20.2"
2319+
"@metamask/sdk-communication-layer" "0.20.5"
2320+
"@metamask/sdk-install-modal-web" "0.20.4"
23212321
"@types/dom-screen-wake-lock" "^1.0.0"
23222322
bowser "^2.9.0"
23232323
cross-fetch "^4.0.0"

0 commit comments

Comments
 (0)