Skip to content

Commit

Permalink
use ReadableStream for portal client stream
Browse files Browse the repository at this point in the history
  • Loading branch information
belopash committed Dec 28, 2024
1 parent 5a51523 commit cc6baca
Show file tree
Hide file tree
Showing 5 changed files with 222 additions and 135 deletions.

This file was deleted.

44 changes: 28 additions & 16 deletions common/config/rush/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 11 additions & 11 deletions test/erc20-transfers/src/processor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ const CONTRACT = '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48'.toLowerCase()
const processor = new EvmBatchProcessor()
.setPortal({
url: 'https://portal.sqd.dev/datasets/ethereum-mainnet',
bufferThreshold: 100 * 1024 * 1024,
bufferThreshold: 10 * 1024 * 1024,
newBlockTimeout: 5000,
})
.setRpcEndpoint('https://rpc.ankr.com/eth')
.setFinalityConfirmation(500)
.setBlockRange({from: 20801368})
.setBlockRange({from: 0})
.setFields({
block: {size: true},
log: {transactionHash: true},
Expand All @@ -32,20 +32,20 @@ processor.run(new TypeormDatabase({supportHotBlocks: true}), async ctx => {
for (let block of ctx.blocks) {
for (let log of block.logs) {
if (log.address == CONTRACT && erc20.events.Transfer.is(log)) {
// let {from, to, value} = erc20.events.Transfer.decode(log)
let {from, to, value} = erc20.events.Transfer.decode(log)
transfers.push(new Transfer({
// id: log.id,
// blockNumber: block.header.height,
// timestamp: new Date(block.header.timestamp),
// tx: log.transactionHash,
// from,
// to,
// amount: value
id: log.id,
blockNumber: block.header.height,
timestamp: new Date(block.header.timestamp),
tx: log.transactionHash,
from,
to,
amount: value
}))
}
}
}

ctx.log.info(`found ${transfers.length} transfers`)
// await ctx.store.insert(transfers)
await ctx.store.insert(transfers)
})
2 changes: 1 addition & 1 deletion util/portal-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@
"@subsquid/http-client": "^1.5.0",
"@subsquid/logger": "^1.3.3",
"@types/node": "^18.18.14",
"typescript": "~5.3.2"
"typescript": "~5.5.4"
}
}
Loading

0 comments on commit cc6baca

Please sign in to comment.