1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
use crateHDK;
use ExternResult;
use ;
/// Get validation receipts associated with an action.
///
/// When an action is created, it is represented as multiple DHT ops to be published on the network.
/// Each op will be validated by other agents on the network and a receipt will be sent back to the
/// author. The return value of this function is organized by DHT op hash. Each [ValidationReceiptSet]
/// contains all the validation receipts that have been received for that DHT op.
///
/// Note: This function will permit you to look for validation receipts for any action hash, but you
/// will only have receipts if the action was authored on the same conductor. Not necessarily the
/// same agent, but it must be the same conductor.
///
/// ### Example
/// ```rust,no_run
/// use hdk::prelude::*;
///
/// # fn main() -> ExternResult<()> {
/// // Use the action hash returned when the entry was created.
/// let action_hash = ActionHash::from_raw_36(vec![0; 36]);
/// let receipts = get_validation_receipts(GetValidationReceiptsInput::new(action_hash))?;
/// let count = receipts
/// .into_iter()
/// .filter(|receipt_set| receipt_set.op_type == "AgentActivity")
/// .flat_map(|receipt_set| receipt_set.receipts)
/// .count();
/// info!("Found {} receipts from agent activity authorities", count);
/// # Ok(())
/// # }
/// ```