seedelf_cli::koios

Function contains_policy_id

Source
pub fn contains_policy_id(
    asset_list: &Option<Vec<Asset>>,
    target_policy_id: &str,
) -> bool
Expand description

Checks if a target policy ID exists in the asset list.

This function checks whether a specified target_policy_id exists within the provided asset_list. If the asset_list is None, the function returns false.

§Arguments

  • asset_list - An optional reference to a vector of Asset items.
  • target_policy_id - A string slice representing the policy ID to search for.

§Returns

  • true - If the target policy ID exists in the asset list.
  • false - If the target policy ID does not exist or the asset list is None.

§Behavior

  • Safely handles None values for asset_list using map_or.
  • Uses iter().any() to efficiently search for a matching policy ID.