Commit c3e85fef authored by kf's avatar kf Committed by Kelvin Fichter

maintenance: clean up typings in core utils

parent cd9b94a2
---
'@eth-optimism/core-utils': patch
---
Cleans up the internal file and folder structure for the typings exported by core-utils
export * from './types'
export * from './sequencer-batch' export * from './sequencer-batch'
...@@ -2,8 +2,7 @@ export * from './coders' ...@@ -2,8 +2,7 @@ export * from './coders'
export * from './common' export * from './common'
export * from './watcher' export * from './watcher'
export * from './l2context' export * from './l2context'
export * from './batches' export * from './types'
export * from './bcfg'
export * from './fees' export * from './fees'
export * from './provider' export * from './provider'
export * from './alias' export * from './alias'
......
// Use this file for simple types that aren't necessarily associated with a specific project or
// package. Often used for alias types like Address = string.
export interface Signature { export interface Signature {
r: string r: string
s: string s: string
......
// Optimism PBC 2021 // Types explicitly related to dealing with Geth.
// Represents the ethereum state /**
* Represents the Ethereum state, in the format that Geth expects it.
*/
export interface State { export interface State {
[address: string]: { [address: string]: {
nonce: number nonce: number
...@@ -14,7 +16,9 @@ export interface State { ...@@ -14,7 +16,9 @@ export interface State {
} }
} }
// Represents a genesis file that geth can consume /**
* Represents Geth's genesis file format.
*/
export interface Genesis { export interface Genesis {
config: { config: {
chainId: number chainId: number
......
export * from './geth'
export * from './bcfg'
export * from './rollup'
export * from './basic'
...@@ -4,6 +4,9 @@ import { ...@@ -4,6 +4,9 @@ import {
TransactionResponse, TransactionResponse,
} from '@ethersproject/abstract-provider' } from '@ethersproject/abstract-provider'
/**
* Structure of the response returned by L2Geth nodes when querying the `rollup_getInfo` endpoint.
*/
export interface RollupInfo { export interface RollupInfo {
mode: 'sequencer' | 'verifier' mode: 'sequencer' | 'verifier'
syncing: boolean syncing: boolean
...@@ -17,14 +20,18 @@ export interface RollupInfo { ...@@ -17,14 +20,18 @@ export interface RollupInfo {
} }
} }
/**
* Enum used for the two transaction types (queue and direct to Sequencer).
*/
export enum QueueOrigin { export enum QueueOrigin {
Sequencer = 'sequencer', Sequencer = 'sequencer',
L1ToL2 = 'l1', L1ToL2 = 'l1',
} }
/** /**
* Transaction & Blocks. These are the true data-types we expect * JSON transaction representation when returned by L2Geth nodes. This is simply an extension to
* from running a batch submitter. * the standard transaction response type. You do NOT need to use this type unless you care about
* having typed access to L2-specific fields.
*/ */
export interface L2Transaction extends TransactionResponse { export interface L2Transaction extends TransactionResponse {
l1BlockNumber: number l1BlockNumber: number
...@@ -33,21 +40,32 @@ export interface L2Transaction extends TransactionResponse { ...@@ -33,21 +40,32 @@ export interface L2Transaction extends TransactionResponse {
rawTransaction: string rawTransaction: string
} }
/**
* JSON block representation when returned by L2Geth nodes. Just a normal block but with
* L2Transaction objects instead of the standard transaction response object.
*/
export interface L2Block extends BlockWithTransactions { export interface L2Block extends BlockWithTransactions {
stateRoot: string stateRoot: string
transactions: [L2Transaction] transactions: [L2Transaction]
} }
/** /**
* BatchElement & Batch. These are the data-types of the compressed / batched * Generic batch element, either a state root batch element or a transaction batch element.
* block data we submit to L1.
*/ */
export interface BatchElement { export interface BatchElement {
// Only exists on state root batch elements.
stateRoot: string stateRoot: string
// Only exists on transaction batch elements.
isSequencerTx: boolean isSequencerTx: boolean
rawTransaction: undefined | string rawTransaction: undefined | string
// Batch element context, exists on all batch elements.
timestamp: number timestamp: number
blockNumber: number blockNumber: number
} }
/**
* List of batch elements.
*/
export type Batch = BatchElement[] export type Batch = BatchElement[]
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