Skip to content

Commit a8782c5

Browse files
committed
Bump versions and yarn, add WC instance return for session info
1 parent 25707f8 commit a8782c5

File tree

11 files changed

+77
-239
lines changed

11 files changed

+77
-239
lines changed

docs/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,11 @@
7676
"@web3-onboard/taho": "^2.0.5",
7777
"@web3-onboard/torus": "^2.2.5",
7878
"@web3-onboard/transaction-preview": "^2.0.8",
79-
"@web3-onboard/trezor": "^2.4.2",
79+
"@web3-onboard/trezor": "^2.4.3",
8080
"@web3-onboard/trust": "^2.0.4",
8181
"@web3-onboard/uauth": "^2.1.1",
8282
"@web3-onboard/venly": "^2.0.0",
83-
"@web3-onboard/walletconnect": "^2.4.6-alpha.1",
83+
"@web3-onboard/walletconnect": "^2.4.6",
8484
"@web3-onboard/web3auth": "^2.2.3",
8585
"@web3-onboard/xdefi": "^2.0.4",
8686
"@web3-onboard/zeal": "^2.0.4",

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

Lines changed: 26 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ npm install @web3-onboard/walletconnect
2929
</TabPanel>
3030
</Tabs>
3131

32-
## Options
3332

3433
```typescript
3534
type WalletConnectOptions = {
@@ -38,26 +37,6 @@ type WalletConnectOptions = {
3837
*/
3938
handleUri?: (uri: string) => Promise<unknown>
4039
} & (
41-
| {
42-
/**
43-
* @deprecated
44-
* Version 1 of WalletConnect has been deprecated by the WC team and the WC bridge is not available.
45-
* To use version 1 a custom bridge url will need to be provided.
46-
* Support will be completely remove from Web3-Onboard in the future
47-
*/
48-
version: 1
49-
/**
50-
* Custom URL Bridge must be defined for V1 usage.
51-
* WalletConnect no longer supports a v1 bridge.
52-
* Upgrading to use WalletConnect v2 is recommended.
53-
* A potential bridge can be found here: 'https://derelay.rabby.io'
54-
*/
55-
bridge: string
56-
connectFirstChainId?: boolean
57-
qrcodeModalOptions?: {
58-
mobileLinks: string[]
59-
}
60-
}
6140
| {
6241
/**
6342
* Project ID associated with [WalletConnect account](https://cloud.walletconnect.com)
@@ -98,6 +77,26 @@ type WalletConnectOptions = {
9877
*/
9978
additionalOptionalMethods?: string[] | undefined
10079
}
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+
}
101100
)
102101
```
103102
@@ -137,26 +136,16 @@ const onboard = Onboard({
137136
wallets: [
138137
walletConnect
139138
//... other wallets
140-
],
141-
chains: [
142-
// chains that are passed as optional chains to WC wallet after cleaning and parsing as number[]
143-
{
144-
id: '0x2105',
145-
token: 'ETH',
146-
label: 'Base',
147-
rpcUrl: 'https://mainnet.base.org'
148-
},
149-
{
150-
id: '0x89',
151-
token: 'MATIC',
152-
label: 'Polygon',
153-
rpcUrl: 'https://matic-mainnet.chainstacklabs.com'
154-
}
155-
// ...
156139
]
157140
})
158141

