Node Reference
Node Properties
INodeProperties
Properties | Type | Description |
---|---|---|
label | String | Display name of the node |
name | String | Actual name of the node using CamelCase |
icon | String | Icon name in the folder |
type | Enum | Type of node. Can be either trigger or action or webhook |
version | Number | Version of the node |
description (optional) | String | Description of the node |
incoming | Number | Number of input edges this node is expected to receive from upstream. From ui, this corresponds to number of dots available at the top of the node. |
outgoing | Number | Number of output edges this node is expected to emit to downstream. From ui, this corresponds to number of dots available at the bottom of the node. |
Example
class ExampleBlock implements INode { label: string; name: string; type: NodeType; description?: string; version: number; icon: string; incoming: number; outgoing: number; constructor() { this.label = 'ExampleBlock'; this.name = 'exampleBlock'; this.icon = 'example-block.svg'; this.type = 'action'; this.version = 1.0; this.description = 'This is an example block'; this.incoming = 1; this.outgoing = 1; }}
Node Parameters
INodeParams[]
There are 4 main groups of node parameters. They are designed to give a better user experience in ui, allowing user to enter inputs step by step.
Parameters | Description |
---|---|
actions (optional) | Type of action/event this node is going to execute or get triggered |
networks (optional) | Blockchain network to execute on. Only used for onchain nodes |
credentials (optional) | Credential needed to authenticate the node |
inputParameters (optional) | Remaining input parameters (e.g: query params, body) |

