Skip to content

Commit 145c3fc

Browse files
committed
Integration tests for EIP 1559 transactions
1 parent 2644b64 commit 145c3fc

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

tool/integration_test.dart

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,38 @@ void main() {
9292
);
9393
});
9494

95+
test('EIP-1559 transactions', () async {
96+
final firstAddress = await first.extractAddress();
97+
final secondAddress = await second.extractAddress();
98+
99+
final balanceOfFirst = await client.getBalance(firstAddress);
100+
final balanceOfSecond = await client.getBalance(secondAddress);
101+
final value = BigInt.from(1337);
102+
103+
final hash = await client.sendTransaction(
104+
first,
105+
Transaction(
106+
to: secondAddress,
107+
value: EtherAmount.inWei(value),
108+
maxFeePerGas: EtherAmount.inWei(BigInt.one),
109+
maxPriorityFeePerGas: EtherAmount.inWei(BigInt.two),
110+
),
111+
);
112+
113+
expect((await client.getBalance(firstAddress)).getInWei,
114+
balanceOfFirst.getInWei - value);
115+
expect((await client.getBalance(secondAddress)).getInWei,
116+
balanceOfSecond.getInWei + value);
117+
118+
final receipt = await client.getTransactionReceipt(hash);
119+
expect(
120+
receipt,
121+
isA<TransactionReceipt>()
122+
.having((e) => e.to, 'to', secondAddress)
123+
.having((e) => e.from, 'from', first.address),
124+
);
125+
});
126+
95127
test('getTransactionReceipt returns null for unknown transactions', () {
96128
expect(client.getTransactionReceipt('0x123'), completion(isNull));
97129
});

0 commit comments

Comments
 (0)