Skip to main content

Crate charms_data

Crate charms_data 

Source

Modules§

util

Macros§

check
Macro to check a condition and return false (early) if it does not hold. This is useful for checking pre-requisite conditions in predicate-type functions. Inspired by the ensure! macro from the anyhow crate. The function must return a boolean. Example:

Structs§

App
App represents an application that can be used to create, transform or destroy charms (tokens, NFTs and other instances of app data).
AppInput
AppSignature
Signature on a Wasm binary hash, together with the x-only public key it was produced with.
B32
32-byte byte string (e.g. a hash, like SHA256).
Data
Represents a data value that is guaranteed to be serialized/deserialized to/from CBOR.
NativeOutput
Transaction
Represents a transaction involving Charms. A Charms transaction sits on top of a Bitcoin transaction. Therefore, it transforms a set of input UTXOs into a set of output UTXOs. A Charms transaction may also reference other valid UTXOs that are not being spent or created.
TxId
ID (hash) of a transaction in the underlying ledger (Bitcoin).
UtxoId
ID of a UTXO (Unspent Transaction Output) in the underlying ledger system (e.g. Bitcoin). A UTXO ID is a pair of (transaction ID, index of the output).
VersionedApp
Identifies a specific version of an app’s Wasm binary, signed by the app’s owning key.

Constants§

NFT
Special App.tag value for non-fungible tokens (NFTs). See App for more details.
SCROLL
Special App.tag value for scrolls: Bitcoin outputs with such charms can only be created at Scrolls addresses. It works as any other non-token app for Cardano.
TOKEN
Special App.tag value for fungible tokens. See App for more details.

Functions§

app_datasDeprecated
Deprecated. Use charm_values instead.
charm_values
Iterate over all charm values of a given app (charm key) in the given outputs (strings of charms).
is_simple_transfer
Check if the transaction is a simple transfer of assets specified by app.
nft_state_preserved
Check if the NFT states are preserved in the transaction. This means that the NFTs (created by the provided app) in the tx inputs are the same as the NFTs in the tx outputs.
sum_token_amount
Sum the token amounts in the provided strings_of_charms.
token_amounts_balanced
Check if the provided app’s token amounts are balanced in the transaction. This means that the sum of the token amounts in the tx inputs is equal to the sum of the token amounts in the tx outputs.

Type Aliases§

Charms
Charms are tokens, NFTs or instances of arbitrary app state. This type alias represents a collection of charms. Structurally it is a map of app -> data.