Skip to contents

Creates a new stream filter on the blockchain. Stream filters are JavaScript programs that can be attached to streams to validate or transform items.

Usage

mc_create_stream_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. Typically includes libraries (list of library names) that the filter depends on. Example: list(libraries = list("mylib")).

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(stream, item) { return true; }"
mc_create_stream_filter(conn, "myfilter", list(libraries = list()), js_code)
} # }