Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
- name: Bootstrap Melos
run: melos bootstrap
- name: Check Formatting
run: melos exec -- dart format . --line-length=120 --set-exit-if-changed
run: melos exec -- dart format lib test --line-length=120 --set-exit-if-changed
- name: Clean Flutter projects
run: melos exec --concurrency=1 -- "flutter clean"
- name: Analyze
Expand Down
111 changes: 46 additions & 65 deletions melos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,82 +8,63 @@ ide:
intellij:
enabled: false

# Shared dependency versions across all packages
# Only path-based overrides go here. Melos 6.x propagates these to each
# package's pubspec_overrides.yaml during bootstrap. Hosted-package version
# pins must live in each package's own pubspec.yaml (melos doesn't propagate
# them for hosted packages).
dependency_overrides:
# Workspace packages - local paths
quantus_sdk:
path: ./quantus_sdk

# Polkadart ecosystem - latest versions
polkadart: ^0.7.1
polkadart_keyring: ^0.7.0
polkadart_cli: ^0.7.1

# Crypto and encoding - latest versions
bip39_mnemonic: ^3.0.9
crypto: ^3.0.6
ss58: ^1.3.1
convert: ^3.0.0

# HTTP and networking
http: ^1.4.0
connectivity_plus: ^7.0.0

# Storage and preferences
shared_preferences: ^2.5.2
flutter_secure_storage: ^10.1.0

# Math and utilities
decimal: ^3.2.2
quiver: ^3.1.0
hex: ^0.2.0
intl: ^0.20.2
path: ^1.9.1

# UI and Graphics (Flutter specific)
flutter_svg: ^2.2.0
qr_flutter: ^4.1.0
flash: ^3.1.1
cupertino_icons: ^1.0.6

# Mobile/Flutter specific
video_player: ^2.10.0
mobile_scanner: ^7.0.1
flutter_native_splash: ^2.4.7
flutter_launcher_icons: ^0.14.4
image_picker: ^1.1.2
permission_handler: ^12.0.1

# State management and architecture
provider: ^6.1.2
hooks_riverpod: ^2.5.0
flutter_hooks: ^0.21.2
go_router: ^15.2.0

# Notifications and UI feedback
another_flushbar: ^1.10.2

# Development and tooling
logger: ^2.5.0
path_provider: ^2.0.0

# Rust bridge
flutter_rust_bridge: ^2.11.1

# Dev dependencies - latest versions
flutter_lints: ^6.0.0
test: ^1.25.0
# Dependency placement convention:
#
# melos.yaml (this file)
# - Only path-based overrides for workspace packages (quantus_sdk).
#
# <package>/pubspec.yaml `dependencies`
# - Lists ONLY packages this package directly imports.
# - Every entry has an explicit ^X.Y.Z pin.
# - For deps shared across packages, keep versions aligned manually.
#
# <package>/pubspec.yaml `dev_dependencies`
# - Build/codegen/CLI tools (build_runner, polkadart_cli,
# flutter_native_splash, flutter_launcher_icons).
# - Lint/test tools (flutter_lints, mockito, custom_lint).
#
# Canonical shared versions (keep aligned across packages that declare them):
# polkadart ^0.7.3 # DO NOT UPDATE - newer versions are
# # incompatible with our ML-DSA signature
# # override, work completely differently,
# # and add no benefits.
# bip39_mnemonic ^4.0.1
# convert ^3.1.2
# http ^1.6.0
# shared_preferences ^2.5.5
# decimal ^3.2.4
# path ^1.9.1
# flutter_svg ^2.3.0
# flash ^3.1.1
# collection ^1.19.1
# telemetrydecksdk ^3.0.0
# flutter_lints ^6.0.0

scripts:
# Analyze all packages
# Analyze all packages (matches CI: flutter analyze with fatal infos)
analyze:
description: Analyze all packages in the workspace
run: melos exec -- dart analyze .
description: Analyze all packages in the workspace (matches CI)
run: melos exec --concurrency=1 -- "flutter analyze . --fatal-infos"

