Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TX refactor PR #3733

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions packages/tx/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Line is added so I can open a placeholder PR on github [REMOVE ME]
import { bytesToBigInt, toBytes } from '@ethereumjs/util'

import type { FeeMarket1559Tx } from './1559/tx.js'
Expand Down Expand Up @@ -617,3 +618,56 @@ export type AuthorizationListBytesItem = [
]
export type AuthorizationListBytes = AuthorizationListBytesItem[]
export type AuthorizationList = AuthorizationListItem[]

type NestedUint8Array = (Uint8Array | NestedUint8Array)[]

// This is all necessary in Block
export interface MinimalTxInterfaceBlock {
supports(capability: Capability): boolean
serialize(): Uint8Array
raw(): NestedUint8Array // TODO make more explicit, can deduce exactly what the raw returns
toJSON(): any // more typesafe

// Properties
maxFeePerGas: bigint
gasPrice: bigint
numBlobs: number
maxFeePerBlobGas: bigint
blobVersionedHashes: Uint8Array[]

// Can likely throw out
getValidationErrors(): string
isSigned(): boolean
}

// This is all necessary in VM
export interface MinimalTxInterfaceVM {
hash(): Uint8Array // Only used in debug logger !?
supports(capability: Capability): boolean
getSenderAddress(): Address
isSigned(): boolean // Only used in debug logger !?
getIntrinsicGas(): bigint
getUpfrontCost(): bigint
getEffectivePriorityFee(): bigint
serialize(): Uint8Array

// Properties
common: Common
gasLimit: bigint
gasPrice: bigint
maxFeePerGas: bigint
maxFeePerBlobGas: bigint
numBlobs: number
data: Uint8Array
AccessListJSON: any // Todo type
authorizationList: any // Todo type
to: Address | undefined | null // Note null got added here
value: bigint
nonce: bigint
blobVersionedHashes: Uint8Array[]
type: number
blobs: any // Todo type

// Can likely throw out
errorStr(): string
}