forked from flashbots/mev-share-client-ts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhistoricalStreamData.ts
35 lines (32 loc) · 937 Bytes
/
historicalStreamData.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import { getProvider, initExample } from './lib/helpers'
const main = async () => {
const provider = getProvider()
const { mevshare } = await initExample(provider)
const info = await mevshare.getEventHistoryInfo()
console.log(info)
let i = 0
let done = false
while (!done) {
const resHistory = await mevshare.getEventHistory({
limit: info.maxLimit,
offset: i * info.maxLimit,
blockStart: info.minBlock,
})
for (const event of resHistory) {
if (event.hint.txs) {
console.log("event", event)
console.log("txs", event.hint.txs)
break
}
}
for (const event of resHistory) {
if (event.hint.logs) {
console.log("logs", event.hint.logs)
done = true
break
}
}
i++
}
}
main()