Skip to content

Commit

Permalink
fix: add params to start polling
Browse files Browse the repository at this point in the history
  • Loading branch information
salimtb committed Nov 10, 2024
1 parent 11e986c commit d26f602
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions packages/assets-controllers/src/TokenDetectionController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -452,17 +452,23 @@ export class TokenDetectionController extends StaticIntervalPollingController<To

/**
* Starts a new polling interval.
* @param options - The options for the polling.
* @param options.chainIds - The chain IDs to poll.
* @param options.address - The address to poll.
*/
async #startPolling(): Promise<void> {
async #startPolling({
chainIds,
address,
}: TokenDetectionPollingInput): Promise<void> {
if (!this.isActive) {
return;
}
this.#stopPolling();
await this.detectTokens();
await this.detectTokens({ chainIds, selectedAddress: address });
// TODO: Either fix this lint violation or explain why it's necessary to ignore.
// eslint-disable-next-line @typescript-eslint/no-misused-promises
this.#intervalId = setInterval(async () => {
await this.detectTokens();
await this.detectTokens({ chainIds, selectedAddress: address });
}, this.getIntervalLength());
}

Expand Down

0 comments on commit d26f602

Please sign in to comment.