Skip to content

Commit

Permalink
fix: chainId
Browse files Browse the repository at this point in the history
  • Loading branch information
heisenberg-2077 committed Sep 12, 2023
1 parent e7ee752 commit 3ce511f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
13 changes: 10 additions & 3 deletions src/background/controller/wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Wallet, { thirdparty } from 'ethereumjs-wallet';
import { ethErrors } from 'eth-rpc-errors';
import * as bip39 from 'bip39';
import { ethers, Contract } from 'ethers';
import { groupBy, uniq } from 'lodash';
import { chain, groupBy, uniq } from 'lodash';
import abiCoder, { AbiCoder } from 'web3-eth-abi';
import * as optimismContracts from '@eth-optimism/contracts';
import {
Expand Down Expand Up @@ -1729,14 +1729,21 @@ export class WalletController extends BaseController {
keyring = new WalletConnect(GET_WALLETCONNECT_CONFIG());
isNewKey = true;
}
const { uri } = await keyring.initConnector(brandName, chainId);
const { uri } = await keyring.initConnector(
brandName,
!chainId ? 1 : chainId
);
let stashId = curStashId;
if (isNewKey) {
stashId = this.addKeyringToStash(keyring);
eventBus.addEventListener(
EVENTS.WALLETCONNECT.INIT,
({ address, brandName, chainId }) => {
(keyring as WalletConnectKeyring).init(address, brandName, chainId);
(keyring as WalletConnectKeyring).init(
address,
brandName,
!chainId ? 1 : chainId
);
}
);
(keyring as WalletConnectKeyring).on('inited', (uri) => {
Expand Down
6 changes: 5 additions & 1 deletion src/background/service/keyring/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -873,7 +873,11 @@ export class KeyringService extends EventEmitter {
eventBus.addEventListener(
EVENTS.WALLETCONNECT.INIT,
({ address, brandName, chainId }) => {
(keyring as WalletConnectKeyring).init(address, brandName, chainId);
(keyring as WalletConnectKeyring).init(
address,
brandName,
!chainId ? 1 : chainId
);
}
);
(keyring as WalletConnectKeyring).on('inited', (uri) => {
Expand Down

0 comments on commit 3ce511f

Please sign in to comment.