Skip to content

Commit

Permalink
configurable delay (experimental)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrq1911 committed Dec 12, 2024
1 parent d126f2a commit c68f186
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ dotenv.config();

export const rpc = process.env.RPC_URL || 'wss://localhost:9988';
export const ahRpc = process.env.AH_RPC_URL || 'wss://polkadot-asset-hub-rpc.polkadot.io';
export const delay = Number(process.env.DELAY) || 1;
export const token = process.env.DISCORD_TOKEN;
export const channel = process.env.DISCORD_CHANNEL;
export const sha = process.env.COMMIT_SHA || 'dev';
Expand Down
3 changes: 2 additions & 1 deletion src/events.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {api} from './api.js';
import ethers from "ethers";
import {delay} from "./config.js";

export class Events {
listeners = [];
Expand Down Expand Up @@ -39,7 +40,7 @@ export class Events {

startWatching() {
this.killWatcher = api().query.system.number(head => {
const block = head.toNumber() - 1;
const block = head.toNumber() - delay;
this.emitFromBlock(block);
});
}
Expand Down

0 comments on commit c68f186

Please sign in to comment.