Skip to content

Commit

Permalink
fix: impersonated connector
Browse files Browse the repository at this point in the history
  • Loading branch information
Argeare5 committed Oct 23, 2023
1 parent 6a83658 commit d732295
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 14 deletions.
4 changes: 2 additions & 2 deletions dist/index.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -2775,7 +2775,7 @@ function createWalletSlice({
}
},
isActiveWalletSetting: false,
connectWallet: async (walletType) => {
connectWallet: async (walletType, chainId) => {
clearWalletLinkLocalStorage();
clearWalletConnectV2LocalStorage();
if (get().activeWallet?.walletType !== walletType) {
Expand All @@ -2790,7 +2790,7 @@ function createWalletSlice({
if (connector) {
if (connector instanceof ImpersonatedConnector) {
connector.setAccountAddress(get()._impersonatedAddress);
await connect({ connector });
await connect({ connector, chainId });
} else {
await connect({ connector });
}
Expand Down
2 changes: 1 addition & 1 deletion dist/index.cjs.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/index.d.cts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ type IWalletSlice = {
activeWallet?: Wallet;
setActiveWallet: (wallet: Omit<Wallet, 'walletClient' | 'client'>) => Promise<void>;
isActiveWalletSetting: boolean;
connectWallet: (walletType: WalletType) => Promise<void>;
connectWallet: (walletType: WalletType, chainId?: number) => Promise<void>;
disconnectActiveWallet: () => Promise<void>;
walletActivating: boolean;
walletConnectionError: string;
Expand Down
2 changes: 1 addition & 1 deletion dist/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ type IWalletSlice = {
activeWallet?: Wallet;
setActiveWallet: (wallet: Omit<Wallet, 'walletClient' | 'client'>) => Promise<void>;
isActiveWalletSetting: boolean;
connectWallet: (walletType: WalletType) => Promise<void>;
connectWallet: (walletType: WalletType, chainId?: number) => Promise<void>;
disconnectActiveWallet: () => Promise<void>;
walletActivating: boolean;
walletConnectionError: string;
Expand Down
4 changes: 2 additions & 2 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"url": "https://github.com/Tima0203"
}
],
"version": "0.2.27",
"version": "0.2.28",
"license": "MIT",
"files": [
"dist",
Expand Down
8 changes: 3 additions & 5 deletions src/web3/store/walletSlice.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// TODO: need add logic for mock connector

import {
connect,
disconnect,
Expand Down Expand Up @@ -43,7 +41,7 @@ export type IWalletSlice = {
wallet: Omit<Wallet, 'walletClient' | 'client'>,
) => Promise<void>;
isActiveWalletSetting: boolean;
connectWallet: (walletType: WalletType) => Promise<void>;
connectWallet: (walletType: WalletType, chainId?: number) => Promise<void>;
disconnectActiveWallet: () => Promise<void>;
walletActivating: boolean;
walletConnectionError: string;
Expand Down Expand Up @@ -119,7 +117,7 @@ export function createWalletSlice({
},
isActiveWalletSetting: false,

connectWallet: async (walletType) => {
connectWallet: async (walletType, chainId) => {
clearWalletLinkLocalStorage();
clearWalletConnectV2LocalStorage();

Expand All @@ -138,7 +136,7 @@ export function createWalletSlice({
if (connector) {
if (connector instanceof ImpersonatedConnector) {
connector.setAccountAddress(get()._impersonatedAddress);
await connect({ connector });
await connect({ connector, chainId });
} else {
await connect({ connector });
}
Expand Down

0 comments on commit d732295

Please sign in to comment.