|
71 | 71 | StreamExt::next(self).await
|
72 | 72 | }
|
73 | 73 |
|
74 |
| - /// Wait for the transaction to be in a block (but not necessarily finalized), and return |
75 |
| - /// an [`TxInBlock`] instance when this happens, or an error if there was a problem |
76 |
| - /// waiting for this to happen. |
77 |
| - /// |
78 |
| - /// **Note:** consumes `self`. If you'd like to perform multiple actions as the state of the |
79 |
| - /// transaction progresses, use [`TxProgress::next()`] instead. |
80 |
| - /// |
81 |
| - /// **Note:** transaction statuses like `Invalid`/`Usurped`/`Dropped` indicate with some |
82 |
| - /// probability that the transaction will not make it into a block but there is no guarantee |
83 |
| - /// that this is true. In those cases the stream is closed however, so you currently have no way to find |
84 |
| - /// out if they finally made it into a block or not. |
85 |
| - pub async fn wait_for_in_block(mut self) -> Result<TxInBlock<T, C>, Error> { |
86 |
| - while let Some(status) = self.next().await { |
87 |
| - match status? { |
88 |
| - // Finalized or otherwise in a block! Return. |
89 |
| - TxStatus::InBestBlock(s) | TxStatus::InFinalizedBlock(s) => return Ok(s), |
90 |
| - // Error scenarios; return the error. |
91 |
| - TxStatus::Error { message } => return Err(TransactionError::Error(message).into()), |
92 |
| - TxStatus::Invalid { message } => { |
93 |
| - return Err(TransactionError::Invalid(message).into()) |
94 |
| - } |
95 |
| - TxStatus::Dropped { message } => { |
96 |
| - return Err(TransactionError::Dropped(message).into()) |
97 |
| - } |
98 |
| - // Ignore anything else and wait for next status event: |
99 |
| - _ => continue, |
100 |
| - } |
101 |
| - } |
102 |
| - Err(RpcError::SubscriptionDropped.into()) |
103 |
| - } |
104 |
| - |
105 | 74 | /// Wait for the transaction to be finalized, and return a [`TxInBlock`]
|
106 | 75 | /// instance when it is, or an error if there was a problem waiting for finalization.
|
107 | 76 | ///
|
|
0 commit comments