-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ft_watcher: add script to watch fast_transfer manually Signed-off-by: bingyuyap <[email protected]>
- Loading branch information
Showing
3 changed files
with
59 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// This file is for when I (@bingyuyap) needs to seed the database manually for testing | ||
import * as dotenv from 'dotenv'; | ||
dotenv.config(); | ||
|
||
import { FTSolanaWatcher } from '../src/watchers/FTSolanaWatcher'; | ||
import { FTEVMWatcher } from '../src/watchers/FTEVMWatcher'; | ||
import { Network } from '@wormhole-foundation/sdk-base'; | ||
import { getNetwork } from '@wormhole-foundation/wormhole-monitor-common'; | ||
|
||
const network = getNetwork(); | ||
async function watchFtSolana(network: Network, fromSlot: number, toSlot: number) { | ||
const watcher = new FTSolanaWatcher(network); | ||
const batchSize = 1000; | ||
|
||
for (let currentSlot = fromSlot; currentSlot <= toSlot; currentSlot += batchSize) { | ||
const batchEndSlot = Math.min(currentSlot + batchSize - 1, toSlot); | ||
await watcher.getFtMessagesForBlocks(currentSlot, batchEndSlot); | ||
console.log(`Processed slots ${currentSlot} to ${batchEndSlot}`); | ||
} | ||
} | ||
|
||
async function watchFt( | ||
network: Network, | ||
chain: 'Arbitrum' | 'Base', | ||
fromBlock: number, | ||
toBlock: number | ||
) { | ||
const watcher = new FTEVMWatcher(network, chain); | ||
const batchSize = 1000; | ||
|
||
for (let currentBlock = fromBlock; currentBlock <= toBlock; currentBlock += batchSize) { | ||
const batchEndBlock = Math.min(currentBlock + batchSize - 1, toBlock); | ||
await watcher.getFtMessagesForBlocks(currentBlock, batchEndBlock); | ||
console.log(`Processed blocks ${currentBlock} to ${batchEndBlock}`); | ||
} | ||
} | ||
|
||
const fromSlot = 321556219; | ||
const toSlot = 321807831; | ||
|
||
const arbitrumFromBlock = 247028328; | ||
const arbitrumToBlock = 247037682; | ||
|
||
const baseFromBlock = 18820795; | ||
const baseToBlock = 18958996; | ||
|
||
watchFt(network, 'Arbitrum', arbitrumFromBlock, arbitrumToBlock).then(() => | ||
console.log('Done watching ftArbitrum') | ||
); | ||
|
||
watchFt(network, 'Base', baseFromBlock, baseToBlock).then(() => | ||
console.log('Done watching ftBase') | ||
); | ||
|
||
watchFtSolana(network, fromSlot, toSlot).then(() => console.log('Done watching ftSolana')); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters