synor/sdk/shared/schemas/rpc.json
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

205 lines
5.9 KiB
JSON

{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://synor.io/schemas/rpc.json",
"title": "Synor RPC SDK",
"description": "Blockchain RPC client for querying blocks, transactions, and chain state",
"$defs": {
"RpcConfig": {
"type": "object",
"allOf": [{ "$ref": "common.json#/$defs/SynorConfig" }],
"properties": {
"wsEndpoint": {
"type": "string",
"format": "uri",
"description": "WebSocket endpoint for subscriptions"
},
"network": {
"type": "string",
"enum": ["mainnet", "testnet"],
"default": "mainnet"
}
}
},
"BlockHeader": {
"type": "object",
"properties": {
"hash": { "$ref": "common.json#/$defs/BlockHash" },
"height": { "type": "integer", "minimum": 0 },
"version": { "type": "integer" },
"previousHash": { "$ref": "common.json#/$defs/BlockHash" },
"merkleRoot": { "type": "string" },
"timestamp": { "$ref": "common.json#/$defs/Timestamp" },
"difficulty": { "type": "string" },
"nonce": { "type": "integer" }
},
"required": ["hash", "height", "previousHash", "merkleRoot", "timestamp"]
},
"Block": {
"type": "object",
"allOf": [{ "$ref": "#/$defs/BlockHeader" }],
"properties": {
"transactions": {
"type": "array",
"items": { "$ref": "common.json#/$defs/TxHash" }
},
"size": { "type": "integer" },
"weight": { "type": "integer" },
"txCount": { "type": "integer" }
},
"required": ["transactions", "txCount"]
},
"TransactionStatus": {
"type": "string",
"enum": ["pending", "confirmed", "failed", "replaced"]
},
"Transaction": {
"type": "object",
"properties": {
"txid": { "$ref": "common.json#/$defs/TxHash" },
"blockHash": { "$ref": "common.json#/$defs/BlockHash" },
"blockHeight": { "type": "integer" },
"confirmations": { "type": "integer" },
"timestamp": { "$ref": "common.json#/$defs/Timestamp" },
"status": { "$ref": "#/$defs/TransactionStatus" },
"raw": { "type": "string" },
"size": { "type": "integer" },
"fee": { "$ref": "common.json#/$defs/Amount" },
"inputs": { "type": "array" },
"outputs": { "type": "array" }
},
"required": ["txid", "status"]
},
"GetBlockRequest": {
"type": "object",
"properties": {
"hash": { "$ref": "common.json#/$defs/BlockHash" },
"height": { "type": "integer" },
"includeTransactions": { "type": "boolean", "default": true }
},
"oneOf": [
{ "required": ["hash"] },
{ "required": ["height"] }
]
},
"GetTransactionRequest": {
"type": "object",
"properties": {
"txid": { "$ref": "common.json#/$defs/TxHash" }
},
"required": ["txid"]
},
"SendTransactionRequest": {
"type": "object",
"properties": {
"raw": { "type": "string", "description": "Hex-encoded signed transaction" }
},
"required": ["raw"]
},
"SendTransactionResponse": {
"type": "object",
"properties": {
"txid": { "$ref": "common.json#/$defs/TxHash" },
"accepted": { "type": "boolean" }
},
"required": ["txid", "accepted"]
},
"FeeEstimate": {
"type": "object",
"properties": {
"priority": { "$ref": "common.json#/$defs/Priority" },
"feeRate": { "$ref": "common.json#/$defs/Amount" },
"estimatedBlocks": { "type": "integer" }
},
"required": ["priority", "feeRate", "estimatedBlocks"]
},
"EstimateFeeRequest": {
"type": "object",
"properties": {
"priority": { "$ref": "common.json#/$defs/Priority" },
"targetBlocks": { "type": "integer", "minimum": 1, "maximum": 100 }
}
},
"ChainInfo": {
"type": "object",
"properties": {
"chain": { "type": "string" },
"network": { "type": "string" },
"height": { "type": "integer" },
"bestBlockHash": { "$ref": "common.json#/$defs/BlockHash" },
"difficulty": { "type": "string" },
"medianTime": { "$ref": "common.json#/$defs/Timestamp" },
"chainWork": { "type": "string" },
"syncing": { "type": "boolean" },
"syncProgress": { "type": "number", "minimum": 0, "maximum": 1 }
},
"required": ["chain", "network", "height", "bestBlockHash"]
},
"MempoolInfo": {
"type": "object",
"properties": {
"size": { "type": "integer" },
"bytes": { "type": "integer" },
"usage": { "type": "integer" },
"maxMempool": { "type": "integer" },
"minFee": { "$ref": "common.json#/$defs/Amount" }
},
"required": ["size", "bytes"]
},
"SubscriptionType": {
"type": "string",
"enum": ["blocks", "transactions", "address", "mempool"]
},
"SubscribeRequest": {
"type": "object",
"properties": {
"type": { "$ref": "#/$defs/SubscriptionType" },
"address": { "$ref": "common.json#/$defs/Address" }
},
"required": ["type"]
},
"Subscription": {
"type": "object",
"properties": {
"id": { "type": "string" },
"type": { "$ref": "#/$defs/SubscriptionType" },
"createdAt": { "$ref": "common.json#/$defs/Timestamp" }
},
"required": ["id", "type"]
},
"BlockNotification": {
"type": "object",
"properties": {
"type": { "const": "block" },
"block": { "$ref": "#/$defs/Block" }
},
"required": ["type", "block"]
},
"TransactionNotification": {
"type": "object",
"properties": {
"type": { "const": "transaction" },
"transaction": { "$ref": "#/$defs/Transaction" },
"address": { "$ref": "common.json#/$defs/Address" }
},
"required": ["type", "transaction"]
}
}
}