diff --git a/.vscode/launch.json b/.vscode/launch.json index 17a99fb8..a5742e5d 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -9,7 +9,7 @@ "request": "launch", "type": "dart", "args": [ - "-v", + // "-v", ] }, { diff --git a/integration_test/_other/creation_experiments_test.dart b/integration_test/_other/creation_experiments_test.dart index ca85df94..70d27a5c 100644 --- a/integration_test/_other/creation_experiments_test.dart +++ b/integration_test/_other/creation_experiments_test.dart @@ -277,109 +277,185 @@ void main() { rethrow; } }); -} + testWidgets('T', (widgetTester) async { + try { + final words = [].join(' '); + final mne = await bdk.Mnemonic.fromString(words); -// external = await bdk.Descriptor.create( - // descriptor: wallet.externalDescriptor, - // network: bdk.Network.Testnet, - // ); - // internal = await bdk.Descriptor.create( - // descriptor: wallet.internalDescriptor, - // network: bdk.Network.Testnet, - // ); - - -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// + final descriptor = await bdk.DescriptorSecretKey.create( + network: bdk.Network.Bitcoin, + mnemonic: mne, + password: '', + ); + int bal = 0; + + for (var i = 0; i < 3; i++) { + late bdk.Descriptor internal; + late bdk.Descriptor external; + + if (i == 0) { + internal = await bdk.Descriptor.newBip49( + secretKey: descriptor, + network: bdk.Network.Bitcoin, + keychain: bdk.KeychainKind.Internal, + ); + + external = await bdk.Descriptor.newBip49( + secretKey: descriptor, + network: bdk.Network.Bitcoin, + keychain: bdk.KeychainKind.External, + ); + } + if (i == 1) { + internal = await bdk.Descriptor.newBip84( + secretKey: descriptor, + network: bdk.Network.Bitcoin, + keychain: bdk.KeychainKind.Internal, + ); + + external = await bdk.Descriptor.newBip84( + secretKey: descriptor, + network: bdk.Network.Bitcoin, + keychain: bdk.KeychainKind.External, + ); + } + if (i == 2) { + internal = await bdk.Descriptor.newBip44( + secretKey: descriptor, + network: bdk.Network.Bitcoin, + keychain: bdk.KeychainKind.Internal, + ); + + external = await bdk.Descriptor.newBip44( + secretKey: descriptor, + network: bdk.Network.Bitcoin, + keychain: bdk.KeychainKind.External, + ); + } + + final wallet = await bdk.Wallet.create( + descriptor: external, + changeDescriptor: internal, + network: bdk.Network.Bitcoin, + databaseConfig: const bdk.DatabaseConfig.memory(), + ); + + final electrum = await bdk.Blockchain.create( + config: const bdk.BlockchainConfig.electrum( + config: bdk.ElectrumConfig( + retry: 3, + stopGap: 20, + timeout: 5, + url: 'ssl://electrum.blockstream.info:50002', + validateDomain: true, + ), + ), + ); + + await wallet.sync(electrum); + + final balance = await wallet.getBalance(); + + bal += balance.total; + } + + expect(bal, isPositive); + } catch (e) { + print(e); + rethrow; + } + }); +} + +// external = await bdk.Descriptor.create( +// descriptor: wallet.externalDescriptor, +// network: bdk.Network.Testnet, +// ); +// internal = await bdk.Descriptor.create( +// descriptor: wallet.internalDescriptor, +// network: bdk.Network.Testnet, +// ); + +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// // BdkException.unExpected(e: called `Result::unwrap()` on an `Err` value: // Descriptor(HardenedDerivationXpub)) - - - // BdkException.miniscript(e: ")))) - // const _t1 = // 'tpubDC5phKKvZNyMBySbRhQW6t1AkutpvxpAbPacFw38eM2DpiMRZAUBXooGNaBUzVKsST56w1osYwEuRtmqsEpKw4fw8mYWm3jbsjMGnYrgbUz'; - - - - - - - // const _d1 = // "wpkh(tprv8ZgxMBicQKsPcthqtyCtGtGzJhWXNC5QwGek1GQMs9vxHFrqhfXzdL5tstUWjLfm8JNeY7TvG2PxrfY5F8edd1JLyXqb2e86JhG4icehVAy/84'/1'/0'/1/*)#7420nc5y"; @@ -395,8 +471,6 @@ void main() { // const _z1 = // 'zpub6qrjqR4sNQqcq3MbPTgNEQ33Dhz8VSU9G7o88FwKWpAMsoYbVbSMVxGtHx2829QkdMJCNrGuwEnF49KJAvXwkLQerAGmWEwpoQAQ7pMBFmV'; - - // //pkh([ddffda99/44'/1'/0']tpubDC5phKKvZNyMBySbRhQW6t1AkutpvxpAbPacFw38eM2DpiMRZAUBXooGNaBUzVKsST56w1osYwEuRtmqsEpKw4fw8mYWm3jbsjMGnYrgbUz/0/*)#23krdrn4 // // pkh([258ee68c/44'/1'/0']tpubDGkapRgaKKcdaEtBkHfcWBDsrUWh1Lubu7JWEyPdU3LTkJQmxMz6qKzWVcAuSNyWjRe7kJ9EVzk6BosPSP5GvfR6SuB913zP1jqUxsjBUsQ/0/*)#75nf0v7a diff --git a/lib/_model/wallet.dart b/lib/_model/wallet.dart index 1d72eae5..286118f6 100644 --- a/lib/_model/wallet.dart +++ b/lib/_model/wallet.dart @@ -565,7 +565,7 @@ class Wallet with _$Wallet { } List getPendingTxs() { - return (transactions?.where((tx) => tx.timestamp == 0).toList() ?? []).toList(); + return (transactions?.where((tx) => tx.timestamp == 0).toList().reversed ?? []).toList(); } List getConfirmedTxs() { diff --git a/lib/import/bloc/import_cubit.dart b/lib/import/bloc/import_cubit.dart index e1cf5576..1e25c394 100644 --- a/lib/import/bloc/import_cubit.dart +++ b/lib/import/bloc/import_cubit.dart @@ -24,10 +24,10 @@ class ImportWalletCubit extends Cubit { required this.walletUpdate, }) : super( const ImportState( - words: [ - ...r2, - ], - ), + // words: [ + // ...r2, + // ], + ), ); final Barcode barcode; @@ -602,6 +602,8 @@ const r2 = [ 'ugly', ]; +const x1 = []; + const x = ''' 1. arrive 2. term diff --git a/lib/settings/electrum.dart b/lib/settings/electrum.dart index 83700fb6..83163404 100644 --- a/lib/settings/electrum.dart +++ b/lib/settings/electrum.dart @@ -72,7 +72,7 @@ class NetworkButton extends StatelessWidget { ), ), if (err.isNotEmpty) - BBText.body( + BBText.errorSmall( err, ), ], diff --git a/lib/settings/page.dart b/lib/settings/page.dart index 9bf85c97..2371e6e3 100644 --- a/lib/settings/page.dart +++ b/lib/settings/page.dart @@ -10,6 +10,7 @@ import 'package:bb_mobile/settings/bloc/settings_cubit.dart'; import 'package:bb_mobile/settings/broadcast.dart'; import 'package:bb_mobile/settings/electrum.dart'; import 'package:bb_mobile/styles.dart'; +import 'package:extra_alignments/extra_alignments.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; @@ -62,6 +63,17 @@ class _Screen extends StatelessWidget { const Gap(8), const TestNetButton(), const NetworkButton(), + const Gap(8), + Divider( + color: context.colour.onBackground.withOpacity(0.2), + ), + const Gap(32), + const CenterLeft( + child: BBText.bodySmall( + 'Version 0.1.2', + isBold: true, + ), + ), const Gap(24), ], ),