[][src]Function hdk::hash_entry

pub fn hash_entry<S: Into<String>>(
    entry_type_name: S,
    entry_value: Value
) -> ZomeApiResult<HashString>

Reconstructs an address of the given entry data. This is the same value that would be returned if entry_type_name and entry_value were passed to the commit_entry function and by which it would be retrievable from the DHT using get_entry. This is often used to reconstruct an address of a base argument when calling get_links.

Examples

fn handle_hash_post(content: String) -> serde_json::Value {
    let maybe_address = hdk::hash_entry("post", json!({
        "content": content,
        "date_created": "now"
    }));
    match maybe_address {
        Ok(address) => {
            json!({"address": address})
        }
        Err(hdk_error) => hdk_error.to_json(),
    }
}