Skip to content

Commit

Permalink
wip: envelope
Browse files Browse the repository at this point in the history
  • Loading branch information
jxom committed Oct 30, 2024
1 parent 2804f77 commit 36e86da
Show file tree
Hide file tree
Showing 12 changed files with 1,845 additions and 1,877 deletions.
12 changes: 9 additions & 3 deletions src/TransactionEnvelopeEip1559.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,18 @@ test('default', () => {
readonly value: 69n
readonly type: 'eip1559'
}>()
expectTypeOf(envelope).toMatchTypeOf<TransactionEnvelopeEip1559>()
expectTypeOf(
envelope,
).toMatchTypeOf<TransactionEnvelopeEip1559.TransactionEnvelopeEip1559>()
}

{
const envelope = TransactionEnvelopeEip1559.from(
'0x123' as TransactionEnvelopeEip1559.Serialized,
)
expectTypeOf(envelope).toMatchTypeOf<TransactionEnvelopeEip1559>()
expectTypeOf(
envelope,
).toMatchTypeOf<TransactionEnvelopeEip1559.TransactionEnvelopeEip1559>()
}

{
Expand All @@ -42,6 +46,8 @@ test('default', () => {
readonly yParity: 0
readonly type: 'eip1559'
}>()
expectTypeOf(envelope).toMatchTypeOf<TransactionEnvelopeEip1559>()
expectTypeOf(
envelope,
).toMatchTypeOf<TransactionEnvelopeEip1559.TransactionEnvelopeEip1559>()
}
})
6 changes: 4 additions & 2 deletions src/TransactionEnvelopeEip1559.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ describe('deserialize', () => {
test('default', () => {
const serialized = TransactionEnvelopeEip1559.serialize(transaction)
const deserialized = TransactionEnvelopeEip1559.deserialize(serialized)
assertType<TransactionEnvelopeEip1559>(deserialized)
assertType<TransactionEnvelopeEip1559.TransactionEnvelopeEip1559>(
deserialized,
)
expect(deserialized).toEqual(transaction)
})

Expand Down Expand Up @@ -551,7 +553,7 @@ describe('serialize', () => {
const transaction_data = {
...transaction,
data: '0x1234',
} satisfies TransactionEnvelopeEip1559
} satisfies TransactionEnvelopeEip1559.TransactionEnvelopeEip1559
const serialized = TransactionEnvelopeEip1559.serialize(transaction_data)
expect(serialized).toEqual(
'0x02f10182031184773594008477359400809470997970c51812dc3a010c7d01b50e0d17dc79c8880de0b6b3a7640000821234c0',
Expand Down
Loading

0 comments on commit 36e86da

Please sign in to comment.