From d02e711dd70862c5b15c8dc83f7bdb8c2d210adb Mon Sep 17 00:00:00 2001 From: Alex Date: Thu, 11 Jan 2024 15:37:18 +0200 Subject: [PATCH] fix: impersonated --- src/web3/connectors/ImpersonatedConnector.ts | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/web3/connectors/ImpersonatedConnector.ts b/src/web3/connectors/ImpersonatedConnector.ts index d8714bc..294e8df 100644 --- a/src/web3/connectors/ImpersonatedConnector.ts +++ b/src/web3/connectors/ImpersonatedConnector.ts @@ -42,7 +42,7 @@ export function impersonated(parameters: ImpersonatedParameters) { >; let connected = false; let connectedChainId: number; - let accountAddress: Hex | undefined = undefined; + let accountAddress: Hex[] | undefined = undefined; return createConnector((config) => ({ id: 'impersonated', @@ -50,7 +50,7 @@ export function impersonated(parameters: ImpersonatedParameters) { type: impersonated.type, async setup() { connectedChainId = config.chains[0].id; - accountAddress = parameters.getAccountAddress(); + accountAddress = [parameters.getAccountAddress() || zeroAddress]; }, async connect({ chainId } = {}) { if (features.connectError) { @@ -119,10 +119,7 @@ export function impersonated(parameters: ImpersonatedParameters) { connected = false; }, async getProvider({ chainId }: { chainId?: number } = {}) { - accountAddress = - (!!parameters.getAccountAddress() - ? parameters.getAccountAddress() - : zeroAddress) || zeroAddress; + accountAddress = [parameters.getAccountAddress() || zeroAddress]; const chain = config.chains.find((x) => x.id === chainId) ?? config.chains[0]; const url = chain.rpcUrls.default.http[0]!;