Skip to content

Commit

Permalink
fix: impersonated
Browse files Browse the repository at this point in the history
  • Loading branch information
Argeare5 committed Jan 11, 2024
1 parent fd8b414 commit d02e711
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/web3/connectors/ImpersonatedConnector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ export function impersonated(parameters: ImpersonatedParameters) {
>;
let connected = false;
let connectedChainId: number;
let accountAddress: Hex | undefined = undefined;
let accountAddress: Hex[] | undefined = undefined;

return createConnector<Provider>((config) => ({
id: 'impersonated',
name: 'Impersonated Connector',
type: impersonated.type,
async setup() {
connectedChainId = config.chains[0].id;
accountAddress = parameters.getAccountAddress();
accountAddress = [parameters.getAccountAddress() || zeroAddress];
},
async connect({ chainId } = {}) {
if (features.connectError) {
Expand Down Expand Up @@ -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]!;
Expand Down

0 comments on commit d02e711

Please sign in to comment.