This commit is contained in:
Rafael Saes 2024-02-29 17:11:09 -03:00
parent 0016d436f3
commit 03a865d3f6
12 changed files with 204 additions and 122 deletions

View file

@ -124,10 +124,9 @@ class BitcoinSilentPaymentAddressRecord extends BaseBitcoinAddressRecord {
super.balance = 0,
super.name = '',
super.isUsed = false,
required super.type,
required this.silentPaymentTweak,
required super.network,
});
}) : super(type: SilentPaymentsAddresType.p2sp);
factory BitcoinSilentPaymentAddressRecord.fromJSON(String jsonSource,
{BasedUtxoNetwork? network}) {
@ -141,18 +140,14 @@ class BitcoinSilentPaymentAddressRecord extends BaseBitcoinAddressRecord {
txCount: decoded['txCount'] as int? ?? 0,
name: decoded['name'] as String? ?? '',
balance: decoded['balance'] as int? ?? 0,
type: decoded['type'] != null && decoded['type'] != ''
? BitcoinAddressType.values
.firstWhere((type) => type.toString() == decoded['type'] as String)
: SegwitAddresType.p2wpkh,
network: (decoded['network'] as String?) == null
? network
: BasedUtxoNetwork.fromName(decoded['network'] as String),
silentPaymentTweak: decoded['silentPaymentTweak'] as String,
silentPaymentTweak: decoded['silentPaymentTweak'] as String?,
);
}
final String silentPaymentTweak;
final String? silentPaymentTweak;
@override
String toJSON() => json.encode({

View file

@ -32,7 +32,6 @@ abstract class BitcoinWalletBase extends ElectrumWallet with Store {
Map<String, int>? initialChangeAddressIndex,
List<BitcoinSilentPaymentAddressRecord>? initialSilentAddresses,
int initialSilentAddressIndex = 0,
SilentPaymentOwner? silentAddress,
}) : super(
mnemonic: mnemonic,
password: password,
@ -54,10 +53,13 @@ abstract class BitcoinWalletBase extends ElectrumWallet with Store {
initialChangeAddressIndex: initialChangeAddressIndex,
initialSilentAddresses: initialSilentAddresses,
initialSilentAddressIndex: initialSilentAddressIndex,
silentAddress: silentAddress,
mainHd: hd,
sideHd: bitcoin.HDWallet.fromSeed(seedBytes, network: networkType).derivePath("m/0'/1"),
network: networkParam ?? network,
masterHd: bitcoin.HDWallet.fromSeed(
seedBytes,
network: network == BitcoinNetwork.testnet ? bitcoin.testnet : bitcoin.bitcoin,
),
);
hasSilentPaymentsScanning = addressPageType == SilentPaymentsAddresType.p2sp.toString();
@ -97,16 +99,6 @@ abstract class BitcoinWalletBase extends ElectrumWallet with Store {
initialAddresses: initialAddresses,
initialSilentAddresses: initialSilentAddresses,
initialSilentAddressIndex: initialSilentAddressIndex,
silentAddress: await SilentPaymentOwner.fromPrivateKeys(
b_scan: ECPrivate.fromHex(bitcoin.HDWallet.fromSeed(
seedBytes,
network: network == BitcoinNetwork.testnet ? bitcoin.testnet : bitcoin.bitcoin,
).derivePath(SCAN_PATH).privKey!),
b_spend: ECPrivate.fromHex(bitcoin.HDWallet.fromSeed(
seedBytes,
network: network == BitcoinNetwork.testnet ? bitcoin.testnet : bitcoin.bitcoin,
).derivePath(SPEND_PATH).privKey!),
hrp: network == BitcoinNetwork.testnet ? 'tsp' : 'sp'),
initialBalance: initialBalance,
seedBytes: seedBytes,
initialRegularAddressIndex: initialRegularAddressIndex,
@ -134,16 +126,6 @@ abstract class BitcoinWalletBase extends ElectrumWallet with Store {
initialAddresses: snp.addresses,
initialSilentAddresses: snp.silentAddresses,
initialSilentAddressIndex: snp.silentAddressIndex,
silentAddress: await SilentPaymentOwner.fromPrivateKeys(
b_scan: ECPrivate.fromHex(bitcoin.HDWallet.fromSeed(
seedBytes,
network: snp.network == BitcoinNetwork.testnet ? bitcoin.testnet : bitcoin.bitcoin,
).derivePath(SCAN_PATH).privKey!),
b_spend: ECPrivate.fromHex(bitcoin.HDWallet.fromSeed(
seedBytes,
network: snp.network == BitcoinNetwork.testnet ? bitcoin.testnet : bitcoin.bitcoin,
).derivePath(SPEND_PATH).privKey!),
hrp: snp.network == BitcoinNetwork.testnet ? 'tsp' : 'sp'),
initialBalance: snp.balance,
seedBytes: seedBytes,
initialRegularAddressIndex: snp.regularAddressIndex,

View file

@ -20,7 +20,7 @@ abstract class BitcoinWalletAddressesBase extends ElectrumWalletAddresses with S
super.initialChangeAddressIndex,
super.initialSilentAddresses,
super.initialSilentAddressIndex = 0,
super.silentAddress,
super.masterHd,
}) : super(walletInfo);
@override

View file

@ -36,7 +36,7 @@ class ElectrumClient {
_tasks = {},
unterminatedString = '';
static const connectionTimeout = Duration(seconds: 5);
static const connectionTimeout = Duration(seconds: 30);
static const aliveTimerDuration = Duration(seconds: 4);
bool get isConnected => _isConnected;

View file

@ -11,13 +11,11 @@ part 'electrum_transaction_history.g.dart';
const transactionsHistoryFileName = 'transactions.json';
class ElectrumTransactionHistory = ElectrumTransactionHistoryBase
with _$ElectrumTransactionHistory;
class ElectrumTransactionHistory = ElectrumTransactionHistoryBase with _$ElectrumTransactionHistory;
abstract class ElectrumTransactionHistoryBase
extends TransactionHistoryBase<ElectrumTransactionInfo> with Store {
ElectrumTransactionHistoryBase(
{required this.walletInfo, required String password})
ElectrumTransactionHistoryBase({required this.walletInfo, required String password})
: _password = password,
_height = 0 {
transactions = ObservableMap<String, ElectrumTransactionInfo>();
@ -30,8 +28,7 @@ abstract class ElectrumTransactionHistoryBase
Future<void> init() async => await _load();
@override
void addOne(ElectrumTransactionInfo transaction) =>
transactions[transaction.id] = transaction;
void addOne(ElectrumTransactionInfo transaction) => transactions[transaction.id] = transaction;
@override
void addMany(Map<String, ElectrumTransactionInfo> transactions) =>
@ -40,13 +37,16 @@ abstract class ElectrumTransactionHistoryBase
@override
Future<void> save() async {
try {
final dirPath =
await pathForWalletDir(name: walletInfo.name, type: walletInfo.type);
final dirPath = await pathForWalletDir(name: walletInfo.name, type: walletInfo.type);
final path = '$dirPath/$transactionsHistoryFileName';
final data =
json.encode({'height': _height, 'transactions': transactions});
final txjson = {};
for (final tx in transactions.entries) {
txjson[tx.key] = tx.value.toJson();
}
final data = json.encode({'height': _height, 'transactions': txjson});
await writeData(path: path, password: _password, data: data);
} catch (e) {
} catch (e, s) {
print(s);
print('Error while save bitcoin transaction history: ${e.toString()}');
}
}
@ -57,8 +57,7 @@ abstract class ElectrumTransactionHistoryBase
}
Future<Map<String, dynamic>> _read() async {
final dirPath =
await pathForWalletDir(name: walletInfo.name, type: walletInfo.type);
final dirPath = await pathForWalletDir(name: walletInfo.name, type: walletInfo.type);
final path = '$dirPath/$transactionsHistoryFileName';
final content = await read(path: path, password: _password);
return json.decode(content) as Map<String, dynamic>;
@ -84,7 +83,5 @@ abstract class ElectrumTransactionHistoryBase
}
}
void _update(ElectrumTransactionInfo transaction) =>
transactions[transaction.id] = transaction;
void _update(ElectrumTransactionInfo transaction) => transactions[transaction.id] = transaction;
}

View file

@ -212,7 +212,7 @@ class ElectrumTransactionInfo extends TransactionInfo {
m['confirmations'] = confirmations;
m['fee'] = fee;
m['to'] = to;
m['unspent'] = unspents?.map((e) => e.toJson()) ?? [];
m['unspent'] = unspents?.map((e) => e.toJson()).toList() ?? [];
return m;
}

View file

@ -171,6 +171,7 @@ abstract class ElectrumWalletBase
@action
Future<void> _setListeners(int height, {int? chainTip}) async {
final currentChainTip = chainTip ?? await electrumClient.getCurrentBlockChainTip() ?? 0;
print(["AttemptingSyncStatus"]);
syncStatus = AttemptingSyncStatus();
if (_isolate != null) {
@ -179,11 +180,12 @@ abstract class ElectrumWalletBase
}
final receivePort = ReceivePort();
print(["_isolate"]);
_isolate = Isolate.spawn(
startRefresh,
ScanData(
sendPort: receivePort.sendPort,
primarySilentAddress: walletAddresses.primarySilentAddress!,
silentAddress: walletAddresses.silentAddress!,
network: network,
height: height,
chainTip: currentChainTip,
@ -245,24 +247,37 @@ abstract class ElectrumWalletBase
@override
Future<void> startSync() async {
try {
print(["attempting"]);
syncStatus = AttemptingSyncStatus();
if (hasSilentPaymentsScanning) {
print(["_setInitialHeight"]);
try {
await _setInitialHeight();
} catch (_) {}
} catch (e) {
print(["_setInitialHeight e ", e]);
}
print(["_setListeners", walletInfo.restoreHeight, currentChainTip]);
if ((currentChainTip ?? 0) > walletInfo.restoreHeight) {
_setListeners(walletInfo.restoreHeight, chainTip: currentChainTip);
}
}
print(["updateTransactions"]);
await updateTransactions();
print(["_subscribeForUpdates"]);
_subscribeForUpdates();
print(["updateUnspent"]);
await updateUnspent();
await updateBalance();
print(["updateBalance"]);
try {
await updateBalance();
} catch (_) {}
print(["_feeRates"]);
_feeRates = await electrumClient.feeRates(network: network);
print(["Timer.periodic"]);
Timer.periodic(
const Duration(minutes: 1), (timer) async => _feeRates = await electrumClient.feeRates());
@ -282,6 +297,7 @@ abstract class ElectrumWalletBase
syncStatus = ConnectingSyncStatus();
await electrumClient.connectToUri(node.uri);
electrumClient.onConnectionStatusChange = (bool isConnected) async {
print(["onConnectionStatusChange", isConnected]);
if (!isConnected) {
syncStatus = LostConnectionSyncStatus();
await electrumClient.close();
@ -291,7 +307,8 @@ abstract class ElectrumWalletBase
}
};
syncStatus = ConnectedSyncStatus();
} catch (e) {
} catch (e, stacktrace) {
print(stacktrace);
print(e.toString());
syncStatus = FailedSyncStatus();
}
@ -330,10 +347,10 @@ abstract class ElectrumWalletBase
ECPrivate? privkey;
if (utx.bitcoinAddressRecord is BitcoinSilentPaymentAddressRecord) {
privkey = walletAddresses.primarySilentAddress!.b_spend.clone().tweakAdd(
privkey = walletAddresses.silentAddress!.b_spend.clone().tweakAdd(
BigintUtils.fromBytes(BytesUtils.fromHexString(
(utx.bitcoinAddressRecord as BitcoinSilentPaymentAddressRecord)
.silentPaymentTweak)),
.silentPaymentTweak!)),
);
} else {
privkey = generateECPrivate(
@ -781,7 +798,8 @@ abstract class ElectrumWalletBase
if (keys.isNotEmpty) {
await unspentCoinsInfo.deleteAll(keys);
}
} catch (e) {
} catch (e, stacktrace) {
print(stacktrace);
print(e.toString());
}
}
@ -799,8 +817,7 @@ abstract class ElectrumWalletBase
(await http.get(Uri.parse("https://blockstream.info/testnet/api/tx/$hash/status"))).body);
time = status["block_time"] as int?;
final tip = await electrumClient.getCurrentBlockChainTip() ?? 0;
confirmations = tip - (status["block_height"] as int? ?? 0);
confirmations = currentChainTip! - (status["block_height"] as int? ?? 0);
} else {
final verboseTransaction = await electrumClient.getTransactionRaw(hash: hash);
@ -843,13 +860,13 @@ abstract class ElectrumWalletBase
try {
final Map<String, ElectrumTransactionInfo> historiesWithDetails = {};
final addressesSet = walletAddresses.allAddresses.map((addr) => addr.address).toSet();
final currentHeight = await electrumClient.getCurrentBlockChainTip() ?? 0;
currentChainTip ??= await electrumClient.getCurrentBlockChainTip() ?? 0;
await Future.wait(ADDRESS_TYPES.map((type) {
final addressesByType = walletAddresses.allAddresses.where((addr) => addr.type == type);
return Future.wait(addressesByType.map((addressRecord) async {
final history = await _fetchAddressHistory(addressRecord, addressesSet, currentHeight);
final history = await _fetchAddressHistory(addressRecord, addressesSet, currentChainTip!);
if (history.isNotEmpty) {
addressRecord.txCount = history.length;
@ -866,7 +883,7 @@ abstract class ElectrumWalletBase
matchedAddresses.toList(),
addressRecord.isHidden,
(address, addressesSet) =>
_fetchAddressHistory(address, addressesSet, currentHeight)
_fetchAddressHistory(address, addressesSet, currentChainTip!)
.then((history) => history.isNotEmpty ? address.address : null),
type: type);
}
@ -875,7 +892,8 @@ abstract class ElectrumWalletBase
}));
return historiesWithDetails;
} catch (e) {
} catch (e, stacktrace) {
print(stacktrace);
print(e.toString());
return {};
}
@ -925,7 +943,8 @@ abstract class ElectrumWalletBase
}
return historiesWithDetails;
} catch (e) {
} catch (e, stacktrace) {
print(stacktrace);
print(e.toString());
return {};
}
@ -933,13 +952,17 @@ abstract class ElectrumWalletBase
Future<void> updateTransactions() async {
try {
print(["_isTransactionUpdating"]);
if (_isTransactionUpdating) {
return;
}
_isTransactionUpdating = true;
print(["fetchTransactions"]);
await fetchTransactions();
print(["end fetchTransactions"]);
walletAddresses.updateReceiveAddresses();
print(["walletAddresses.updateReceiveAddresses() end"]);
_isTransactionUpdating = false;
} catch (e, stacktrace) {
print(stacktrace);
@ -957,11 +980,12 @@ abstract class ElectrumWalletBase
await updateUnspent();
await updateBalance();
await updateTransactions();
} catch (e, s) {
} catch (e, stacktrace) {
print(stacktrace);
print(e.toString());
_onError?.call(FlutterErrorDetails(
exception: e,
stack: s,
stack: stacktrace,
library: this.runtimeType.toString(),
));
}
@ -975,11 +999,12 @@ abstract class ElectrumWalletBase
final currentHeight = await electrumClient.getCurrentBlockChainTip();
if (currentHeight != null) walletInfo.restoreHeight = currentHeight;
_setListeners(walletInfo.restoreHeight, chainTip: currentHeight);
} catch (e, s) {
} catch (e, stacktrace) {
print(stacktrace);
print(e.toString());
_onError?.call(FlutterErrorDetails(
exception: e,
stack: s,
stack: stacktrace,
library: this.runtimeType.toString(),
));
}
@ -1064,16 +1089,18 @@ abstract class ElectrumWalletBase
}
Future<void> _setInitialHeight() async {
if (walletInfo.restoreHeight == 0) {
currentChainTip = await electrumClient.getCurrentBlockChainTip();
if (currentChainTip != null) walletInfo.restoreHeight = currentChainTip!;
}
print(["walletInfo.restoreHeight", walletInfo.restoreHeight]);
// if (walletInfo.restoreHeight == 0) {
currentChainTip = await electrumClient.getCurrentBlockChainTip();
print(["did _setInitialHeight", walletInfo.restoreHeight, currentChainTip]);
if (currentChainTip != null) walletInfo.restoreHeight = currentChainTip!;
// }
}
}
class ScanData {
final SendPort sendPort;
final SilentPaymentOwner primarySilentAddress;
final SilentPaymentOwner silentAddress;
final int height;
final String node;
final BasedUtxoNetwork network;
@ -1084,7 +1111,7 @@ class ScanData {
ScanData({
required this.sendPort,
required this.primarySilentAddress,
required this.silentAddress,
required this.height,
required this.node,
required this.network,
@ -1097,7 +1124,7 @@ class ScanData {
factory ScanData.fromHeight(ScanData scanData, int newHeight) {
return ScanData(
sendPort: scanData.sendPort,
primarySilentAddress: scanData.primarySilentAddress,
silentAddress: scanData.silentAddress,
height: newHeight,
node: scanData.node,
network: scanData.network,
@ -1117,6 +1144,7 @@ class SyncResponse {
}
Future<void> startRefresh(ScanData scanData) async {
print(["startRefresh"]);
var cachedBlockchainHeight = scanData.chainTip;
Future<ElectrumClient> connect() async {
@ -1153,6 +1181,7 @@ Future<void> startRefresh(ScanData scanData) async {
initialSyncHeight = syncHeight;
}
print(["lastKnownBlockHeight == syncHeight", lastKnownBlockHeight, syncHeight]);
if (lastKnownBlockHeight == syncHeight) {
scanData.sendPort.send(SyncResponse(currentChainTip, SyncedSyncStatus()));
return;
@ -1205,11 +1234,12 @@ Future<void> startRefresh(ScanData scanData) async {
final spb = SilentPaymentBuilder(receiverTweak: tweak);
final result = spb.scanOutputs(
scanData.primarySilentAddress.b_scan,
scanData.primarySilentAddress.B_spend,
scanData.silentAddress.b_scan,
scanData.silentAddress.B_spend,
output_pubkeys.map((output) => output.toString()).toList(),
precomputedLabels: scanData.labels,
);
print(result);
if (result.isEmpty) {
// no results tx, continue to next tx
@ -1226,15 +1256,12 @@ Future<void> startRefresh(ScanData scanData) async {
BitcoinUnspent? info;
await Future.forEach<Map<String, dynamic>>(listUnspent, (unspent) async {
try {
final addressRecord = BitcoinSilentPaymentAddressRecord(
address,
index: 0,
isHidden: true,
isUsed: true,
network: scanData.network,
silentPaymentTweak: t_k,
type: SegwitAddresType.p2tr,
);
final addressRecord = BitcoinSilentPaymentAddressRecord(address,
index: 0,
isHidden: true,
isUsed: true,
network: scanData.network,
silentPaymentTweak: t_k);
info = BitcoinUnspent.fromJSON(addressRecord, unspent);
} catch (_) {}
});
@ -1258,7 +1285,7 @@ Future<void> startRefresh(ScanData scanData) async {
isPending: false,
date: DateTime.now(),
confirmations: currentChainTip - syncHeight - 1,
to: scanData.primarySilentAddress.toString(),
to: scanData.silentAddress.toString(),
unspents: [tx],
);
@ -1310,7 +1337,6 @@ Future<void> startRefresh(ScanData scanData) async {
});
} catch (_) {}
}
// break;
// Finished scanning block, add 1 to height and continue to next block in loop
syncHeight += 1;

View file

@ -30,10 +30,9 @@ abstract class ElectrumWalletAddressesBase extends WalletAddresses with Store {
Map<String, int>? initialRegularAddressIndex,
Map<String, int>? initialChangeAddressIndex,
List<BitcoinSilentPaymentAddressRecord>? initialSilentAddresses,
int initialSilentAddressIndex = 0,
SilentPaymentOwner? silentAddress,
int initialSilentAddressIndex = 1,
bitcoin.HDWallet? masterHd,
}) : _addresses = ObservableList<BitcoinAddressRecord>.of((initialAddresses ?? []).toSet()),
primarySilentAddress = silentAddress,
addressesByReceiveType =
ObservableList<BaseBitcoinAddressRecord>.of((<BitcoinAddressRecord>[]).toSet()),
receiveAddresses = ObservableList<BitcoinAddressRecord>.of((initialAddresses ?? [])
@ -51,6 +50,17 @@ abstract class ElectrumWalletAddressesBase extends WalletAddresses with Store {
(initialSilentAddresses ?? []).toSet()),
currentSilentAddressIndex = initialSilentAddressIndex,
super(walletInfo) {
if (masterHd != null) {
silentAddress = SilentPaymentOwner.fromPrivateKeys(
b_scan: ECPrivate.fromHex(masterHd.derivePath(SCAN_PATH).privKey!),
b_spend: ECPrivate.fromHex(masterHd.derivePath(SPEND_PATH).privKey!),
hrp: network == BitcoinNetwork.testnet ? 'tsp' : 'sp');
if (silentAddresses.length == 0)
silentAddresses.add(BitcoinSilentPaymentAddressRecord(silentAddress.toString(),
index: 1, isHidden: false, name: "", silentPaymentTweak: null, network: network));
}
updateAddressesByMatch();
}
@ -70,7 +80,8 @@ abstract class ElectrumWalletAddressesBase extends WalletAddresses with Store {
final bitcoin.HDWallet mainHd;
final bitcoin.HDWallet sideHd;
final SilentPaymentOwner? primarySilentAddress;
@observable
SilentPaymentOwner? silentAddress;
@observable
BitcoinAddressType _addressPageType = SegwitAddresType.p2wpkh;
@ -92,7 +103,7 @@ abstract class ElectrumWalletAddressesBase extends WalletAddresses with Store {
return activeSilentAddress!;
}
return primarySilentAddress!.toString();
return silentAddress.toString();
}
String receiveAddress;
@ -123,7 +134,14 @@ abstract class ElectrumWalletAddressesBase extends WalletAddresses with Store {
@override
set address(String addr) {
if (addressPageType == SilentPaymentsAddresType.p2sp) {
activeSilentAddress = addr;
final selected = silentAddresses.firstWhere((addressRecord) => addressRecord.address == addr);
if (selected.silentPaymentTweak != null && silentAddress != null) {
activeSilentAddress =
silentAddress!.toLabeledSilentPaymentAddress(selected.index).toString();
} else {
activeSilentAddress = silentAddress!.toString();
}
return;
}
@ -225,27 +243,28 @@ abstract class ElectrumWalletAddressesBase extends WalletAddresses with Store {
for (int i = 0; i < silentAddresses.length; i++) {
final silentAddressRecord = silentAddresses[i];
final silentPaymentTweak = silentAddressRecord.silentPaymentTweak;
labels[G
.tweakMul(BigintUtils.fromBytes(BytesUtils.fromHexString(silentPaymentTweak)))
.toHex()] = silentPaymentTweak;
if (silentPaymentTweak != null)
labels[G
.tweakMul(BigintUtils.fromBytes(BytesUtils.fromHexString(silentPaymentTweak)))
.toHex()] = silentPaymentTweak;
}
return labels;
}
@action
BaseBitcoinAddressRecord generateNewAddress({String label = ''}) {
if (addressPageType == SilentPaymentsAddresType.p2sp) {
if (addressPageType == SilentPaymentsAddresType.p2sp && silentAddress != null) {
currentSilentAddressIndex += 1;
final address = BitcoinSilentPaymentAddressRecord(
primarySilentAddress!.toLabeledSilentPaymentAddress(currentSilentAddressIndex).toString(),
silentAddress!.toLabeledSilentPaymentAddress(currentSilentAddressIndex).toString(),
index: currentSilentAddressIndex,
isHidden: false,
name: label,
silentPaymentTweak:
BytesUtils.toHexString(primarySilentAddress!.generateLabel(currentSilentAddressIndex)),
BytesUtils.toHexString(silentAddress!.generateLabel(currentSilentAddressIndex)),
network: network,
type: SilentPaymentsAddresType.p2sp,
);
silentAddresses.add(address);

View file

@ -78,11 +78,9 @@ packages:
bitcoin_base:
dependency: "direct main"
description:
path: "."
ref: cake-update-v2
resolved-ref: "7634511b15e5a48bd18e3c19f81971628090c04f"
url: "https://github.com/cake-tech/bitcoin_base.git"
source: git
path: "/home/rafael/Working/bitcoin_base"
relative: false
source: path
version: "4.0.0"
bitcoin_flutter:
dependency: "direct main"
@ -96,11 +94,9 @@ packages:
blockchain_utils:
dependency: "direct main"
description:
path: "."
ref: cake-update-v1
resolved-ref: "6a0b891db4d90c647ebf5fc3a9132e614c70e1c6"
url: "https://github.com/cake-tech/blockchain_utils"
source: git
path: "/home/rafael/Working/blockchain_utils"
relative: false
source: path
version: "1.6.0"
boolean_selector:
dependency: transitive

View file

@ -31,13 +31,9 @@ dependencies:
unorm_dart: ^0.2.0
cryptography: ^2.0.5
bitcoin_base:
git:
url: https://github.com/cake-tech/bitcoin_base.git
ref: cake-update-v2
path: /home/rafael/Working/bitcoin_base
blockchain_utils:
git:
url: https://github.com/cake-tech/blockchain_utils
ref: cake-update-v1
path: /home/rafael/Working/blockchain_utils
dev_dependencies:
flutter_test:

View file

@ -30,13 +30,9 @@ dependencies:
url: https://github.com/cake-tech/bitbox-flutter.git
ref: master
bitcoin_base:
git:
url: https://github.com/cake-tech/bitcoin_base.git
ref: cake-update-v2
path: /home/rafael/Working/bitcoin_base
blockchain_utils:
git:
url: https://github.com/cake-tech/blockchain_utils
ref: cake-update-v1
path: /home/rafael/Working/blockchain_utils
dev_dependencies:
flutter_test:

View file

@ -0,0 +1,75 @@
#!/usr/bin/env fish
set APP_ANDROID_NAME ""
set APP_ANDROID_VERSION ""
set APP_ANDROID_BUILD_VERSION ""
set APP_ANDROID_ID ""
set APP_ANDROID_PACKAGE ""
set APP_ANDROID_SCHEME ""
set MONERO_COM "monero.com"
set CAKEWALLET "cakewallet"
set HAVEN "haven"
set -l TYPES $MONERO_COM $CAKEWALLET $HAVEN
set APP_ANDROID_TYPE $argv[1]
set MONERO_COM_NAME "Monero.com"
set MONERO_COM_VERSION "1.10.0"
set MONERO_COM_BUILD_NUMBER 72
set MONERO_COM_BUNDLE_ID "com.monero.app"
set MONERO_COM_PACKAGE "com.monero.app"
set MONERO_COM_SCHEME "monero.com"
set CAKEWALLET_NAME "Cake Wallet"
set CAKEWALLET_VERSION "4.13.0"
set CAKEWALLET_BUILD_NUMBER 189
set CAKEWALLET_BUNDLE_ID "com.cakewallet.cake_wallet"
set CAKEWALLET_PACKAGE "com.cakewallet.cake_wallet"
set CAKEWALLET_SCHEME "cakewallet"
set HAVEN_NAME "Haven"
set HAVEN_VERSION "1.0.0"
set HAVEN_BUILD_NUMBER 1
set HAVEN_BUNDLE_ID "com.cakewallet.haven"
set HAVEN_PACKAGE "com.cakewallet.haven"
if not contains $APP_ANDROID_TYPE $TYPES
echo "Wrong app type."
return 1
exit 1
end
switch $APP_ANDROID_TYPE
case $MONERO_COM
set APP_ANDROID_NAME $MONERO_COM_NAME
set APP_ANDROID_VERSION $MONERO_COM_VERSION
set APP_ANDROID_BUILD_NUMBER $MONERO_COM_BUILD_NUMBER
set APP_ANDROID_BUNDLE_ID $MONERO_COM_BUNDLE_ID
set APP_ANDROID_PACKAGE $MONERO_COM_PACKAGE
set APP_ANDROID_SCHEME $MONERO_COM_SCHEME
;;
case $CAKEWALLET
set APP_ANDROID_NAME $CAKEWALLET_NAME
set APP_ANDROID_VERSION $CAKEWALLET_VERSION
set APP_ANDROID_BUILD_NUMBER $CAKEWALLET_BUILD_NUMBER
set APP_ANDROID_BUNDLE_ID $CAKEWALLET_BUNDLE_ID
set APP_ANDROID_PACKAGE $CAKEWALLET_PACKAGE
set APP_ANDROID_SCHEME $CAKEWALLET_SCHEME
;;
case $HAVEN
set APP_ANDROID_NAME $HAVEN_NAME
set APP_ANDROID_VERSION $HAVEN_VERSION
set APP_ANDROID_BUILD_NUMBER $HAVEN_BUILD_NUMBER
set APP_ANDROID_BUNDLE_ID $HAVEN_BUNDLE_ID
set APP_ANDROID_PACKAGE $HAVEN_PACKAGE
;;
end
export APP_ANDROID_TYPE
export APP_ANDROID_NAME
export APP_ANDROID_VERSION
export APP_ANDROID_BUILD_NUMBER
export APP_ANDROID_BUNDLE_ID
export APP_ANDROID_PACKAGE
export APP_ANDROID_SCHEME