mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-18 05:51:34 +02:00
Upstream Cake declares bitcoinConfigPath + bitcoinOutputPath at the top of tool/import_secrets_config.dart but never references them in the function body. Result: every fresh clone runs 'dart run tool/generate_new_secrets.dart' and ends up with cw_evm/cw_solana/cw_tron/cw_nano/.secrets.g.dart populated but cw_bitcoin/lib/.secrets.g.dart still missing — and the Linux build fails on the cw_bitcoin import that needs breezApiKey. Plumb bitcoin into the pipeline the same way the others are. The bitcoin JSON config (tool/.bitcoin-secrets-config.json) only has breezApiKey today, which we populate as an empty string since Lightning is disabled.
97 lines
3.4 KiB
Dart
97 lines
3.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 solanaConfigPath = 'tool/.solana-secrets-config.json';
|
|
const solanaOutputPath = 'cw_solana/lib/.secrets.g.dart';
|
|
|
|
const tronConfigPath = 'tool/.tron-secrets-config.json';
|
|
const tronOutputPath = 'cw_tron/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 solanaOutputFile = File(solanaOutputPath);
|
|
final solanaInput =
|
|
json.decode(File(solanaConfigPath).readAsStringSync()) as Map<String, dynamic>;
|
|
final solanaOutput =
|
|
solanaInput.keys.fold('', (String acc, String val) => acc + generateConst(val, solanaInput));
|
|
|
|
final tronOutputFile = File(tronOutputPath);
|
|
final tronInput = json.decode(File(tronConfigPath).readAsStringSync()) as Map<String, dynamic>;
|
|
final tronOutput =
|
|
tronInput.keys.fold('', (String acc, String val) => acc + generateConst(val, tronInput));
|
|
|
|
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 (solanaOutputFile.existsSync()) {
|
|
await solanaOutputFile.delete();
|
|
}
|
|
|
|
await solanaOutputFile.writeAsString(solanaOutput);
|
|
|
|
if (tronOutputFile.existsSync()) {
|
|
await tronOutputFile.delete();
|
|
}
|
|
|
|
await tronOutputFile.writeAsString(tronOutput);
|
|
|
|
if (nanoOutputFile.existsSync()) {
|
|
await nanoOutputFile.delete();
|
|
}
|
|
|
|
await nanoOutputFile.writeAsString(nanoOutput);
|
|
|
|
if (bitcoinOutputFile.existsSync()) {
|
|
await bitcoinOutputFile.delete();
|
|
}
|
|
|
|
await bitcoinOutputFile.writeAsString(bitcoinOutput);
|
|
}
|