Skip to content

Commit e33a8a5

Browse files
committed
tx: removed eipSupport() function in TransactionFactory (redundant, EIP dependency check is done in Common)
1 parent 5f2e910 commit e33a8a5

File tree

2 files changed

+5
-21
lines changed

2 files changed

+5
-21
lines changed

packages/tx/src/transactionFactory.ts

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export default class TransactionFactory {
1212

1313
/**
1414
* Create a transaction from a `txData` object
15+
*
1516
* @param txData - The transaction data. The `type` field will determine which transaction type is returned (if undefined, create a Transaction)
1617
* @param txOptions - Options to pass on to the constructor of the transaction
1718
*/
@@ -35,6 +36,7 @@ export default class TransactionFactory {
3536
/**
3637
* This method tries to decode `raw` data. It is somewhat equivalent to `fromRlpSerializedTx`.
3738
* However, it could be that the data is not directly RLP-encoded (it is a Typed Transaction)
39+
*
3840
* @param rawData - The raw data buffer
3941
* @param txOptions - The transaction options
4042
*/
@@ -55,7 +57,7 @@ export default class TransactionFactory {
5557
throw new Error(`TypedTransaction with ID ${rawData[0]} unknown`)
5658
}
5759

58-
if (!TransactionFactory.eipSupport(common, EIP)) {
60+
if (!common.isActivatedEIP(EIP)) {
5961
throw new Error(
6062
`Cannot create TypedTransaction with ID ${rawData[0]}: EIP ${EIP} not activated`
6163
)
@@ -72,6 +74,7 @@ export default class TransactionFactory {
7274
* A Buffer (a TypedTransaction - encoded as TransactionType || rlp(TransactionPayload))
7375
* A Buffer[] (Transaction)
7476
* This method returns the right transaction.
77+
*
7578
* @param rawData - Either a Buffer or a Buffer[]
7679
* @param txOptions - The transaction options
7780
*/
@@ -89,6 +92,7 @@ export default class TransactionFactory {
8992
/**
9093
* This helper method allows one to retrieve the class which matches the transactionID
9194
* If transactionID is undefined, return the Transaction class.
95+
*
9296
* @param transactionID
9397
* @param common
9498
*/
@@ -113,16 +117,4 @@ export default class TransactionFactory {
113117
throw new Error(`TypedTransaction with ID ${transactionID} unknown`)
114118
}
115119
}
116-
117-
/**
118-
* Check if a typed transaction eip is supported by common
119-
* @param common - The common to use
120-
* @param eip - The EIP to check
121-
*/
122-
public static eipSupport(common: Common, eip: number): boolean {
123-
if (!common.isActivatedEIP(2718)) {
124-
return false
125-
}
126-
return common.isActivatedEIP(eip)
127-
}
128120
}

packages/tx/test/transactionFactory.spec.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,4 @@ tape('[TransactionFactory]: Basic functions', function (t) {
109109
st.equals(eip2930Tx.constructor.name, AccessListEIP2930Transaction.name)
110110
st.end()
111111
})
112-
113-
t.test('if eip2718 is not activated, always return that the eip is not activated', function (st) {
114-
const newCommon = new Common({ chain: 'mainnet', hardfork: 'istanbul' })
115-
116-
const eip2930Active = TransactionFactory.eipSupport(newCommon, 2930)
117-
st.ok(!eip2930Active)
118-
st.end()
119-
})
120112
})

0 commit comments

Comments
 (0)