Crate tari_template_lib

source ·
Expand description

This crate contains an interface for WASM templates to interact with the state of the Tari Network, as well as some utilities for executing functions that may be slow in the WASM environment.

In most cases, you will only require the prelude which can be included with:

use tari_template_lib::prelude::*;

Modules§

  • Definitions and utilities related to instruction arguments
  • Access control rules for template-related data like component methods and resources
  • Context definitions related to the caller of an instruction
  • Utilities for building and managing components inside templates
  • A collection of convenient constant values
  • Cryptography utilities related to public keys and balance proofs
  • A wrapper for engine calls related to events
  • Rust macros that can be used inside templates
  • The collection of all struct definitions that represent data in the Tari network (e.g., resources, components, proofs, etc.)
  • Hook that implements common behavior when a panic happens during template execution
  • The prelude contains all the commonly used types and functions that are used. To use it, add the import use tari_template_lib::prelude::*;
  • Utilities to get random values inside templates
  • Utilities for building and managing resources inside templates
  • Utilities related to templates
  • Public types that are available to internal template code.

Macros§

  • Low-level macro for building instruction arguments, used by both arg! and args! macros. Not intended for general usage.
  • Low-level macro used for counting characters in the encoding of arguments. Not intended for general usage
  • Utility macro for building a single instruction argument
  • Utility macro for building multiple instruction arguments
  • Macro for writing debug messages from inside templates
  • Macro for emitting error log messages from inside templates
  • Macro for emitting log messages from inside templates
  • Low-level macro used for encoding the arguments of engine calls. Not intended for general usage
  • Macro for emitting log messages from inside templates
  • Low-level macro used for generating serde serializers/deserializers for newtype structs. Not intended for general usage
  • Macro for emitting warn log messages from inside templates

Structs§

  • TODO: YAGNI currently, it may come into play for cross-template requests
  • The Consensus module provides access to data about the current state of the chain. Currently, it only exposes the epoch via current_epoch.
  • Representation of a 32-byte hash value
  • Representation of a hash parsing error

Functions§

  • Returns the corresponding TariEngine of the current template execution
  • Returns a template’s current call context
  • Sets up a template’s current call context
  • Encodes any Rust type using CBOR