Zetrix Connect Wallet SDK
A Flutter package for integrating Zetrix blockchain wallet connectivity and operations.
Features
- Wallet Connection: Connect to Zetrix wallets via WebSocket
- Blockchain Operations: Interact with Zetrix blockchain
- QR Code Generation: Generate QR codes for wallet connections
- Secure Storage: Store session data securely using platform-specific secure storage
- Device Detection: Detect device information for platform-specific behavior
- Cryptographic Utilities: Hash functions and cryptographic operations
- App Linking: Launch external wallet applications
Getting Started
Prerequisites
- Flutter SDK (^3.0.0)
- Dart SDK (^3.0.0)
Installation
Add this to your package's pubspec.yaml file:
dependencies:
zetrix_connect_wallet_sdk: ^1.0.0
Then run:
flutter pub get
Android Configuration
Add the following permissions to your android/app/src/main/AndroidManifest.xml:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
For secure storage, ensure your app has the correct namespace in android/app/build.gradle:
android {
namespace "com.example.your_app"
// ...
}
Usage
Basic Wallet Connection
import 'package:zetrix_connect_wallet_sdk/zetrix_connect_wallet_sdk.dart';
void main() async {
// Initialize wallet connection
final walletConnect = ZetrixWalletConnect();
// Connect to wallet
await walletConnect.connect();
// Get session ID
final sessionId = await StorageUtils.getSessionId();
print('Session ID: $sessionId');
}
Blockchain Operations
import 'package:zetrix_connect_wallet_sdk/zetrix_connect_wallet_sdk.dart';
void performTransaction() {
final chainSdk = ChainSDK();
// Perform blockchain operations
chainSdk.someOperation();
}
QR Code Display
import 'package:zetrix_connect_wallet_sdk/zetrix_connect_wallet_sdk.dart';
void showQR(BuildContext context) {
ZetrixQrCode.showQrCode(context, 'your-data-here');
}
Secure Storage
import 'package:zetrix_connect_wallet_sdk/zetrix_connect_wallet_sdk.dart';
void storeData() async {
await StorageUtils.setAuthData('key', 'value');
final data = await StorageUtils.getAuthData('key');
print('Stored data: $data');
}
Device Information
import 'package:zetrix_connect_wallet_sdk/zetrix_connect_wallet_sdk.dart';
void getDeviceInfo() async {
final deviceInfo = await DeviceUtils.getDeviceInfo();
print('Device: ${deviceInfo['model']}');
}
Architecture
This package follows a modular architecture with the following structure:
src/core/: Core wallet connection and WebSocket managementsrc/blockchain/: Blockchain interaction utilitiessrc/utils/: Utility functions for crypto, storage, device detectionsrc/constants/: Application constantssrc/ui/: UI components like QR code displaysrc/navigation/: App linking and navigation utilities
For detailed architecture information, see ARCHITECTURE.md.
Contributing
Contributions are welcome! Please read our contributing guidelines and submit pull requests.
License
This project is licensed under the MIT License - see the LICENSE file for details.