Skip to contents

Creates a new transaction filter on the blockchain. Transaction filters are JavaScript programs that validate or transform transactions.

Usage

mc_create_tx_filter(conn, name, options, js_code)

Arguments

conn

A connection object created by mc_connect.

name

Character string. Name of the filter (must be unique).

options

List of filter options. Usually includes for (target asset or stream) and libraries (list of library names). Example: list("for" = "asset1", libraries = list("lib1")).

js_code

Character string. The JavaScript code for the filter.

Value

A list containing the result of the RPC call (usually transaction ID).

Examples

if (FALSE) { # \dontrun{
js_code <- "function filter(tx) { return tx.vin.length > 0; }"
mc_create_tx_filter(conn, "myfilter", list("for" = "asset1"), js_code)
} # }