Skip to content

Commit 280e013

Browse files
committed
change usage from fromRlpSerializedTx to fromSerializedTx
1 parent d1c6208 commit 280e013

File tree

7 files changed

+19
-19
lines changed

7 files changed

+19
-19
lines changed

packages/tx/examples/ropsten-tx.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const txData = toBuffer(
77
)
88

99
const common = new Common({ chain: 'ropsten', hardfork: 'petersburg' })
10-
const tx = Transaction.fromRlpSerializedTx(txData, { common })
10+
const tx = Transaction.fromSerializedTx(txData, { common })
1111

1212
if (
1313
tx.validate() &&

packages/tx/src/eip2930Transaction.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,12 @@ export default class AccessListEIP2930Transaction extends BaseTransaction<Access
8282

8383
/**
8484
* Instantiate a transaction from the serialized tx.
85-
* (alias of fromSerializedTx())
85+
* (alias of `fromSerializedTx()`)
8686
*
8787
* Note: This means that the Buffer should start with 0x01.
8888
*
8989
* @deprecated this constructor alias is deprecated and will be removed
90-
* in favor of the from SerializedTx() constructor
90+
* in favor of the `fromSerializedTx() constructor
9191
*/
9292
public static fromRlpSerializedTx(serialized: Buffer, opts: TxOptions = {}) {
9393
return AccessListEIP2930Transaction.fromSerializedTx(serialized, opts)

packages/tx/src/legacyTransaction.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@ export default class Transaction extends BaseTransaction<Transaction> {
4242

4343
/**
4444
* Instantiate a transaction from the serialized tx.
45-
* (alias of fromSerializedTx())
45+
* (alias of `fromSerializedTx()`)
4646
*
4747
* @deprecated this constructor alias is deprecated and will be removed
48-
* in favor of the from SerializedTx() constructor
48+
* in favor of the `fromSerializedTx()` constructor
4949
*/
5050
public static fromRlpSerializedTx(serialized: Buffer, opts: TxOptions = {}) {
5151
return Transaction.fromSerializedTx(serialized, opts)

packages/tx/src/transactionFactory.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,9 @@ export default class TransactionFactory {
6363
)
6464
}
6565

66-
return AccessListEIP2930Transaction.fromRlpSerializedTx(rawData, txOptions)
66+
return AccessListEIP2930Transaction.fromSerializedTx(rawData, txOptions)
6767
} else {
68-
return Transaction.fromRlpSerializedTx(rawData, txOptions)
68+
return Transaction.fromSerializedTx(rawData, txOptions)
6969
}
7070
}
7171

packages/tx/test/base.spec.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,10 @@ tape('[BaseTransaction]', function (t) {
8080
tx = txType.class.fromTxData({}, { common, freeze: false })
8181
const rlpData = tx.serialize()
8282

83-
tx = txType.class.fromRlpSerializedTx(rlpData, { common })
83+
tx = txType.class.fromSerializedTx(rlpData, { common })
8484
st.ok(Object.isFrozen(tx), `${txType.name}: tx should be frozen by default`)
8585

86-
tx = txType.class.fromRlpSerializedTx(rlpData, { common, freeze: false })
86+
tx = txType.class.fromSerializedTx(rlpData, { common, freeze: false })
8787
st.ok(
8888
!Object.isFrozen(tx),
8989
`${txType.name}: tx should not be frozen when freeze deactivated in options`
@@ -105,12 +105,12 @@ tape('[BaseTransaction]', function (t) {
105105
for (const txType of txTypes) {
106106
txType.txs.forEach(function (tx: any) {
107107
st.ok(
108-
txType.class.fromRlpSerializedTx(tx.serialize(), { common }),
109-
`${txType.name}: should do roundtrip serialize() -> fromRlpSerializedTx()`
108+
txType.class.fromSerializedTx(tx.serialize(), { common }),
109+
`${txType.name}: should do roundtrip serialize() -> fromSerializedTx()`
110110
)
111111
st.ok(
112112
txType.class.fromSerializedTx(tx.serialize(), { common }),
113-
`${txType.name}: should do roundtrip serialize() -> fromRlpSerializedTx()`
113+
`${txType.name}: should do roundtrip serialize() -> fromSerializedTx()`
114114
)
115115
})
116116
}

packages/tx/test/legacy.spec.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ tape('[Transaction]', function (t) {
5555
const privKey = Buffer.from(txFixtures[0].privateKey, 'hex')
5656
tx = tx.sign(privKey)
5757
const serialized = tx.serialize()
58-
st.throws(() => Transaction.fromRlpSerializedTx(serialized))
58+
st.throws(() => Transaction.fromSerializedTx(serialized))
5959
st.end()
6060
}
6161
)
@@ -131,7 +131,7 @@ tape('[Transaction]', function (t) {
131131
const s1 = tx.serialize()
132132

133133
const s1Rlp = toBuffer('0x' + s1.toString('hex'))
134-
const tx2 = Transaction.fromRlpSerializedTx(s1Rlp)
134+
const tx2 = Transaction.fromSerializedTx(s1Rlp)
135135
const s2 = tx2.serialize()
136136

137137
st.ok(s1.equals(s2))
@@ -182,7 +182,7 @@ tape('[Transaction]', function (t) {
182182
"getMessageToSign(), getSenderPublicKey() (implicit call) -> verify EIP155 signature based on Vitalik's tests",
183183
function (st) {
184184
txFixturesEip155.forEach(function (tx) {
185-
const pt = Transaction.fromRlpSerializedTx(toBuffer(tx.rlp))
185+
const pt = Transaction.fromSerializedTx(toBuffer(tx.rlp))
186186
st.equal(pt.getMessageToSign().toString('hex'), tx.hash)
187187
st.equal('0x' + pt.serialize().toString('hex'), tx.rlp)
188188
st.equal(pt.getSenderAddress().toString(), '0x' + tx.sender)
@@ -359,7 +359,7 @@ tape('[Transaction]', function (t) {
359359

360360
const serialized = tx.serialize()
361361

362-
const reTx = Transaction.fromRlpSerializedTx(serialized, { common })
362+
const reTx = Transaction.fromSerializedTx(serialized, { common })
363363
st.equal(reTx.verifySignature(), true)
364364
st.equal(reTx.common.chainId(), 42)
365365

@@ -394,11 +394,11 @@ tape('[Transaction]', function (t) {
394394
const rawSigned = tx.serialize()
395395
st.ok(tx.isSigned())
396396

397-
tx = Transaction.fromRlpSerializedTx(rawUnsigned)
397+
tx = Transaction.fromSerializedTx(rawUnsigned)
398398
st.notOk(tx.isSigned())
399399
tx = tx.sign(privateKey)
400400
st.ok(tx.isSigned())
401-
tx = Transaction.fromRlpSerializedTx(rawSigned)
401+
tx = Transaction.fromSerializedTx(rawSigned)
402402
st.ok(tx.isSigned())
403403

404404
const signedValues = (rlp.decode(rawSigned) as any) as Buffer[]

packages/tx/test/transactionRunner.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ tape('TransactionTests', (t) => {
4646
const rawTx = toBuffer(testData.rlp)
4747
const hardfork = forkNameMap[forkName]
4848
const common = new Common({ chain: 1, hardfork })
49-
const tx = Transaction.fromRlpSerializedTx(rawTx, { common })
49+
const tx = Transaction.fromSerializedTx(rawTx, { common })
5050

5151
const sender = tx.getSenderAddress().toString()
5252
const hash = tx.hash().toString('hex')

0 commit comments

Comments
 (0)