mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-11-17 01:37:54 +00:00
clean up
This commit is contained in:
parent
5b5ee30e41
commit
4d891e0f31
7 changed files with 29 additions and 217 deletions
|
@ -1368,7 +1368,7 @@ class EpicCashWallet extends CoinServiceAPI
|
|||
@override
|
||||
Future<void> recoverFromMnemonic({
|
||||
required String mnemonic,
|
||||
required String mnemonicPassphrase, // unused in epic
|
||||
String? mnemonicPassphrase, // unused in epic
|
||||
required int maxUnusedAddressGap,
|
||||
required int maxNumberOfIndexesToCheck,
|
||||
required int height,
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import 'package:bitcoindart/bitcoindart.dart';
|
||||
import 'package:decimal/decimal.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:hive/hive.dart';
|
||||
|
@ -40,56 +39,6 @@ void main() async {
|
|||
});
|
||||
});
|
||||
|
||||
group("bip32 node/root", () {
|
||||
test("getBip32Root", () {
|
||||
final root = getBip32Root(TEST_MNEMONIC, bitcoin);
|
||||
expect(root.toWIF(), ROOT_WIF);
|
||||
});
|
||||
|
||||
// test("getBip32NodeFromRoot", () {
|
||||
// final root = getBip32Root(TEST_MNEMONIC, bitcoin);
|
||||
// // two mainnet
|
||||
// final node44 = getBip32NodeFromRoot(0, 0, root, DerivePathType.bip44);
|
||||
// expect(node44.toWIF(), NODE_WIF_44);
|
||||
// final node49 = getBip32NodeFromRoot(0, 0, root, DerivePathType.bip49);
|
||||
// expect(node49.toWIF(), NODE_WIF_49);
|
||||
// // and one on testnet
|
||||
// final node84 = getBip32NodeFromRoot(
|
||||
// 0, 0, getBip32Root(TEST_MNEMONIC, testnet), DerivePathType.bip84);
|
||||
// expect(node84.toWIF(), NODE_WIF_84);
|
||||
// // a bad derive path
|
||||
// bool didThrow = false;
|
||||
// try {
|
||||
// getBip32NodeFromRoot(0, 0, root, null);
|
||||
// } catch (_) {
|
||||
// didThrow = true;
|
||||
// }
|
||||
// expect(didThrow, true);
|
||||
// // finally an invalid network
|
||||
// didThrow = false;
|
||||
// final invalidNetwork = NetworkType(
|
||||
// messagePrefix: '\x18hello world\n',
|
||||
// bech32: 'gg',
|
||||
// bip32: Bip32Type(public: 0x055521e, private: 0x055555),
|
||||
// pubKeyHash: 0x55,
|
||||
// scriptHash: 0x55,
|
||||
// wif: 0x00);
|
||||
// try {
|
||||
// getBip32NodeFromRoot(0, 0, getBip32Root(TEST_MNEMONIC, invalidNetwork),
|
||||
// DerivePathType.bip44);
|
||||
// } catch (_) {
|
||||
// didThrow = true;
|
||||
// }
|
||||
// expect(didThrow, true);
|
||||
// });
|
||||
|
||||
test("basic getBip32Node", () {
|
||||
final node =
|
||||
getBip32Node(0, 0, TEST_MNEMONIC, testnet, DerivePathType.bip84);
|
||||
expect(node.toWIF(), NODE_WIF_84);
|
||||
});
|
||||
});
|
||||
|
||||
group("validate testnet bitcoin addresses", () {
|
||||
MockElectrumX? client;
|
||||
MockCachedElectrumX? cachedClient;
|
||||
|
|
|
@ -40,50 +40,6 @@ void main() {
|
|||
});
|
||||
});
|
||||
|
||||
group("bip32 node/root", () {
|
||||
test("getBip32Root", () {
|
||||
final root = getBip32Root(TEST_MNEMONIC, dogecoin);
|
||||
expect(root.toWIF(), ROOT_WIF);
|
||||
});
|
||||
|
||||
// test("getBip32NodeFromRoot", () {
|
||||
// final root = getBip32Root(TEST_MNEMONIC, dogecoin);
|
||||
// // two mainnet
|
||||
// final node44 = getBip32NodeFromRoot(0, 0, root, DerivePathType.bip44);
|
||||
// expect(node44.toWIF(), NODE_WIF_44);
|
||||
//
|
||||
// // a bad derive path
|
||||
// bool didThrow = false;
|
||||
// try {
|
||||
// getBip32NodeFromRoot(0, 0, root, null);
|
||||
// } catch (_) {
|
||||
// didThrow = true;
|
||||
// }
|
||||
// expect(didThrow, true);
|
||||
// // finally an invalid network
|
||||
// didThrow = false;
|
||||
// final invalidNetwork = NetworkType(
|
||||
// messagePrefix: '\x18hello world\n',
|
||||
// bech32: 'gg',
|
||||
// bip32: Bip32Type(public: 0x055521e, private: 0x055555),
|
||||
// pubKeyHash: 0x55,
|
||||
// scriptHash: 0x55,
|
||||
// wif: 0x00);
|
||||
// try {
|
||||
// getBip32NodeFromRoot(0, 0, getBip32Root(TEST_MNEMONIC, invalidNetwork),
|
||||
// DerivePathType.bip44);
|
||||
// } catch (_) {
|
||||
// didThrow = true;
|
||||
// }
|
||||
// expect(didThrow, true);
|
||||
// });
|
||||
|
||||
test("basic getBip32Node", () {
|
||||
final node = getBip32Node(
|
||||
0, 0, TEST_MNEMONIC, dogecointestnet, DerivePathType.bip44);
|
||||
expect(node.toWIF(), NODE_WIF_44);
|
||||
});
|
||||
});
|
||||
|
||||
group("validate mainnet dogecoin addresses", () {
|
||||
MockElectrumX? client;
|
||||
|
|
|
@ -125,11 +125,13 @@ class FakeCoinServiceAPI extends CoinServiceAPI {
|
|||
Future<FeeObject> get fees => throw UnimplementedError();
|
||||
|
||||
@override
|
||||
Future<void> recoverFromMnemonic(
|
||||
{required String mnemonic,
|
||||
required int maxUnusedAddressGap,
|
||||
required int maxNumberOfIndexesToCheck,
|
||||
required int height}) {
|
||||
Future<void> recoverFromMnemonic({
|
||||
required String mnemonic,
|
||||
String? mnemonicPassphrase,
|
||||
required int maxUnusedAddressGap,
|
||||
required int maxNumberOfIndexesToCheck,
|
||||
required int height,
|
||||
}) {
|
||||
// TODO: implement recoverFromMnemonic
|
||||
throw UnimplementedError();
|
||||
}
|
||||
|
@ -167,4 +169,12 @@ class FakeCoinServiceAPI extends CoinServiceAPI {
|
|||
@override
|
||||
// TODO: implement utxos
|
||||
Future<List<UTXO>> get utxos => throw UnimplementedError();
|
||||
|
||||
@override
|
||||
// TODO: implement mnemonicPassphrase
|
||||
Future<String?> get mnemonicPassphrase => throw UnimplementedError();
|
||||
|
||||
@override
|
||||
// TODO: implement mnemonicString
|
||||
Future<String?> get mnemonicString => throw UnimplementedError();
|
||||
}
|
||||
|
|
|
@ -37,8 +37,8 @@ import 'sample_data/transaction_data_samples.dart';
|
|||
void main() {
|
||||
group("isolate functions", () {
|
||||
test("isolateDerive", () async {
|
||||
final result =
|
||||
await isolateDerive(IsolateDeriveParams.mnemonic, 0, 2, firoNetwork);
|
||||
final result = await isolateDerive(
|
||||
IsolateDeriveParams.mnemonic, "", 0, 2, firoNetwork);
|
||||
expect(result, isA<Map<String, dynamic>>());
|
||||
expect(result.toString(), IsolateDeriveParams.expected);
|
||||
});
|
||||
|
@ -71,6 +71,7 @@ void main() {
|
|||
|
||||
final message = await isolateRestore(
|
||||
TEST_MNEMONIC,
|
||||
"",
|
||||
Coin.firo,
|
||||
1,
|
||||
setData,
|
||||
|
@ -125,6 +126,7 @@ void main() {
|
|||
expect(
|
||||
() => isolateRestore(
|
||||
TEST_MNEMONIC,
|
||||
"",
|
||||
Coin.firo,
|
||||
1,
|
||||
setData,
|
||||
|
@ -140,6 +142,7 @@ void main() {
|
|||
"aNmsUtzPzQ3SKWNjEH48GacMQJXWN5Rotm",
|
||||
false,
|
||||
TEST_MNEMONIC,
|
||||
"",
|
||||
2,
|
||||
[],
|
||||
459185,
|
||||
|
@ -221,18 +224,6 @@ void main() {
|
|||
expect(firoTestNetwork.wif, 0xb9);
|
||||
});
|
||||
|
||||
test("getBip32Node", () {
|
||||
final node = getBip32Node(0, 3, Bip32TestParams.mnemonic, firoNetwork);
|
||||
expect(node.index, 3);
|
||||
expect(node.chainCode.toList(), Bip32TestParams.chainCodeList);
|
||||
expect(node.depth, 5);
|
||||
expect(node.toBase58(), Bip32TestParams.base58);
|
||||
expect(node.publicKey.toList(), Bip32TestParams.publicKeyList);
|
||||
expect(node.privateKey!.toList(), Bip32TestParams.privateKeyList);
|
||||
expect(node.parentFingerprint, Bip32TestParams.parentFingerprint);
|
||||
expect(node.fingerprint.toList(), Bip32TestParams.fingerprintList);
|
||||
});
|
||||
|
||||
// group("getJMintTransactions", () {
|
||||
// test(
|
||||
// "getJMintTransactions throws Error due to some invalid transactions passed to this function",
|
||||
|
@ -1187,7 +1178,10 @@ void main() {
|
|||
tracker: MockTransactionNotificationTracker(),
|
||||
);
|
||||
|
||||
await firo.fillAddresses(FillAddressesParams.mnemonic);
|
||||
await firo.fillAddresses(
|
||||
FillAddressesParams.mnemonic,
|
||||
"",
|
||||
);
|
||||
|
||||
final rcv = await secureStore.read(
|
||||
key: "${testWalletId}fillAddresses_receiveDerivations");
|
||||
|
@ -2898,7 +2892,10 @@ void main() {
|
|||
firo.timer = Timer(const Duration(), () {});
|
||||
|
||||
// build sending wallet
|
||||
await firo.fillAddresses(TEST_MNEMONIC);
|
||||
await firo.fillAddresses(
|
||||
TEST_MNEMONIC,
|
||||
"",
|
||||
);
|
||||
final wallet = await Hive.openBox<dynamic>("${testWalletId}send");
|
||||
|
||||
final rcv =
|
||||
|
|
|
@ -39,56 +39,6 @@ void main() {
|
|||
});
|
||||
});
|
||||
|
||||
group("bip32 node/root", () {
|
||||
test("getBip32Root", () {
|
||||
final root = getBip32Root(TEST_MNEMONIC, namecoin);
|
||||
expect(root.toWIF(), ROOT_WIF);
|
||||
});
|
||||
|
||||
// test("getBip32NodeFromRoot", () {
|
||||
// final root = getBip32Root(TEST_MNEMONIC, namecoin);
|
||||
// // two mainnet
|
||||
// final node44 = getBip32NodeFromRoot(0, 0, root, DerivePathType.bip44);
|
||||
// expect(node44.toWIF(), NODE_WIF_44);
|
||||
// final node49 = getBip32NodeFromRoot(0, 0, root, DerivePathType.bip49);
|
||||
// expect(node49.toWIF(), NODE_WIF_49);
|
||||
// // and one on testnet
|
||||
// final node84 = getBip32NodeFromRoot(
|
||||
// 0, 0, getBip32Root(TEST_MNEMONIC, testnet), DerivePathType.bip84);
|
||||
// expect(node84.toWIF(), NODE_WIF_84);
|
||||
// // a bad derive path
|
||||
// bool didThrow = false;
|
||||
// try {
|
||||
// getBip32NodeFromRoot(0, 0, root, null);
|
||||
// } catch (_) {
|
||||
// didThrow = true;
|
||||
// }
|
||||
// expect(didThrow, true);
|
||||
// // finally an invalid network
|
||||
// didThrow = false;
|
||||
// final invalidNetwork = NetworkType(
|
||||
// messagePrefix: '\x18hello world\n',
|
||||
// bech32: 'gg',
|
||||
// bip32: Bip32Type(public: 0x055521e, private: 0x055555),
|
||||
// pubKeyHash: 0x55,
|
||||
// scriptHash: 0x55,
|
||||
// wif: 0x00);
|
||||
// try {
|
||||
// getBip32NodeFromRoot(0, 0, getBip32Root(TEST_MNEMONIC, invalidNetwork),
|
||||
// DerivePathType.bip44);
|
||||
// } catch (_) {
|
||||
// didThrow = true;
|
||||
// }
|
||||
// expect(didThrow, true);
|
||||
// });
|
||||
|
||||
// test("basic getBip32Node", () {
|
||||
// final node =
|
||||
// getBip32Node(0, 0, TEST_MNEMONIC, testnet, DerivePathType.bip84);
|
||||
// expect(node.toWIF(), NODE_WIF_84);
|
||||
// });
|
||||
});
|
||||
|
||||
group("validate mainnet namecoin addresses", () {
|
||||
MockElectrumX? client;
|
||||
MockCachedElectrumX? cachedClient;
|
||||
|
|
|
@ -40,56 +40,6 @@ void main() {
|
|||
});
|
||||
});
|
||||
|
||||
group("bip32 node/root", () {
|
||||
test("getBip32Root", () {
|
||||
final root = getBip32Root(TEST_MNEMONIC, particl);
|
||||
expect(root.toWIF(), ROOT_WIF);
|
||||
});
|
||||
|
||||
// test("getBip32NodeFromRoot", () {
|
||||
// final root = getBip32Root(TEST_MNEMONIC, particl);
|
||||
// // two mainnet
|
||||
// final node44 = getBip32NodeFromRoot(0, 0, root, DerivePathType.bip44);
|
||||
// expect(node44.toWIF(), NODE_WIF_44);
|
||||
// final node49 = getBip32NodeFromRoot(0, 0, root, DerivePathType.bip49);
|
||||
// expect(node49.toWIF(), NODE_WIF_49);
|
||||
// // and one on testnet
|
||||
// final node84 = getBip32NodeFromRoot(
|
||||
// 0, 0, getBip32Root(TEST_MNEMONIC, testnet), DerivePathType.bip84);
|
||||
// expect(node84.toWIF(), NODE_WIF_84);
|
||||
// // a bad derive path
|
||||
// bool didThrow = false;
|
||||
// try {
|
||||
// getBip32NodeFromRoot(0, 0, root, null);
|
||||
// } catch (_) {
|
||||
// didThrow = true;
|
||||
// }
|
||||
// expect(didThrow, true);
|
||||
// // finally an invalid network
|
||||
// didThrow = false;
|
||||
// final invalidNetwork = NetworkType(
|
||||
// messagePrefix: '\x18hello world\n',
|
||||
// bech32: 'gg',
|
||||
// bip32: Bip32Type(public: 0x055521e, private: 0x055555),
|
||||
// pubKeyHash: 0x55,
|
||||
// scriptHash: 0x55,
|
||||
// wif: 0x00);
|
||||
// try {
|
||||
// getBip32NodeFromRoot(0, 0, getBip32Root(TEST_MNEMONIC, invalidNetwork),
|
||||
// DerivePathType.bip44);
|
||||
// } catch (_) {
|
||||
// didThrow = true;
|
||||
// }
|
||||
// expect(didThrow, true);
|
||||
// });
|
||||
//TODO Testnet not setup
|
||||
// test("basic getBip32Node", () {
|
||||
// final node =
|
||||
// getBip32Node(0, 0, TEST_MNEMONIC, testnet, DerivePathType.bip84);
|
||||
// expect(node.toWIF(), NODE_WIF_84);
|
||||
// });
|
||||
});
|
||||
|
||||
group("validate mainnet particl addresses", () {
|
||||
MockElectrumX? client;
|
||||
MockCachedElectrumX? cachedClient;
|
||||
|
|
Loading…
Reference in a new issue