- Implement SynorStorage class for decentralized storage operations including upload, download, pinning, and CAR file management. - Create supporting types and models for storage operations such as UploadOptions, Pin, and StorageConfig. - Implement SynorWallet class for wallet operations including wallet creation, address generation, transaction signing, and balance queries. - Create supporting types and models for wallet operations such as Wallet, Address, and Transaction. - Introduce error handling for both storage and wallet operations.
60 lines
1.9 KiB
Dart
60 lines
1.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
|
|
///
|
|
/// ## 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}');
|
|
///
|
|
/// // Clean up
|
|
/// wallet.close();
|
|
/// rpc.close();
|
|
/// storage.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`)
|
|
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';
|
|
|
|
// Re-export Compute Priority with alias-friendly access
|
|
// Users can import compute directly for Priority: import 'package:synor_sdk/synor_compute.dart';
|