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
245 lines
7.1 KiB
JSON
245 lines
7.1 KiB
JSON
{
|
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
"$id": "https://synor.io/schemas/economics.json",
|
|
"title": "Synor Economics SDK",
|
|
"description": "Pricing, billing, staking, and reward management",
|
|
|
|
"$defs": {
|
|
"EconomicsConfig": {
|
|
"type": "object",
|
|
"allOf": [{ "$ref": "common.json#/$defs/SynorConfig" }]
|
|
},
|
|
|
|
"ServiceType": {
|
|
"type": "string",
|
|
"enum": ["compute", "storage", "hosting", "database", "rpc", "bridge", "mining"]
|
|
},
|
|
|
|
"UsageMetrics": {
|
|
"type": "object",
|
|
"properties": {
|
|
"service": { "$ref": "#/$defs/ServiceType" },
|
|
"computeSeconds": { "type": "number" },
|
|
"storageBytes": { "type": "integer" },
|
|
"bandwidthBytes": { "type": "integer" },
|
|
"requests": { "type": "integer" },
|
|
"gpuSeconds": { "type": "number" }
|
|
},
|
|
"required": ["service"]
|
|
},
|
|
|
|
"Price": {
|
|
"type": "object",
|
|
"properties": {
|
|
"amount": { "$ref": "common.json#/$defs/Amount" },
|
|
"currency": { "type": "string", "default": "SYNOR" },
|
|
"unit": { "type": "string" },
|
|
"breakdown": {
|
|
"type": "array",
|
|
"items": { "$ref": "#/$defs/PriceComponent" }
|
|
}
|
|
},
|
|
"required": ["amount", "currency"]
|
|
},
|
|
|
|
"PriceComponent": {
|
|
"type": "object",
|
|
"properties": {
|
|
"name": { "type": "string" },
|
|
"amount": { "$ref": "common.json#/$defs/Amount" },
|
|
"quantity": { "type": "number" },
|
|
"unitPrice": { "$ref": "common.json#/$defs/Amount" }
|
|
},
|
|
"required": ["name", "amount"]
|
|
},
|
|
|
|
"UsagePlan": {
|
|
"type": "object",
|
|
"properties": {
|
|
"services": {
|
|
"type": "array",
|
|
"items": { "$ref": "#/$defs/UsageMetrics" }
|
|
},
|
|
"period": { "$ref": "#/$defs/BillingPeriod" }
|
|
},
|
|
"required": ["services"]
|
|
},
|
|
|
|
"CostEstimate": {
|
|
"type": "object",
|
|
"properties": {
|
|
"total": { "$ref": "#/$defs/Price" },
|
|
"services": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "object",
|
|
"properties": {
|
|
"service": { "$ref": "#/$defs/ServiceType" },
|
|
"cost": { "$ref": "#/$defs/Price" }
|
|
}
|
|
}
|
|
},
|
|
"discounts": {
|
|
"type": "array",
|
|
"items": { "$ref": "#/$defs/AppliedDiscount" }
|
|
}
|
|
},
|
|
"required": ["total"]
|
|
},
|
|
|
|
"BillingPeriod": {
|
|
"type": "string",
|
|
"enum": ["hourly", "daily", "weekly", "monthly", "yearly"]
|
|
},
|
|
|
|
"Usage": {
|
|
"type": "object",
|
|
"properties": {
|
|
"period": { "$ref": "#/$defs/BillingPeriod" },
|
|
"startDate": { "$ref": "common.json#/$defs/Timestamp" },
|
|
"endDate": { "$ref": "common.json#/$defs/Timestamp" },
|
|
"services": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "object",
|
|
"properties": {
|
|
"service": { "$ref": "#/$defs/ServiceType" },
|
|
"metrics": { "$ref": "#/$defs/UsageMetrics" },
|
|
"cost": { "$ref": "#/$defs/Price" }
|
|
}
|
|
}
|
|
},
|
|
"total": { "$ref": "#/$defs/Price" }
|
|
},
|
|
"required": ["period", "startDate", "endDate", "total"]
|
|
},
|
|
|
|
"Invoice": {
|
|
"type": "object",
|
|
"properties": {
|
|
"id": { "type": "string" },
|
|
"period": { "$ref": "#/$defs/BillingPeriod" },
|
|
"startDate": { "$ref": "common.json#/$defs/Timestamp" },
|
|
"endDate": { "$ref": "common.json#/$defs/Timestamp" },
|
|
"amount": { "$ref": "#/$defs/Price" },
|
|
"status": {
|
|
"type": "string",
|
|
"enum": ["pending", "paid", "overdue", "cancelled"]
|
|
},
|
|
"paidAt": { "$ref": "common.json#/$defs/Timestamp" },
|
|
"txHash": { "$ref": "common.json#/$defs/TxHash" }
|
|
},
|
|
"required": ["id", "period", "amount", "status"]
|
|
},
|
|
|
|
"AccountBalance": {
|
|
"type": "object",
|
|
"properties": {
|
|
"available": { "$ref": "common.json#/$defs/Amount" },
|
|
"pending": { "$ref": "common.json#/$defs/Amount" },
|
|
"staked": { "$ref": "common.json#/$defs/Amount" },
|
|
"rewards": { "$ref": "common.json#/$defs/Amount" }
|
|
},
|
|
"required": ["available"]
|
|
},
|
|
|
|
"StakeRequest": {
|
|
"type": "object",
|
|
"properties": {
|
|
"amount": { "$ref": "common.json#/$defs/Amount" },
|
|
"duration": { "$ref": "common.json#/$defs/Duration" },
|
|
"validator": { "$ref": "common.json#/$defs/Address" }
|
|
},
|
|
"required": ["amount"]
|
|
},
|
|
|
|
"StakeReceipt": {
|
|
"type": "object",
|
|
"properties": {
|
|
"stakeId": { "type": "string" },
|
|
"txHash": { "$ref": "common.json#/$defs/TxHash" },
|
|
"amount": { "$ref": "common.json#/$defs/Amount" },
|
|
"startDate": { "$ref": "common.json#/$defs/Timestamp" },
|
|
"endDate": { "$ref": "common.json#/$defs/Timestamp" },
|
|
"estimatedApy": { "type": "number" }
|
|
},
|
|
"required": ["stakeId", "txHash", "amount"]
|
|
},
|
|
|
|
"UnstakeRequest": {
|
|
"type": "object",
|
|
"properties": {
|
|
"stakeId": { "type": "string" }
|
|
},
|
|
"required": ["stakeId"]
|
|
},
|
|
|
|
"UnstakeReceipt": {
|
|
"type": "object",
|
|
"properties": {
|
|
"txHash": { "$ref": "common.json#/$defs/TxHash" },
|
|
"amount": { "$ref": "common.json#/$defs/Amount" },
|
|
"rewards": { "$ref": "common.json#/$defs/Amount" },
|
|
"availableAt": { "$ref": "common.json#/$defs/Timestamp" }
|
|
},
|
|
"required": ["txHash", "amount"]
|
|
},
|
|
|
|
"Rewards": {
|
|
"type": "object",
|
|
"properties": {
|
|
"total": { "$ref": "common.json#/$defs/Amount" },
|
|
"claimed": { "$ref": "common.json#/$defs/Amount" },
|
|
"pending": { "$ref": "common.json#/$defs/Amount" },
|
|
"apy": { "type": "number" },
|
|
"breakdown": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "object",
|
|
"properties": {
|
|
"stakeId": { "type": "string" },
|
|
"amount": { "$ref": "common.json#/$defs/Amount" },
|
|
"period": { "type": "string" }
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"required": ["total", "claimed", "pending"]
|
|
},
|
|
|
|
"Discount": {
|
|
"type": "object",
|
|
"properties": {
|
|
"code": { "type": "string" },
|
|
"name": { "type": "string" },
|
|
"type": {
|
|
"type": "string",
|
|
"enum": ["percentage", "fixed", "volume", "loyalty", "referral"]
|
|
},
|
|
"value": { "$ref": "common.json#/$defs/Amount" },
|
|
"minSpend": { "$ref": "common.json#/$defs/Amount" },
|
|
"maxDiscount": { "$ref": "common.json#/$defs/Amount" },
|
|
"validUntil": { "$ref": "common.json#/$defs/Timestamp" },
|
|
"usesRemaining": { "type": "integer" }
|
|
},
|
|
"required": ["code", "name", "type", "value"]
|
|
},
|
|
|
|
"AppliedDiscount": {
|
|
"type": "object",
|
|
"properties": {
|
|
"discount": { "$ref": "#/$defs/Discount" },
|
|
"savedAmount": { "$ref": "common.json#/$defs/Amount" }
|
|
},
|
|
"required": ["discount", "savedAmount"]
|
|
},
|
|
|
|
"ApplyDiscountRequest": {
|
|
"type": "object",
|
|
"properties": {
|
|
"code": { "type": "string" }
|
|
},
|
|
"required": ["code"]
|
|
}
|
|
}
|
|
}
|