Skip to contents

Creates a JavaScript library on the blockchain. Libraries contain reusable code that can be imported by filters.

Usage

mc_create_library(
  conn,
  name,
  updatemode = c("none", "instant", "approve"),
  js_code
)

Arguments

conn

A connection object created by mc_connect.

name

Character string. Library name (must be unique).

updatemode

Character string. How library updates are handled: "none" – no updates allowed; "instant" – updates take effect immediately; "approve" – updates require admin approval.

js_code

Character string. The JavaScript code for the library.

Value

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

Examples

if (FALSE) { # \dontrun{
js_code <- "function add(a, b) { return a + b; }"
mc_create_library(conn, "math", updatemode = "none", js_code)
} # }