Example
class ExampleBlock implements INode { //...properties actions: INodeParams[]; networks: INodeParams[]; credentials: INodeParams[]; inputParameters: INodeParams[]; constructor() { //...properties this.actions = [ { label: 'Select Action', name: 'action', type: 'options', options: [ { label: 'Action 1', name: 'action1', }, ], default: 'action1', }, ] as INodeParams[]; this.networks = [ { label: 'Network', name: 'network', type: 'options', options: [ { label: 'Ethereum Mainnet', name: 'homestead', }, ], default: 'homestead', }, ] as INodeParams[]; this.credentials = [ { label: 'Credential Method', name: 'credentialMethod', type: 'options', options: [ { label: 'Some API Key', name: 'someApi', }, ], default: 'someApi', }, ] as INodeParams[]; this.inputParameters = [ { label: 'Input Field 1', name: 'inputField1', type: 'string', default: '', }, ] as INodeParams[]; }
Node Parameters Properties
INodeParams
Each node parameter has the following properties:
Properties | Type | Description |
---|---|---|
label | String | Display name of parameter |
name | String | Actual name of parameter using CamelCase |
type | Enum NodeParamsType | Type of parameter |
default (optional) | String, Number, Boolean, Object, Array | Default value of parameter |
description (optional) | String | Description of parameter |
options (optional) | Array INodeOptionsValue[] | Parameter options. Used with options |
array (optional) | Array INodeParams[] | Parameter array. Used with array . See array example |
loadMethod (optional) | String | Method name used to load async options. Used with asyncOptions . See asyncOptions example |
loadFromDbCollections (optional) | DbCollectionName[] | Which database collection to retrieve from server. Used with asyncOptions and loadMethod . See asyncOptions example |
optional (optional) | Boolean, INodeDisplay | To indicate if this parameter is an optional field. If not specified, parameter is mandatory |
show (optional) | INodeDisplay | Show this parameter if condition is met |
hide (optional) | INodeDisplay | Hide this parameter if condition is met |
rows (optional) | Number | Number of rows for the parameter input field |
placeholder (optional) | String | Placeholder text of the parameter input field |
Node Parameter Option Properties
INodeOptionsValue
Properties | Type | Description |
---|---|---|
label | String | Display name of option |
name | String | Actual name of option using CamelCase |
description (optional) | String | Description of option |
parentGroup (optional) | String | Group of option |
inputParameters (optional) | String | Description of additional parameter needed for this option. See inputParameters example |
exampleParameters (optional) | String | Example of additional parameter needed for this option. See exampleParameters example |
exampleResponse (optional) | Object | Example of output response for this option. See exampleResponse example |
show (optional) | INodeDisplay | Show this option if condition is met |
hide (optional) | INodeDisplay | Hide this option if condition is met |
hideRegisteredCredential (optional) | Boolean | Only used on credentialMethod option to hide registeredCredentials. See hideRegisteredCredential example |
Node Parameter Display
INodeDisplay
Can be used with these parameter properties: show
, hide
to display or hide the parameter.
This is useful when you want to hide a specific parameter depending on other parameters.
Example
this.inputParameters = [ { label: 'Input 1', name: 'input1', type: 'options', options: [ { label: 'Option A', name: 'optionA', }, { label: 'Option B', name: 'optionB', }, { label: 'Option C', name: 'optionC', }, { label: 'Option D', name: 'optionD', }, ] }, { label: 'Input 2', name: 'input2', type: 'string', description: 'Only show when Input1 has value of optionA OR optionB', show: { 'inputParameters.input1': ['optionA', 'optionB'] } }, { label: 'Input 3', name: 'input3', type: 'string', description: 'Only show when Input1 has value of optionC', show: { 'inputParameters.input1': ['optionC'] } }, { label: 'Input 4', name: 'input4', type: 'string', description: 'Only hide when Input1 has value of optionD', show: { 'inputParameters.input1': ['optionD'] } }]
It supports string and regex match as well:
this.inputParameters = [ { label: 'Input 1', name: 'input1', type: 'string', }, { label: 'Input 2', name: 'input2', type: 'string', description: 'Only show when Input1 === "matchstring"', show: { 'inputParameters.input1': "matchstring" } }, { label: 'Input 3', name: 'input3', type: 'string', description: 'Only show when Input1 matches the regex pattern where string is not empty or blank', show: { 'inputParameters.input1': '(.|\\s)*\\S(.|\\s)*' } }]
When used on options properties
to display/hide a specific option depending on other parameters:
this.inputParameters = [ { label: 'Input 1', name: 'input1', type: 'options', options: [ { label: 'Option A', name: 'optionA', }, { label: 'Option B', name: 'optionB', } ] }, { label: 'Input 2', name: 'input2', type: 'options', options: [ { label: 'Option C', name: 'optionC', description: 'Only show optionC when Input1 has value of optionA', show: { 'inputParameters.input1': ['optionA'] } }, { label: 'Option D', name: 'optionD', description: 'Only hide optionD when Input1 has value of optionA', hide: { 'inputParameters.input1': ['optionA'] } } ] }]
INodeDisplay
can also be used on optional
parameter properties to make a specific parameter become an optional parameter depending on other parameters.
this.inputParameters = [ { label: 'Input 1', name: 'input1', type: 'options', options: [ { label: 'Option A', name: 'optionA', }, { label: 'Option B', name: 'optionB', } ] }, { label: 'Input 2', name: 'input2', type: 'string', description: 'Make Input2 become optional if Input1 has value of optionB, otherwise it is mandatory', optional: { 'inputParameters.input1': ['optionB'] } },]
Node Parameter Type
NodeParamsType
A parameter can be one of these types: string
, number
, boolean
, options
, asyncOptions
, array
, password
, json
, code
, date
, file
.
String
{ label: 'Input String', name: 'inputString', type: 'string',}// Get as stringconst inputString = nodeData[paramCategory].inputString as string;

Number
{ label: 'Input Number', name: 'inputNumber', type: 'number',}// Get as numberconst inputNumber = nodeData[paramCategory].inputNumber as number;

Options
{ label: 'Input Options', name: 'inputOptions', type: 'options', options: [ { label: 'Option A', name: 'optionA', }, { label: 'Option B', name: 'optionB', }, ]}// Get as stringconst inputOptions = nodeData[paramCategory].inputOptions as string;

AsyncOptions
AsyncOptions
can be used when we want to display parameter options depending on the value of other parameters.
It has to be used with loadMethod
to specify which function to get the options.
class ExampleAsyncOption implements INode { //...properties //...parameters inputParameters?: INodeParams[]; constructor() { //...properties //...parameters this.inputParameters = [ { label: 'Input 1', name: 'input1', type: 'options', options: [ { label: 'Option A', name: 'optionA', }, { label: 'Option B', name: 'optionB', } ] }, { label: 'Input 2', name: 'input2', type: 'asyncOptions', loadMethod: 'getInput2Option' }, ] as INodeParams[]; } loadMethods = { async getInput2Option(nodeData: INodeData): Promise<INodeOptionsValue[]> { const returnData: INodeOptionsValue[] = []; const inputParametersData = nodeData.inputParameters; if (inputParametersData === undefined) throw new Error('Required data missing'); const input1 = inputParametersData.input1 as string; if (input1 === 'optionA') { returnData.push({ label: 'A Selected', description: 'Only visible when Option A selected', name: 'aSelected', }); } else if (input1 === 'optionB') { returnData.push({ label: 'B Selected', description: 'Only visible when Option B selected', name: 'bSelected', }); } return returnData; } }}

AsyncOptions
can also be used with loadFromDbCollections
to retrieve database collection.
class ExampleAsyncOption implements INode { //...properties //...parameters inputParameters?: INodeParams[]; constructor() { //...properties //...parameters this.inputParameters = [ { label: 'Select Workflow', name: 'workflow', type: 'asyncOptions', loadFromDbCollections: ['Workflow'], loadMethod: 'getWorkflows', } ] as INodeParams[]; } loadMethods = { async getWorkflows(nodeData: INodeData, dbCollection?: IDbCollection): Promise<INodeOptionsValue[]> { const returnData: INodeOptionsValue[] = []; const workflows: IWorkflow[] = dbCollection.Workflow; for (let i = 0; i < workflows.length; i+=1) { returnData.push({ label: workflows[i].name, name: workflows[i]._id, }); } return returnData; } }}
See ContractEventTrigger.ts
example
Array
Array
can be used whenever we want to display a set of parameter collections.
{ label: 'Input Array', name: 'inputArray', type: 'array', array: [ { label: 'Child Input Options', name: 'childInputOptions', type: 'options', options: [ { label: 'Option A', name: 'optionA', }, { label: 'Option B', name: 'optionB', }, ] }, { label: 'Child Input String', name: 'childInputString', type: 'string', } ]}// Declare custom array interfaceinterface IArray { childInputOptions: string; childInputString: string;}for (const item of nodeData[paramCategory].inputArray as IArray[]) { console.log(item.childInputOptions) console.log(item.childInputString)}

See Scheduler.ts
example
Password
{ label: 'Input Password', name: 'inputPW', type: 'password',}// Get as stringconst inputPW = nodeData[paramCategory].inputPW as string;

Json
Can be used when the parameter is of JSON format {}
or an array []
.
{ label: 'Input Json', name: 'inputJson', type: 'json',}// Get as stringlet inputJson = nodeData[paramCategory].inputJson as string;//Remove whitespacesinputJson = inputJson.replace(/\s/g, ''); try { const parsedInputJson = JSON.parse(inputJson);} catch(error) { throw handleErrorMessage(error);}

Code
{ label: 'Input Code', name: 'inputCode', type: 'code',}// Get as stringconst inputCode = nodeData[paramCategory].inputCode as string;

Date
{ label: 'Input Date', name: 'inputDate', type: 'date',}// Get as stringconst inputDate = nodeData[paramCategory].inputDate as string;// Convert to millisecondsconst startTime = Date.parse(inputDate);

File
{ label: 'Input File', name: 'inputFile', type: 'file',}// Get as string (base64)const fileBase64 = nodeData[paramCategory].inputFile as string;// Get file as bufferconst splitDataURI = fileBase64.split(',');const bf = Buffer.from(splitDataURI[1], "base64");

Folder
{ label: 'Input Folder', name: 'inputFolder', type: 'folder',}const folderContent = nodeData[paramCategory].inputFolder as string;const base64Array = JSON.parse(folderContent.replace(/\s/g, ''));for (let i = 0; i < base64Array.length; i+=1 ) { const fileBase64 = base64Array[i]; const splitDataURI = fileBase64.split(','); const filepath = (splitDataURI.pop() || 'filepath:').split(':')[1]; const bf = Buffer.from((splitDataURI.pop() || ''), "base64");}
