RoboOS logo
RoboOS

TypeScript/JavaScript SDK

Complete guide to the RoboOS TypeScript/JavaScript SDK for Node.js, Bun, and browser environments.

TypeScript/JavaScript SDK

The RoboOS TypeScript/JavaScript SDK is the primary SDK for integrating robots into the RoboOS ecosystem. It's designed for modern JavaScript environments including Node.js, Bun, and browser applications.

This SDK provides full-featured support for all RoboOS capabilities including wallet management, payment channels, task marketplace, zero-knowledge verification, and reputation systems.

Installation

Install the SDK using npm, yarn, pnpm, or bun:

bash
npm install @roboos/robot-sdk
# or
bun add @roboos/robot-sdk
# or
yarn add @roboos/robot-sdk

Requirements: - Node.js 18+ or Bun - TypeScript 5+ (optional but recommended)

Quick Start

Here's a minimal example to get started:

typescript
import { RobotSDK, ForkliftRobot } from '@roboos/robot-sdk';

// Initialize SDK
const sdk = new RobotSDK({
  network: 'mainnet-beta',
  fprEndpoint: 'https://fpr.theroboos.com',
  marketplaceEndpoint: 'https://marketplace.theroboos.com',
});

// Create robot wallet
const wallet = await sdk.wallet.create({
  storage: 'file',
  path: './robot-wallet.json',
  encrypted: true,
});

// Initialize forklift robot
const forklift = new ForkliftRobot({
  robotId: 'forklift-001',
  wallet,
  config: sdk.getConfig(),
  capabilities: {
    lifting: true,
    transport: true,
    stacking: true,
    maxWeight: 2000,
    maxHeight: 5,
    navigation: true,
  },
});

// Connect to RoboOS
await forklift.initialize();
await forklift.connect();

Core Features

Robot Wallet SDK - Complete Solana wallet management with x402 stealth payment integration. Create, load, and manage robot wallets with encryption support.

Fleet Payment Router (FPR) Client - Payment channels and micropayments for efficient robot-to-robot transactions. Open channels, send payments, and manage channel lifecycle.

Task Marketplace API - Full marketplace integration for task bidding, querying, and assignment. Support for custom bidding strategies and task type definitions.

Zero-Knowledge Verification - Task completion proofs using ZK technology. Generate and verify proofs for task completion without revealing sensitive data.

Reputation System - Integration with Robot Reputation Ledger (RRL). Query and update robot reputation scores based on task completion history.

Robot Type Helpers - Pre-built helpers for Forklift, AMR, Cleaning, Hospital, Drone, and Robotic Arm robot types with type-specific capabilities.

Robot Types

The SDK provides specialized robot classes for different robot types:

ForkliftRobot - Material handling and warehouse operations. Capabilities include lifting, transport, stacking with configurable max weight and height.

AMRRobot - Autonomous Mobile Robot for navigation and delivery tasks. Supports path planning, obstacle avoidance, and payload management.

CleaningRobot - Area coverage and route optimization. Features include vacuum, mopping, and area mapping capabilities.

HospitalRobot - Medical transport and sterilization tasks. Specialized for healthcare environments with safety and compliance features.

DroneRobot - Flight routes and surveillance. Supports waypoint navigation, payload delivery, and aerial monitoring.

RoboticArm - Assembly and manipulation tasks. Precision control for pick-and-place operations and complex manipulation.

Wallet Management

Create and manage robot wallets:

typescript
// Create new wallet
const wallet = await sdk.wallet.create({
  storage: 'file',
  path: './wallet.json',
  encrypted: true,
});

// Load existing wallet
const loadedWallet = await sdk.wallet.load({
  storage: 'file',
  path: './wallet.json',
  password: 'your-password',
});

// Get wallet info
const info = wallet.getInfo();
console.log('Public Key:', info.publicKey);
console.log('Balance:', await wallet.getBalance());

// Generate x402 stealth address
const stealthAddress = await wallet.generateStealthAddress();

Payment Channels

Use FPR for efficient micropayments:

typescript
const fpr = forklift.getFPR();

// Open payment channel
const channel = await fpr.openChannel({
  peerRobotId: 'robot-002',
  collateral: 1000, // ROS tokens
});

// Send payment
await fpr.sendPayment({
  channelId: channel.id,
  amount: 50,
  metadata: { taskId: 'task-123' },
});

// Close channel
await fpr.closeChannel(channel.id);

Task Marketplace

Query and bid on tasks:

typescript
const marketplace = forklift.getMarketplace();

// Query available tasks
const tasks = await marketplace.queryTasks({
  type: 'material_handling',
  status: 'pending',
  maxResults: 10,
});

// Bid on a task
const bid = await marketplace.bid({
  taskId: tasks[0].id,
  bidAmount: 50,
  estimatedDuration: 300,
});

// Accept and execute task
if (bid.accepted) {
  await marketplace.acceptTask(tasks[0].id);
  await forklift.executeTask(tasks[0]);
  
  // Submit completion proof
  await marketplace.completeTask(tasks[0].id, {
    proof: generateZKProof(tasks[0]),
  });
}

Examples

Check out the examples directory in the SDK repository:

- Basic Robot - Basic SDK usage and initialization - Forklift Example - Forklift-specific capabilities and task handling - Bidding Example - Custom bidding strategies and task selection - Payment Channel Example - Payment channels and micropayments - AMR Example - Autonomous Mobile Robot navigation and delivery

All examples are available in the `examples/` directory of the SDK repository.