synor/sdk/js
Gulshan Yadav 59a7123535 feat(sdk): implement Phase 1 SDKs for Wallet, RPC, and Storage
Implements comprehensive SDK support for three core services across
four programming languages (JavaScript/TypeScript, Python, Go, Rust).

## New SDKs

### Wallet SDK
- Key management (create, import, export)
- Transaction signing
- Message signing and verification
- Balance and UTXO queries
- Stealth address support

### RPC SDK
- Block and transaction queries
- Chain state information
- Fee estimation
- Mempool information
- WebSocket subscriptions for real-time updates

### Storage SDK
- Content upload and download
- Pinning operations
- CAR file support
- Directory management
- Gateway URL generation

## Shared Infrastructure

- JSON Schema definitions for all 11 services
- Common type definitions (Address, Amount, UTXO, etc.)
- Unified error handling patterns
- Builder patterns for configuration

## Package Updates

- JavaScript: Updated to @synor/sdk with module exports
- Python: Updated to synor-sdk with websockets dependency
- Go: Added gorilla/websocket dependency
- Rust: Added base64, urlencoding, multipart support

## Fixes

- Fixed Tensor Default trait implementation
- Fixed ProcessorType enum casing
2026-01-27 00:46:24 +05:30
..
src feat(sdk): implement Phase 1 SDKs for Wallet, RPC, and Storage 2026-01-27 00:46:24 +05:30
package.json feat(sdk): implement Phase 1 SDKs for Wallet, RPC, and Storage 2026-01-27 00:46:24 +05:30
README.md docs(sdk): add comprehensive documentation for all 12 SDKs 2026-01-11 18:05:03 +05:30

Synor Compute SDK for JavaScript/TypeScript

Access distributed heterogeneous compute at 90% cost reduction.

Installation

npm install synor-compute
# or
pnpm add synor-compute
# or
yarn add synor-compute

Quick Start

import { SynorCompute, Tensor } from 'synor-compute';

const client = new SynorCompute('your-api-key');

// Matrix multiplication on GPU
const a = Tensor.random([512, 512]);
const b = Tensor.random([512, 512]);
const result = await client.matmul(a, b, {
  precision: 'fp16',
  processor: 'gpu'
});

console.log(`Execution time: ${result.executionTimeMs}ms`);
console.log(`Cost: $${result.cost}`);

Tensor Operations

// Create tensors
const zeros = Tensor.zeros([3, 3]);
const ones = Tensor.ones([2, 2]);
const random = Tensor.random([10, 10]);
const randn = Tensor.randn([100]); // Normal distribution

// From array
const data = Tensor.from([1, 2, 3, 4, 5, 6], [2, 3]);

// Operations
const reshaped = data.reshape([3, 2]);
const transposed = data.transpose();

Matrix Operations

// Matrix multiplication
const result = await client.matmul(a, b, {
  precision: 'fp16',
  processor: 'gpu',
  strategy: 'speed'
});

// 2D Convolution
const conv = await client.conv2d(input, kernel, {
  stride: [1, 1],
  padding: [1, 1]
});

// Flash Attention
const attention = await client.attention(query, key, value, {
  numHeads: 8,
  flash: true
});

LLM Inference

// Single response
const response = await client.inference('llama-3-70b', 'Explain quantum computing', {
  maxTokens: 512,
  temperature: 0.7
});
console.log(response.result);

// Streaming response
for await (const chunk of client.inferenceStream('llama-3-70b', 'Write a poem')) {
  process.stdout.write(chunk);
}

Configuration

const client = new SynorCompute({
  apiKey: 'your-api-key',
  baseUrl: 'https://api.synor.io/compute/v1', // or localhost:17250 for local
  defaultProcessor: 'gpu',
  defaultPrecision: 'fp16',
  defaultStrategy: 'balanced',
  timeout: 30000,
  debug: false
});

Job Management

// Submit async job
const job = await client.submitJob('matmul', { a, b });

// Poll for status
const status = await client.getJobStatus(job.jobId);

// Cancel job
await client.cancelJob(job.jobId);

Error Handling

import { SynorError } from 'synor-compute';

try {
  const result = await client.matmul(a, b);
} catch (error) {
  if (error instanceof SynorError) {
    console.error(`API Error: ${error.message} (${error.statusCode})`);
  }
}

TypeScript Support

Full TypeScript support with exported types:

import type {
  Tensor,
  ProcessorType,
  Precision,
  BalancingStrategy,
  JobStatus,
  SynorConfig,
  MatMulOptions,
  InferenceOptions,
  JobResult
} from 'synor-compute';

Testing

npm test
# or
pnpm test

License

MIT