Node Definition
For the front-end to display the newly created node, a node definition has to be created and submitted it to the front-end's node database.
Steps
Create node definition
type; should be set to native
data contains general information about the node
inputs and outputs !!! Note: the node definition uses targets to describe inputs, and sources to describe outputs. Remnants of front-end library which uses the point-of-view of a directional edge, going from a source to a target.
optional: to accept static inputs on the UI, you need to define a form schema.
We use the JSON Schema to define the form.
build a form here: https://rjsf-team.github.io/react-jsonschema-form/ or here https://ginkgobioworks.github.io/react-json-schema-form-builder/
both JSONSchema and UISchema are needed
Commit node definition to our repo
POST node definition to DB
Sample node definition
{
"type": "native", // WASM, deno
"data": {
"node_definition_version": "0.1",
"unique_id": "",
"node_id": "transfer_sol",
"version": "0.1",
"display_name": "Transfer SOL",
"description": "",
"tags": [],
"related_to": [
{
"id": "",
"type": "",
"relationship": ""
}
],
"resources": {
"source_code_url": "",
"documentation_url": ""
},
"usage": {
"license": "Apache-2.0",
"license_url": "",
"pricing": {
"currency": "USDC",
"purchase_price": 0,
"price_per_run": 0,
"custom": {
"unit": "monthly",
"value": "0"
}
}
},
"authors": [
{
"name": "Space Operator",
"contact": ""
}
],
"design": {
"width": 0,
"height": 0,
"icon_url": "",
"backgroundColorDark": "#000000",
"backgroundColor": "#fff"
},
"options": {}
},
"sources": [
{
"name": "signature",
"type": "signature",
"defaultValue": null,
"tooltip": ""
}
],
"targets": [
{
"name": "sender",
"type_bounds": ["keypair"],
"required": true,
"defaultValue": null,
"tooltip": "",
"passthrough": false
},
{
"name": "recipient",
"type_bounds": ["pubkey"],
"required": true,
"defaultValue": null,
"tooltip": "",
"passthrough": false
},
{
"name": "amount",
"type_bounds": ["f64"],
"required": true,
"defaultValue": null,
"tooltip": "",
"passthrough": false
},
{
"name": "submit",
"type_bounds": ["bool"],
"required": false,
"defaultValue": true,
"tooltip": "",
"passthrough": false
}
],
"targets_form.json_schema": {},
"targets_form.ui_schema": {}
}
POST node definition to DB
body should be the node definition JSON
Last updated
Was this helpful?