Skip to content

Commit

Permalink
tx: rename AccessList2930Transaction -> AccessList2930Tx
Browse files Browse the repository at this point in the history
  • Loading branch information
jochem-brouwer committed Nov 7, 2024
1 parent eedb3ce commit c9e855a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 19 deletions.
21 changes: 7 additions & 14 deletions packages/tx/src/2930/tx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,7 @@ export type TxValuesArray = AllTypesTxValuesArray[TransactionType.AccessListEIP2
* - TransactionType: 1
* - EIP: [EIP-2930](https://eips.ethereum.org/EIPS/eip-2930)
*/
export class AccessList2930Transaction
implements TransactionInterface<TransactionType.AccessListEIP2930>
{
export class AccessList2930Tx implements TransactionInterface<TransactionType.AccessListEIP2930> {
public type: number = TransactionType.AccessListEIP2930 // Legacy tx type

public readonly gasPrice: bigint
Expand Down Expand Up @@ -170,12 +168,12 @@ export class AccessList2930Transaction
* Format: `[chainId, nonce, gasPrice, gasLimit, to, value, data, accessList,
* signatureYParity (v), signatureR (r), signatureS (s)]`
*
* Use {@link AccessList2930Transaction.serialize} to add a transaction to a block
* Use {@link AccessList2930Tx.serialize} to add a transaction to a block
* with {@link createBlockFromBytesArray}.
*
* For an unsigned tx this method uses the empty Bytes values for the
* signature parameters `v`, `r` and `s` for encoding. For an EIP-155 compliant
* representation for external signing use {@link AccessList2930Transaction.getMessageToSign}.
* representation for external signing use {@link AccessList2930Tx.getMessageToSign}.
*/
raw(): TxValuesArray {
return [
Expand Down Expand Up @@ -280,7 +278,7 @@ export class AccessList2930Transaction
r: Uint8Array | bigint,
s: Uint8Array | bigint,
convertV: boolean = false,
): AccessList2930Transaction {
): AccessList2930Tx {
r = toBytes(r)
s = toBytes(s)
const opts = { ...this.txOptions, common: this.common }
Expand Down Expand Up @@ -334,17 +332,12 @@ export class AccessList2930Transaction
return Legacy.getSenderAddress(this)
}

sign(privateKey: Uint8Array): AccessList2930Transaction {
return <AccessList2930Transaction>Legacy.sign(this, privateKey)
sign(privateKey: Uint8Array): AccessList2930Tx {
return <AccessList2930Tx>Legacy.sign(this, privateKey)
}

public isSigned(): boolean {
const { v, r, s } = this
if (v === undefined || r === undefined || s === undefined) {
return false
} else {
return true
}
return Legacy.isSigned(this)
}

/**
Expand Down
10 changes: 5 additions & 5 deletions packages/tx/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { bytesToBigInt, toBytes } from '@ethereumjs/util'

import type { FeeMarket1559Tx } from './1559/tx.js'
import type { AccessList2930Transaction } from './2930/tx.js'
import type { AccessList2930Tx } from './2930/tx.js'
import type { Blob4844Tx } from './4844/tx.js'
import type { EOACode7702Transaction } from './7702/tx.js'
import type { LegacyTx } from './legacy/tx.js'
Expand Down Expand Up @@ -158,7 +158,7 @@ export enum TransactionType {
export interface Transaction {
[TransactionType.Legacy]: LegacyTx
[TransactionType.FeeMarketEIP1559]: FeeMarket1559Tx
[TransactionType.AccessListEIP2930]: AccessList2930Transaction
[TransactionType.AccessListEIP2930]: AccessList2930Tx
[TransactionType.BlobEIP4844]: Blob4844Tx
[TransactionType.EOACodeEIP7702]: EOACode7702Transaction
}
Expand All @@ -169,7 +169,7 @@ export function isLegacyTx(tx: TypedTransaction): tx is LegacyTx {
return tx.type === TransactionType.Legacy
}

export function isAccessList2930Tx(tx: TypedTransaction): tx is AccessList2930Transaction {
export function isAccessList2930Tx(tx: TypedTransaction): tx is AccessList2930Tx {
return tx.type === TransactionType.AccessListEIP2930
}

Expand Down Expand Up @@ -357,7 +357,7 @@ export type LegacyTxData = {
}

/**
* {@link AccessList2930Transaction} data.
* {@link AccessList2930Tx} data.
*/
export interface AccessList2930TxData extends LegacyTxData {
/**
Expand Down Expand Up @@ -441,7 +441,7 @@ export interface TxValuesArray {
type LegacyTxValuesArray = Uint8Array[]

/**
* Bytes values array for an {@link AccessList2930Transaction}
* Bytes values array for an {@link AccessList2930Tx}
*/
type AccessList2930TxValuesArray = [
Uint8Array,
Expand Down

0 comments on commit c9e855a

Please sign in to comment.