Skip to content

Commit

Permalink
✅ Fix: build
Browse files Browse the repository at this point in the history
  • Loading branch information
William Cory authored and William Cory committed Aug 12, 2024
1 parent 4a73a58 commit 044e7a1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
16 changes: 8 additions & 8 deletions packages/actions/src/eth/ethNewFilterHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ import { parseBlockTag } from './utils/parseBlockTag.js'
*/

/**
* @param {import('@tevm/base-client').BaseClient} client
* @param {import('@tevm/node').TevmNode} tevmNode
* @returns {import('./EthHandler.js').EthNewFilterHandler} ethNewFilterHandler
*/
export const ethNewFilterHandler = (client) => {
export const ethNewFilterHandler = (tevmNode) => {
return async (params) => {
const { topics, address, toBlock = 'latest', fromBlock = 'latest' } = params
const vm = await client.getVm()
const vm = await tevmNode.getVm()
/**
* @param {typeof toBlock} tag
*/
Expand Down Expand Up @@ -50,25 +50,25 @@ export const ethNewFilterHandler = (client) => {

const id = generateRandomId()
/**
* @param {import('@tevm/base-client').Filter['logs'][number]} log
* @param {import('@tevm/node').Filter['logs'][number]} log
*/
const listener = (log) => {
const filter = client.getFilters().get(id)
const filter = tevmNode.getFilters().get(id)
if (!filter) {
return
}
filter.logs.push(log)
}
client.on('newLog', listener)
tevmNode.on('newLog', listener)
// populate with past blocks
const receiptsManager = await client.getReceiptsManager()
const receiptsManager = await tevmNode.getReceiptsManager()
const pastLogs = await receiptsManager.getLogs(
_fromBlock,
_toBlock,
address !== undefined ? [createAddress(address).bytes] : [],
topics?.map((topic) => hexToBytes(topic)),
)
client.setFilter({
tevmNode.setFilter({
id,
type: 'Log',
created: Date.now(),
Expand Down
6 changes: 3 additions & 3 deletions packages/procedures/src/eth/ethGetFilterLogsProcedure.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createAddress, createContractAddress } from '@tevm/address'
import { type BaseClient, createBaseClient } from '@tevm/base-client'
import { type TevmNode, createTevmNode } from '@tevm/node'
import { SimpleContract } from '@tevm/contract'
import { PREFUNDED_ACCOUNTS, encodeDeployData, encodeFunctionData, numberToHex } from '@tevm/utils'
import { beforeEach, describe, expect, it } from 'vitest'
Expand All @@ -9,7 +9,7 @@ import { ethGetFilterLogsProcedure } from './ethGetFilterLogsProcedure.js'
import { ethNewFilterJsonRpcProcedure } from './ethNewFilterProcedure.js'

describe(ethGetFilterLogsProcedure.name, () => {
let client: BaseClient
let client: TevmNode

const INITIAL_BALANCE = 20n
const contract = SimpleContract.withAddress(
Expand All @@ -25,7 +25,7 @@ describe(ethGetFilterLogsProcedure.name, () => {
}

beforeEach(async () => {
client = createBaseClient()
client = createTevmNode()

expect(
(
Expand Down

0 comments on commit 044e7a1

Please sign in to comment.