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

259 lines
6.6 KiB
JSON

{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://synor.io/schemas/storage.json",
"title": "Synor Storage SDK",
"description": "Decentralized storage, pinning, and content retrieval",
"$defs": {
"StorageConfig": {
"type": "object",
"allOf": [{ "$ref": "common.json#/$defs/SynorConfig" }],
"properties": {
"gateway": {
"type": "string",
"format": "uri",
"description": "IPFS gateway URL"
},
"pinningService": {
"type": "string",
"format": "uri",
"description": "Remote pinning service URL"
},
"chunkSize": {
"type": "integer",
"minimum": 262144,
"maximum": 1048576,
"default": 262144,
"description": "Chunk size in bytes for large files"
}
}
},
"ContentId": {
"$ref": "common.json#/$defs/ContentId"
},
"UploadOptions": {
"type": "object",
"properties": {
"pin": { "type": "boolean", "default": true },
"wrapWithDirectory": { "type": "boolean", "default": false },
"cidVersion": { "type": "integer", "enum": [0, 1], "default": 1 },
"hashAlgorithm": {
"type": "string",
"enum": ["sha2-256", "blake3"],
"default": "sha2-256"
},
"onProgress": {
"type": "string",
"description": "Callback function name for progress updates"
}
}
},
"UploadResponse": {
"type": "object",
"properties": {
"cid": { "$ref": "#/$defs/ContentId" },
"size": { "type": "integer" },
"name": { "type": "string" },
"hash": { "type": "string" }
},
"required": ["cid", "size"]
},
"DownloadOptions": {
"type": "object",
"properties": {
"offset": { "type": "integer", "minimum": 0 },
"length": { "type": "integer", "minimum": 1 },
"onProgress": {
"type": "string",
"description": "Callback function name for progress updates"
}
}
},
"PinStatus": {
"type": "string",
"enum": ["queued", "pinning", "pinned", "failed", "unpinned"]
},
"Pin": {
"type": "object",
"properties": {
"cid": { "$ref": "#/$defs/ContentId" },
"status": { "$ref": "#/$defs/PinStatus" },
"name": { "type": "string" },
"size": { "type": "integer" },
"createdAt": { "$ref": "common.json#/$defs/Timestamp" },
"expiresAt": { "$ref": "common.json#/$defs/Timestamp" },
"delegates": {
"type": "array",
"items": { "type": "string" }
}
},
"required": ["cid", "status"]
},
"PinRequest": {
"type": "object",
"properties": {
"cid": { "$ref": "#/$defs/ContentId" },
"name": { "type": "string" },
"duration": { "$ref": "common.json#/$defs/Duration" },
"origins": {
"type": "array",
"items": { "type": "string" }
}
},
"required": ["cid"]
},
"ListPinsRequest": {
"type": "object",
"properties": {
"status": {
"type": "array",
"items": { "$ref": "#/$defs/PinStatus" }
},
"match": {
"type": "string",
"enum": ["exact", "iexact", "partial", "ipartial"]
},
"name": { "type": "string" }
},
"allOf": [{ "$ref": "common.json#/$defs/PaginationParams" }]
},
"GatewayUrl": {
"type": "object",
"properties": {
"url": { "type": "string", "format": "uri" },
"cid": { "$ref": "#/$defs/ContentId" },
"path": { "type": "string" }
},
"required": ["url", "cid"]
},
"CarFile": {
"type": "object",
"properties": {
"version": { "type": "integer", "enum": [1, 2] },
"roots": {
"type": "array",
"items": { "$ref": "#/$defs/ContentId" }
},
"blocks": {
"type": "array",
"items": { "$ref": "#/$defs/CarBlock" }
},
"size": { "type": "integer" }
},
"required": ["version", "roots"]
},
"CarBlock": {
"type": "object",
"properties": {
"cid": { "$ref": "#/$defs/ContentId" },
"data": { "type": "string", "description": "Base64-encoded block data" },
"size": { "type": "integer" }
},
"required": ["cid", "data"]
},
"FileEntry": {
"type": "object",
"properties": {
"name": { "type": "string" },
"content": { "type": "string", "description": "Base64-encoded file content" },
"cid": { "$ref": "#/$defs/ContentId" }
},
"required": ["name"]
},
"DirectoryEntry": {
"type": "object",
"properties": {
"name": { "type": "string" },
"cid": { "$ref": "#/$defs/ContentId" },
"size": { "type": "integer" },
"type": {
"type": "string",
"enum": ["file", "directory"]
}
},
"required": ["name", "cid", "type"]
},
"CreateDirectoryRequest": {
"type": "object",
"properties": {
"files": {
"type": "array",
"items": { "$ref": "#/$defs/FileEntry" }
}
},
"required": ["files"]
},
"ListDirectoryRequest": {
"type": "object",
"properties": {
"cid": { "$ref": "#/$defs/ContentId" },
"path": { "type": "string" }
},
"required": ["cid"]
},
"ListDirectoryResponse": {
"type": "object",
"properties": {
"entries": {
"type": "array",
"items": { "$ref": "#/$defs/DirectoryEntry" }
},
"cid": { "$ref": "#/$defs/ContentId" }
},
"required": ["entries", "cid"]
},
"ImportCarRequest": {
"type": "object",
"properties": {
"car": { "type": "string", "description": "Base64-encoded CAR file" },
"pin": { "type": "boolean", "default": true }
},
"required": ["car"]
},
"ImportCarResponse": {
"type": "object",
"properties": {
"roots": {
"type": "array",
"items": { "$ref": "#/$defs/ContentId" }
},
"blocksImported": { "type": "integer" }
},
"required": ["roots", "blocksImported"]
},
"StorageStats": {
"type": "object",
"properties": {
"totalSize": { "type": "integer" },
"pinCount": { "type": "integer" },
"bandwidth": {
"type": "object",
"properties": {
"upload": { "type": "integer" },
"download": { "type": "integer" }
}
}
},
"required": ["totalSize", "pinCount"]
}
}
}