Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
public async getTransferEvents(): Promise {
// Creates a local or default provider
const provider =
this.network === 'private'
? new ethers.providers.JsonRpcProvider()
: ethers.getDefaultProvider(this.network);
// Setup the ERC20 contract interface
const contract = new ethers.Contract(
this.tokenContractAddress,
erc20BalanceOfAbiFragment,
provider,
);
// Create a filter to find all the Transfer logs for the toAddress
const filter = contract.filters.Transfer(null, this.toAddress) as ethers.providers.Filter;
filter.fromBlock = 0;
filter.toBlock = 'latest';
// Get the event logs
const logs = await provider.getLogs(filter);
constructor() {
this.provider = ethers.getDefaultProvider();
this.client = new EtherscanClient();
}
public constructor(
privateKey: string,
contractAbi: string|ParamType[],
config: IBeaconConfig,
logger: ILogger,
provider?: Provider
) {
this.config = config;
this.logger = logger;
if(!provider) {
provider = ethers.getDefaultProvider();
}
this.wallet = new Wallet(privateKey, provider);
this.contractAbi = contractAbi;
}
constructor(
private readonly config: ConfigService,
@Inject(MessagingClientProviderId) private readonly messagingClient: ClientProxy,
) {
const provider = ethers.getDefaultProvider();
this.medianizer = new ethers.Contract(MEDIANIZER_ADDRESS, medianizerAbi, provider);
}