159142
const connectedWallets = await onboard.connectWallet()
143+
144+
// Assuming only wallet connect is connected, index 0
145+
// `instance` will give insight into the WalletConnect info
146+
// such as namespaces, methods, chains, etc per wallet connected
147+
const { instance } = connectedWallets[0]
148+
160149
console.log(connectedWallets)
161150
```
162151

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-monorepo",
3-
"version": "2.24.8",
3+
"version": "2.24.9",
44
"private": true,
55
"workspaces": {
66
"packages": [

packages/demo/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,13 @@
5252
"@web3-onboard/taho": "^2.0.5",
5353
"@web3-onboard/torus": "^2.2.4",
5454
"@web3-onboard/transaction-preview": "^2.0.7",
55-
"@web3-onboard/trezor": "^2.4.2",
55+
"@web3-onboard/trezor": "^2.4.3",
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.6-alpha.1",
59+
"@web3-onboard/walletconnect": "^2.4.6",
6060
"@web3-onboard/web3auth": "^2.2.2",
61-
"@web3-onboard/xdefi": "^2.0.5-alpha.1",
61+
"@web3-onboard/xdefi": "^2.0.5",
6262
"@web3-onboard/zeal": "^2.0.3",
6363
"vconsole": "^3.15.1"
6464
},

packages/demo/src/App.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@
118118
const walletConnect = walletConnectModule({
119119
handleUri: uri => console.log(uri),
120120
projectId: 'f6bd6e2911b56f5ac3bc8b2d0e2d7ad5',
121-
additionalOptionalMethods: ['someSillyShit']
121+
dappUrl: 'https://www.onboard.blocknative.com'
122122
})
123123
const portis = portisModule({
124124
apiKey: 'b2b7586f-2b1e-4c30-a7fb-c2d1533b153b'

packages/trezor/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/trezor",
3-
"version": "2.4.3-alpha.1",
3+
"version": "2.4.3",
44
"description": "Trezor hardware 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",

packages/walletconnect/README.md

Lines changed: 26 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -19,26 +19,6 @@ type WalletConnectOptions = {
1919
*/
2020
handleUri?: (uri: string) => Promise<unknown>
2121
} & (
22-
| {
23-
/**
24-
* @deprecated
25-
* Version 1 of WalletConnect has been deprecated by the WC team and the WC bridge is not available.
26-
* To use version 1 a custom bridge url will need to be provided.
27-
* Support will be completely remove from Web3-Onboard in the future
28-
*/
29-
version: 1
30-
/**
31-
* Custom URL Bridge must be defined for V1 usage.
32-
* WalletConnect no longer supports a v1 bridge.
33-
* Upgrading to use WalletConnect v2 is recommended.
34-
* A potential bridge can be found here: 'https://derelay.rabby.io'
35-
*/
36-
bridge: string
37-
connectFirstChainId?: boolean
38-
qrcodeModalOptions?: {
39-
mobileLinks: string[]
40-
}
41-
}
4222
| {
4323
/**
4424
* Project ID associated with [WalletConnect account](https://cloud.walletconnect.com)
@@ -79,6 +59,26 @@ type WalletConnectOptions = {
7959
*/
8060
additionalOptionalMethods?: string[] | undefined
8161
}
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+
}
8282
)
8383
```
8484
@@ -122,5 +122,11 @@ const onboard = Onboard({
122122
})
123123

124124
const connectedWallets = await onboard.connectWallet()
125+
126+
// Assuming only wallet connect is connected, index 0
127+
// `instance` will give insight into the WalletConnect info
128+
// such as namespaces, methods, chains, etc per wallet connected
129+
const { instance } = connectedWallets[0]
130+
125131
console.log(connectedWallets)
126132
```

packages/walletconnect/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/walletconnect",
3-
"version": "2.4.6-alpha.1",
3+
"version": "2.4.6",
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",

packages/walletconnect/src/v2.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ function walletConnect(options: WalletConnectOptions): WalletInit {
4040
dappUrl
4141
} = options
4242

43+
let instance: unknown
44+
4345
return () => {
4446
return {
4547
label: 'WalletConnect',
@@ -209,7 +211,10 @@ function walletConnect(options: WalletConnectOptions): WalletInit {
209211
})
210212

211213
this.disconnect = () => {
212-
if (this.connector.session) this.connector.disconnect()
214+
if (this.connector.session) {
215+
this.connector.disconnect()
216+
instance = null
217+
}
213218
}
214219

215220
if (options && handleUri) {
@@ -231,6 +236,7 @@ function walletConnect(options: WalletConnectOptions): WalletInit {
231236

232237
const checkForSession = () => {
233238
const session = this.connector.session
239+
instance = session
234240
if (session) {
235241
this.emit('accountsChanged', this.connector.accounts)
236242
this.emit('chainChanged', this.connector.chainId)
@@ -286,6 +292,7 @@ function walletConnect(options: WalletConnectOptions): WalletInit {
286292
// update ethereum provider to load accounts & chainId
287293
const accounts = this.connector.accounts
288294
const chainId = this.connector.chainId
295+
instance = this.connector.session
289296
const hexChainId = `0x${chainId.toString(16)}`
290297
this.emit('chainChanged', hexChainId)
291298
return resolve(accounts)
@@ -337,7 +344,8 @@ function walletConnect(options: WalletConnectOptions): WalletInit {
337344
}
338345

339346
return {
340-
provider: new EthProvider({ chains, connector })
347+
provider: new EthProvider({ chains, connector }),
348+
instance
341349
}
342350
}
343351
}

packages/xdefi/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/xdefi",
3-
"version": "2.0.5-alpha.1",
3+
"version": "2.0.5",
44
"description": "XDEFI 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",

0 commit comments

Comments
 (0)