Skip to content

Commit 800ed61

Browse files
authored
Update: Remove deprecated WalletConnect v1 support & update package deps (#1950)
* Remove WC v1 support, cleanup docs and update WC deps * Move types to typesfile, rename v2 file to WC as v1 support is removed * Update WC dep version * Refine validation
1 parent 156451d commit 800ed61

File tree

10 files changed

+211
-633
lines changed

10 files changed

+211
-633
lines changed

docs/src/routes/docs/[...4]wallets/[...26]walletconnect/+page.md

Lines changed: 42 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,7 @@ title: WalletConnect
44

55
# {$frontmatter.title}
66

7-
Wallet module for connecting WalletConnect to web3-onboard, currently supporting both v1 and v2.
8-
9-
:::admonition type=warning
10-
_Version 1 of WalletConnect has been deprecated by the WC team and the WC bridge is not available. Upgrading to use WalletConnect v2 is recommended. Support will be completely removed from Web3-Onboard in the future_
11-
:::
7+
Wallet module for connecting WalletConnect to web3-onboard.
128

139
## Install
1410

@@ -32,71 +28,44 @@ npm install @web3-onboard/walletconnect
3228

3329
```typescript
3430
type WalletConnectOptions = {
31+
/**
32+
* Project ID associated with [WalletConnect account](https://cloud.walletconnect.com)
33+
*/
34+
projectId: string
35+
/**
36+
* Defaults to `appMetadata.explore` that is supplied to the web3-onboard init
37+
* Strongly recommended to provide atleast one URL as it is required by some wallets (i.e. MetaMask)
38+
* To connect with walletconnect
39+
*/
40+
dappUrl?: string
41+
/**
42+
* List of Required Chain(s) ID for wallets to support in number format (integer or hex)
43+
* Defaults to [1] - Ethereum
44+
*/
45+
requiredChains?: number[] | undefined
46+
/**
47+
* List of Optional Chain(s) ID for wallets to support in number format (integer or hex)
48+
* Defaults to the chains provided within the web3-onboard init chain property
49+
*/
50+
optionalChains?: number[] | undefined
51+
/**
52+
* `undefined` by default, see https://docs.walletconnect.com/2.0/web/walletConnectModal/options
53+
*/
54+
qrModalOptions?: EthereumProviderOptions['qrModalOptions']
55+
/**
56+
* Additional required methods to be added to the default list of ['eth_sendTransaction', 'personal_sign']
57+
* Passed methods to be included along with the defaults methods - see https://docs.walletconnect.com/2.0/advanced/providers/ethereum#required-and-optional-methods
58+
*/
59+
additionalRequiredMethods?: string[] | undefined
60+
/**
61+
* Additional methods to be added to the default list of ['eth_sendTransaction', 'eth_signTransaction', 'personal_sign', 'eth_sign', 'eth_signTypedData', 'eth_signTypedData_v4']
62+
* Passed methods to be included along with the defaults methods - see https://docs.walletconnect.com/2.0/web/walletConnectModal/options
63+
*/
64+
additionalOptionalMethods?: string[] | undefined
3565
/**
3666
* Optional function to handle WalletConnect URI when it becomes available
3767
*/
3868
handleUri?: (uri: string) => Promise<unknown>
39-
} & (
40-
| {
41-
/**
42-
* Project ID associated with [WalletConnect account](https://cloud.walletconnect.com)
43-
*/
44-
projectId: string
45-
/**
46-
* Defaults to `appMetadata.explore` that is supplied to the web3-onboard init
47-
* Strongly recommended to provide atleast one URL as it is required by some wallets (i.e. MetaMask)
48-
* To connect with walletconnect
49-
*/
50-
dappUrl?: string
51-
/**
52-
* Defaults to version: 2
53-
*/
54-
version?: 2
55-
/**
56-
* List of Required Chain(s) ID for wallets to support in number format (integer or hex)
57-
* Defaults to [1] - Ethereum
58-
*/
59-
requiredChains?: number[] | undefined
60-
/**
61-
* List of Optional Chain(s) ID for wallets to support in number format (integer or hex)
62-
* Defaults to the chains provided within the web3-onboard init chain property
63-
*/
64-
optionalChains?: number[] | undefined
65-
/**
66-
* `undefined` by default, see https://docs.walletconnect.com/2.0/web/walletConnectModal/options
67-
*/
68-
qrModalOptions?: EthereumProviderOptions['qrModalOptions']
69-
/**
70-
* Additional required methods to be added to the default list of ['eth_sendTransaction', 'personal_sign']
71-
* Passed methods to be included along with the defaults methods - see https://docs.walletconnect.com/2.0/advanced/providers/ethereum#required-and-optional-methods
72-
*/
73-
additionalRequiredMethods?: string[] | undefined
74-
/**
75-
* Additional methods to be added to the default list of ['eth_sendTransaction', 'eth_signTransaction', 'personal_sign', 'eth_sign', 'eth_signTypedData', 'eth_signTypedData_v4']
76-
* Passed methods to be included along with the defaults methods - see https://docs.walletconnect.com/2.0/web/walletConnectModal/options
77-
*/
78-
additionalOptionalMethods?: string[] | undefined
79-
}
80-
| {
81-
/**
82-
* @deprecated
83-
* Version 1 of WalletConnect has been deprecated by the WC team and the WC bridge is not available.
84-
* To use version 1 a custom bridge url will need to be provided.
85-
* Support will be completely remove from Web3-Onboard in the future
86-
*/
87-
version: 1
88-
/**
89-
* Custom URL Bridge must be defined for V1 usage.
90-
* WalletConnect no longer supports a v1 bridge.
91-
* Upgrading to use WalletConnect v2 is recommended.
92-
* A potential bridge can be found here: 'https://derelay.rabby.io'
93-
*/
94-
bridge: string
95-
connectFirstChainId?: boolean
96-
qrcodeModalOptions?: {
97-
mobileLinks: string[]
98-
}
99-
}
10069
)
10170
```
10271
@@ -106,15 +75,19 @@ type WalletConnectOptions = {
10675
import Onboard from '@web3-onboard/core'
10776
import walletConnectModule from '@web3-onboard/walletconnect'
10877

109-
const wcV2InitOptions = {
78+
const wcInitOptions = {
11079
/**
11180
* Project ID associated with [WalletConnect account](https://cloud.walletconnect.com)
11281
*/
11382
projectId: 'abc123...',
11483
/**
11584
* Chains required to be supported by all wallets connecting to your DApp
11685
*/
117-
requiredChains: [1, 56],
86+
requiredChains: [1],
87+
/**
88+
* Chains required to be supported by all wallets connecting to your DApp
89+
*/
90+
optionalChains: [42161, 8453, 10, 137, 56],
11891
/**
11992
* Defaults to `appMetadata.explore` that is supplied to the web3-onboard init
12093
* Strongly recommended to provide atleast one URL as it is required by some wallets (i.e. MetaMask)
@@ -124,12 +97,9 @@ const wcV2InitOptions = {
12497
}
12598

12699
// initialize the module with options
127-
// If version isn't set it will default to V2 - V1 support will be completely removed shortly as it is deprecated
128-
const walletConnect = walletConnectModule(wcV2InitOptions)
100+
const walletConnect = walletConnectModule(wcInitOptions)
129101

130102
// can also initialize with no options...
131-
// Defaults to V2 - V1 support will be completely removed shortly as it is deprecated
132-
// const walletConnect = walletConnectModule()
133103

134104
const onboard = Onboard({
135105
// ... other Onboard options

packages/demo/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
"@web3-onboard/trust": "^2.0.3",
5757
"@web3-onboard/uauth": "^2.1.2",
5858
"@web3-onboard/venly": "^2.0.0",
59-
"@web3-onboard/walletconnect": "^2.4.7",
59+
"@web3-onboard/walletconnect": "^2.5.0-alpha.1",
6060
"@web3-onboard/web3auth": "^2.2.2",
6161
"@web3-onboard/xdefi": "^2.0.5",
6262
"@web3-onboard/zeal": "^2.0.3",

packages/walletconnect/README.md

Lines changed: 41 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -6,79 +6,48 @@
66

77
`npm i @web3-onboard/core @web3-onboard/walletconnect`
88

9-
## Version 1 of WalletConnect has been deprecated
10-
11-
_Version 1 of WalletConnect has been deprecated by the WC team and the WC bridge is not available. If wanting to continue to use WalletConnect V1 a custom bridge URL is required. Support will be completely removed from Web3-Onboard in the future_
12-
139
## Options
1410

1511
```typescript
1612
type WalletConnectOptions = {
13+
/**
14+
* Project ID associated with [WalletConnect account](https://cloud.walletconnect.com)
15+
*/
16+
projectId: string
17+
/**
18+
* Defaults to `appMetadata.explore` that is supplied to the web3-onboard init
19+
* Strongly recommended to provide atleast one URL as it is required by some wallets (i.e. MetaMask)
20+
* To connect with walletconnect
21+
*/
22+
dappUrl?: string
23+
/**
24+
* List of Required Chain(s) ID for wallets to support in number format (integer or hex)
25+
* Defaults to [1] - Ethereum
26+
*/
27+
requiredChains?: number[] | undefined
28+
/**
29+
* List of Optional Chain(s) ID for wallets to support in number format (integer or hex)
30+
* Defaults to the chains provided within the web3-onboard init chain property
31+
*/
32+
optionalChains?: number[] | undefined
33+
/**
34+
* `undefined` by default, see https://docs.walletconnect.com/2.0/web/walletConnectModal/options
35+
*/
36+
qrModalOptions?: EthereumProviderOptions['qrModalOptions']
37+
/**
38+
* Additional required methods to be added to the default list of ['eth_sendTransaction', 'personal_sign']
39+
* Passed methods to be included along with the defaults methods - see https://docs.walletconnect.com/2.0/advanced/providers/ethereum#required-and-optional-methods
40+
*/
41+
additionalRequiredMethods?: string[] | undefined
42+
/**
43+
* Additional methods to be added to the default list of ['eth_sendTransaction', 'eth_signTransaction', 'personal_sign', 'eth_sign', 'eth_signTypedData', 'eth_signTypedData_v4']
44+
* Passed methods to be included along with the defaults methods - see https://docs.walletconnect.com/2.0/web/walletConnectModal/options
45+
*/
46+
additionalOptionalMethods?: string[] | undefined
1747
/**
1848
* Optional function to handle WalletConnect URI when it becomes available
1949
*/
2050
handleUri?: (uri: string) => Promise<unknown>
21-
} & (
22-
| {
23-
/**
24-
* Project ID associated with [WalletConnect account](https://cloud.walletconnect.com)
25-
*/
26-
projectId: string
27-
/**
28-
* Defaults to `appMetadata.explore` that is supplied to the web3-onboard init
29-
* Strongly recommended to provide atleast one URL as it is required by some wallets (i.e. MetaMask)
30-
* To connect with walletconnect
31-
*/
32-
dappUrl?: string
33-
/**
34-
* Defaults to version: 2
35-
*/
36-
version?: 2
37-
/**
38-
* List of Required Chain(s) ID for wallets to support in number format (integer or hex)
39-
* Defaults to [1] - Ethereum
40-
*/
41-
requiredChains?: number[] | undefined
42-
/**
43-
* List of Optional Chain(s) ID for wallets to support in number format (integer or hex)
44-
* Defaults to the chains provided within the web3-onboard init chain property
45-
*/
46-
optionalChains?: number[] | undefined
47-
/**
48-
* `undefined` by default, see https://docs.walletconnect.com/2.0/web/walletConnectModal/options
49-
*/
50-
qrModalOptions?: EthereumProviderOptions['qrModalOptions']
51-
/**
52-
* Additional required methods to be added to the default list of ['eth_sendTransaction', 'personal_sign']
53-
* Passed methods to be included along with the defaults methods - see https://docs.walletconnect.com/2.0/advanced/providers/ethereum#required-and-optional-methods
54-
*/
55-
additionalRequiredMethods?: string[] | undefined
56-
/**
57-
* Additional methods to be added to the default list of ['eth_sendTransaction', 'eth_signTransaction', 'personal_sign', 'eth_sign', 'eth_signTypedData', 'eth_signTypedData_v4']
58-
* Passed methods to be included along with the defaults methods - see https://docs.walletconnect.com/2.0/web/walletConnectModal/options
59-
*/
60-
additionalOptionalMethods?: string[] | undefined
61-
}
62-
| {
63-
/**
64-
* @deprecated
65-
* Version 1 of WalletConnect has been deprecated by the WC team and the WC bridge is not available.
66-
* To use version 1 a custom bridge url will need to be provided.
67-
* Support will be completely remove from Web3-Onboard in the future
68-
*/
69-
version: 1
70-
/**
71-
* Custom URL Bridge must be defined for V1 usage.
72-
* WalletConnect no longer supports a v1 bridge.
73-
* Upgrading to use WalletConnect v2 is recommended.
74-
* A potential bridge can be found here: 'https://derelay.rabby.io'
75-
*/
76-
bridge: string
77-
connectFirstChainId?: boolean
78-
qrcodeModalOptions?: {
79-
mobileLinks: string[]
80-
}
81-
}
8251
)
8352
```
8453
@@ -88,15 +57,19 @@ type WalletConnectOptions = {
8857
import Onboard from '@web3-onboard/core'
8958
import walletConnectModule from '@web3-onboard/walletconnect'
9059

91-
const wcV2InitOptions = {
60+
const wcInitOptions = {
9261
/**
9362
* Project ID associated with [WalletConnect account](https://cloud.walletconnect.com)
9463
*/
9564
projectId: 'abc123...',
9665
/**
9766
* Chains required to be supported by all wallets connecting to your DApp
9867
*/
99-
requiredChains: [1, 56],
68+
requiredChains: [1],
69+
/**
70+
* Chains required to be supported by all wallets connecting to your DApp
71+
*/
72+
optionalChains: [42161, 8453, 10, 137, 56],
10073
/**
10174
* Defaults to `appMetadata.explore` that is supplied to the web3-onboard init
10275
* Strongly recommended to provide atleast one URL as it is required by some wallets (i.e. MetaMask)
@@ -106,12 +79,9 @@ const wcV2InitOptions = {
10679
}
10780

10881
// initialize the module with options
109-
// If version isn't set it will default to V2 - V1 support will be completely removed shortly as it is deprecated
110-
const walletConnect = walletConnectModule(wcV2InitOptions)
82+
const walletConnect = walletConnectModule(wcInitOptions)
11183

11284
// can also initialize with no options...
113-
// Defaults to V2 - V1 support will be completely removed shortly as it is deprecated
114-
// const walletConnect = walletConnectModule()
11585

11686
const onboard = Onboard({
11787
// ... other Onboard options

packages/walletconnect/package.json

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@web3-onboard/walletconnect",
3-
"version": "2.4.7",
3+
"version": "2.5.0-alpha.1",
44
"description": "WalletConnect SDK 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",
@@ -59,11 +59,8 @@
5959
"@walletconnect/types": "^2.9.0"
6060
},
6161
"dependencies": {
62-
"@ethersproject/providers": "5.5.0",
63-
"@walletconnect/client": "^1.8.0",
64-
"@walletconnect/ethereum-provider": "^2.10.1",
62+
"@walletconnect/ethereum-provider": "^2.10.2",
6563
"@walletconnect/modal": "2.6.2",
66-
"@walletconnect/qrcode-modal": "^1.8.0",
6764
"@web3-onboard/common": "^2.3.3",
6865
"joi": "17.9.1",
6966
"rxjs": "^7.5.2"

0 commit comments

Comments
 (0)