Fxied Timer type (#3540).

This commit is contained in:
Richard Moore 2022-11-30 17:19:21 -05:00
parent faef9f81ec
commit 01d99a601a
2 changed files with 7 additions and 3 deletions

@ -51,6 +51,8 @@ import type {
TransactionRequest
} from "./provider.js";
type Timer = ReturnType<typeof setTimeout>;
// Constants
const BN_2 = BigInt(2);
@ -341,7 +343,7 @@ export class AbstractProvider implements Provider {
#lastBlockNumber: number;
#nextTimer: number;
#timers: Map<number, { timer: null | NodeJS.Timer, func: () => void, time: number }>;
#timers: Map<number, { timer: null | Timer, func: () => void, time: number }>;
#disableCcipRead: boolean;
@ -983,7 +985,7 @@ export class AbstractProvider implements Provider {
if (confirms === 0) { return this.getTransactionReceipt(hash); }
return new Promise(async (resolve, reject) => {
let timer: null | NodeJS.Timer = null;
let timer: null | Timer = null;
const listener = (async (blockNumber: number) => {
try {

@ -32,6 +32,8 @@ import type { Networkish } from "./network.js";
import type { Provider, TransactionRequest, TransactionResponse } from "./provider.js";
import type { Signer } from "./signer.js";
type Timer = ReturnType<typeof setTimeout>;
const Primitive = "bigint,boolean,function,number,string,symbol".split(/,/g);
//const Methods = "getAddress,then".split(/,/g);
@ -358,7 +360,7 @@ export abstract class JsonRpcApiProvider extends AbstractProvider {
// Payloads are queued and triggered in batches using the drainTimer
#payloads: Array<Payload>;
#drainTimer: null | NodeJS.Timer;
#drainTimer: null | Timer;
#notReady: null | {
promise: Promise<void>,