Basic Function

Hello, World!

Functions are written as modules in Javascript or Typescript. Your code should export a function called triggerHandler that will be called whenever your function is triggered. triggerHandler takes two arguments and returns an JSON stringify-able object.

A simple function will look like this:

export function triggerHandler(context, data) {
    return { context: context, data: data };
}

This function will return both of its arguments to your webhook and is a great way to get started building functions on SendBlocks.

More advanced functions can make use of our runtime APIs which include persistent key-value data stores, price feeds, and more.

It is possible to replay functions for a given range of blocks.