Phase 3 SDK expansion - Flutter/Dart implementations: - Database SDK: Multi-model database with Key-Value, Document, Vector, and Time Series stores - Hosting SDK: Decentralized web hosting with domain management, DNS, deployments, and SSL provisioning - Bridge SDK: Cross-chain asset transfers with lock-mint and burn-unlock patterns All SDKs follow consistent patterns with: - Async/await API using Futures - Proper error handling with typed exceptions - Configurable retry logic and timeouts - Full type safety with Dart's type system
88 lines
2.9 KiB
Dart
88 lines
2.9 KiB
Dart
/// Synor SDK for Flutter/Dart
|
|
///
|
|
/// A comprehensive SDK for the Synor blockchain platform including:
|
|
/// - **Compute**: Distributed heterogeneous computing
|
|
/// - **Wallet**: Key management and transaction signing
|
|
/// - **RPC**: Blockchain queries and subscriptions
|
|
/// - **Storage**: IPFS-compatible decentralized storage
|
|
/// - **Database**: Multi-model database (KV, Document, Vector, TimeSeries)
|
|
/// - **Hosting**: Decentralized web hosting
|
|
/// - **Bridge**: Cross-chain asset transfers
|
|
///
|
|
/// ## Quick Start
|
|
///
|
|
/// ```dart
|
|
/// import 'package:synor_sdk/synor_sdk.dart';
|
|
///
|
|
/// void main() async {
|
|
/// // Wallet operations
|
|
/// final wallet = SynorWallet(WalletConfig(apiKey: 'your-api-key'));
|
|
/// final result = await wallet.createWallet();
|
|
/// print('Wallet ID: ${result.wallet.id}');
|
|
///
|
|
/// // RPC queries
|
|
/// final rpc = SynorRpc(RpcConfig(apiKey: 'your-api-key'));
|
|
/// final block = await rpc.getLatestBlock();
|
|
/// print('Latest block: ${block.height}');
|
|
///
|
|
/// // Storage operations
|
|
/// final storage = SynorStorage(StorageConfig(apiKey: 'your-api-key'));
|
|
/// final data = utf8.encode('Hello, World!');
|
|
/// final upload = await storage.upload(Uint8List.fromList(data));
|
|
/// print('CID: ${upload.cid}');
|
|
///
|
|
/// // Database operations
|
|
/// final db = SynorDatabase(DatabaseConfig(apiKey: 'your-api-key'));
|
|
/// await db.kv.set('key', 'value');
|
|
///
|
|
/// // Hosting operations
|
|
/// final hosting = SynorHosting(HostingConfig(apiKey: 'your-api-key'));
|
|
/// final deployment = await hosting.deploy('Qm...');
|
|
///
|
|
/// // Bridge operations
|
|
/// final bridge = SynorBridge(BridgeConfig(apiKey: 'your-api-key'));
|
|
/// final transfer = await bridge.bridgeTo('SYNR', '1000', ChainId.ethereum, '0x...');
|
|
///
|
|
/// // Clean up
|
|
/// wallet.close();
|
|
/// rpc.close();
|
|
/// storage.close();
|
|
/// db.close();
|
|
/// hosting.close();
|
|
/// bridge.close();
|
|
/// }
|
|
/// ```
|
|
///
|
|
/// ## Naming Conventions
|
|
///
|
|
/// Some types have service-specific prefixes to avoid conflicts:
|
|
/// - Wallet: `Network`, `WalletType`, `Priority`
|
|
/// - RPC: `RpcNetwork`, `RpcPriority`, `RpcTransaction`
|
|
/// - Storage: `PinStatus`, `HashAlgorithm`, `EntryType`
|
|
/// - Compute: `Precision`, `ProcessorType`, `Priority` (as `ComputePriority`)
|
|
/// - Bridge: `ChainId`, `TransferStatus`, `TransferDirection`
|
|
library synor_sdk;
|
|
|
|
// Compute SDK - hide Priority to avoid conflict with Wallet
|
|
export 'synor_compute.dart' hide Priority;
|
|
|
|
// Wallet SDK
|
|
export 'src/wallet/synor_wallet.dart';
|
|
|
|
// RPC SDK
|
|
export 'src/rpc/synor_rpc.dart';
|
|
|
|
// Storage SDK
|
|
export 'src/storage/synor_storage.dart';
|
|
|
|
// Database SDK
|
|
export 'src/database/client.dart';
|
|
|
|
// Hosting SDK
|
|
export 'src/hosting/client.dart';
|
|
|
|
// Bridge SDK - hide types that conflict with other SDKs
|
|
export 'src/bridge/client.dart' hide FeeEstimate, SignedTransaction;
|
|
|
|
// Re-export Compute Priority with alias-friendly access
|
|
// Users can import compute directly for Priority: import 'package:synor_sdk/synor_compute.dart';
|