Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mocodesmo committed Jun 27, 2023
1 parent ca527c2 commit 51efe41
Show file tree
Hide file tree
Showing 6 changed files with 188 additions and 100 deletions.
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"request": "launch",
"type": "dart",
"args": [
"-v",
// "-v",
]
},
{
Expand Down
260 changes: 167 additions & 93 deletions integration_test/_other/creation_experiments_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand All @@ -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

Expand Down
2 changes: 1 addition & 1 deletion lib/_model/wallet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,7 @@ class Wallet with _$Wallet {
}

List<Transaction> getPendingTxs() {
return (transactions?.where((tx) => tx.timestamp == 0).toList() ?? []).toList();
return (transactions?.where((tx) => tx.timestamp == 0).toList().reversed ?? []).toList();
}

List<Transaction> getConfirmedTxs() {
Expand Down
10 changes: 6 additions & 4 deletions lib/import/bloc/import_cubit.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ class ImportWalletCubit extends Cubit<ImportState> {
required this.walletUpdate,
}) : super(
const ImportState(
words: [
...r2,
],
),
// words: [
// ...r2,
// ],
),
);

final Barcode barcode;
Expand Down Expand Up @@ -602,6 +602,8 @@ const r2 = [
'ugly',
];

const x1 = [];

const x = '''
1. arrive
2. term
Expand Down
2 changes: 1 addition & 1 deletion lib/settings/electrum.dart
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class NetworkButton extends StatelessWidget {
),
),
if (err.isNotEmpty)
BBText.body(
BBText.errorSmall(
err,
),
],
Expand Down
12 changes: 12 additions & 0 deletions lib/settings/page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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),
],
),
Expand Down

0 comments on commit 51efe41

Please sign in to comment.