Commit 6a104265 authored by Liam Horne's avatar Liam Horne

refactor: move event types into core-utils

parent c56e4d42
/* Imports: External */
import { ethers } from 'ethers' import { ethers } from 'ethers'
export type TypedEthersEvent<T> = ethers.Event & {
args: T
}
export interface EventArgsAddressSet { export interface EventArgsAddressSet {
_name: string _name: string
_newAddress: string _newAddress: string
......
...@@ -3,3 +3,4 @@ export * from './common' ...@@ -3,3 +3,4 @@ export * from './common'
export * from './watcher' export * from './watcher'
export * from './base-service' export * from './base-service'
export * from './l2context' export * from './l2context'
export * from './events'
...@@ -6,12 +6,12 @@ import { ...@@ -6,12 +6,12 @@ import {
fromHexString, fromHexString,
toHexString, toHexString,
TxType, TxType,
EventArgsSequencerBatchAppended
} from '@eth-optimism/core-utils' } from '@eth-optimism/core-utils'
/* Imports: Internal */ /* Imports: Internal */
import { import {
DecodedSequencerBatchTransaction, DecodedSequencerBatchTransaction,
EventArgsSequencerBatchAppended,
SequencerBatchAppendedExtraData, SequencerBatchAppendedExtraData,
SequencerBatchAppendedParsedEvent, SequencerBatchAppendedParsedEvent,
TransactionBatchEntry, TransactionBatchEntry,
......
/* Imports: External */ /* Imports: External */
import { getContractFactory } from '@eth-optimism/contracts' import { getContractFactory } from '@eth-optimism/contracts'
import { EventArgsStateBatchAppended } from '@eth-optimism/core-utils'
import { BigNumber } from 'ethers' import { BigNumber } from 'ethers'
/* Imports: Internal */ /* Imports: Internal */
import { import {
EventArgsStateBatchAppended, StateRootBatchEntry,
StateRootBatchEntry,
StateBatchAppendedExtraData, StateBatchAppendedExtraData,
StateBatchAppendedParsedEvent, StateBatchAppendedParsedEvent,
StateRootEntry, StateRootEntry,
......
import {EventArgsTransactionEnqueued} from '@eth-optimism/core-utils'
/* Imports: Internal */ /* Imports: Internal */
import { BigNumber } from 'ethers' import { BigNumber } from 'ethers'
import { import {
EnqueueEntry, EnqueueEntry,
EventArgsTransactionEnqueued, EventHandlerSet,
EventHandlerSet,
} from '../../../types' } from '../../../types'
export const handleEventsTransactionEnqueued: EventHandlerSet< export const handleEventsTransactionEnqueued: EventHandlerSet<
......
/* Imports: External */ /* Imports: External */
import { fromHexString, BaseService } from '@eth-optimism/core-utils' import { fromHexString, BaseService, EventArgsAddressSet } from '@eth-optimism/core-utils'
import { JsonRpcProvider } from '@ethersproject/providers' import { JsonRpcProvider } from '@ethersproject/providers'
import { LevelUp } from 'levelup' import { LevelUp } from 'levelup'
...@@ -13,7 +13,6 @@ import { ...@@ -13,7 +13,6 @@ import {
validators, validators,
} from '../../utils' } from '../../utils'
import { import {
EventArgsAddressSet,
TypedEthersEvent, TypedEthersEvent,
EventHandlerSet, EventHandlerSet,
} from '../../types' } from '../../types'
......
import { JsonRpcProvider } from '@ethersproject/providers' import { JsonRpcProvider } from '@ethersproject/providers'
import { BigNumber } from 'ethers' import { BigNumber, Event } from 'ethers'
import { TransportDB } from '../db/transport-db' import { TransportDB } from '../db/transport-db'
import { TypedEthersEvent } from './event-types'
import { import {
TransactionBatchEntry, TransactionBatchEntry,
TransactionEntry, TransactionEntry,
...@@ -10,6 +9,10 @@ import { ...@@ -10,6 +9,10 @@ import {
StateRootEntry, StateRootEntry,
} from './database-types' } from './database-types'
export type TypedEthersEvent<T> = Event & {
args: T
}
export type GetExtraDataHandler<TEventArgs, TExtraData> = ( export type GetExtraDataHandler<TEventArgs, TExtraData> = (
event?: TypedEthersEvent<TEventArgs>, event?: TypedEthersEvent<TEventArgs>,
l1RpcProvider?: JsonRpcProvider l1RpcProvider?: JsonRpcProvider
......
export * from './api-types' export * from './api-types'
export * from './database-types' export * from './database-types'
export * from './event-handler-types' export * from './event-handler-types'
export * from './event-types'
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment