|
1 | | -use alloy::{network::Ethereum, primitives::U256, providers::Provider, sol}; |
2 | | -use event_scanner::test_utils::LogMetadata; |
| 1 | +use alloy::{network::Ethereum, sol}; |
3 | 2 |
|
4 | 3 | // Shared test contract used across integration tests |
5 | 4 | sol! { |
|
37 | 36 | let contract = TestCounter::deploy(provider).await?; |
38 | 37 | Ok(contract) |
39 | 38 | } |
40 | | - |
41 | | -#[allow(dead_code)] |
42 | | -pub(crate) trait TestCounterExt { |
43 | | - async fn increase_and_get_meta( |
44 | | - &self, |
45 | | - ) -> anyhow::Result<LogMetadata<TestCounter::CountIncreased>>; |
46 | | - async fn decrease_and_get_meta( |
47 | | - &self, |
48 | | - ) -> anyhow::Result<LogMetadata<TestCounter::CountDecreased>>; |
49 | | -} |
50 | | - |
51 | | -impl<P: Provider + Clone> TestCounterExt for TestCounter::TestCounterInstance<P> { |
52 | | - async fn increase_and_get_meta( |
53 | | - &self, |
54 | | - ) -> anyhow::Result<LogMetadata<TestCounter::CountIncreased>> { |
55 | | - let receipt = self.increase().send().await?.get_receipt().await?; |
56 | | - let tx_hash = receipt.transaction_hash; |
57 | | - let new_count = receipt.decoded_log::<TestCounter::CountIncreased>().unwrap().data.newCount; |
58 | | - Ok(LogMetadata { |
59 | | - event: TestCounter::CountIncreased { newCount: U256::from(new_count) }, |
60 | | - address: *self.address(), |
61 | | - tx_hash, |
62 | | - }) |
63 | | - } |
64 | | - |
65 | | - async fn decrease_and_get_meta( |
66 | | - &self, |
67 | | - ) -> anyhow::Result<LogMetadata<TestCounter::CountDecreased>> { |
68 | | - let receipt = self.decrease().send().await?.get_receipt().await?; |
69 | | - let tx_hash = receipt.transaction_hash; |
70 | | - let new_count = receipt.decoded_log::<TestCounter::CountDecreased>().unwrap().data.newCount; |
71 | | - Ok(LogMetadata { |
72 | | - event: TestCounter::CountDecreased { newCount: U256::from(new_count) }, |
73 | | - address: *self.address(), |
74 | | - tx_hash, |
75 | | - }) |
76 | | - } |
77 | | -} |
0 commit comments