import { JsonRpcSigner } from '@ethersproject/providers' ; import { ethers , network } from 'hardhat' ; export const impersonate = async ( address ) : Promise < JsonRpcSigner > => { await network . provider . request ( { method : 'hardhat_impersonateAccount' , params : [ address ] , } ) ; return ethers . provider . getSigner ( address ) ; } ;