mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-21 06:18:42 +02:00
These chains were already disabled in availableWalletTypes (none of them
were getting created), but the source dirs and the codegen scaffolding
for them still lived in tree (~20K lines of dead Dart).
Surgery:
- Delete cw_decred/ cw_solana/ cw_tron/ cw_zano/ source trees
- Strip 5 generate*() function bodies from tool/configure.dart
(generateSolana, generateTron, generateZano, generateDecred,
generateZcash) plus their top-level imports, args, calls,
signatures, and conditional pubspec/walletTypes injection blocks.
configure.dart shrinks from 2134 to 1561 lines and dart analyze
is clean.
- Strip solana/tron secrets config + output paths from
tool/import_secrets_config.dart
- Delete scripts/{android,ios,macos}/build_decred.sh,
scripts/ios/build_zano{,_all}.sh
- Patch scripts/{android,ios,macos}/build_all.sh,
scripts/android/copy_monero_deps.sh, scripts/ios/setup.sh,
scripts/ios/gen_framework.sh to drop decred/zano steps
- Patch scripts/android/docker/build.sh + Dockerfile.final to drop the
decred Docker stage; delete scripts/android/docker/Dockerfile.decred
- Update .github/workflows/build-linux.yml comments to reflect the
remaining cw_* module list (evm, nano, bitcoin)
Note: WalletType.{solana,tron,zano,decred,zcash} enum values still live
in cw_core/lib/wallet_type.dart and there are dead switch cases in
lib/di.dart and lib/new-ui/pages/*.dart that reference them. Those
paths are unreachable (the enum values never get assigned to any wallet)
but cleaning them up is a separate hygiene pass.
68 lines
2.4 KiB
Dart
68 lines
2.4 KiB
Dart
import 'dart:convert';
|
|
import 'dart:io';
|
|
import 'utils/utils.dart';
|
|
|
|
const configPath = 'tool/.secrets-config.json';
|
|
const outputPath = 'lib/.secrets.g.dart';
|
|
|
|
const evmChainsConfigPath = 'tool/.evm-secrets-config.json';
|
|
const evmChainsOutputPath = 'cw_evm/lib/.secrets.g.dart';
|
|
|
|
const bitcoinConfigPath = 'tool/.bitcoin-secrets-config.json';
|
|
const bitcoinOutputPath = 'cw_bitcoin/lib/.secrets.g.dart';
|
|
|
|
const nanoConfigPath = 'tool/.nano-secrets-config.json';
|
|
const nanoOutputPath = 'cw_nano/lib/.secrets.g.dart';
|
|
|
|
Future<void> main(List<String> args) async => importSecretsConfig();
|
|
|
|
Future<void> importSecretsConfig() async {
|
|
final outputFile = File(outputPath);
|
|
final input = json.decode(File(configPath).readAsStringSync()) as Map<String, dynamic>;
|
|
final output = input.keys.fold('', (String acc, String val) => acc + generateConst(val, input));
|
|
|
|
final evmChainsOutputFile = File(evmChainsOutputPath);
|
|
final evmChainsInput =
|
|
json.decode(File(evmChainsConfigPath).readAsStringSync()) as Map<String, dynamic>;
|
|
final evmChainsOutput = evmChainsInput.keys
|
|
.fold('', (String acc, String val) => acc + generateConst(val, evmChainsInput));
|
|
|
|
final nanoOutputFile = File(nanoOutputPath);
|
|
final nanoInput = json.decode(File(nanoConfigPath).readAsStringSync()) as Map<String, dynamic>;
|
|
final nanoOutput =
|
|
nanoInput.keys.fold('', (String acc, String val) => acc + generateConst(val, nanoInput));
|
|
|
|
// Hash Wallet: upstream Cake declares bitcoinConfigPath/bitcoinOutputPath
|
|
// but never processes them, leaving cw_bitcoin/lib/.secrets.g.dart missing
|
|
// and the build broken on a fresh clone. Add it to the pipeline.
|
|
final bitcoinOutputFile = File(bitcoinOutputPath);
|
|
final bitcoinInput =
|
|
json.decode(File(bitcoinConfigPath).readAsStringSync()) as Map<String, dynamic>;
|
|
final bitcoinOutput =
|
|
bitcoinInput.keys.fold('', (String acc, String val) => acc + generateConst(val, bitcoinInput));
|
|
|
|
if (outputFile.existsSync()) {
|
|
await outputFile.delete();
|
|
}
|
|
|
|
await outputFile.writeAsString(output);
|
|
|
|
if (evmChainsOutputFile.existsSync()) {
|
|
await evmChainsOutputFile.delete();
|
|
}
|
|
|
|
await evmChainsOutputFile.writeAsString(evmChainsOutput);
|
|
|
|
if (nanoOutputFile.existsSync()) {
|
|
await nanoOutputFile.delete();
|
|
}
|
|
|
|
await nanoOutputFile.writeAsString(nanoOutput);
|
|
|
|
if (bitcoinOutputFile.existsSync()) {
|
|
await bitcoinOutputFile.delete();
|
|
}
|
|
|
|
await bitcoinOutputFile.writeAsString(bitcoinOutput);
|
|
}
|