Grants permissions and attaches arbitrary data (metadata) to the transaction. The data can be text, JSON, or any hex‑encoded value.
Arguments
- conn
A connection object created by
mc_connect.- to_address
Character string. The address receiving the permissions.
- permissions
Character string. Comma‑separated list of permissions.
- data
Data to embed. Can be a character string (will be hex‑encoded), a list (converted to JSON then hex), or raw binary.
- native_amount
Numeric. Amount of native currency to send (default 0).
See also
mc_grant_with_data_from to specify the grantor.
Other permissions:
mc_grant(),
mc_grant_from(),
mc_grant_with_data_from(),
mc_list_permissions(),
mc_revoke(),
mc_revoke_from(),
mc_verify_permission()
Examples
if (FALSE) { # \dontrun{
# Grant with a text note
txid <- mc_grant_with_data(conn, "1A...", "send",
data = "Welcome to the network!")
# Grant with JSON metadata
metadata <- list(reason = "partnership", level = "full")
txid <- mc_grant_with_data(conn, "1A...", "connect,send",
data = metadata, native_amount = 0.1)
} # }