[][src]Module hdk::api

This file contains many of the structs, enums, and functions relevant for Zome developers! Detailed references and examples can be found here for how to use the HDK exposed functions to access powerful Holochain functions.

Structs

AGENT_ADDRESS

The hash of your public key. This is your node address on the DHT. It can be used for node-to-node messaging with send and receive functions.

AGENT_ID_STR

The identity string used when the chain was first initialized.

AGENT_INITIAL_HASH

The hash of the first identity entry on your chain (The second entry on your chain). This is your peer's identity on the DHT.

CAPABILITY_REQ

The CapabilityRequest under which this wasm function is executing

DNA_ADDRESS

The address of the DNA the Zome is embedded within. This is often useful as a fixed value that is known by all participants running the DNA.

DNA_NAME

The name property as taken from the DNA.

EntryValidationArgs
GetEntryMask
LinkValidationArgs
LinkValidationPackageArgs
PUBLIC_TOKEN

The Address of the public token (if any)

Enums

BundleOnClose

Allowed input for close_bundle()

Dispatch
LinkDirection

Statics

G_MEM_STACK

Internal global for memory usage

Functions

call

Call an exposed function from another zome or another (bridged) instance running on the same agent in the same conductor. Arguments for the called function are passed as JsonString. Returns the value that's returned by the given function as a json str.

close_bundle

NOT YET AVAILABLE

commit_entry

Attempts to commit an entry to your local source chain. The entry will have to pass the defined validation rules for that entry type. If the entry type is defined as public, will also publish the entry to the DHT. Returns either an address of the committed entry as a string, or an error.

debug

Prints a string through the stdout of the running service, and also writes that string to the logger in the execution context

entry_address

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.

get_entry

Retrieves latest version of an entry from the local chain or the DHT, by looking it up using the specified address. Returns None if no entry exists at the specified address or if the entry's crud-status is not LIVE.

get_entry_history

Return an EntryHistory filled with all the versions of the entry from the version at the specified address to the latest. Returns None if no entry exists at the specified address.

get_entry_initial

Returns the Entry at the exact address specified, whatever its crud-status. Returns None if no entry exists at the specified address.

get_entry_result

Retrieves an entry and its metadata from the local chain or the DHT, by looking it up using the specified address. The data returned is configurable with the GetEntryOptions argument.

get_links

Helper function for get_links. Returns a vector with the default return results.

get_links_and_load

Helper function for get_links. Returns a vector of the entries themselves

get_links_result

Retrieves data about entries linked to a base address with a given tag. This is the most general version of the various get_links helpers (such as get_links_and_load) and can return the linked addresses, entries, headers and sources. Also supports CRUD status_request. The data returned is configurable with the GetLinksOptions to specify links options and GetEntryOptions argument wto specify options when loading the entries.

get_links_with_options

Consumes three values; the address of an entry get get links from (the base), the tag of the links to be retrieved, and an options struct for selecting what meta data and crud status links to retrieve. Note: the tag is intended to describe the relationship between the base and other entries you wish to lookup. This function returns a list of addresses of other entries which matched as being linked by the given tag. Links are created using the Zome API function link_entries. If you also need the content of the entry consider using one of the helper functions: get_links_result or get_links_and_load

keystore_derive_key

keystore_derive_key ( ) -> ( )

keystore_derive_seed

keystore_derive_seed ( ) -> ( () )

keystore_list

keystore_list ( ) -> ( Vec )

keystore_new_random

keystore_new_random ( dst_id, size ) -> ( () )

keystore_sign

keystore_sign ( ) -> ( )

link_entries

Consumes three values, two of which are the addresses of entries, and one of which is a string that defines a relationship between them, called a tag. Later, lists of entries can be looked up by using get_links. Entries can only be looked up in the direction from the base, which is the first argument, to the target.

property

NOT YET AVAILABLE

query

Returns a list of entries from your local source chain that match a given entry type name or names.

query_result
remove_entry

Commit a DeletionEntry to your local source chain that marks an entry as 'deleted' by setting its status metadata to Deleted and adding the DeleteEntry's address in the deleted entry's metadata, which will be used by validation routes.

remove_link

Consumes three values, two of which are the addresses of entries, and one of which is a string that removes a relationship between them, called a tag. Later, lists of entries.

send

Sends a node-to-node message to the given agent, specified by their address. Addresses of agents can be accessed using hdk::AGENT_ADDRESS. This works in conjunction with the receive callback that has to be defined in the define_zome! macro.

sign

sign ( priv_id_str, base64payload ) -> ( base64signature )

sign_one_time

sign_one_time ( priv_id_str, base64payloads ) -> ( base64signature )

sleep

Lets the DNA runtime sleep for the given duration.

start_bundle

NOT YET AVAILABLE

update_agent

NOT YET AVAILABLE

update_entry

Commit an entry to your local source chain that "updates" a previous entry, meaning when getting the previous entry, the updated entry will be returned. update_entry sets the previous entry's status metadata to Modified and adds the updated entry's address in the previous entry's metadata. The updated entry will hold the previous entry's address in its header, which will be used by validation routes.

verify_signature

NOT YET AVAILABLE