Skip to content

Commit 7c80e49

Browse files
authored
[walletconnect-v2.0.4-alpha.2] : Feature - Connect First ChainId on WalletConnect session request (#1099)
* walletConnnect chain id * walletConnnect chain id with option * merge develop * merge develop * readme * demo package bump * demo package bump
1 parent adcc3cc commit 7c80e49

File tree

4 files changed

+8
-5
lines changed

4 files changed

+8
-5
lines changed

packages/demo/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "demo",
3-
"version": "2.0.4",
3+
"version": "2.0.5",
44
"devDependencies": {
55
"assert": "^2.0.0",
66
"buffer": "^6.0.3",
@@ -35,7 +35,7 @@
3535
"@web3-onboard/portis": "^2.0.3-alpha.1",
3636
"@web3-onboard/torus": "^2.0.4-alpha.1",
3737
"@web3-onboard/trezor": "^2.1.3-alpha.1",
38-
"@web3-onboard/walletconnect": "^2.0.4-alpha.1",
38+
"@web3-onboard/walletconnect": "^2.0.4-alpha.2",
3939
"@web3-onboard/web3auth": "^2.0.2-alpha.1",
4040
"vconsole": "^3.9.5"
4141
},

packages/walletconnect/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ type WalletConnectOptions = {
1414
qrcodeModalOptions?: {
1515
mobileLinks: string[] // set the order and list of mobile linking wallets
1616
}
17+
connectFirstChainId?: boolean // if true, connects to the first network chain provided
1718
}
1819
```
1920
@@ -29,6 +30,7 @@ const walletConnect = walletConnectModule({
2930
qrcodeModalOptions: {
3031
mobileLinks: ['rainbow', 'metamask', 'argent', 'trust', 'imtoken', 'pillar']
3132
}
33+
connectFirstChainId: true
3234
})
3335

3436
// can also initialize with no options...

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.0.4-alpha.1",
3+
"version": "2.0.4-alpha.2",
44
"description": "WalletConnect module for web3-onboard",
55
"module": "dist/index.js",
66
"browser": "dist/index.js",

packages/walletconnect/src/index.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,11 @@ interface WalletConnectOptions {
1212
qrcodeModalOptions?: {
1313
mobileLinks: string[]
1414
}
15+
connectFirstChainId?: boolean
1516
}
1617

1718
function walletConnect(options?: WalletConnectOptions): WalletInit {
18-
const { bridge = 'https://bridge.walletconnect.org', qrcodeModalOptions } =
19+
const { bridge = 'https://bridge.walletconnect.org', qrcodeModalOptions , connectFirstChainId} =
1920
options || {}
2021

2122
return () => {
@@ -129,7 +130,7 @@ function walletConnect(options?: WalletConnectOptions): WalletInit {
129130
// Check if connection is already established
130131
if (!this.connector.connected) {
131132
// create new session
132-
this.connector.createSession().then(() => {
133+
this.connector.createSession(connectFirstChainId ? {chainId: parseInt(chains[0].id, 16)} : undefined).then(() => {
133134
QRCodeModal.open(
134135
this.connector.uri,
135136
() =>

0 commit comments

Comments
 (0)