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 handleRequest(payload: JSONRPCRequestPayload, next: NextCallback, end: ErrorCallback): Promise {
switch (payload.method) {
case 'eth_getTransactionCount':
const requestDefaultBlock = providerEngineUtils.blockTagForPayload(payload);
if (requestDefaultBlock === BlockParamLiteral.Pending) {
const address = NonceTrackerSubprovider._determineAddress(payload);
const cachedResult = this._nonceCache[address];
if (cachedResult !== undefined) {
return end(null, cachedResult);
} else {
return next((requestError: Error | null, requestResult: any, cb: Callback) => {
if (requestError === null) {
this._nonceCache[address] = requestResult as string;
}
cb();
});
}
} else {
return next();
}
case 'eth_sendRawTransaction':