Skip to content

Commit

Permalink
feat() accelerate refresh
Browse files Browse the repository at this point in the history
  • Loading branch information
immortal-tofu committed Dec 6, 2023
1 parent 41159b2 commit 4955f38
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/utils/rpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,11 @@ export const getEventContract = (contract: Contract): Contract => {
};

export const onNextBlock = (fn: () => void | Promise<void>) => {
const provider = getWsProvider();
const execFn = () => {
void fn();
void provider.off('block', execFn);
};
void provider.on('block', execFn);
// const provider = getWsProvider();
// const execFn = () => {
// void fn();
// void provider.off('block', execFn);
// };
// void provider.on('block', execFn);
void fn();
};

0 comments on commit 4955f38

Please sign in to comment.