Space Operator
  • Welcome
  • Visual Builder
    • Flows
      • API Key & POST Request
      • WebSocket
        • Signature Requests
      • Nested Flows
      • Learn Solana
      • Add flows to your websites
      • Iterate with Localhost
    • Nodes
      • Web Assembly Nodes
        • space-cli
        • space-lib
        • Examples in Rust
          • Rectangle
          • Filter
          • Regex
        • Uploading WASM binary via UI
      • Native Nodes
        • Code Template
        • Node Definition
        • ValueSet
        • Submitting Native Nodes
        • Tracing
      • Mock Nodes
      • JS Node
      • API Input Node
  • Self-hosting
    • Docker Compose
    • Serving HTTPS
    • Lightsail Instance
    • Export data to your instance
  • FAQ
    • Servers
  • References
    • Flows
    • Flow Deployment
Powered by GitBook
On this page

Was this helpful?

  1. Visual Builder
  2. Nodes
  3. Native Nodes

Node Definition

PreviousCode TemplateNextValueSet

Last updated 1 year ago

Was this helpful?

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

  1. Create node definition

    1. type; should be set to native

    2. data contains general information about the node

    3. 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.

    4. optional: to accept static inputs on the UI, you need to define a form schema.

      We use the JSON Schema to define the form.

      1. build a form here: https://rjsf-team.github.io/react-jsonschema-form/ or here

      2. both JSONSchema and UISchema are needed

  2. Commit node definition to our repo

  3. 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

https://ginkgobioworks.github.io/react-json-schema-form-builder/
https://github.com/space-operator/flow-backend
https://hyjboblkjeevkzaqsyxe.supabase.co/rest/v1/nodes