Skip to content

Commit 5730a9b

Browse files
authored
[walletConnect-v2.2.1-alpha.1]: Fix - WalletConnect switch chains handling during transaction (#1380)
* Fix handling of chains with transactions * Prettier
1 parent 96ddb7c commit 5730a9b

File tree

4 files changed

+14
-8
lines changed

4 files changed

+14
-8
lines changed

packages/demo/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
"@web3-onboard/torus": "^2.1.3",
3939
"@web3-onboard/trezor": "^2.3.2",
4040
"@web3-onboard/tallyho": "^2.0.1",
41-
"@web3-onboard/walletconnect": "^2.2.0",
41+
"@web3-onboard/walletconnect": "^2.2.1-alpha.1",
4242
"@web3-onboard/web3auth": "^2.1.3",
4343
"@web3-onboard/enkrypt": "^2.0.0",
4444
"@web3-onboard/mew-wallet": "^2.0.0",

packages/demo/src/App.svelte

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@
3939
new VConsole()
4040
}
4141
42+
const infura_key = '80633e48116943128cbab25e402764ab'
43+
4244
let defaultTransactionObject = JSON.stringify(
4345
{
4446
from: '0xD87927847330FC926afd2B66C478A42a004aB4e7',
@@ -149,19 +151,19 @@
149151
id: '0x1',
150152
token: 'ETH',
151153
label: 'Ethereum',
152-
rpcUrl: 'https://mainnet.infura.io/v3/17c1e1500e384acfb6a72c5d2e67742e'
154+
rpcUrl: `https://mainnet.infura.io/v3/${infura_key}`
153155
},
154156
{
155157
id: 3,
156158
token: 'tROP',
157159
label: 'Ropsten',
158-
rpcUrl: 'https://ropsten.infura.io/v3/17c1e1500e384acfb6a72c5d2e67742e'
160+
rpcUrl: `https://ropsten.infura.io/v3/${infura_key}`
159161
},
160162
{
161163
id: '0x5',
162164
token: 'ETH',
163165
label: 'Goerli',
164-
rpcUrl: `https://goerli.infura.io/v3/17c1e1500e384acfb6a72c5d2e67742e`
166+
rpcUrl: `https://goerli.infura.io/v3/${infura_key}`
165167
},
166168
{
167169
id: '0x13881',

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.2.0",
3+
"version": "2.2.1-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",

packages/walletconnect/src/index.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -223,9 +223,13 @@ function walletConnect(options?: WalletConnectOptions): WalletInit {
223223
message: `The Provider requires a chainId to be passed in as an argument`
224224
})
225225
}
226-
return this.connector.updateSession({
227-
chainId: chainIdObj.chainId,
228-
accounts: this.connector.accounts
226+
return this.connector.sendCustomRequest({
227+
method: 'wallet_switchEthereumChain',
228+
params: [
229+
{
230+
chainId: chainIdObj.chainId
231+
}
232+
]
229233
})
230234
}
231235

0 commit comments

Comments
 (0)