# Format all packages
format:
description: Format all packages in the workspace
run: melos exec -- dart format . --line-length=120
run: melos exec -- dart format lib test --line-length=120

# Auto-apply lint fixes, then format
fix:
description: Auto-apply lint fixes (dart fix), then format
run: |
melos exec --concurrency=1 -- "dart fix --apply"
melos exec -- "dart format lib test --line-length=120"

# Test all packages
test:
Expand Down
41 changes: 18 additions & 23 deletions miner-app/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1,28 +1,23 @@
# This file configures the analyzer, which statically analyzes Dart code to
# check for errors, warnings, and lints.
#
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
# invoked from the command line by running `flutter analyze`.

# The following line activates a set of recommended lints for Flutter apps,
# packages, and plugins designed to encourage good coding practices.
include: package:flutter_lints/flutter.yaml

formatter:
page_width: 120

linter:
# The lint rules applied to this project can be customized in the
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
# included above or to enable additional rules. A list of all available lints
# and their documentation is published at https://dart.dev/lints.
#
# Instead of disabling a lint rule for the entire project in the
# section below, it can also be suppressed for a single line of code
# or a specific dart file by using the `// ignore: name_of_lint` and
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
# producing the lint.
rules:
avoid_print: false # Uncomment to disable the `avoid_print` rule
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
- always_declare_return_types
- avoid_empty_else
- prefer_const_constructors
- prefer_final_fields
- prefer_single_quotes
- use_null_aware_elements

# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options
analyzer:
exclude:
- "**/*.g.dart"
- "**/*.freezed.dart"
errors:
avoid_print: ignore # print is the most reliable way to debug the app
missing_required_param: error
missing_return: error
must_be_immutable: error
8 changes: 4 additions & 4 deletions miner-app/lib/features/miner/miner_dashboard_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ class _MinerDashboardScreenState extends State<MinerDashboardScreen> {
SliverToBoxAdapter(
child: UpdateBanner(
updateProgress: _minerUpdateProgress,
version: _minerUpdateInfo.latestVersion ?? "undefined",
version: _minerUpdateInfo.latestVersion ?? 'undefined',
message: 'New miner binary available!',
onUpdate: _handleUpdateMiner,
),
Expand All @@ -295,14 +295,14 @@ class _MinerDashboardScreenState extends State<MinerDashboardScreen> {
child: UpdateBanner(
updateProgress: _nodeUpdateProgress,
backgroundColor: Colors.green.shade500,
version: _nodeUpdateInfo.latestVersion ?? "undefined",
version: _nodeUpdateInfo.latestVersion ?? 'undefined',
message: 'New node binary available!',
onUpdate: _handleUpdateNode,
),
),

// Custom app bar with glass effect
MinerAppBar(),
const MinerAppBar(),

// Main content
SliverPadding(
Expand All @@ -313,7 +313,7 @@ class _MinerDashboardScreenState extends State<MinerDashboardScreen> {

Center(
child: ConstrainedBox(
constraints: BoxConstraints(maxWidth: 400),
constraints: const BoxConstraints(maxWidth: 400),
child: SizedBox(
width: double.infinity,
child: MinerControls(
Expand Down
2 changes: 1 addition & 1 deletion miner-app/lib/features/miner/miner_status.dart
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ class _StatusBadgeState extends State<_StatusBadge> with TickerProviderStateMixi
? (Matrix4.identity()..rotateZ(_pulseAnimation.value))
: Matrix4.identity(),
child: RotationTransition(
turns: widget.config.isAnimated ? _rotationController : AlwaysStoppedAnimation(0),
turns: widget.config.isAnimated ? _rotationController : const AlwaysStoppedAnimation(0),
child: Icon(widget.config.icon, color: Colors.white, size: 18),
),
),
Expand Down
8 changes: 4 additions & 4 deletions miner-app/lib/features/settings/settings_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -438,11 +438,11 @@ class _SettingsScreenState extends State<SettingsScreen> {
builder: (context) => AlertDialog(
backgroundColor: const Color(0xFF1C1C1C),
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16)),
title: Row(
title: const Row(
children: [
Icon(Icons.shield_outlined, color: Colors.orange, size: 24),
const SizedBox(width: 12),
const Text('Inner Hash', style: TextStyle(color: Colors.white, fontSize: 18)),
SizedBox(width: 12),
Text('Inner Hash', style: TextStyle(color: Colors.white, fontSize: 18)),
],
),
content: SizedBox(
Expand All @@ -460,7 +460,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
),
child: Row(
children: [
Icon(Icons.warning_amber_rounded, color: Colors.orange, size: 20),
const Icon(Icons.warning_amber_rounded, color: Colors.orange, size: 20),
const SizedBox(width: 8),
Expanded(
child: Text(
Expand Down
38 changes: 19 additions & 19 deletions miner-app/lib/features/setup/node_setup_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ class _NodeSetupScreenState extends State<NodeSetupScreen> {
bool _isLoading = true;
bool _isDownloading = false;
double _downloadProgress = 0.0;
String _downloadProgressText = "";
String _currentDownloadingBinary = "";
String _downloadProgressText = '';
String _currentDownloadingBinary = '';

@override
void initState() {
Expand Down Expand Up @@ -60,7 +60,7 @@ class _NodeSetupScreenState extends State<NodeSetupScreen> {
_isLoading = true;
_isDownloading = true;
_downloadProgress = 0.0;
_downloadProgressText = "Starting downloads...";
_downloadProgressText = 'Starting downloads...';
});

try {
Expand All @@ -69,8 +69,8 @@ class _NodeSetupScreenState extends State<NodeSetupScreen> {
final nodeVersion = await BinaryManager.getLatestNodeVersion();

setState(() {
_currentDownloadingBinary = "Node Binary $nodeVersion";
_downloadProgressText = "Downloading Node Binary...";
_currentDownloadingBinary = 'Node Binary $nodeVersion';
_downloadProgressText = 'Downloading Node Binary...';
});

await BinaryManager.ensureNodeBinary(
Expand All @@ -80,10 +80,10 @@ class _NodeSetupScreenState extends State<NodeSetupScreen> {
if (progress.totalBytes > 0) {
_downloadProgress = progress.downloadedBytes / progress.totalBytes;
_downloadProgressText =
"Node: ${(progress.downloadedBytes / (1024 * 1024)).toStringAsFixed(2)} MB / ${(progress.totalBytes / (1024 * 1024)).toStringAsFixed(2)} MB";
'Node: ${(progress.downloadedBytes / (1024 * 1024)).toStringAsFixed(2)} MB / ${(progress.totalBytes / (1024 * 1024)).toStringAsFixed(2)} MB';
} else {
_downloadProgress = progress.downloadedBytes > 0 ? 1.0 : 0.0;
_downloadProgressText = progress.downloadedBytes > 0 ? "Node Downloaded" : "Downloading Node...";
_downloadProgressText = progress.downloadedBytes > 0 ? 'Node Downloaded' : 'Downloading Node...';
}
});
}
Expand All @@ -100,9 +100,9 @@ class _NodeSetupScreenState extends State<NodeSetupScreen> {
final minerVersion = await BinaryManager.getLatestMinerVersion();

setState(() {
_currentDownloadingBinary = "External Miner $minerVersion";
_currentDownloadingBinary = 'External Miner $minerVersion';
_downloadProgress = 0.0;
_downloadProgressText = "Downloading External Miner...";
_downloadProgressText = 'Downloading External Miner...';
});

await BinaryManager.ensureExternalMinerBinary(
Expand All @@ -112,10 +112,10 @@ class _NodeSetupScreenState extends State<NodeSetupScreen> {
if (progress.totalBytes > 0) {
_downloadProgress = progress.downloadedBytes / progress.totalBytes;
_downloadProgressText =
"Miner: ${(progress.downloadedBytes / (1024 * 1024)).toStringAsFixed(2)} MB / ${(progress.totalBytes / (1024 * 1024)).toStringAsFixed(2)} MB";
'Miner: ${(progress.downloadedBytes / (1024 * 1024)).toStringAsFixed(2)} MB / ${(progress.totalBytes / (1024 * 1024)).toStringAsFixed(2)} MB';
} else {
_downloadProgress = progress.downloadedBytes > 0 ? 1.0 : 0.0;
_downloadProgressText = progress.downloadedBytes > 0 ? "Miner Downloaded" : "Downloading Miner...";
_downloadProgressText = progress.downloadedBytes > 0 ? 'Miner Downloaded' : 'Downloading Miner...';
}
});
}
Expand All @@ -131,7 +131,7 @@ class _NodeSetupScreenState extends State<NodeSetupScreen> {
if (mounted) {
setState(() {
_isDownloading = false;
_downloadProgressText = "All binaries installed successfully!";
_downloadProgressText = 'All binaries installed successfully!';
});
}

Expand All @@ -143,7 +143,7 @@ class _NodeSetupScreenState extends State<NodeSetupScreen> {
setState(() {
_isLoading = false;
_isDownloading = false;
_downloadProgressText = "Error: ${e.toString()}";
_downloadProgressText = 'Error: ${e.toString()}';
});
}
if (mounted) {
Expand Down Expand Up @@ -198,23 +198,23 @@ class _NodeSetupScreenState extends State<NodeSetupScreen> {
const SizedBox(height: 16),
const Text('Mining Software Installed!', style: TextStyle(fontSize: 24, fontWeight: FontWeight.bold)),
const SizedBox(height: 8),
Column(
const Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(Icons.check, color: Colors.green, size: 20),
const SizedBox(width: 8),
const Text('Node Binary'),
SizedBox(width: 8),
Text('Node Binary'),
],
),
const SizedBox(height: 4),
SizedBox(height: 4),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(Icons.check, color: Colors.green, size: 20),
const SizedBox(width: 8),
const Text('External Miner'),
SizedBox(width: 8),
Text('External Miner'),
],
),
],
Expand Down
6 changes: 3 additions & 3 deletions miner-app/lib/src/services/binary_manager.dart
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ class BinaryManager {

static String _buildNodeDownloadUrl(String tag) {
final target = _targetTriple();
final extension = Platform.isWindows ? "zip" : "tar.gz";
final extension = Platform.isWindows ? 'zip' : 'tar.gz';
final asset = '$_binary-$tag-$target.$extension';
return 'https://github.com/$_repoOwner/$_repoName/releases/download/$tag/$asset';
}
Expand Down Expand Up @@ -329,7 +329,7 @@ class BinaryManager {

// Pick asset name
final target = _targetTriple();
final extension = Platform.isWindows ? "zip" : "tar.gz";
final extension = Platform.isWindows ? 'zip' : 'tar.gz';
final asset = '$_binary-$tag-$target.$extension';
final url = 'https://github.com/$_repoOwner/$_repoName/releases/download/$tag/$asset';

Expand Down Expand Up @@ -661,7 +661,7 @@ class BinaryManager {
}
}

static String _normalizeFilename(String file) => Platform.isWindows ? "$file.exe" : file;
static String _normalizeFilename(String file) => Platform.isWindows ? '$file.exe' : file;

static Future<Directory> _getCacheDir() async =>
Directory(p.join(await getQuantusHomeDirectoryPath(), 'bin')).create(recursive: true);
Expand Down
Loading
Loading