mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-03-12 09:27:01 +00:00
coin tests linter warnings and clean up
This commit is contained in:
parent
aafca9289d
commit
35f6ffd4fc
8 changed files with 417 additions and 477 deletions
|
@ -494,14 +494,14 @@ void main() async {
|
|||
test("get fees succeeds", () async {
|
||||
when(client?.ping()).thenAnswer((_) async => true);
|
||||
when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
"hosts": {},
|
||||
"hosts": <dynamic, dynamic>{},
|
||||
"pruning": null,
|
||||
"server_version": "Unit tests",
|
||||
"protocol_min": "1.4",
|
||||
"protocol_max": "1.4.2",
|
||||
"genesis_hash": GENESIS_HASH_TESTNET,
|
||||
"hash_function": "sha256",
|
||||
"services": []
|
||||
"services": <dynamic>[]
|
||||
});
|
||||
when(client?.estimateFee(blocks: 1))
|
||||
.thenAnswer((realInvocation) async => Decimal.zero);
|
||||
|
@ -527,14 +527,14 @@ void main() async {
|
|||
test("get fees fails", () async {
|
||||
when(client?.ping()).thenAnswer((_) async => true);
|
||||
when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
"hosts": {},
|
||||
"hosts": <dynamic, dynamic>{},
|
||||
"pruning": null,
|
||||
"server_version": "Unit tests",
|
||||
"protocol_min": "1.4",
|
||||
"protocol_max": "1.4.2",
|
||||
"genesis_hash": GENESIS_HASH_TESTNET,
|
||||
"hash_function": "sha256",
|
||||
"services": []
|
||||
"services": <dynamic>[]
|
||||
});
|
||||
when(client?.estimateFee(blocks: 1))
|
||||
.thenAnswer((realInvocation) async => Decimal.zero);
|
||||
|
@ -563,14 +563,14 @@ void main() async {
|
|||
// test("get maxFee", () async {
|
||||
// when(client?.ping()).thenAnswer((_) async => true);
|
||||
// when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
// "hosts": {},
|
||||
// "hosts": <dynamic, dynamic>{},
|
||||
// "pruning": null,
|
||||
// "server_version": "Unit tests",
|
||||
// "protocol_min": "1.4",
|
||||
// "protocol_max": "1.4.2",
|
||||
// "genesis_hash": GENESIS_HASH_TESTNET,
|
||||
// "hash_function": "sha256",
|
||||
// "services": []
|
||||
// "services": <dynamic>[]
|
||||
// });
|
||||
// when(client?.estimateFee(blocks: 20))
|
||||
// .thenAnswer((realInvocation) async => Decimal.zero);
|
||||
|
@ -657,7 +657,7 @@ void main() async {
|
|||
|
||||
// test("initializeWallet no network exception", () async {
|
||||
// when(client?.ping()).thenThrow(Exception("Network connection failed"));
|
||||
// final wallets = await Hive.openBox(testWalletId);
|
||||
// final wallets = await Hive.openBox<dynamic> (testWalletId);
|
||||
// expect(await btc?.initializeExisting(), false);
|
||||
// expect(secureStore?.interactions, 0);
|
||||
// verify(client?.ping()).called(1);
|
||||
|
@ -669,17 +669,17 @@ void main() async {
|
|||
test("initializeWallet mainnet throws bad network", () async {
|
||||
when(client?.ping()).thenAnswer((_) async => true);
|
||||
when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
"hosts": {},
|
||||
"hosts": <dynamic, dynamic>{},
|
||||
"pruning": null,
|
||||
"server_version": "Unit tests",
|
||||
"protocol_min": "1.4",
|
||||
"protocol_max": "1.4.2",
|
||||
"genesis_hash": GENESIS_HASH_TESTNET,
|
||||
"hash_function": "sha256",
|
||||
"services": []
|
||||
"services": <dynamic>[]
|
||||
});
|
||||
// await btc?.initializeNew();
|
||||
final wallets = await Hive.openBox<dynamic>(testWalletId);
|
||||
await Hive.openBox<dynamic>(testWalletId);
|
||||
|
||||
await expectLater(
|
||||
() => btc?.initializeExisting(), throwsA(isA<Exception>()))
|
||||
|
@ -695,20 +695,21 @@ void main() async {
|
|||
test("initializeWallet throws mnemonic overwrite exception", () async {
|
||||
when(client?.ping()).thenAnswer((_) async => true);
|
||||
when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
"hosts": {},
|
||||
"hosts": <dynamic, dynamic>{},
|
||||
"pruning": null,
|
||||
"server_version": "Unit tests",
|
||||
"protocol_min": "1.4",
|
||||
"protocol_max": "1.4.2",
|
||||
"genesis_hash": GENESIS_HASH_MAINNET,
|
||||
"hash_function": "sha256",
|
||||
"services": []
|
||||
"services": <dynamic>[]
|
||||
});
|
||||
await secureStore.write(
|
||||
key: "${testWalletId}_mnemonic", value: "some mnemonic");
|
||||
|
||||
final wallets = await Hive.openBox(testWalletId);
|
||||
expectLater(() => btc?.initializeExisting(), throwsA(isA<Exception>()))
|
||||
await Hive.openBox<dynamic>(testWalletId);
|
||||
await expectLater(
|
||||
() => btc?.initializeExisting(), throwsA(isA<Exception>()))
|
||||
.then((_) {
|
||||
expect(secureStore.interactions, 1);
|
||||
// verify(client?.ping()).called(1);
|
||||
|
@ -721,14 +722,14 @@ void main() async {
|
|||
// test("initializeWallet testnet throws bad network", () async {
|
||||
// when(client?.ping()).thenAnswer((_) async => true);
|
||||
// when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
// "hosts": {},
|
||||
// "hosts": <dynamic, dynamic>{},
|
||||
// "pruning": null,
|
||||
// "server_version": "Unit tests",
|
||||
// "protocol_min": "1.4",
|
||||
// "protocol_max": "1.4.2",
|
||||
// "genesis_hash": GENESIS_HASH_MAINNET,
|
||||
// "hash_function": "sha256",
|
||||
// "services": []
|
||||
// "services": <dynamic>[]
|
||||
// });
|
||||
//
|
||||
// btc = BitcoinWallet(
|
||||
|
@ -758,14 +759,14 @@ void main() async {
|
|||
// // .thenAnswer((realInvocation) async => Decimal.fromInt(10));
|
||||
// when(client?.ping()).thenAnswer((_) async => true);
|
||||
// when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
// "hosts": {},
|
||||
// "hosts": <dynamic, dynamic>{},
|
||||
// "pruning": null,
|
||||
// "server_version": "Unit tests",
|
||||
// "protocol_min": "1.4",
|
||||
// "protocol_max": "1.4.2",
|
||||
// "genesis_hash": GENESIS_HASH_MAINNET,
|
||||
// "hash_function": "sha256",
|
||||
// "services": []
|
||||
// "services": <dynamic>[]
|
||||
// });
|
||||
// expect(await btc?.initializeWallet(), true);
|
||||
//
|
||||
|
@ -779,7 +780,7 @@ void main() async {
|
|||
// expect(didThrow, true);
|
||||
//
|
||||
// // set node
|
||||
// final wallet = await Hive.openBox(testWalletId);
|
||||
// final wallet = await Hive.openBox<dynamic> (testWalletId);
|
||||
// await wallet.put("nodes", {
|
||||
// "default": {
|
||||
// "id": "some nodeID",
|
||||
|
@ -807,18 +808,18 @@ void main() async {
|
|||
// // .thenAnswer((realInvocation) async => Decimal.fromInt(10));
|
||||
// when(client?.ping()).thenAnswer((_) async => true);
|
||||
// when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
// "hosts": {},
|
||||
// "hosts": <dynamic, dynamic>{},
|
||||
// "pruning": null,
|
||||
// "server_version": "Unit tests",
|
||||
// "protocol_min": "1.4",
|
||||
// "protocol_max": "1.4.2",
|
||||
// "genesis_hash": GENESIS_HASH_MAINNET,
|
||||
// "hash_function": "sha256",
|
||||
// "services": []
|
||||
// "services": <dynamic>[]
|
||||
// });
|
||||
// expect(await btc?.initializeWallet(), true);
|
||||
//
|
||||
// final wallet = await Hive.openBox(testWalletId);
|
||||
// final wallet = await Hive.openBox<dynamic> (testWalletId);
|
||||
//
|
||||
// expect(await wallet.get("addressBookEntries"), {});
|
||||
// expect(await wallet.get('notes'), null);
|
||||
|
@ -892,20 +893,20 @@ void main() async {
|
|||
// when(client?.getBatchHistory(args: anyNamed("args")))
|
||||
// .thenAnswer((_) async => {});
|
||||
// when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
// "hosts": {},
|
||||
// "hosts": <dynamic, dynamic>{},
|
||||
// "pruning": null,
|
||||
// "server_version": "Unit tests",
|
||||
// "protocol_min": "1.4",
|
||||
// "protocol_max": "1.4.2",
|
||||
// "genesis_hash": GENESIS_HASH_MAINNET,
|
||||
// "hash_function": "sha256",
|
||||
// "services": []
|
||||
// "services": <dynamic>[]
|
||||
// });
|
||||
// // init new wallet
|
||||
// expect(await btc?.initializeWallet(), true);
|
||||
//
|
||||
// // fetch data to compare later
|
||||
// final newWallet = await Hive.openBox(testWalletId);
|
||||
// final newWallet = await Hive.openBox<dynamic> (testWalletId);
|
||||
//
|
||||
// final addressBookEntries = await newWallet.get("addressBookEntries");
|
||||
// final notes = await newWallet.get('notes');
|
||||
|
@ -964,7 +965,7 @@ void main() async {
|
|||
// expect(await btc?.initializeWallet(), true);
|
||||
//
|
||||
// // compare data to ensure state matches state of previously closed wallet
|
||||
// final wallet = await Hive.openBox(testWalletId);
|
||||
// final wallet = await Hive.openBox<dynamic> (testWalletId);
|
||||
//
|
||||
// expect(await wallet.get("addressBookEntries"), addressBookEntries);
|
||||
// expect(await wallet.get('notes'), notes);
|
||||
|
@ -1029,7 +1030,7 @@ void main() async {
|
|||
// // test("get fiatPrice", () async {
|
||||
// // // when(priceAPI.getBitcoinPrice(baseCurrency: "USD"))
|
||||
// // // .thenAnswer((realInvocation) async => Decimal.fromInt(10));
|
||||
// // await Hive.openBox(testWalletId);
|
||||
// // await Hive.openBox<dynamic> (testWalletId);
|
||||
// // expect(await btc.basePrice, Decimal.fromInt(10));
|
||||
// // verify(priceAPI.getBitcoinPrice(baseCurrency: "USD")).called(1);
|
||||
// // verifyNoMoreInteractions(client);
|
||||
|
@ -1050,14 +1051,14 @@ void main() async {
|
|||
// );
|
||||
// when(client?.ping()).thenAnswer((_) async => true);
|
||||
// when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
// "hosts": {},
|
||||
// "hosts": <dynamic, dynamic>{},
|
||||
// "pruning": null,
|
||||
// "server_version": "Unit tests",
|
||||
// "protocol_min": "1.4",
|
||||
// "protocol_max": "1.4.2",
|
||||
// "genesis_hash": GENESIS_HASH_TESTNET,
|
||||
// "hash_function": "sha256",
|
||||
// "services": []
|
||||
// "services": <dynamic>[]
|
||||
// });
|
||||
// await btc?.initializeWallet();
|
||||
// expect(
|
||||
|
@ -1092,14 +1093,14 @@ void main() async {
|
|||
// );
|
||||
// when(client?.ping()).thenAnswer((_) async => true);
|
||||
// when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
// "hosts": {},
|
||||
// "hosts": <dynamic, dynamic>{},
|
||||
// "pruning": null,
|
||||
// "server_version": "Unit tests",
|
||||
// "protocol_min": "1.4",
|
||||
// "protocol_max": "1.4.2",
|
||||
// "genesis_hash": GENESIS_HASH_TESTNET,
|
||||
// "hash_function": "sha256",
|
||||
// "services": []
|
||||
// "services": <dynamic>[]
|
||||
// });
|
||||
// await btc?.initializeWallet();
|
||||
// final addresses = await btc?.allOwnAddresses;
|
||||
|
@ -1130,14 +1131,14 @@ void main() async {
|
|||
// );
|
||||
// when(client?.ping()).thenAnswer((_) async => true);
|
||||
// when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
// "hosts": {},
|
||||
// "hosts": <dynamic, dynamic>{},
|
||||
// "pruning": null,
|
||||
// "server_version": "Unit tests",
|
||||
// "protocol_min": "1.4",
|
||||
// "protocol_max": "1.4.2",
|
||||
// "genesis_hash": GENESIS_HASH_TESTNET,
|
||||
// "hash_function": "sha256",
|
||||
// "services": []
|
||||
// "services": <dynamic>[]
|
||||
// });
|
||||
//
|
||||
// when(client?.getBatchUTXOs(args: anyNamed("args")))
|
||||
|
@ -1242,14 +1243,14 @@ void main() async {
|
|||
// );
|
||||
// when(client?.ping()).thenAnswer((_) async => true);
|
||||
// when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
// "hosts": {},
|
||||
// "hosts": <dynamic, dynamic>{},
|
||||
// "pruning": null,
|
||||
// "server_version": "Unit tests",
|
||||
// "protocol_min": "1.4",
|
||||
// "protocol_max": "1.4.2",
|
||||
// "genesis_hash": GENESIS_HASH_TESTNET,
|
||||
// "hash_function": "sha256",
|
||||
// "services": []
|
||||
// "services": <dynamic>[]
|
||||
// });
|
||||
//
|
||||
// when(client?.getBatchUTXOs(args: anyNamed("args")))
|
||||
|
@ -1307,14 +1308,14 @@ void main() async {
|
|||
// );
|
||||
// when(client?.ping()).thenAnswer((_) async => true);
|
||||
// when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
// "hosts": {},
|
||||
// "hosts": <dynamic, dynamic>{},
|
||||
// "pruning": null,
|
||||
// "server_version": "Unit tests",
|
||||
// "protocol_min": "1.4",
|
||||
// "protocol_max": "1.4.2",
|
||||
// "genesis_hash": GENESIS_HASH_TESTNET,
|
||||
// "hash_function": "sha256",
|
||||
// "services": []
|
||||
// "services": <dynamic>[]
|
||||
// });
|
||||
//
|
||||
// when(client?.getBatchUTXOs(args: anyNamed("args")))
|
||||
|
@ -1352,14 +1353,14 @@ void main() async {
|
|||
// );
|
||||
// when(client?.ping()).thenAnswer((_) async => true);
|
||||
// when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
// "hosts": {},
|
||||
// "hosts": <dynamic, dynamic>{},
|
||||
// "pruning": null,
|
||||
// "server_version": "Unit tests",
|
||||
// "protocol_min": "1.4",
|
||||
// "protocol_max": "1.4.2",
|
||||
// "genesis_hash": GENESIS_HASH_TESTNET,
|
||||
// "hash_function": "sha256",
|
||||
// "services": []
|
||||
// "services": <dynamic>[]
|
||||
// });
|
||||
// await btc?.initializeWallet();
|
||||
//
|
||||
|
@ -1468,14 +1469,14 @@ void main() async {
|
|||
// test("_checkCurrentReceivingAddressesForTransactions succeeds", () async {
|
||||
// when(client?.ping()).thenAnswer((_) async => true);
|
||||
// when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
// "hosts": {},
|
||||
// "hosts": <dynamic, dynamic>{},
|
||||
// "pruning": null,
|
||||
// "server_version": "Unit tests",
|
||||
// "protocol_min": "1.4",
|
||||
// "protocol_max": "1.4.2",
|
||||
// "genesis_hash": GENESIS_HASH_MAINNET,
|
||||
// "hash_function": "sha256",
|
||||
// "services": []
|
||||
// "services": <dynamic>[]
|
||||
// });
|
||||
// when(client?.getHistory(scripthash: anyNamed("scripthash")))
|
||||
// .thenAnswer((realInvocation) async => [
|
||||
|
@ -1517,18 +1518,18 @@ void main() async {
|
|||
// test("_checkCurrentReceivingAddressesForTransactions fails", () async {
|
||||
// when(client?.ping()).thenAnswer((_) async => true);
|
||||
// when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
// "hosts": {},
|
||||
// "hosts": <dynamic, dynamic>{},
|
||||
// "pruning": null,
|
||||
// "server_version": "Unit tests",
|
||||
// "protocol_min": "1.4",
|
||||
// "protocol_max": "1.4.2",
|
||||
// "genesis_hash": GENESIS_HASH_MAINNET,
|
||||
// "hash_function": "sha256",
|
||||
// "services": []
|
||||
// "services": <dynamic>[]
|
||||
// });
|
||||
// when(client?.getHistory(scripthash: anyNamed("scripthash")))
|
||||
// .thenThrow(Exception("some exception"));
|
||||
// final wallet = await Hive.openBox(testWalletId);
|
||||
// final wallet = await Hive.openBox<dynamic> (testWalletId);
|
||||
//
|
||||
// await btc?.initializeNew();
|
||||
// await btc?.initializeExisting();
|
||||
|
@ -1557,14 +1558,14 @@ void main() async {
|
|||
// test("_checkCurrentChangeAddressesForTransactions succeeds", () async {
|
||||
// when(client?.ping()).thenAnswer((_) async => true);
|
||||
// when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
// "hosts": {},
|
||||
// "hosts": <dynamic, dynamic>{},
|
||||
// "pruning": null,
|
||||
// "server_version": "Unit tests",
|
||||
// "protocol_min": "1.4",
|
||||
// "protocol_max": "1.4.2",
|
||||
// "genesis_hash": GENESIS_HASH_MAINNET,
|
||||
// "hash_function": "sha256",
|
||||
// "services": []
|
||||
// "services": <dynamic>[]
|
||||
// });
|
||||
// when(client?.getHistory(scripthash: anyNamed("scripthash")))
|
||||
// .thenAnswer((realInvocation) async => [
|
||||
|
@ -1606,14 +1607,14 @@ void main() async {
|
|||
// test("_checkCurrentChangeAddressesForTransactions fails", () async {
|
||||
// when(client?.ping()).thenAnswer((_) async => true);
|
||||
// when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
// "hosts": {},
|
||||
// "hosts": <dynamic, dynamic>{},
|
||||
// "pruning": null,
|
||||
// "server_version": "Unit tests",
|
||||
// "protocol_min": "1.4",
|
||||
// "protocol_max": "1.4.2",
|
||||
// "genesis_hash": GENESIS_HASH_MAINNET,
|
||||
// "hash_function": "sha256",
|
||||
// "services": []
|
||||
// "services": <dynamic>[]
|
||||
// });
|
||||
// when(client?.getHistory(scripthash: anyNamed("scripthash")))
|
||||
// .thenThrow(Exception("some exception"));
|
||||
|
@ -1689,7 +1690,7 @@ void main() async {
|
|||
//
|
||||
// secureStore: secureStore,
|
||||
// );
|
||||
// final wallet = await Hive.openBox(testWalletId);
|
||||
// final wallet = await Hive.openBox<dynamic> (testWalletId);
|
||||
// await wallet.put('receivingAddressesP2PKH', []);
|
||||
// await wallet.put('receivingAddressesP2SH', [
|
||||
// "2Mv83bPh2HzPRXptuQg9ejbKpSp87Zi52zT",
|
||||
|
@ -1827,7 +1828,7 @@ void main() async {
|
|||
//
|
||||
// secureStore: secureStore,
|
||||
// );
|
||||
// final wallet = await Hive.openBox(testWalletId);
|
||||
// final wallet = await Hive.openBox<dynamic> (testWalletId);
|
||||
// await wallet.put('receivingAddressesP2PKH', []);
|
||||
// await wallet.put('receivingAddressesP2SH', [
|
||||
// "2Mv83bPh2HzPRXptuQg9ejbKpSp87Zi52zT",
|
||||
|
@ -1968,7 +1969,7 @@ void main() async {
|
|||
//
|
||||
// secureStore: secureStore,
|
||||
// );
|
||||
// final wallet = await Hive.openBox(testWalletId);
|
||||
// final wallet = await Hive.openBox<dynamic> (testWalletId);
|
||||
// await wallet.put('receivingAddressesP2PKH', []);
|
||||
// await wallet.put('receivingAddressesP2SH', [
|
||||
// "2Mv83bPh2HzPRXptuQg9ejbKpSp87Zi52zT",
|
||||
|
@ -2027,7 +2028,7 @@ void main() async {
|
|||
//
|
||||
// secureStore: secureStore,
|
||||
// );
|
||||
// final wallet = await Hive.openBox(testWalletId);
|
||||
// final wallet = await Hive.openBox<dynamic> (testWalletId);
|
||||
// await wallet.put('receivingAddressesP2PKH', []);
|
||||
// await wallet.put('receivingAddressesP2SH', [
|
||||
// "2Mv83bPh2HzPRXptuQg9ejbKpSp87Zi52zT",
|
||||
|
@ -2068,14 +2069,14 @@ void main() async {
|
|||
"recoverFromMnemonic using empty seed on mainnet fails due to bad genesis hash match",
|
||||
() async {
|
||||
when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
"hosts": {},
|
||||
"hosts": <dynamic, dynamic>{},
|
||||
"pruning": null,
|
||||
"server_version": "Unit tests",
|
||||
"protocol_min": "1.4",
|
||||
"protocol_max": "1.4.2",
|
||||
"genesis_hash": GENESIS_HASH_TESTNET,
|
||||
"hash_function": "sha256",
|
||||
"services": []
|
||||
"services": <dynamic>[]
|
||||
});
|
||||
|
||||
bool hasThrown = false;
|
||||
|
@ -2110,14 +2111,14 @@ void main() async {
|
|||
secureStore: secureStore,
|
||||
);
|
||||
when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
"hosts": {},
|
||||
"hosts": <dynamic, dynamic>{},
|
||||
"pruning": null,
|
||||
"server_version": "Unit tests",
|
||||
"protocol_min": "1.4",
|
||||
"protocol_max": "1.4.2",
|
||||
"genesis_hash": GENESIS_HASH_MAINNET,
|
||||
"hash_function": "sha256",
|
||||
"services": []
|
||||
"services": <dynamic>[]
|
||||
});
|
||||
|
||||
bool hasThrown = false;
|
||||
|
@ -2143,14 +2144,14 @@ void main() async {
|
|||
"recoverFromMnemonic using empty seed on mainnet fails due to attempted overwrite of mnemonic",
|
||||
() async {
|
||||
when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
"hosts": {},
|
||||
"hosts": <dynamic, dynamic>{},
|
||||
"pruning": null,
|
||||
"server_version": "Unit tests",
|
||||
"protocol_min": "1.4",
|
||||
"protocol_max": "1.4.2",
|
||||
"genesis_hash": GENESIS_HASH_MAINNET,
|
||||
"hash_function": "sha256",
|
||||
"services": []
|
||||
"services": <dynamic>[]
|
||||
});
|
||||
|
||||
await secureStore.write(
|
||||
|
@ -2177,14 +2178,14 @@ void main() async {
|
|||
|
||||
test("recoverFromMnemonic using empty seed on mainnet succeeds", () async {
|
||||
when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
"hosts": {},
|
||||
"hosts": <dynamic, dynamic>{},
|
||||
"pruning": null,
|
||||
"server_version": "Unit tests",
|
||||
"protocol_min": "1.4",
|
||||
"protocol_max": "1.4.2",
|
||||
"genesis_hash": GENESIS_HASH_MAINNET,
|
||||
"hash_function": "sha256",
|
||||
"services": []
|
||||
"services": <dynamic>[]
|
||||
});
|
||||
when(client?.getBatchHistory(args: historyBatchArgs0))
|
||||
.thenAnswer((_) async => emptyHistoryBatchResponse);
|
||||
|
@ -2199,7 +2200,7 @@ void main() async {
|
|||
when(client?.getBatchHistory(args: historyBatchArgs5))
|
||||
.thenAnswer((_) async => emptyHistoryBatchResponse);
|
||||
// await DB.instance.init();
|
||||
final wallet = await Hive.openBox(testWalletId);
|
||||
await Hive.openBox<dynamic>(testWalletId);
|
||||
bool hasThrown = false;
|
||||
try {
|
||||
await btc?.recoverFromMnemonic(
|
||||
|
@ -2231,14 +2232,14 @@ void main() async {
|
|||
|
||||
test("get mnemonic list", () async {
|
||||
when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
"hosts": {},
|
||||
"hosts": <dynamic, dynamic>{},
|
||||
"pruning": null,
|
||||
"server_version": "Unit tests",
|
||||
"protocol_min": "1.4",
|
||||
"protocol_max": "1.4.2",
|
||||
"genesis_hash": GENESIS_HASH_MAINNET,
|
||||
"hash_function": "sha256",
|
||||
"services": []
|
||||
"services": <dynamic>[]
|
||||
});
|
||||
when(client?.getBatchHistory(args: historyBatchArgs0))
|
||||
.thenAnswer((_) async => emptyHistoryBatchResponse);
|
||||
|
@ -2253,7 +2254,7 @@ void main() async {
|
|||
when(client?.getBatchHistory(args: historyBatchArgs5))
|
||||
.thenAnswer((_) async => emptyHistoryBatchResponse);
|
||||
|
||||
final wallet = await Hive.openBox(testWalletId);
|
||||
await Hive.openBox<dynamic>(testWalletId);
|
||||
|
||||
await btc?.recoverFromMnemonic(
|
||||
mnemonic: TEST_MNEMONIC,
|
||||
|
@ -2278,14 +2279,14 @@ void main() async {
|
|||
test("recoverFromMnemonic using non empty seed on mainnet succeeds",
|
||||
() async {
|
||||
when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
"hosts": {},
|
||||
"hosts": <dynamic, dynamic>{},
|
||||
"pruning": null,
|
||||
"server_version": "Unit tests",
|
||||
"protocol_min": "1.4",
|
||||
"protocol_max": "1.4.2",
|
||||
"genesis_hash": GENESIS_HASH_MAINNET,
|
||||
"hash_function": "sha256",
|
||||
"services": []
|
||||
"services": <dynamic>[]
|
||||
});
|
||||
when(client?.getBatchHistory(args: historyBatchArgs0))
|
||||
.thenAnswer((_) async => historyBatchResponse);
|
||||
|
@ -2352,14 +2353,14 @@ void main() async {
|
|||
|
||||
test("fullRescan succeeds", () async {
|
||||
when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
"hosts": {},
|
||||
"hosts": <dynamic, dynamic>{},
|
||||
"pruning": null,
|
||||
"server_version": "Unit tests",
|
||||
"protocol_min": "1.4",
|
||||
"protocol_max": "1.4.2",
|
||||
"genesis_hash": GENESIS_HASH_MAINNET,
|
||||
"hash_function": "sha256",
|
||||
"services": []
|
||||
"services": <dynamic>[]
|
||||
});
|
||||
when(client?.getBatchHistory(args: historyBatchArgs0))
|
||||
.thenAnswer((_) async => historyBatchResponse);
|
||||
|
@ -2587,14 +2588,14 @@ void main() async {
|
|||
|
||||
test("fullRescan fails", () async {
|
||||
when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
"hosts": {},
|
||||
"hosts": <dynamic, dynamic>{},
|
||||
"pruning": null,
|
||||
"server_version": "Unit tests",
|
||||
"protocol_min": "1.4",
|
||||
"protocol_max": "1.4.2",
|
||||
"genesis_hash": GENESIS_HASH_MAINNET,
|
||||
"hash_function": "sha256",
|
||||
"services": []
|
||||
"services": <dynamic>[]
|
||||
});
|
||||
|
||||
when(client?.getBatchHistory(args: historyBatchArgs0))
|
||||
|
@ -2794,14 +2795,14 @@ void main() async {
|
|||
|
||||
// test("fetchBuildTxData succeeds", () async {
|
||||
// when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
// "hosts": {},
|
||||
// "hosts": <dynamic, dynamic>{},
|
||||
// "pruning": null,
|
||||
// "server_version": "Unit tests",
|
||||
// "protocol_min": "1.4",
|
||||
// "protocol_max": "1.4.2",
|
||||
// "genesis_hash": GENESIS_HASH_MAINNET,
|
||||
// "hash_function": "sha256",
|
||||
// "services": []
|
||||
// "services": <dynamic>[]
|
||||
// });
|
||||
// when(client?.getBatchHistory(args: historyBatchArgs0))
|
||||
// .thenAnswer((_) async => historyBatchResponse);
|
||||
|
@ -2996,14 +2997,14 @@ void main() async {
|
|||
//
|
||||
// test("fetchBuildTxData throws", () async {
|
||||
// when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
// "hosts": {},
|
||||
// "hosts": <dynamic, dynamic>{},
|
||||
// "pruning": null,
|
||||
// "server_version": "Unit tests",
|
||||
// "protocol_min": "1.4",
|
||||
// "protocol_max": "1.4.2",
|
||||
// "genesis_hash": GENESIS_HASH_MAINNET,
|
||||
// "hash_function": "sha256",
|
||||
// "services": []
|
||||
// "services": <dynamic>[]
|
||||
// });
|
||||
// when(client?.getBatchHistory(args: historyBatchArgs0))
|
||||
// .thenAnswer((_) async => historyBatchResponse);
|
||||
|
@ -3076,14 +3077,14 @@ void main() async {
|
|||
//
|
||||
// test("build transaction succeeds", () async {
|
||||
// when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
// "hosts": {},
|
||||
// "hosts": <dynamic, dynamic>{},
|
||||
// "pruning": null,
|
||||
// "server_version": "Unit tests",
|
||||
// "protocol_min": "1.4",
|
||||
// "protocol_max": "1.4.2",
|
||||
// "genesis_hash": GENESIS_HASH_MAINNET,
|
||||
// "hash_function": "sha256",
|
||||
// "services": []
|
||||
// "services": <dynamic>[]
|
||||
// });
|
||||
// when(client?.getBatchHistory(args: historyBatchArgs0))
|
||||
// .thenAnswer((_) async => historyBatchResponse);
|
||||
|
@ -3181,14 +3182,14 @@ void main() async {
|
|||
//
|
||||
// test("build transaction fails", () async {
|
||||
// when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
// "hosts": {},
|
||||
// "hosts": <dynamic, dynamic>{},
|
||||
// "pruning": null,
|
||||
// "server_version": "Unit tests",
|
||||
// "protocol_min": "1.4",
|
||||
// "protocol_max": "1.4.2",
|
||||
// "genesis_hash": GENESIS_HASH_MAINNET,
|
||||
// "hash_function": "sha256",
|
||||
// "services": []
|
||||
// "services": <dynamic>[]
|
||||
// });
|
||||
// when(client?.getBatchHistory(args: historyBatchArgs0))
|
||||
// .thenAnswer((_) async => historyBatchResponse);
|
||||
|
@ -3292,14 +3293,14 @@ void main() async {
|
|||
//
|
||||
// test("two output coinSelection succeeds", () async {
|
||||
// when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
// "hosts": {},
|
||||
// "hosts": <dynamic, dynamic>{},
|
||||
// "pruning": null,
|
||||
// "server_version": "Unit tests",
|
||||
// "protocol_min": "1.4",
|
||||
// "protocol_max": "1.4.2",
|
||||
// "genesis_hash": GENESIS_HASH_MAINNET,
|
||||
// "hash_function": "sha256",
|
||||
// "services": []
|
||||
// "services": <dynamic>[]
|
||||
// });
|
||||
// when(client?.getBatchHistory(args: historyBatchArgs0))
|
||||
// .thenAnswer((_) async => historyBatchResponse);
|
||||
|
@ -3397,14 +3398,14 @@ void main() async {
|
|||
//
|
||||
// test("one output option A coinSelection", () async {
|
||||
// when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
// "hosts": {},
|
||||
// "hosts": <dynamic, dynamic>{},
|
||||
// "pruning": null,
|
||||
// "server_version": "Unit tests",
|
||||
// "protocol_min": "1.4",
|
||||
// "protocol_max": "1.4.2",
|
||||
// "genesis_hash": GENESIS_HASH_MAINNET,
|
||||
// "hash_function": "sha256",
|
||||
// "services": []
|
||||
// "services": <dynamic>[]
|
||||
// });
|
||||
// when(client?.getBatchHistory(args: historyBatchArgs0))
|
||||
// .thenAnswer((_) async => historyBatchResponse);
|
||||
|
@ -3501,14 +3502,14 @@ void main() async {
|
|||
//
|
||||
// test("one output option B coinSelection", () async {
|
||||
// when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
// "hosts": {},
|
||||
// "hosts": <dynamic, dynamic>{},
|
||||
// "pruning": null,
|
||||
// "server_version": "Unit tests",
|
||||
// "protocol_min": "1.4",
|
||||
// "protocol_max": "1.4.2",
|
||||
// "genesis_hash": GENESIS_HASH_MAINNET,
|
||||
// "hash_function": "sha256",
|
||||
// "services": []
|
||||
// "services": <dynamic>[]
|
||||
// });
|
||||
// when(client?.getBatchHistory(args: historyBatchArgs0))
|
||||
// .thenAnswer((_) async => historyBatchResponse);
|
||||
|
@ -3605,14 +3606,14 @@ void main() async {
|
|||
//
|
||||
// test("insufficient funds option A coinSelection", () async {
|
||||
// when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
// "hosts": {},
|
||||
// "hosts": <dynamic, dynamic>{},
|
||||
// "pruning": null,
|
||||
// "server_version": "Unit tests",
|
||||
// "protocol_min": "1.4",
|
||||
// "protocol_max": "1.4.2",
|
||||
// "genesis_hash": GENESIS_HASH_MAINNET,
|
||||
// "hash_function": "sha256",
|
||||
// "services": []
|
||||
// "services": <dynamic>[]
|
||||
// });
|
||||
// when(client?.getBatchHistory(args: historyBatchArgs0))
|
||||
// .thenAnswer((_) async => historyBatchResponse);
|
||||
|
@ -3668,14 +3669,14 @@ void main() async {
|
|||
//
|
||||
// test("insufficient funds option B coinSelection", () async {
|
||||
// when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
// "hosts": {},
|
||||
// "hosts": <dynamic, dynamic>{},
|
||||
// "pruning": null,
|
||||
// "server_version": "Unit tests",
|
||||
// "protocol_min": "1.4",
|
||||
// "protocol_max": "1.4.2",
|
||||
// "genesis_hash": GENESIS_HASH_MAINNET,
|
||||
// "hash_function": "sha256",
|
||||
// "services": []
|
||||
// "services": <dynamic>[]
|
||||
// });
|
||||
// when(client?.getBatchHistory(args: historyBatchArgs0))
|
||||
// .thenAnswer((_) async => historyBatchResponse);
|
||||
|
@ -3731,14 +3732,14 @@ void main() async {
|
|||
//
|
||||
// test("insufficient funds option C coinSelection", () async {
|
||||
// when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
// "hosts": {},
|
||||
// "hosts": <dynamic, dynamic>{},
|
||||
// "pruning": null,
|
||||
// "server_version": "Unit tests",
|
||||
// "protocol_min": "1.4",
|
||||
// "protocol_max": "1.4.2",
|
||||
// "genesis_hash": GENESIS_HASH_MAINNET,
|
||||
// "hash_function": "sha256",
|
||||
// "services": []
|
||||
// "services": <dynamic>[]
|
||||
// });
|
||||
// when(client?.getBatchHistory(args: historyBatchArgs0))
|
||||
// .thenAnswer((_) async => historyBatchResponse);
|
||||
|
@ -3830,14 +3831,14 @@ void main() async {
|
|||
//
|
||||
// test("check for more outputs coinSelection", () async {
|
||||
// when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
// "hosts": {},
|
||||
// "hosts": <dynamic, dynamic>{},
|
||||
// "pruning": null,
|
||||
// "server_version": "Unit tests",
|
||||
// "protocol_min": "1.4",
|
||||
// "protocol_max": "1.4.2",
|
||||
// "genesis_hash": GENESIS_HASH_MAINNET,
|
||||
// "hash_function": "sha256",
|
||||
// "services": []
|
||||
// "services": <dynamic>[]
|
||||
// });
|
||||
// when(client?.getBatchHistory(args: historyBatchArgs0))
|
||||
// .thenAnswer((_) async => historyBatchResponse);
|
||||
|
@ -3936,14 +3937,14 @@ void main() async {
|
|||
//
|
||||
// test("prepareSend and confirmSend succeed", () async {
|
||||
// when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
// "hosts": {},
|
||||
// "hosts": <dynamic, dynamic>{},
|
||||
// "pruning": null,
|
||||
// "server_version": "Unit tests",
|
||||
// "protocol_min": "1.4",
|
||||
// "protocol_max": "1.4.2",
|
||||
// "genesis_hash": GENESIS_HASH_MAINNET,
|
||||
// "hash_function": "sha256",
|
||||
// "services": []
|
||||
// "services": <dynamic>[]
|
||||
// });
|
||||
// when(client?.getBatchHistory(args: historyBatchArgs0))
|
||||
// .thenAnswer((_) async => historyBatchResponse);
|
||||
|
@ -4053,14 +4054,14 @@ void main() async {
|
|||
|
||||
test("prepareSend fails", () async {
|
||||
when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
"hosts": {},
|
||||
"hosts": <dynamic, dynamic>{},
|
||||
"pruning": null,
|
||||
"server_version": "Unit tests",
|
||||
"protocol_min": "1.4",
|
||||
"protocol_max": "1.4.2",
|
||||
"genesis_hash": GENESIS_HASH_MAINNET,
|
||||
"hash_function": "sha256",
|
||||
"services": []
|
||||
"services": <dynamic>[]
|
||||
});
|
||||
when(client?.getBatchHistory(args: historyBatchArgs0))
|
||||
.thenAnswer((_) async => historyBatchResponse);
|
||||
|
@ -4113,21 +4114,21 @@ void main() async {
|
|||
|
||||
// modify addresses to properly mock data to build a tx
|
||||
final rcv44 = await secureStore.read(
|
||||
key: testWalletId + "_receiveDerivationsP2PKH");
|
||||
key: "${testWalletId}_receiveDerivationsP2PKH");
|
||||
await secureStore.write(
|
||||
key: testWalletId + "_receiveDerivationsP2PKH",
|
||||
key: "${testWalletId}_receiveDerivationsP2PKH",
|
||||
value: rcv44?.replaceFirst("1RMSPixoLPuaXuhR2v4HsUMcRjLncKDaw",
|
||||
"16FuTPaeRSPVxxCnwQmdyx2PQWxX6HWzhQ"));
|
||||
final rcv49 =
|
||||
await secureStore.read(key: testWalletId + "_receiveDerivationsP2SH");
|
||||
await secureStore.read(key: "${testWalletId}_receiveDerivationsP2SH");
|
||||
await secureStore.write(
|
||||
key: testWalletId + "_receiveDerivationsP2SH",
|
||||
key: "${testWalletId}_receiveDerivationsP2SH",
|
||||
value: rcv49?.replaceFirst("3AV74rKfibWmvX34F99yEvUcG4LLQ9jZZk",
|
||||
"36NvZTcMsMowbt78wPzJaHHWaNiyR73Y4g"));
|
||||
final rcv84 = await secureStore.read(
|
||||
key: testWalletId + "_receiveDerivationsP2WPKH");
|
||||
key: "${testWalletId}_receiveDerivationsP2WPKH");
|
||||
await secureStore.write(
|
||||
key: testWalletId + "_receiveDerivationsP2WPKH",
|
||||
key: "${testWalletId}_receiveDerivationsP2WPKH",
|
||||
value: rcv84?.replaceFirst(
|
||||
"bc1qggtj4ka8jsaj44hhd5mpamx7mp34m2d3w7k0m0",
|
||||
"bc1q42lja79elem0anu8q8s3h2n687re9jax556pcc"));
|
||||
|
@ -4300,7 +4301,7 @@ void main() async {
|
|||
// // );
|
||||
// //
|
||||
// // // set node
|
||||
// // final wallet = await Hive.openBox(testWalletId);
|
||||
// // final wallet = await Hive.openBox<dynamic> (testWalletId);
|
||||
// // await wallet.put("nodes", {
|
||||
// // "default": {
|
||||
// // "id": "some nodeID",
|
||||
|
@ -4336,14 +4337,14 @@ void main() async {
|
|||
|
||||
test("refresh wallet mutex locked", () async {
|
||||
when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
"hosts": {},
|
||||
"hosts": <dynamic, dynamic>{},
|
||||
"pruning": null,
|
||||
"server_version": "Unit tests",
|
||||
"protocol_min": "1.4",
|
||||
"protocol_max": "1.4.2",
|
||||
"genesis_hash": GENESIS_HASH_MAINNET,
|
||||
"hash_function": "sha256",
|
||||
"services": []
|
||||
"services": <dynamic>[]
|
||||
});
|
||||
when(client?.getBatchHistory(args: historyBatchArgs0))
|
||||
.thenAnswer((_) async => historyBatchResponse);
|
||||
|
@ -4412,14 +4413,14 @@ void main() async {
|
|||
when(client?.getBlockHeadTip()).thenAnswer((realInvocation) async =>
|
||||
{"height": 520481, "hex": "some block hex"});
|
||||
when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
"hosts": {},
|
||||
"hosts": <dynamic, dynamic>{},
|
||||
"pruning": null,
|
||||
"server_version": "Unit tests",
|
||||
"protocol_min": "1.4",
|
||||
"protocol_max": "1.4.2",
|
||||
"genesis_hash": GENESIS_HASH_MAINNET,
|
||||
"hash_function": "sha256",
|
||||
"services": []
|
||||
"services": <dynamic>[]
|
||||
});
|
||||
when(client?.getHistory(scripthash: anyNamed("scripthash")))
|
||||
.thenAnswer((_) async => []);
|
||||
|
|
|
@ -459,14 +459,14 @@ void main() {
|
|||
test("get fees succeeds", () async {
|
||||
when(client?.ping()).thenAnswer((_) async => true);
|
||||
when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
"hosts": {},
|
||||
"hosts": <dynamic, dynamic>{},
|
||||
"pruning": null,
|
||||
"server_version": "Unit tests",
|
||||
"protocol_min": "1.4",
|
||||
"protocol_max": "1.4.2",
|
||||
"genesis_hash": GENESIS_HASH_TESTNET,
|
||||
"hash_function": "sha256",
|
||||
"services": []
|
||||
"services": <dynamic>[]
|
||||
});
|
||||
when(client?.estimateFee(blocks: 1))
|
||||
.thenAnswer((realInvocation) async => Decimal.zero);
|
||||
|
@ -493,14 +493,14 @@ void main() {
|
|||
test("get fees fails", () async {
|
||||
when(client?.ping()).thenAnswer((_) async => true);
|
||||
when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
"hosts": {},
|
||||
"hosts": <dynamic, dynamic>{},
|
||||
"pruning": null,
|
||||
"server_version": "Unit tests",
|
||||
"protocol_min": "1.4",
|
||||
"protocol_max": "1.4.2",
|
||||
"genesis_hash": GENESIS_HASH_TESTNET,
|
||||
"hash_function": "sha256",
|
||||
"services": []
|
||||
"services": <dynamic>[]
|
||||
});
|
||||
when(client?.estimateFee(blocks: 1))
|
||||
.thenAnswer((realInvocation) async => Decimal.zero);
|
||||
|
@ -530,14 +530,14 @@ void main() {
|
|||
test("get maxFee", () async {
|
||||
when(client?.ping()).thenAnswer((_) async => true);
|
||||
when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
"hosts": {},
|
||||
"hosts": <dynamic, dynamic>{},
|
||||
"pruning": null,
|
||||
"server_version": "Unit tests",
|
||||
"protocol_min": "1.4",
|
||||
"protocol_max": "1.4.2",
|
||||
"genesis_hash": GENESIS_HASH_TESTNET,
|
||||
"hash_function": "sha256",
|
||||
"services": []
|
||||
"services": <dynamic>[]
|
||||
});
|
||||
when(client?.estimateFee(blocks: 20))
|
||||
.thenAnswer((realInvocation) async => Decimal.zero);
|
||||
|
@ -592,7 +592,7 @@ void main() {
|
|||
Hive.registerAdapter(UtxoObjectAdapter());
|
||||
Hive.registerAdapter(StatusAdapter());
|
||||
|
||||
final wallets = await Hive.openBox('wallets');
|
||||
final wallets = await Hive.openBox<dynamic>('wallets');
|
||||
await wallets.put('currentWalletName', testWalletName);
|
||||
}
|
||||
|
||||
|
@ -638,14 +638,14 @@ void main() {
|
|||
|
||||
// test("initializeNew mainnet throws bad network", () async {
|
||||
// when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
// "hosts": {},
|
||||
// "hosts": <dynamic, dynamic>{},
|
||||
// "pruning": null,
|
||||
// "server_version": "Unit tests",
|
||||
// "protocol_min": "1.4",
|
||||
// "protocol_max": "1.4.2",
|
||||
// "genesis_hash": GENESIS_HASH_TESTNET,
|
||||
// "hash_function": "sha256",
|
||||
// "services": []
|
||||
// "services": <dynamic>[]
|
||||
// });
|
||||
//
|
||||
// await Hive.openBox<dynamic>(testWalletId);
|
||||
|
@ -664,14 +664,14 @@ void main() {
|
|||
|
||||
test("initializeNew throws mnemonic overwrite exception", () async {
|
||||
when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
"hosts": {},
|
||||
"hosts": <dynamic, dynamic>{},
|
||||
"pruning": null,
|
||||
"server_version": "Unit tests",
|
||||
"protocol_min": "1.4",
|
||||
"protocol_max": "1.4.2",
|
||||
"genesis_hash": GENESIS_HASH_MAINNET,
|
||||
"hash_function": "sha256",
|
||||
"services": []
|
||||
"services": <dynamic>[]
|
||||
});
|
||||
await secureStore.write(
|
||||
key: "${testWalletId}_mnemonic", value: "some mnemonic");
|
||||
|
@ -692,14 +692,14 @@ void main() {
|
|||
// test("initializeExisting testnet throws bad network", () async {
|
||||
// when(client?.ping()).thenAnswer((_) async => true);
|
||||
// when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
// "hosts": {},
|
||||
// "hosts": <dynamic, dynamic>{},
|
||||
// "pruning": null,
|
||||
// "server_version": "Unit tests",
|
||||
// "protocol_min": "1.4",
|
||||
// "protocol_max": "1.4.2",
|
||||
// "genesis_hash": GENESIS_HASH_TESTNET,
|
||||
// "hash_function": "sha256",
|
||||
// "services": []
|
||||
// "services": <dynamic>[]
|
||||
// });
|
||||
//
|
||||
// bch = BitcoinCashWallet(
|
||||
|
@ -732,14 +732,14 @@ void main() {
|
|||
// // .thenAnswer((realInvocation) async => Decimal.fromInt(10));
|
||||
// when(client?.ping()).thenAnswer((_) async => true);
|
||||
// when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
// "hosts": {},
|
||||
// "hosts": <dynamic, dynamic>{},
|
||||
// "pruning": null,
|
||||
// "server_version": "Unit tests",
|
||||
// "protocol_min": "1.4",
|
||||
// "protocol_max": "1.4.2",
|
||||
// "genesis_hash": GENESIS_HASH_MAINNET,
|
||||
// "hash_function": "sha256",
|
||||
// "services": []
|
||||
// "services": <dynamic>[]
|
||||
// });
|
||||
// // await DebugService.instance.init();
|
||||
// expect(bch?.initializeExisting(), true);
|
||||
|
@ -754,7 +754,7 @@ void main() {
|
|||
// expect(didThrow, true);
|
||||
//
|
||||
// // set node
|
||||
// final wallet = await Hive.openBox(testWalletId);
|
||||
// final wallet = await Hive.openBox<dynamic> (testWalletId);
|
||||
// await wallet.put("nodes", {
|
||||
// "default": {
|
||||
// "id": "some nodeID",
|
||||
|
@ -782,18 +782,18 @@ void main() {
|
|||
// .thenAnswer((realInvocation) async => Decimal.fromInt(10));
|
||||
// when(client?.ping()).thenAnswer((_) async => true);
|
||||
// when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
// "hosts": {},
|
||||
// "hosts": <dynamic, dynamic>{},
|
||||
// "pruning": null,
|
||||
// "server_version": "Unit tests",
|
||||
// "protocol_min": "1.4",
|
||||
// "protocol_max": "1.4.2",
|
||||
// "genesis_hash": GENESIS_HASH_MAINNET,
|
||||
// "hash_function": "sha256",
|
||||
// "services": []
|
||||
// "services": <dynamic>[]
|
||||
// });
|
||||
// expect(await bch?.initializeWallet(), true);
|
||||
//
|
||||
// final wallet = await Hive.openBox(testWalletId);
|
||||
// final wallet = await Hive.openBox<dynamic> (testWalletId);
|
||||
//
|
||||
// expect(await wallet.get("addressBookEntries"), {});
|
||||
// expect(await wallet.get('notes'), null);
|
||||
|
@ -838,20 +838,20 @@ void main() {
|
|||
// // when(client?.getBatchHistory(args: anyNamed("args")))
|
||||
// // .thenAnswer((_) async => {});
|
||||
// // when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
// // "hosts": {},
|
||||
// // "hosts": <dynamic, dynamic>{},
|
||||
// // "pruning": null,
|
||||
// // "server_version": "Unit tests",
|
||||
// // "protocol_min": "1.4",
|
||||
// // "protocol_max": "1.4.2",
|
||||
// // "genesis_hash": GENESIS_HASH_MAINNET,
|
||||
// // "hash_function": "sha256",
|
||||
// // "services": []
|
||||
// // "services": <dynamic>[]
|
||||
// // });
|
||||
// // // init new wallet
|
||||
// // expect(bch?.initializeNew(), true);
|
||||
// //
|
||||
// // // fetch data to compare later
|
||||
// // final newWallet = await Hive.openBox(testWalletId);
|
||||
// // final newWallet = await Hive.openBox<dynamic> (testWalletId);
|
||||
// //
|
||||
// // final addressBookEntries = await newWallet.get("addressBookEntries");
|
||||
// // final notes = await newWallet.get('notes');
|
||||
|
@ -890,7 +890,7 @@ void main() {
|
|||
// // expect(bch?.initializeExisting(), true);
|
||||
// //
|
||||
// // // compare data to ensure state matches state of previously closed wallet
|
||||
// // final wallet = await Hive.openBox(testWalletId);
|
||||
// // final wallet = await Hive.openBox<dynamic> (testWalletId);
|
||||
// //
|
||||
// // expect(await wallet.get("addressBookEntries"), addressBookEntries);
|
||||
// // expect(await wallet.get('notes'), notes);
|
||||
|
@ -938,14 +938,14 @@ void main() {
|
|||
);
|
||||
when(client?.ping()).thenAnswer((_) async => true);
|
||||
when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
"hosts": {},
|
||||
"hosts": <dynamic, dynamic>{},
|
||||
"pruning": null,
|
||||
"server_version": "Unit tests",
|
||||
"protocol_min": "1.4",
|
||||
"protocol_max": "1.4.2",
|
||||
"genesis_hash": GENESIS_HASH_TESTNET,
|
||||
"hash_function": "sha256",
|
||||
"services": []
|
||||
"services": <dynamic>[]
|
||||
});
|
||||
|
||||
await Hive.openBox<dynamic>(testWalletId);
|
||||
|
@ -976,14 +976,14 @@ void main() {
|
|||
// );
|
||||
// when(client?.ping()).thenAnswer((_) async => true);
|
||||
// when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
// "hosts": {},
|
||||
// "hosts": <dynamic, dynamic>{},
|
||||
// "pruning": null,
|
||||
// "server_version": "Unit tests",
|
||||
// "protocol_min": "1.4",
|
||||
// "protocol_max": "1.4.2",
|
||||
// "genesis_hash": GENESIS_HASH_TESTNET,
|
||||
// "hash_function": "sha256",
|
||||
// "services": []
|
||||
// "services": <dynamic>[]
|
||||
// });
|
||||
//
|
||||
// await Hive.openBox<dynamic>(testWalletId);
|
||||
|
@ -1080,14 +1080,14 @@ void main() {
|
|||
// // );
|
||||
// // when(client?.ping()).thenAnswer((_) async => true);
|
||||
// // when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
// // "hosts": {},
|
||||
// // "hosts": <dynamic, dynamic>{},
|
||||
// // "pruning": null,
|
||||
// // "server_version": "Unit tests",
|
||||
// // "protocol_min": "1.4",
|
||||
// // "protocol_max": "1.4.2",
|
||||
// // "genesis_hash": GENESIS_HASH_TESTNET,
|
||||
// // "hash_function": "sha256",
|
||||
// // "services": []
|
||||
// // "services": <dynamic>[]
|
||||
// // });
|
||||
// //
|
||||
// // when(client?.getBatchUTXOs(args: anyNamed("args")))
|
||||
|
@ -1099,7 +1099,7 @@ void main() {
|
|||
// // await bch?.initializeWallet();
|
||||
// //
|
||||
// // // add some extra addresses to make sure we have more than the single batch size of 10
|
||||
// // final wallet = await Hive.openBox(testWalletId);
|
||||
// // final wallet = await Hive.openBox<dynamic> (testWalletId);
|
||||
// // final addresses = await wallet.get("receivingAddressesP2PKH");
|
||||
// // addresses.add("DQaAi9R58GXMpDyhePys6hHCuif4fhc1sN");
|
||||
// // addresses.add("DBVhuF8QgeuxU2pssxzMgJqPhGCx5qyVkD");
|
||||
|
@ -1143,14 +1143,14 @@ void main() {
|
|||
);
|
||||
when(client?.ping()).thenAnswer((_) async => true);
|
||||
when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
"hosts": {},
|
||||
"hosts": <dynamic, dynamic>{},
|
||||
"pruning": null,
|
||||
"server_version": "Unit tests",
|
||||
"protocol_min": "1.4",
|
||||
"protocol_max": "1.4.2",
|
||||
"genesis_hash": GENESIS_HASH_TESTNET,
|
||||
"hash_function": "sha256",
|
||||
"services": []
|
||||
"services": <dynamic>[]
|
||||
});
|
||||
|
||||
await Hive.openBox<dynamic>(testWalletId);
|
||||
|
@ -1191,14 +1191,14 @@ void main() {
|
|||
);
|
||||
when(client?.ping()).thenAnswer((_) async => true);
|
||||
when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
"hosts": {},
|
||||
"hosts": <dynamic, dynamic>{},
|
||||
"pruning": null,
|
||||
"server_version": "Unit tests",
|
||||
"protocol_min": "1.4",
|
||||
"protocol_max": "1.4.2",
|
||||
"genesis_hash": GENESIS_HASH_TESTNET,
|
||||
"hash_function": "sha256",
|
||||
"services": []
|
||||
"services": <dynamic>[]
|
||||
});
|
||||
|
||||
await Hive.openBox<dynamic>(testWalletId);
|
||||
|
@ -1208,7 +1208,7 @@ void main() {
|
|||
await bch?.initializeExisting();
|
||||
|
||||
// get stored
|
||||
expect(await bch?.storedChainHeight, 0);
|
||||
expect(bch?.storedChainHeight, 0);
|
||||
|
||||
// fetch fails
|
||||
when(client?.getBlockHeadTip()).thenThrow(Exception("Some exception"));
|
||||
|
@ -1222,10 +1222,10 @@ void main() {
|
|||
expect(await bch?.chainHeight, 100);
|
||||
|
||||
// update
|
||||
await bch?.updateStoredChainHeight(newHeight: 1000);
|
||||
await bch?.updateCachedChainHeight(1000);
|
||||
|
||||
// fetch updated
|
||||
expect(await bch?.storedChainHeight, 1000);
|
||||
expect(bch?.storedChainHeight, 1000);
|
||||
|
||||
verifyNever(client?.ping()).called(0);
|
||||
verify(client?.getServerFeatures()).called(1);
|
||||
|
@ -1296,14 +1296,14 @@ void main() {
|
|||
test("_checkCurrentReceivingAddressesForTransactions succeeds", () async {
|
||||
when(client?.ping()).thenAnswer((_) async => true);
|
||||
when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
"hosts": {},
|
||||
"hosts": <dynamic, dynamic>{},
|
||||
"pruning": null,
|
||||
"server_version": "Unit tests",
|
||||
"protocol_min": "1.4",
|
||||
"protocol_max": "1.4.2",
|
||||
"genesis_hash": GENESIS_HASH_MAINNET,
|
||||
"hash_function": "sha256",
|
||||
"services": []
|
||||
"services": <dynamic>[]
|
||||
});
|
||||
when(client?.getHistory(scripthash: anyNamed("scripthash")))
|
||||
.thenAnswer((realInvocation) async => [
|
||||
|
@ -1348,14 +1348,14 @@ void main() {
|
|||
test("_checkCurrentReceivingAddressesForTransactions fails", () async {
|
||||
when(client?.ping()).thenAnswer((_) async => true);
|
||||
when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
"hosts": {},
|
||||
"hosts": <dynamic, dynamic>{},
|
||||
"pruning": null,
|
||||
"server_version": "Unit tests",
|
||||
"protocol_min": "1.4",
|
||||
"protocol_max": "1.4.2",
|
||||
"genesis_hash": GENESIS_HASH_MAINNET,
|
||||
"hash_function": "sha256",
|
||||
"services": []
|
||||
"services": <dynamic>[]
|
||||
});
|
||||
when(client?.getHistory(scripthash: anyNamed("scripthash")))
|
||||
.thenThrow(Exception("some exception"));
|
||||
|
@ -1389,14 +1389,14 @@ void main() {
|
|||
test("_checkCurrentChangeAddressesForTransactions succeeds", () async {
|
||||
when(client?.ping()).thenAnswer((_) async => true);
|
||||
when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
"hosts": {},
|
||||
"hosts": <dynamic, dynamic>{},
|
||||
"pruning": null,
|
||||
"server_version": "Unit tests",
|
||||
"protocol_min": "1.4",
|
||||
"protocol_max": "1.4.2",
|
||||
"genesis_hash": GENESIS_HASH_MAINNET,
|
||||
"hash_function": "sha256",
|
||||
"services": []
|
||||
"services": <dynamic>[]
|
||||
});
|
||||
when(client?.getHistory(scripthash: anyNamed("scripthash")))
|
||||
.thenAnswer((realInvocation) async => [
|
||||
|
@ -1442,14 +1442,14 @@ void main() {
|
|||
test("_checkCurrentChangeAddressesForTransactions fails", () async {
|
||||
when(client?.ping()).thenAnswer((_) async => true);
|
||||
when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
"hosts": {},
|
||||
"hosts": <dynamic, dynamic>{},
|
||||
"pruning": null,
|
||||
"server_version": "Unit tests",
|
||||
"protocol_min": "1.4",
|
||||
"protocol_max": "1.4.2",
|
||||
"genesis_hash": GENESIS_HASH_MAINNET,
|
||||
"hash_function": "sha256",
|
||||
"services": []
|
||||
"services": <dynamic>[]
|
||||
});
|
||||
when(client?.getHistory(scripthash: anyNamed("scripthash")))
|
||||
.thenThrow(Exception("some exception"));
|
||||
|
@ -1527,7 +1527,7 @@ void main() {
|
|||
//
|
||||
// secureStore: secureStore,
|
||||
// );
|
||||
// final wallet = await Hive.openBox(testWalletId);
|
||||
// final wallet = await Hive.openBox<dynamic> (testWalletId);
|
||||
// await wallet.put('receivingAddressesP2PKH', []);
|
||||
//
|
||||
// await wallet.put('changeAddressesP2PKH', []);
|
||||
|
@ -1656,7 +1656,7 @@ void main() {
|
|||
//
|
||||
// secureStore: secureStore,
|
||||
// );
|
||||
// final wallet = await Hive.openBox(testWalletId);
|
||||
// final wallet = await Hive.openBox<dynamic> (testWalletId);
|
||||
// await wallet.put('receivingAddressesP2PKH', []);
|
||||
//
|
||||
// await wallet.put('changeAddressesP2PKH', []);
|
||||
|
@ -1789,7 +1789,7 @@ void main() {
|
|||
//
|
||||
// secureStore: secureStore,
|
||||
// );
|
||||
// final wallet = await Hive.openBox(testWalletId);
|
||||
// final wallet = await Hive.openBox<dynamic> (testWalletId);
|
||||
// await wallet.put('receivingAddressesP2PKH', []);
|
||||
//
|
||||
// await wallet.put('changeAddressesP2PKH', []);
|
||||
|
@ -1841,7 +1841,7 @@ void main() {
|
|||
// //
|
||||
// // secureStore: secureStore,
|
||||
// // );
|
||||
// // final wallet = await Hive.openBox(testWalletId);
|
||||
// // final wallet = await Hive.openBox<dynamic> (testWalletId);
|
||||
// // await wallet.put('receivingAddressesP2PKH', []);
|
||||
// //
|
||||
// // await wallet.put('changeAddressesP2PKH', []);
|
||||
|
@ -1868,14 +1868,14 @@ void main() {
|
|||
|
||||
test("get mnemonic list", () async {
|
||||
when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
"hosts": {},
|
||||
"hosts": <dynamic, dynamic>{},
|
||||
"pruning": null,
|
||||
"server_version": "Unit tests",
|
||||
"protocol_min": "1.4",
|
||||
"protocol_max": "1.4.2",
|
||||
"genesis_hash": GENESIS_HASH_MAINNET,
|
||||
"hash_function": "sha256",
|
||||
"services": []
|
||||
"services": <dynamic>[]
|
||||
});
|
||||
|
||||
// when(client?.getBatchHistory(args: anyNamed("args")))
|
||||
|
@ -1893,7 +1893,7 @@ void main() {
|
|||
when(client?.getBatchHistory(args: historyBatchArgs3))
|
||||
.thenAnswer((_) async => emptyHistoryBatchResponse);
|
||||
|
||||
final wallet = await Hive.openBox(testWalletId);
|
||||
await Hive.openBox<dynamic>(testWalletId);
|
||||
|
||||
// add maxNumberOfIndexesToCheck and height
|
||||
await bch?.recoverFromMnemonic(
|
||||
|
@ -1919,14 +1919,14 @@ void main() {
|
|||
"recoverFromMnemonic using empty seed on mainnet fails due to bad genesis hash match",
|
||||
() async {
|
||||
when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
"hosts": {},
|
||||
"hosts": <dynamic, dynamic>{},
|
||||
"pruning": null,
|
||||
"server_version": "Unit tests",
|
||||
"protocol_min": "1.4",
|
||||
"protocol_max": "1.4.2",
|
||||
"genesis_hash": GENESIS_HASH_TESTNET,
|
||||
"hash_function": "sha256",
|
||||
"services": []
|
||||
"services": <dynamic>[]
|
||||
});
|
||||
|
||||
bool hasThrown = false;
|
||||
|
@ -1961,14 +1961,14 @@ void main() {
|
|||
secureStore: secureStore,
|
||||
);
|
||||
when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
"hosts": {},
|
||||
"hosts": <dynamic, dynamic>{},
|
||||
"pruning": null,
|
||||
"server_version": "Unit tests",
|
||||
"protocol_min": "1.4",
|
||||
"protocol_max": "1.4.2",
|
||||
"genesis_hash": GENESIS_HASH_MAINNET,
|
||||
"hash_function": "sha256",
|
||||
"services": []
|
||||
"services": <dynamic>[]
|
||||
});
|
||||
|
||||
bool hasThrown = false;
|
||||
|
@ -1994,14 +1994,14 @@ void main() {
|
|||
"recoverFromMnemonic using empty seed on mainnet fails due to attempted overwrite of mnemonic",
|
||||
() async {
|
||||
when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
"hosts": {},
|
||||
"hosts": <dynamic, dynamic>{},
|
||||
"pruning": null,
|
||||
"server_version": "Unit tests",
|
||||
"protocol_min": "1.4",
|
||||
"protocol_max": "1.4.2",
|
||||
"genesis_hash": GENESIS_HASH_MAINNET,
|
||||
"hash_function": "sha256",
|
||||
"services": []
|
||||
"services": <dynamic>[]
|
||||
});
|
||||
|
||||
await secureStore.write(
|
||||
|
@ -2029,14 +2029,14 @@ void main() {
|
|||
test("recoverFromMnemonic using non empty seed on mainnet succeeds",
|
||||
() async {
|
||||
when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
"hosts": {},
|
||||
"hosts": <dynamic, dynamic>{},
|
||||
"pruning": null,
|
||||
"server_version": "Unit tests",
|
||||
"protocol_min": "1.4",
|
||||
"protocol_max": "1.4.2",
|
||||
"genesis_hash": GENESIS_HASH_MAINNET,
|
||||
"hash_function": "sha256",
|
||||
"services": []
|
||||
"services": <dynamic>[]
|
||||
});
|
||||
when(client?.getBatchHistory(args: historyBatchArgs0))
|
||||
.thenAnswer((_) async => historyBatchResponse);
|
||||
|
@ -2058,7 +2058,7 @@ void main() {
|
|||
return historyBatchResponse;
|
||||
});
|
||||
|
||||
// final wallet = await Hive.openBox(testWalletId);
|
||||
// final wallet = await Hive.openBox<dynamic> (testWalletId);
|
||||
await Hive.openBox<dynamic>(testWalletId);
|
||||
|
||||
bool hasThrown = false;
|
||||
|
@ -2099,14 +2099,14 @@ void main() {
|
|||
|
||||
test("fullRescan succeeds", () async {
|
||||
when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
"hosts": {},
|
||||
"hosts": <dynamic, dynamic>{},
|
||||
"pruning": null,
|
||||
"server_version": "Unit tests",
|
||||
"protocol_min": "1.4",
|
||||
"protocol_max": "1.4.2",
|
||||
"genesis_hash": GENESIS_HASH_MAINNET,
|
||||
"hash_function": "sha256",
|
||||
"services": []
|
||||
"services": <dynamic>[]
|
||||
});
|
||||
when(client?.getBatchHistory(args: historyBatchArgs0))
|
||||
.thenAnswer((_) async => historyBatchResponse);
|
||||
|
@ -2140,7 +2140,7 @@ void main() {
|
|||
]
|
||||
})).thenAnswer((_) async => {"0": []});
|
||||
|
||||
final wallet = await Hive.openBox(testWalletId);
|
||||
final wallet = await Hive.openBox<dynamic>(testWalletId);
|
||||
|
||||
// restore so we have something to rescan
|
||||
await bch?.recoverFromMnemonic(
|
||||
|
@ -2289,14 +2289,14 @@ void main() {
|
|||
|
||||
test("fullRescan fails", () async {
|
||||
when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
"hosts": {},
|
||||
"hosts": <dynamic, dynamic>{},
|
||||
"pruning": null,
|
||||
"server_version": "Unit tests",
|
||||
"protocol_min": "1.4",
|
||||
"protocol_max": "1.4.2",
|
||||
"genesis_hash": GENESIS_HASH_MAINNET,
|
||||
"hash_function": "sha256",
|
||||
"services": []
|
||||
"services": <dynamic>[]
|
||||
});
|
||||
|
||||
when(client?.getBatchHistory(args: historyBatchArgs0))
|
||||
|
@ -2331,7 +2331,7 @@ void main() {
|
|||
]
|
||||
})).thenAnswer((_) async => {"0": []});
|
||||
|
||||
final wallet = await Hive.openBox(testWalletId);
|
||||
final wallet = await Hive.openBox<dynamic>(testWalletId);
|
||||
|
||||
// restore so we have something to rescan
|
||||
await bch?.recoverFromMnemonic(
|
||||
|
@ -2421,14 +2421,14 @@ void main() {
|
|||
|
||||
// // test("fetchBuildTxData succeeds", () async {
|
||||
// // when(client.getServerFeatures()).thenAnswer((_) async => {
|
||||
// // "hosts": {},
|
||||
// // "hosts": <dynamic, dynamic>{},
|
||||
// // "pruning": null,
|
||||
// // "server_version": "Unit tests",
|
||||
// // "protocol_min": "1.4",
|
||||
// // "protocol_max": "1.4.2",
|
||||
// // "genesis_hash": GENESIS_HASH_MAINNET,
|
||||
// // "hash_function": "sha256",
|
||||
// // "services": []
|
||||
// // "services": <dynamic>[]
|
||||
// // });
|
||||
// // when(client.getBatchHistory(args: historyBatchArgs0))
|
||||
// // .thenAnswer((_) async => historyBatchResponse);
|
||||
|
@ -2598,14 +2598,14 @@ void main() {
|
|||
|
||||
// test("fetchBuildTxData throws", () async {
|
||||
// when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
// "hosts": {},
|
||||
// "hosts": <dynamic, dynamic>{},
|
||||
// "pruning": null,
|
||||
// "server_version": "Unit tests",
|
||||
// "protocol_min": "1.4",
|
||||
// "protocol_max": "1.4.2",
|
||||
// "genesis_hash": GENESIS_HASH_MAINNET,
|
||||
// "hash_function": "sha256",
|
||||
// "services": []
|
||||
// "services": <dynamic>[]
|
||||
// });
|
||||
// when(client?.getBatchHistory(args: historyBatchArgs0))
|
||||
// .thenAnswer((_) async => historyBatchResponse);
|
||||
|
@ -2679,14 +2679,14 @@ void main() {
|
|||
|
||||
// test("build transaction succeeds", () async {
|
||||
// when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
// "hosts": {},
|
||||
// "hosts": <dynamic, dynamic>{},
|
||||
// "pruning": null,
|
||||
// "server_version": "Unit tests",
|
||||
// "protocol_min": "1.4",
|
||||
// "protocol_max": "1.4.2",
|
||||
// "genesis_hash": GENESIS_HASH_MAINNET,
|
||||
// "hash_function": "sha256",
|
||||
// "services": []
|
||||
// "services": <dynamic>[]
|
||||
// });
|
||||
// when(client?.getBatchHistory(args: historyBatchArgs0))
|
||||
// .thenAnswer((_) async => historyBatchResponse);
|
||||
|
@ -2882,14 +2882,14 @@ void main() {
|
|||
|
||||
test("refresh wallet mutex locked", () async {
|
||||
when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
"hosts": {},
|
||||
"hosts": <dynamic, dynamic>{},
|
||||
"pruning": null,
|
||||
"server_version": "Unit tests",
|
||||
"protocol_min": "1.4",
|
||||
"protocol_max": "1.4.2",
|
||||
"genesis_hash": GENESIS_HASH_MAINNET,
|
||||
"hash_function": "sha256",
|
||||
"services": []
|
||||
"services": <dynamic>[]
|
||||
});
|
||||
when(client?.getBatchHistory(args: historyBatchArgs0))
|
||||
.thenAnswer((_) async => historyBatchResponse);
|
||||
|
@ -2920,7 +2920,7 @@ void main() {
|
|||
]
|
||||
})).thenAnswer((realInvocation) async => {"0": []});
|
||||
|
||||
final wallet = await Hive.openBox(testWalletId);
|
||||
await Hive.openBox<dynamic>(testWalletId);
|
||||
// recover to fill data
|
||||
await bch?.recoverFromMnemonic(
|
||||
mnemonic: TEST_MNEMONIC,
|
||||
|
@ -2972,14 +2972,14 @@ void main() {
|
|||
test("refresh wallet throws", () async {
|
||||
when(client?.getBlockHeadTip()).thenThrow(Exception("some exception"));
|
||||
when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
"hosts": {},
|
||||
"hosts": <dynamic, dynamic>{},
|
||||
"pruning": null,
|
||||
"server_version": "Unit tests",
|
||||
"protocol_min": "1.4",
|
||||
"protocol_max": "1.4.2",
|
||||
"genesis_hash": GENESIS_HASH_MAINNET,
|
||||
"hash_function": "sha256",
|
||||
"services": []
|
||||
"services": <dynamic>[]
|
||||
});
|
||||
when(client?.getBatchHistory(args: historyBatchArgs0))
|
||||
.thenAnswer((_) async => historyBatchResponse);
|
||||
|
@ -3014,7 +3014,7 @@ void main() {
|
|||
when(client?.getHistory(scripthash: anyNamed("scripthash")))
|
||||
.thenThrow(Exception("some exception"));
|
||||
|
||||
final wallet = await Hive.openBox(testWalletId);
|
||||
await Hive.openBox<dynamic>(testWalletId);
|
||||
|
||||
// recover to fill data
|
||||
await bch?.recoverFromMnemonic(
|
||||
|
@ -3069,14 +3069,14 @@ void main() {
|
|||
// when(client?.getBlockHeadTip()).thenAnswer((realInvocation) async =>
|
||||
// {"height": 520481, "hex": "some block hex"});
|
||||
// when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
// "hosts": {},
|
||||
// "hosts": <dynamic, dynamic>{},
|
||||
// "pruning": null,
|
||||
// "server_version": "Unit tests",
|
||||
// "protocol_min": "1.4",
|
||||
// "protocol_max": "1.4.2",
|
||||
// "genesis_hash": GENESIS_HASH_MAINNET,
|
||||
// "hash_function": "sha256",
|
||||
// "services": []
|
||||
// "services": <dynamic>[]
|
||||
// });
|
||||
// when(client?.getBatchHistory(args: historyBatchArgs0))
|
||||
// .thenAnswer((_) async => historyBatchResponse);
|
||||
|
|
|
@ -244,10 +244,10 @@ void main() {
|
|||
});
|
||||
|
||||
group("basic getters, setters, and functions", () {
|
||||
final dcoin = Coin.dogecoin;
|
||||
final dtestcoin = Coin.dogecoinTestNet;
|
||||
final testWalletId = "DOGEtestWalletID";
|
||||
final testWalletName = "DOGEWallet";
|
||||
const dcoin = Coin.dogecoin;
|
||||
const dtestcoin = Coin.dogecoinTestNet;
|
||||
const testWalletId = "DOGEtestWalletID";
|
||||
const testWalletName = "DOGEWallet";
|
||||
|
||||
MockElectrumX? client;
|
||||
MockCachedElectrumX? cachedClient;
|
||||
|
@ -352,14 +352,14 @@ void main() {
|
|||
test("get fees succeeds", () async {
|
||||
when(client?.ping()).thenAnswer((_) async => true);
|
||||
when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
"hosts": {},
|
||||
"hosts": <dynamic, dynamic>{},
|
||||
"pruning": null,
|
||||
"server_version": "Unit tests",
|
||||
"protocol_min": "1.4",
|
||||
"protocol_max": "1.4.2",
|
||||
"genesis_hash": GENESIS_HASH_TESTNET,
|
||||
"hash_function": "sha256",
|
||||
"services": []
|
||||
"services": <dynamic>[]
|
||||
});
|
||||
when(client?.estimateFee(blocks: 1))
|
||||
.thenAnswer((realInvocation) async => Decimal.zero);
|
||||
|
@ -386,14 +386,14 @@ void main() {
|
|||
test("get fees fails", () async {
|
||||
when(client?.ping()).thenAnswer((_) async => true);
|
||||
when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
"hosts": {},
|
||||
"hosts": <dynamic, dynamic>{},
|
||||
"pruning": null,
|
||||
"server_version": "Unit tests",
|
||||
"protocol_min": "1.4",
|
||||
"protocol_max": "1.4.2",
|
||||
"genesis_hash": GENESIS_HASH_TESTNET,
|
||||
"hash_function": "sha256",
|
||||
"services": []
|
||||
"services": <dynamic>[]
|
||||
});
|
||||
when(client?.estimateFee(blocks: 1))
|
||||
.thenAnswer((realInvocation) async => Decimal.zero);
|
||||
|
@ -423,14 +423,14 @@ void main() {
|
|||
test("get maxFee", () async {
|
||||
when(client?.ping()).thenAnswer((_) async => true);
|
||||
when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
"hosts": {},
|
||||
"hosts": <dynamic, dynamic>{},
|
||||
"pruning": null,
|
||||
"server_version": "Unit tests",
|
||||
"protocol_min": "1.4",
|
||||
"protocol_max": "1.4.2",
|
||||
"genesis_hash": GENESIS_HASH_TESTNET,
|
||||
"hash_function": "sha256",
|
||||
"services": []
|
||||
"services": <dynamic>[]
|
||||
});
|
||||
when(client?.estimateFee(blocks: 20))
|
||||
.thenAnswer((realInvocation) async => Decimal.zero);
|
||||
|
@ -453,10 +453,10 @@ void main() {
|
|||
});
|
||||
|
||||
group("DogeWallet service class functions that depend on shared storage", () {
|
||||
final dcoin = Coin.dogecoin;
|
||||
final dtestcoin = Coin.dogecoinTestNet;
|
||||
final testWalletId = "DOGEtestWalletID";
|
||||
final testWalletName = "DOGEWallet";
|
||||
const dcoin = Coin.dogecoin;
|
||||
const dtestcoin = Coin.dogecoinTestNet;
|
||||
const testWalletId = "DOGEtestWalletID";
|
||||
const testWalletName = "DOGEWallet";
|
||||
|
||||
bool hiveAdaptersRegistered = false;
|
||||
|
||||
|
@ -485,7 +485,7 @@ void main() {
|
|||
Hive.registerAdapter(UtxoObjectAdapter());
|
||||
Hive.registerAdapter(StatusAdapter());
|
||||
|
||||
final wallets = await Hive.openBox('wallets');
|
||||
final wallets = await Hive.openBox<dynamic>('wallets');
|
||||
await wallets.put('currentWalletName', testWalletName);
|
||||
}
|
||||
|
||||
|
@ -531,14 +531,14 @@ void main() {
|
|||
|
||||
// test("initializeNew mainnet throws bad network", () async {
|
||||
// when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
// "hosts": {},
|
||||
// "hosts": <dynamic, dynamic>{},
|
||||
// "pruning": null,
|
||||
// "server_version": "Unit tests",
|
||||
// "protocol_min": "1.4",
|
||||
// "protocol_max": "1.4.2",
|
||||
// "genesis_hash": GENESIS_HASH_TESTNET,
|
||||
// "hash_function": "sha256",
|
||||
// "services": []
|
||||
// "services": <dynamic>[]
|
||||
// });
|
||||
//
|
||||
// await Hive.openBox<dynamic>(testWalletId);
|
||||
|
@ -557,14 +557,14 @@ void main() {
|
|||
|
||||
test("initializeNew throws mnemonic overwrite exception", () async {
|
||||
when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
"hosts": {},
|
||||
"hosts": <dynamic, dynamic>{},
|
||||
"pruning": null,
|
||||
"server_version": "Unit tests",
|
||||
"protocol_min": "1.4",
|
||||
"protocol_max": "1.4.2",
|
||||
"genesis_hash": GENESIS_HASH_MAINNET,
|
||||
"hash_function": "sha256",
|
||||
"services": []
|
||||
"services": <dynamic>[]
|
||||
});
|
||||
await secureStore.write(
|
||||
key: "${testWalletId}_mnemonic", value: "some mnemonic");
|
||||
|
@ -572,7 +572,7 @@ void main() {
|
|||
await Hive.openBox<dynamic>(testWalletId);
|
||||
await Hive.openBox<dynamic>(DB.boxNamePrefs);
|
||||
|
||||
expectLater(() => doge?.initializeNew(), throwsA(isA<Exception>()))
|
||||
await expectLater(() => doge?.initializeNew(), throwsA(isA<Exception>()))
|
||||
.then((_) {
|
||||
expect(secureStore.interactions, 2);
|
||||
verifyNever(client?.ping()).called(0);
|
||||
|
@ -585,14 +585,14 @@ void main() {
|
|||
// test("initializeExisting testnet throws bad network", () async {
|
||||
// when(client?.ping()).thenAnswer((_) async => true);
|
||||
// when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
// "hosts": {},
|
||||
// "hosts": <dynamic, dynamic>{},
|
||||
// "pruning": null,
|
||||
// "server_version": "Unit tests",
|
||||
// "protocol_min": "1.4",
|
||||
// "protocol_max": "1.4.2",
|
||||
// "genesis_hash": GENESIS_HASH_MAINNET,
|
||||
// "hash_function": "sha256",
|
||||
// "services": []
|
||||
// "services": <dynamic>[]
|
||||
// });
|
||||
//
|
||||
// doge = DogecoinWallet(
|
||||
|
@ -625,14 +625,14 @@ void main() {
|
|||
// // .thenAnswer((realInvocation) async => Decimal.fromInt(10));
|
||||
// when(client?.ping()).thenAnswer((_) async => true);
|
||||
// when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
// "hosts": {},
|
||||
// "hosts": <dynamic, dynamic>{},
|
||||
// "pruning": null,
|
||||
// "server_version": "Unit tests",
|
||||
// "protocol_min": "1.4",
|
||||
// "protocol_max": "1.4.2",
|
||||
// "genesis_hash": GENESIS_HASH_MAINNET,
|
||||
// "hash_function": "sha256",
|
||||
// "services": []
|
||||
// "services": <dynamic>[]
|
||||
// });
|
||||
// // await DebugService.instance.init();
|
||||
// expect(doge?.initializeExisting(), true);
|
||||
|
@ -647,7 +647,7 @@ void main() {
|
|||
// expect(didThrow, true);
|
||||
//
|
||||
// // set node
|
||||
// final wallet = await Hive.openBox(testWalletId);
|
||||
// final wallet = await Hive.openBox<dynamic> (testWalletId);
|
||||
// await wallet.put("nodes", {
|
||||
// "default": {
|
||||
// "id": "some nodeID",
|
||||
|
@ -675,18 +675,18 @@ void main() {
|
|||
// .thenAnswer((realInvocation) async => Decimal.fromInt(10));
|
||||
// when(client?.ping()).thenAnswer((_) async => true);
|
||||
// when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
// "hosts": {},
|
||||
// "hosts": <dynamic, dynamic>{},
|
||||
// "pruning": null,
|
||||
// "server_version": "Unit tests",
|
||||
// "protocol_min": "1.4",
|
||||
// "protocol_max": "1.4.2",
|
||||
// "genesis_hash": GENESIS_HASH_MAINNET,
|
||||
// "hash_function": "sha256",
|
||||
// "services": []
|
||||
// "services": <dynamic>[]
|
||||
// });
|
||||
// expect(await doge?.initializeWallet(), true);
|
||||
//
|
||||
// final wallet = await Hive.openBox(testWalletId);
|
||||
// final wallet = await Hive.openBox<dynamic> (testWalletId);
|
||||
//
|
||||
// expect(await wallet.get("addressBookEntries"), {});
|
||||
// expect(await wallet.get('notes'), null);
|
||||
|
@ -731,20 +731,20 @@ void main() {
|
|||
// // when(client?.getBatchHistory(args: anyNamed("args")))
|
||||
// // .thenAnswer((_) async => {});
|
||||
// // when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
// // "hosts": {},
|
||||
// // "hosts": <dynamic, dynamic>{},
|
||||
// // "pruning": null,
|
||||
// // "server_version": "Unit tests",
|
||||
// // "protocol_min": "1.4",
|
||||
// // "protocol_max": "1.4.2",
|
||||
// // "genesis_hash": GENESIS_HASH_MAINNET,
|
||||
// // "hash_function": "sha256",
|
||||
// // "services": []
|
||||
// // "services": <dynamic>[]
|
||||
// // });
|
||||
// // // init new wallet
|
||||
// // expect(doge?.initializeNew(), true);
|
||||
// //
|
||||
// // // fetch data to compare later
|
||||
// // final newWallet = await Hive.openBox(testWalletId);
|
||||
// // final newWallet = await Hive.openBox<dynamic> (testWalletId);
|
||||
// //
|
||||
// // final addressBookEntries = await newWallet.get("addressBookEntries");
|
||||
// // final notes = await newWallet.get('notes');
|
||||
|
@ -783,7 +783,7 @@ void main() {
|
|||
// // expect(doge?.initializeExisting(), true);
|
||||
// //
|
||||
// // // compare data to ensure state matches state of previously closed wallet
|
||||
// // final wallet = await Hive.openBox(testWalletId);
|
||||
// // final wallet = await Hive.openBox<dynamic> (testWalletId);
|
||||
// //
|
||||
// // expect(await wallet.get("addressBookEntries"), addressBookEntries);
|
||||
// // expect(await wallet.get('notes'), notes);
|
||||
|
@ -831,14 +831,14 @@ void main() {
|
|||
);
|
||||
when(client?.ping()).thenAnswer((_) async => true);
|
||||
when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
"hosts": {},
|
||||
"hosts": <dynamic, dynamic>{},
|
||||
"pruning": null,
|
||||
"server_version": "Unit tests",
|
||||
"protocol_min": "1.4",
|
||||
"protocol_max": "1.4.2",
|
||||
"genesis_hash": GENESIS_HASH_TESTNET,
|
||||
"hash_function": "sha256",
|
||||
"services": []
|
||||
"services": <dynamic>[]
|
||||
});
|
||||
|
||||
await Hive.openBox<dynamic>(testWalletId);
|
||||
|
@ -878,14 +878,14 @@ void main() {
|
|||
// );
|
||||
// when(client?.ping()).thenAnswer((_) async => true);
|
||||
// when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
// "hosts": {},
|
||||
// "hosts": <dynamic, dynamic>{},
|
||||
// "pruning": null,
|
||||
// "server_version": "Unit tests",
|
||||
// "protocol_min": "1.4",
|
||||
// "protocol_max": "1.4.2",
|
||||
// "genesis_hash": GENESIS_HASH_TESTNET,
|
||||
// "hash_function": "sha256",
|
||||
// "services": []
|
||||
// "services": <dynamic>[]
|
||||
// });
|
||||
//
|
||||
// await Hive.openBox<dynamic>(testWalletId);
|
||||
|
@ -982,14 +982,14 @@ void main() {
|
|||
// // );
|
||||
// // when(client?.ping()).thenAnswer((_) async => true);
|
||||
// // when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
// // "hosts": {},
|
||||
// // "hosts": <dynamic, dynamic>{},
|
||||
// // "pruning": null,
|
||||
// // "server_version": "Unit tests",
|
||||
// // "protocol_min": "1.4",
|
||||
// // "protocol_max": "1.4.2",
|
||||
// // "genesis_hash": GENESIS_HASH_TESTNET,
|
||||
// // "hash_function": "sha256",
|
||||
// // "services": []
|
||||
// // "services": <dynamic>[]
|
||||
// // });
|
||||
// //
|
||||
// // when(client?.getBatchUTXOs(args: anyNamed("args")))
|
||||
|
@ -1001,7 +1001,7 @@ void main() {
|
|||
// // await doge?.initializeWallet();
|
||||
// //
|
||||
// // // add some extra addresses to make sure we have more than the single batch size of 10
|
||||
// // final wallet = await Hive.openBox(testWalletId);
|
||||
// // final wallet = await Hive.openBox<dynamic> (testWalletId);
|
||||
// // final addresses = await wallet.get("receivingAddressesP2PKH");
|
||||
// // addresses.add("DQaAi9R58GXMpDyhePys6hHCuif4fhc1sN");
|
||||
// // addresses.add("DBVhuF8QgeuxU2pssxzMgJqPhGCx5qyVkD");
|
||||
|
@ -1045,14 +1045,14 @@ void main() {
|
|||
);
|
||||
when(client?.ping()).thenAnswer((_) async => true);
|
||||
when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
"hosts": {},
|
||||
"hosts": <dynamic, dynamic>{},
|
||||
"pruning": null,
|
||||
"server_version": "Unit tests",
|
||||
"protocol_min": "1.4",
|
||||
"protocol_max": "1.4.2",
|
||||
"genesis_hash": GENESIS_HASH_TESTNET,
|
||||
"hash_function": "sha256",
|
||||
"services": []
|
||||
"services": <dynamic>[]
|
||||
});
|
||||
|
||||
await Hive.openBox<dynamic>(testWalletId);
|
||||
|
@ -1093,14 +1093,14 @@ void main() {
|
|||
);
|
||||
when(client?.ping()).thenAnswer((_) async => true);
|
||||
when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
"hosts": {},
|
||||
"hosts": <dynamic, dynamic>{},
|
||||
"pruning": null,
|
||||
"server_version": "Unit tests",
|
||||
"protocol_min": "1.4",
|
||||
"protocol_max": "1.4.2",
|
||||
"genesis_hash": GENESIS_HASH_TESTNET,
|
||||
"hash_function": "sha256",
|
||||
"services": []
|
||||
"services": <dynamic>[]
|
||||
});
|
||||
|
||||
await Hive.openBox<dynamic>(testWalletId);
|
||||
|
@ -1110,7 +1110,7 @@ void main() {
|
|||
await doge?.initializeExisting();
|
||||
|
||||
// get stored
|
||||
expect(await doge?.storedChainHeight, 0);
|
||||
expect(doge?.storedChainHeight, 0);
|
||||
|
||||
// fetch fails
|
||||
when(client?.getBlockHeadTip()).thenThrow(Exception("Some exception"));
|
||||
|
@ -1124,10 +1124,10 @@ void main() {
|
|||
expect(await doge?.chainHeight, 100);
|
||||
|
||||
// update
|
||||
await doge?.updateStoredChainHeight(newHeight: 1000);
|
||||
await doge?.updateCachedChainHeight(1000);
|
||||
|
||||
// fetch updated
|
||||
expect(await doge?.storedChainHeight, 1000);
|
||||
expect(doge?.storedChainHeight, 1000);
|
||||
|
||||
verifyNever(client?.ping()).called(0);
|
||||
verify(client?.getServerFeatures()).called(1);
|
||||
|
@ -1198,14 +1198,14 @@ void main() {
|
|||
test("_checkCurrentReceivingAddressesForTransactions succeeds", () async {
|
||||
when(client?.ping()).thenAnswer((_) async => true);
|
||||
when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
"hosts": {},
|
||||
"hosts": <dynamic, dynamic>{},
|
||||
"pruning": null,
|
||||
"server_version": "Unit tests",
|
||||
"protocol_min": "1.4",
|
||||
"protocol_max": "1.4.2",
|
||||
"genesis_hash": GENESIS_HASH_MAINNET,
|
||||
"hash_function": "sha256",
|
||||
"services": []
|
||||
"services": <dynamic>[]
|
||||
});
|
||||
when(client?.getHistory(scripthash: anyNamed("scripthash")))
|
||||
.thenAnswer((realInvocation) async => [
|
||||
|
@ -1250,14 +1250,14 @@ void main() {
|
|||
test("_checkCurrentReceivingAddressesForTransactions fails", () async {
|
||||
when(client?.ping()).thenAnswer((_) async => true);
|
||||
when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
"hosts": {},
|
||||
"hosts": <dynamic, dynamic>{},
|
||||
"pruning": null,
|
||||
"server_version": "Unit tests",
|
||||
"protocol_min": "1.4",
|
||||
"protocol_max": "1.4.2",
|
||||
"genesis_hash": GENESIS_HASH_MAINNET,
|
||||
"hash_function": "sha256",
|
||||
"services": []
|
||||
"services": <dynamic>[]
|
||||
});
|
||||
when(client?.getHistory(scripthash: anyNamed("scripthash")))
|
||||
.thenThrow(Exception("some exception"));
|
||||
|
@ -1291,14 +1291,14 @@ void main() {
|
|||
test("_checkCurrentChangeAddressesForTransactions succeeds", () async {
|
||||
when(client?.ping()).thenAnswer((_) async => true);
|
||||
when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
"hosts": {},
|
||||
"hosts": <dynamic, dynamic>{},
|
||||
"pruning": null,
|
||||
"server_version": "Unit tests",
|
||||
"protocol_min": "1.4",
|
||||
"protocol_max": "1.4.2",
|
||||
"genesis_hash": GENESIS_HASH_MAINNET,
|
||||
"hash_function": "sha256",
|
||||
"services": []
|
||||
"services": <dynamic>[]
|
||||
});
|
||||
when(client?.getHistory(scripthash: anyNamed("scripthash")))
|
||||
.thenAnswer((realInvocation) async => [
|
||||
|
@ -1344,14 +1344,14 @@ void main() {
|
|||
test("_checkCurrentChangeAddressesForTransactions fails", () async {
|
||||
when(client?.ping()).thenAnswer((_) async => true);
|
||||
when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
"hosts": {},
|
||||
"hosts": <dynamic, dynamic>{},
|
||||
"pruning": null,
|
||||
"server_version": "Unit tests",
|
||||
"protocol_min": "1.4",
|
||||
"protocol_max": "1.4.2",
|
||||
"genesis_hash": GENESIS_HASH_MAINNET,
|
||||
"hash_function": "sha256",
|
||||
"services": []
|
||||
"services": <dynamic>[]
|
||||
});
|
||||
when(client?.getHistory(scripthash: anyNamed("scripthash")))
|
||||
.thenThrow(Exception("some exception"));
|
||||
|
@ -1429,7 +1429,7 @@ void main() {
|
|||
//
|
||||
// secureStore: secureStore,
|
||||
// );
|
||||
// final wallet = await Hive.openBox(testWalletId);
|
||||
// final wallet = await Hive.openBox<dynamic> (testWalletId);
|
||||
// await wallet.put('receivingAddressesP2PKH', []);
|
||||
//
|
||||
// await wallet.put('changeAddressesP2PKH', []);
|
||||
|
@ -1558,7 +1558,7 @@ void main() {
|
|||
//
|
||||
// secureStore: secureStore,
|
||||
// );
|
||||
// final wallet = await Hive.openBox(testWalletId);
|
||||
// final wallet = await Hive.openBox<dynamic> (testWalletId);
|
||||
// await wallet.put('receivingAddressesP2PKH', []);
|
||||
//
|
||||
// await wallet.put('changeAddressesP2PKH', []);
|
||||
|
@ -1691,7 +1691,7 @@ void main() {
|
|||
//
|
||||
// secureStore: secureStore,
|
||||
// );
|
||||
// final wallet = await Hive.openBox(testWalletId);
|
||||
// final wallet = await Hive.openBox<dynamic> (testWalletId);
|
||||
// await wallet.put('receivingAddressesP2PKH', []);
|
||||
//
|
||||
// await wallet.put('changeAddressesP2PKH', []);
|
||||
|
@ -1743,7 +1743,7 @@ void main() {
|
|||
// //
|
||||
// // secureStore: secureStore,
|
||||
// // );
|
||||
// // final wallet = await Hive.openBox(testWalletId);
|
||||
// // final wallet = await Hive.openBox<dynamic> (testWalletId);
|
||||
// // await wallet.put('receivingAddressesP2PKH', []);
|
||||
// //
|
||||
// // await wallet.put('changeAddressesP2PKH', []);
|
||||
|
@ -1770,21 +1770,21 @@ void main() {
|
|||
|
||||
test("get mnemonic list", () async {
|
||||
when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
"hosts": {},
|
||||
"hosts": <dynamic, dynamic>{},
|
||||
"pruning": null,
|
||||
"server_version": "Unit tests",
|
||||
"protocol_min": "1.4",
|
||||
"protocol_max": "1.4.2",
|
||||
"genesis_hash": GENESIS_HASH_MAINNET,
|
||||
"hash_function": "sha256",
|
||||
"services": []
|
||||
"services": <dynamic>[]
|
||||
});
|
||||
when(client?.getBatchHistory(args: historyBatchArgs0))
|
||||
.thenAnswer((_) async => emptyHistoryBatchResponse);
|
||||
when(client?.getBatchHistory(args: historyBatchArgs1))
|
||||
.thenAnswer((_) async => emptyHistoryBatchResponse);
|
||||
|
||||
final wallet = await Hive.openBox(testWalletId);
|
||||
await Hive.openBox<dynamic>(testWalletId);
|
||||
|
||||
// add maxNumberOfIndexesToCheck and height
|
||||
await doge?.recoverFromMnemonic(
|
||||
|
@ -1808,14 +1808,14 @@ void main() {
|
|||
"recoverFromMnemonic using empty seed on mainnet fails due to bad genesis hash match",
|
||||
() async {
|
||||
when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
"hosts": {},
|
||||
"hosts": <dynamic, dynamic>{},
|
||||
"pruning": null,
|
||||
"server_version": "Unit tests",
|
||||
"protocol_min": "1.4",
|
||||
"protocol_max": "1.4.2",
|
||||
"genesis_hash": GENESIS_HASH_TESTNET,
|
||||
"hash_function": "sha256",
|
||||
"services": []
|
||||
"services": <dynamic>[]
|
||||
});
|
||||
|
||||
bool hasThrown = false;
|
||||
|
@ -1850,14 +1850,14 @@ void main() {
|
|||
secureStore: secureStore,
|
||||
);
|
||||
when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
"hosts": {},
|
||||
"hosts": <dynamic, dynamic>{},
|
||||
"pruning": null,
|
||||
"server_version": "Unit tests",
|
||||
"protocol_min": "1.4",
|
||||
"protocol_max": "1.4.2",
|
||||
"genesis_hash": GENESIS_HASH_MAINNET,
|
||||
"hash_function": "sha256",
|
||||
"services": []
|
||||
"services": <dynamic>[]
|
||||
});
|
||||
|
||||
bool hasThrown = false;
|
||||
|
@ -1883,14 +1883,14 @@ void main() {
|
|||
"recoverFromMnemonic using empty seed on mainnet fails due to attempted overwrite of mnemonic",
|
||||
() async {
|
||||
when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
"hosts": {},
|
||||
"hosts": <dynamic, dynamic>{},
|
||||
"pruning": null,
|
||||
"server_version": "Unit tests",
|
||||
"protocol_min": "1.4",
|
||||
"protocol_max": "1.4.2",
|
||||
"genesis_hash": GENESIS_HASH_MAINNET,
|
||||
"hash_function": "sha256",
|
||||
"services": []
|
||||
"services": <dynamic>[]
|
||||
});
|
||||
|
||||
await secureStore.write(
|
||||
|
@ -1918,14 +1918,14 @@ void main() {
|
|||
test("recoverFromMnemonic using non empty seed on mainnet succeeds",
|
||||
() async {
|
||||
when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
"hosts": {},
|
||||
"hosts": <dynamic, dynamic>{},
|
||||
"pruning": null,
|
||||
"server_version": "Unit tests",
|
||||
"protocol_min": "1.4",
|
||||
"protocol_max": "1.4.2",
|
||||
"genesis_hash": GENESIS_HASH_MAINNET,
|
||||
"hash_function": "sha256",
|
||||
"services": []
|
||||
"services": <dynamic>[]
|
||||
});
|
||||
when(client?.getBatchHistory(args: historyBatchArgs0))
|
||||
.thenAnswer((_) async => historyBatchResponse);
|
||||
|
@ -1944,7 +1944,7 @@ void main() {
|
|||
]
|
||||
})).thenAnswer((realInvocation) async => {"0": []});
|
||||
|
||||
final wallet = await Hive.openBox<dynamic>(testWalletId);
|
||||
await Hive.openBox<dynamic>(testWalletId);
|
||||
|
||||
bool hasThrown = false;
|
||||
try {
|
||||
|
@ -1984,14 +1984,14 @@ void main() {
|
|||
|
||||
test("fullRescan succeeds", () async {
|
||||
when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
"hosts": {},
|
||||
"hosts": <dynamic, dynamic>{},
|
||||
"pruning": null,
|
||||
"server_version": "Unit tests",
|
||||
"protocol_min": "1.4",
|
||||
"protocol_max": "1.4.2",
|
||||
"genesis_hash": GENESIS_HASH_MAINNET,
|
||||
"hash_function": "sha256",
|
||||
"services": []
|
||||
"services": <dynamic>[]
|
||||
});
|
||||
when(client?.getBatchHistory(args: historyBatchArgs0))
|
||||
.thenAnswer((_) async => historyBatchResponse);
|
||||
|
@ -2101,14 +2101,14 @@ void main() {
|
|||
|
||||
test("fullRescan fails", () async {
|
||||
when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
"hosts": {},
|
||||
"hosts": <dynamic, dynamic>{},
|
||||
"pruning": null,
|
||||
"server_version": "Unit tests",
|
||||
"protocol_min": "1.4",
|
||||
"protocol_max": "1.4.2",
|
||||
"genesis_hash": GENESIS_HASH_MAINNET,
|
||||
"hash_function": "sha256",
|
||||
"services": []
|
||||
"services": <dynamic>[]
|
||||
});
|
||||
|
||||
when(client?.getBatchHistory(args: historyBatchArgs0))
|
||||
|
@ -2130,7 +2130,7 @@ void main() {
|
|||
when(cachedClient?.clearSharedTransactionCache(coin: Coin.dogecoin))
|
||||
.thenAnswer((realInvocation) async {});
|
||||
|
||||
final wallet = await Hive.openBox(testWalletId);
|
||||
final wallet = await Hive.openBox<dynamic>(testWalletId);
|
||||
|
||||
// restore so we have something to rescan
|
||||
await doge?.recoverFromMnemonic(
|
||||
|
@ -2211,14 +2211,14 @@ void main() {
|
|||
|
||||
// // test("fetchBuildTxData succeeds", () async {
|
||||
// // when(client.getServerFeatures()).thenAnswer((_) async => {
|
||||
// // "hosts": {},
|
||||
// // "hosts": <dynamic, dynamic>{},
|
||||
// // "pruning": null,
|
||||
// // "server_version": "Unit tests",
|
||||
// // "protocol_min": "1.4",
|
||||
// // "protocol_max": "1.4.2",
|
||||
// // "genesis_hash": GENESIS_HASH_MAINNET,
|
||||
// // "hash_function": "sha256",
|
||||
// // "services": []
|
||||
// // "services": <dynamic>[]
|
||||
// // });
|
||||
// // when(client.getBatchHistory(args: historyBatchArgs0))
|
||||
// // .thenAnswer((_) async => historyBatchResponse);
|
||||
|
@ -2388,14 +2388,14 @@ void main() {
|
|||
|
||||
// test("fetchBuildTxData throws", () async {
|
||||
// when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
// "hosts": {},
|
||||
// "hosts": <dynamic, dynamic>{},
|
||||
// "pruning": null,
|
||||
// "server_version": "Unit tests",
|
||||
// "protocol_min": "1.4",
|
||||
// "protocol_max": "1.4.2",
|
||||
// "genesis_hash": GENESIS_HASH_MAINNET,
|
||||
// "hash_function": "sha256",
|
||||
// "services": []
|
||||
// "services": <dynamic>[]
|
||||
// });
|
||||
// when(client?.getBatchHistory(args: historyBatchArgs0))
|
||||
// .thenAnswer((_) async => historyBatchResponse);
|
||||
|
@ -2469,14 +2469,14 @@ void main() {
|
|||
|
||||
// test("build transaction succeeds", () async {
|
||||
// when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
// "hosts": {},
|
||||
// "hosts": <dynamic, dynamic>{},
|
||||
// "pruning": null,
|
||||
// "server_version": "Unit tests",
|
||||
// "protocol_min": "1.4",
|
||||
// "protocol_max": "1.4.2",
|
||||
// "genesis_hash": GENESIS_HASH_MAINNET,
|
||||
// "hash_function": "sha256",
|
||||
// "services": []
|
||||
// "services": <dynamic>[]
|
||||
// });
|
||||
// when(client?.getBatchHistory(args: historyBatchArgs0))
|
||||
// .thenAnswer((_) async => historyBatchResponse);
|
||||
|
@ -2672,14 +2672,14 @@ void main() {
|
|||
|
||||
test("refresh wallet mutex locked", () async {
|
||||
when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
"hosts": {},
|
||||
"hosts": <dynamic, dynamic>{},
|
||||
"pruning": null,
|
||||
"server_version": "Unit tests",
|
||||
"protocol_min": "1.4",
|
||||
"protocol_max": "1.4.2",
|
||||
"genesis_hash": GENESIS_HASH_MAINNET,
|
||||
"hash_function": "sha256",
|
||||
"services": []
|
||||
"services": <dynamic>[]
|
||||
});
|
||||
when(client?.getBatchHistory(args: historyBatchArgs0))
|
||||
.thenAnswer((_) async => historyBatchResponse);
|
||||
|
@ -2697,7 +2697,7 @@ void main() {
|
|||
]
|
||||
})).thenAnswer((realInvocation) async => {"0": []});
|
||||
|
||||
final wallet = await Hive.openBox(testWalletId);
|
||||
final wallet = await Hive.openBox<dynamic>(testWalletId);
|
||||
|
||||
// recover to fill data
|
||||
await doge?.recoverFromMnemonic(
|
||||
|
@ -2737,14 +2737,14 @@ void main() {
|
|||
test("refresh wallet throws", () async {
|
||||
when(client?.getBlockHeadTip()).thenThrow(Exception("some exception"));
|
||||
when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
"hosts": {},
|
||||
"hosts": <dynamic, dynamic>{},
|
||||
"pruning": null,
|
||||
"server_version": "Unit tests",
|
||||
"protocol_min": "1.4",
|
||||
"protocol_max": "1.4.2",
|
||||
"genesis_hash": GENESIS_HASH_MAINNET,
|
||||
"hash_function": "sha256",
|
||||
"services": []
|
||||
"services": <dynamic>[]
|
||||
});
|
||||
when(client?.getBatchHistory(args: historyBatchArgs0))
|
||||
.thenAnswer((_) async => historyBatchResponse);
|
||||
|
@ -2764,7 +2764,7 @@ void main() {
|
|||
when(client?.getHistory(scripthash: anyNamed("scripthash")))
|
||||
.thenThrow(Exception("some exception"));
|
||||
|
||||
final wallet = await Hive.openBox(testWalletId);
|
||||
await Hive.openBox<dynamic>(testWalletId);
|
||||
|
||||
// recover to fill data
|
||||
await doge?.recoverFromMnemonic(
|
||||
|
@ -2805,14 +2805,14 @@ void main() {
|
|||
// when(client?.getBlockHeadTip()).thenAnswer((realInvocation) async =>
|
||||
// {"height": 520481, "hex": "some block hex"});
|
||||
// when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
// "hosts": {},
|
||||
// "hosts": <dynamic, dynamic>{},
|
||||
// "pruning": null,
|
||||
// "server_version": "Unit tests",
|
||||
// "protocol_min": "1.4",
|
||||
// "protocol_max": "1.4.2",
|
||||
// "genesis_hash": GENESIS_HASH_MAINNET,
|
||||
// "hash_function": "sha256",
|
||||
// "services": []
|
||||
// "services": <dynamic>[]
|
||||
// });
|
||||
// when(client?.getBatchHistory(args: historyBatchArgs0))
|
||||
// .thenAnswer((_) async => historyBatchResponse);
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
import 'dart:typed_data';
|
||||
|
||||
import 'package:crypto/crypto.dart';
|
||||
import 'package:decimal/decimal.dart';
|
||||
|
@ -20,7 +19,6 @@ import 'package:stackwallet/utilities/address_utils.dart';
|
|||
import 'package:stackwallet/utilities/enums/coin_enum.dart';
|
||||
import 'package:stackwallet/utilities/flutter_secure_storage_interface.dart';
|
||||
import 'package:stackwallet/utilities/format.dart';
|
||||
import 'package:tuple/tuple.dart';
|
||||
|
||||
import 'firo_wallet_test.mocks.dart';
|
||||
import 'firo_wallet_test_parameters.dart';
|
||||
|
@ -44,7 +42,7 @@ void main() {
|
|||
test("isolateRestore success", () async {
|
||||
final cachedClient = MockCachedElectrumX();
|
||||
final txData = TransactionData.fromJson(dateTimeChunksJson);
|
||||
final Map setData = {};
|
||||
final Map<dynamic, dynamic> setData = {};
|
||||
setData[1] = GetAnonymitySetSampleData.data;
|
||||
final usedSerials = GetUsedSerialsSampleData.serials["serials"] as List;
|
||||
|
||||
|
@ -87,8 +85,8 @@ void main() {
|
|||
});
|
||||
|
||||
test("isolateRestore throws", () async {
|
||||
final Map setData = {};
|
||||
final usedSerials = [];
|
||||
final Map<dynamic, dynamic> setData = {};
|
||||
final usedSerials = <dynamic>[];
|
||||
|
||||
expect(
|
||||
() => isolateRestore(
|
||||
|
@ -109,13 +107,11 @@ void main() {
|
|||
false,
|
||||
TEST_MNEMONIC,
|
||||
2,
|
||||
Decimal.ten,
|
||||
[],
|
||||
459185,
|
||||
Coin.firo,
|
||||
firoNetwork,
|
||||
[GetAnonymitySetSampleData.data],
|
||||
"en_US",
|
||||
);
|
||||
|
||||
expect(result, 1);
|
||||
|
@ -208,7 +204,7 @@ void main() {
|
|||
// "getJMintTransactions throws Error due to some invalid transactions passed to this function",
|
||||
// () {
|
||||
// final cachedClient = MockCachedElectrumX();
|
||||
// final priceAPI = MockPriceAPI();
|
||||
//
|
||||
//
|
||||
// // mock price calls
|
||||
// when(priceAPI.getPricesAnd24hChange( baseCurrency: "USD"))
|
||||
|
@ -269,7 +265,7 @@ void main() {
|
|||
//
|
||||
// test("getJMintTransactions success", () async {
|
||||
// final cachedClient = MockCachedElectrumX();
|
||||
// final priceAPI = MockPriceAPI();
|
||||
//
|
||||
//
|
||||
// // mock price calls
|
||||
// when(priceAPI.getPricesAnd24hChange( baseCurrency: "USD"))
|
||||
|
@ -532,7 +528,7 @@ void main() {
|
|||
Hive.registerAdapter(LelantusCoinAdapter());
|
||||
}
|
||||
|
||||
final wallets = await Hive.openBox('wallets');
|
||||
final wallets = await Hive.openBox<dynamic>('wallets');
|
||||
await wallets.put('currentWalletName', testWalletName);
|
||||
});
|
||||
|
||||
|
@ -540,7 +536,7 @@ void main() {
|
|||
// final client = MockElectrumX();
|
||||
// final cachedClient = MockCachedElectrumX();
|
||||
// final secureStore = FakeSecureStorage();
|
||||
// final priceAPI = MockPriceAPI();
|
||||
//
|
||||
//
|
||||
// when(client.getServerFeatures()).thenAnswer((_) async => false);
|
||||
//
|
||||
|
@ -561,7 +557,7 @@ void main() {
|
|||
// final client = MockElectrumX();
|
||||
// final cachedClient = MockCachedElectrumX();
|
||||
// final secureStore = FakeSecureStorage();
|
||||
// final priceAPI = MockPriceAPI();
|
||||
//
|
||||
//
|
||||
// when(client.ping()).thenThrow(Exception("Network connection failed"));
|
||||
//
|
||||
|
@ -583,19 +579,19 @@ void main() {
|
|||
// final client = MockElectrumX();
|
||||
// final cachedClient = MockCachedElectrumX();
|
||||
// final secureStore = FakeSecureStorage();
|
||||
// final priceAPI = MockPriceAPI();
|
||||
//
|
||||
//
|
||||
// when(client.ping()).thenAnswer((_) async => true);
|
||||
//
|
||||
// when(client.getServerFeatures()).thenAnswer((_) async => {
|
||||
// "hosts": {},
|
||||
// "hosts": <dynamic, dynamic>{},
|
||||
// "pruning": null,
|
||||
// "server_version": "Unit tests",
|
||||
// "protocol_min": "1.4",
|
||||
// "protocol_max": "1.4.2",
|
||||
// "genesis_hash": GENESIS_HASH_MAINNET,
|
||||
// "hash_function": "sha256",
|
||||
// "services": []
|
||||
// "services": <dynamic>[]
|
||||
// });
|
||||
//
|
||||
// final firo = FiroWallet(
|
||||
|
@ -616,19 +612,19 @@ void main() {
|
|||
// final client = MockElectrumX();
|
||||
// final cachedClient = MockCachedElectrumX();
|
||||
// final secureStore = FakeSecureStorage();
|
||||
// final priceAPI = MockPriceAPI();
|
||||
//
|
||||
//
|
||||
// when(client.ping()).thenAnswer((_) async => true);
|
||||
//
|
||||
// when(client.getServerFeatures()).thenAnswer((_) async => {
|
||||
// "hosts": {},
|
||||
// "hosts": <dynamic, dynamic>{},
|
||||
// "pruning": null,
|
||||
// "server_version": "Unit tests",
|
||||
// "protocol_min": "1.4",
|
||||
// "protocol_max": "1.4.2",
|
||||
// "genesis_hash": GENESIS_HASH_TESTNET,
|
||||
// "hash_function": "sha256",
|
||||
// "services": []
|
||||
// "services": <dynamic>[]
|
||||
// });
|
||||
//
|
||||
// final firo = FiroWallet(
|
||||
|
@ -652,21 +648,21 @@ void main() {
|
|||
// final client = MockElectrumX();
|
||||
// final cachedClient = MockCachedElectrumX();
|
||||
// final secureStore = FakeSecureStorage();
|
||||
// final priceAPI = MockPriceAPI();
|
||||
//
|
||||
// when(priceAPI.getPrice(ticker: "tFIRO", baseCurrency: "USD"))
|
||||
// .thenAnswer((_) async => Decimal.fromInt(-1));
|
||||
//
|
||||
// when(client.ping()).thenAnswer((_) async => true);
|
||||
//
|
||||
// when(client.getServerFeatures()).thenAnswer((_) async => {
|
||||
// "hosts": {},
|
||||
// "hosts": <dynamic, dynamic>{},
|
||||
// "pruning": null,
|
||||
// "server_version": "Unit tests",
|
||||
// "protocol_min": "1.4",
|
||||
// "protocol_max": "1.4.2",
|
||||
// "genesis_hash": GENESIS_HASH_TESTNET,
|
||||
// "hash_function": "sha256",
|
||||
// "services": []
|
||||
// "services": <dynamic>[]
|
||||
// });
|
||||
//
|
||||
// final List<Map<String, dynamic>> emptyList = [];
|
||||
|
@ -723,21 +719,21 @@ void main() {
|
|||
// final client = MockElectrumX();
|
||||
// final cachedClient = MockCachedElectrumX();
|
||||
// final secureStore = FakeSecureStorage();
|
||||
// final priceAPI = MockPriceAPI();
|
||||
//
|
||||
// // when(priceAPI.getPrice(ticker: "tFIRO", baseCurrency: "USD"))
|
||||
// // .thenAnswer((_) async => Decimal.fromInt(-1));
|
||||
//
|
||||
// when(client.ping()).thenAnswer((_) async => true);
|
||||
//
|
||||
// when(client.getServerFeatures()).thenAnswer((_) async => {
|
||||
// "hosts": {},
|
||||
// "hosts": <dynamic, dynamic>{},
|
||||
// "pruning": null,
|
||||
// "server_version": "Unit tests",
|
||||
// "protocol_min": "1.4",
|
||||
// "protocol_max": "1.4.2",
|
||||
// "genesis_hash": GENESIS_HASH_TESTNET,
|
||||
// "hash_function": "sha256",
|
||||
// "services": []
|
||||
// "services": <dynamic>[]
|
||||
// });
|
||||
//
|
||||
// final List<Map<String, dynamic>> emptyList = [];
|
||||
|
@ -828,7 +824,7 @@ void main() {
|
|||
// final client = MockElectrumX();
|
||||
// final cachedClient = MockCachedElectrumX();
|
||||
// final secureStore = FakeSecureStorage();
|
||||
// final priceAPI = MockPriceAPI();
|
||||
//
|
||||
// // mock price calls
|
||||
// when(priceAPI.getPricesAnd24hChange(baseCurrency: "USD")).thenAnswer(
|
||||
// (_) async => {Coin.firo: Tuple2(Decimal.fromInt(10), 1.0)});
|
||||
|
@ -836,14 +832,14 @@ void main() {
|
|||
// when(client.ping()).thenAnswer((_) async => true);
|
||||
//
|
||||
// when(client.getServerFeatures()).thenAnswer((_) async => {
|
||||
// "hosts": {},
|
||||
// "hosts": <dynamic, dynamic>{},
|
||||
// "pruning": null,
|
||||
// "server_version": "Unit tests",
|
||||
// "protocol_min": "1.4",
|
||||
// "protocol_max": "1.4.2",
|
||||
// "genesis_hash": GENESIS_HASH_MAINNET,
|
||||
// "hash_function": "sha256",
|
||||
// "services": []
|
||||
// "services": <dynamic>[]
|
||||
// });
|
||||
//
|
||||
// final List<Map<String, dynamic>> emptyList = [];
|
||||
|
@ -905,7 +901,7 @@ void main() {
|
|||
// final client = MockElectrumX();
|
||||
// final cachedClient = MockCachedElectrumX();
|
||||
// final secureStore = FakeSecureStorage();
|
||||
// final priceAPI = MockPriceAPI();
|
||||
//
|
||||
// final tracker = MockTransactionNotificationTracker();
|
||||
//
|
||||
// await Hive.openBox<dynamic>(DB.boxNamePrefs);
|
||||
|
@ -971,12 +967,8 @@ void main() {
|
|||
final client = MockElectrumX();
|
||||
final cachedClient = MockCachedElectrumX();
|
||||
final secureStore = FakeSecureStorage();
|
||||
final priceAPI = MockPriceAPI();
|
||||
final tracker = MockTransactionNotificationTracker();
|
||||
|
||||
// mock price calls
|
||||
when(priceAPI.getPricesAnd24hChange(baseCurrency: "USD")).thenAnswer(
|
||||
(_) async => {Coin.firo: Tuple2(Decimal.fromInt(10), 1.0)});
|
||||
final tracker = MockTransactionNotificationTracker();
|
||||
|
||||
when(tracker.pendings).thenAnswer((realInvocation) => [
|
||||
"51576e2230c2911a508aabb85bb50045f04b8dc958790ce2372986c3ebbe7d3e",
|
||||
|
@ -1048,8 +1040,8 @@ void main() {
|
|||
|
||||
// firo.unconfirmedTxs = {};
|
||||
|
||||
final wallet =
|
||||
await Hive.openBox("${testWalletId}refreshIfThereIsNewData");
|
||||
final wallet = await Hive.openBox<dynamic>(
|
||||
"${testWalletId}refreshIfThereIsNewData");
|
||||
await wallet.put('receivingAddresses', [
|
||||
"a8VV7vMzJdTQj1eLEJNskhLEBUxfNWhpAg",
|
||||
"aPjLWDTPQsoPHUTxKBNRzoebDALj3eTcfh",
|
||||
|
@ -1070,7 +1062,7 @@ void main() {
|
|||
// final client = MockElectrumX();
|
||||
// final cachedClient = MockCachedElectrumX();
|
||||
// final secureStore = FakeSecureStorage();
|
||||
// final priceAPI = MockPriceAPI();
|
||||
//
|
||||
// final tracker = MockTransactionNotificationTracker();
|
||||
//
|
||||
// when(client.getTransaction(txHash: SampleGetTransactionData.txHash6))
|
||||
|
@ -1126,7 +1118,6 @@ void main() {
|
|||
final client = MockElectrumX();
|
||||
final cachedClient = MockCachedElectrumX();
|
||||
final secureStore = FakeSecureStorage();
|
||||
final priceAPI = MockPriceAPI();
|
||||
|
||||
when(client.broadcastTransaction(
|
||||
rawTx:
|
||||
|
@ -1155,7 +1146,6 @@ void main() {
|
|||
final client = MockElectrumX();
|
||||
final cachedClient = MockCachedElectrumX();
|
||||
final secureStore = FakeSecureStorage();
|
||||
final priceAPI = MockPriceAPI();
|
||||
|
||||
final firo = FiroWallet(
|
||||
walletName: testWalletName,
|
||||
|
@ -1225,11 +1215,6 @@ void main() {
|
|||
when(client.getBlockHeadTip()).thenAnswer(
|
||||
(_) async => {"height": 455873, "hex": "this value not used here"});
|
||||
|
||||
final priceAPI = MockPriceAPI();
|
||||
// mock price calls
|
||||
when(priceAPI.getPricesAnd24hChange(baseCurrency: "USD")).thenAnswer(
|
||||
(_) async => {Coin.firo: Tuple2(Decimal.fromInt(10), 1.0)});
|
||||
|
||||
final firo = FiroWallet(
|
||||
walletName: testWalletName,
|
||||
walletId: "${testWalletId}buildMintTransaction",
|
||||
|
@ -1240,7 +1225,8 @@ void main() {
|
|||
tracker: MockTransactionNotificationTracker(),
|
||||
);
|
||||
|
||||
final wallet = await Hive.openBox("${testWalletId}buildMintTransaction");
|
||||
final wallet =
|
||||
await Hive.openBox<dynamic>("${testWalletId}buildMintTransaction");
|
||||
|
||||
await wallet.put("mintIndex", 0);
|
||||
|
||||
|
@ -1268,18 +1254,17 @@ void main() {
|
|||
final client = MockElectrumX();
|
||||
final cachedClient = MockCachedElectrumX();
|
||||
final secureStore = FakeSecureStorage();
|
||||
final priceAPI = MockPriceAPI();
|
||||
|
||||
// mock electrumx client calls
|
||||
when(client.getServerFeatures()).thenAnswer((_) async => {
|
||||
"hosts": {},
|
||||
"hosts": <dynamic, dynamic>{},
|
||||
"pruning": null,
|
||||
"server_version": "Unit tests",
|
||||
"protocol_min": "1.4",
|
||||
"protocol_max": "1.4.2",
|
||||
"genesis_hash": GENESIS_HASH_MAINNET,
|
||||
"hash_function": "sha256",
|
||||
"services": []
|
||||
"services": <dynamic>[]
|
||||
});
|
||||
|
||||
when(client.getLatestCoinId()).thenAnswer((_) async => 1);
|
||||
|
@ -1356,10 +1341,6 @@ void main() {
|
|||
return SampleGetTransactionData.txData7;
|
||||
});
|
||||
|
||||
// mock price calls
|
||||
when(priceAPI.getPricesAnd24hChange(baseCurrency: "USD")).thenAnswer(
|
||||
(_) async => {Coin.firo: Tuple2(Decimal.fromInt(10), 1.0)});
|
||||
|
||||
final firo = FiroWallet(
|
||||
walletName: testWalletName,
|
||||
walletId: "${testWalletId}recoverFromMnemonic",
|
||||
|
@ -1507,7 +1488,6 @@ void main() {
|
|||
final client = MockElectrumX();
|
||||
final cachedClient = MockCachedElectrumX();
|
||||
final secureStore = FakeSecureStorage();
|
||||
final priceAPI = MockPriceAPI();
|
||||
|
||||
await secureStore.write(
|
||||
key: '${testWalletId}fullRescan_mnemonic', value: TEST_MNEMONIC);
|
||||
|
@ -1529,10 +1509,6 @@ void main() {
|
|||
when(cachedClient.clearSharedTransactionCache(coin: Coin.firo))
|
||||
.thenAnswer((_) async => {});
|
||||
|
||||
// mock price calls
|
||||
when(priceAPI.getPricesAnd24hChange(baseCurrency: "USD")).thenAnswer(
|
||||
(_) async => {Coin.firo: Tuple2(Decimal.fromInt(10), 1.0)});
|
||||
|
||||
final firo = FiroWallet(
|
||||
walletName: testWalletName,
|
||||
walletId: "${testWalletId}fullRescan",
|
||||
|
@ -1545,7 +1521,7 @@ void main() {
|
|||
|
||||
// pre grab derivations in order to set up mock calls needed later on
|
||||
await firo.fillAddresses(TEST_MNEMONIC);
|
||||
final wallet = await Hive.openBox("${testWalletId}fullRescan");
|
||||
final wallet = await Hive.openBox<dynamic>("${testWalletId}fullRescan");
|
||||
|
||||
final rcv = await secureStore.read(
|
||||
key: "${testWalletId}fullRescan_receiveDerivations");
|
||||
|
@ -1721,7 +1697,6 @@ void main() {
|
|||
final client = MockElectrumX();
|
||||
final cachedClient = MockCachedElectrumX();
|
||||
final secureStore = FakeSecureStorage();
|
||||
final priceAPI = MockPriceAPI();
|
||||
|
||||
await secureStore.write(
|
||||
key: '${testWalletId}fullRescan_mnemonic', value: TEST_MNEMONIC);
|
||||
|
@ -1736,10 +1711,6 @@ void main() {
|
|||
when(cachedClient.clearSharedTransactionCache(coin: Coin.firo))
|
||||
.thenAnswer((_) async => {});
|
||||
|
||||
// mock price calls
|
||||
when(priceAPI.getPricesAnd24hChange(baseCurrency: "USD")).thenAnswer(
|
||||
(_) async => {Coin.firo: Tuple2(Decimal.fromInt(10), 1.0)});
|
||||
|
||||
final firo = FiroWallet(
|
||||
walletName: testWalletName,
|
||||
walletId: "${testWalletId}fullRescan",
|
||||
|
@ -1864,18 +1835,17 @@ void main() {
|
|||
final client = MockElectrumX();
|
||||
final cachedClient = MockCachedElectrumX();
|
||||
final secureStore = FakeSecureStorage();
|
||||
final priceAPI = MockPriceAPI();
|
||||
|
||||
// mock electrumx client calls
|
||||
when(client.getServerFeatures()).thenAnswer((_) async => {
|
||||
"hosts": {},
|
||||
"hosts": <dynamic, dynamic>{},
|
||||
"pruning": null,
|
||||
"server_version": "Unit tests",
|
||||
"protocol_min": "1.4",
|
||||
"protocol_max": "1.4.2",
|
||||
"genesis_hash": GENESIS_HASH_MAINNET,
|
||||
"hash_function": "sha256",
|
||||
"services": []
|
||||
"services": <dynamic>[]
|
||||
});
|
||||
|
||||
when(client.getLatestCoinId()).thenAnswer((_) async => 1);
|
||||
|
@ -1893,9 +1863,6 @@ void main() {
|
|||
when(cachedClient.getUsedCoinSerials(startNumber: 0, coin: Coin.firo))
|
||||
.thenAnswer(
|
||||
(_) async => GetUsedSerialsSampleData.serials['serials'] as List);
|
||||
// mock price calls
|
||||
when(priceAPI.getPricesAnd24hChange(baseCurrency: "USD")).thenAnswer(
|
||||
(_) async => {Coin.firo: Tuple2(Decimal.fromInt(10), 1.0)});
|
||||
|
||||
final firo = FiroWallet(
|
||||
walletName: testWalletName,
|
||||
|
@ -2142,18 +2109,17 @@ void main() {
|
|||
final client = MockElectrumX();
|
||||
final cachedClient = MockCachedElectrumX();
|
||||
final secureStore = FakeSecureStorage();
|
||||
final priceAPI = MockPriceAPI();
|
||||
|
||||
// mock electrumx client calls
|
||||
when(client.getServerFeatures()).thenAnswer((_) async => {
|
||||
"hosts": {},
|
||||
"hosts": <dynamic, dynamic>{},
|
||||
"pruning": null,
|
||||
"server_version": "Unit tests",
|
||||
"protocol_min": "1.4",
|
||||
"protocol_max": "1.4.2",
|
||||
"genesis_hash": GENESIS_HASH_MAINNET,
|
||||
"hash_function": "sha256",
|
||||
"services": []
|
||||
"services": <dynamic>[]
|
||||
});
|
||||
|
||||
final firo = FiroWallet(
|
||||
|
@ -2179,18 +2145,17 @@ void main() {
|
|||
final client = MockElectrumX();
|
||||
final cachedClient = MockCachedElectrumX();
|
||||
final secureStore = FakeSecureStorage();
|
||||
final priceAPI = MockPriceAPI();
|
||||
|
||||
// mock electrumx client calls
|
||||
when(client.getServerFeatures()).thenAnswer((_) async => {
|
||||
"hosts": {},
|
||||
"hosts": <dynamic, dynamic>{},
|
||||
"pruning": null,
|
||||
"server_version": "Unit tests",
|
||||
"protocol_min": "1.4",
|
||||
"protocol_max": "1.4.2",
|
||||
"genesis_hash": GENESIS_HASH_TESTNET,
|
||||
"hash_function": "sha256",
|
||||
"services": []
|
||||
"services": <dynamic>[]
|
||||
});
|
||||
|
||||
final firo = FiroWallet(
|
||||
|
@ -2343,7 +2308,6 @@ void main() {
|
|||
final client = MockElectrumX();
|
||||
final cachedClient = MockCachedElectrumX();
|
||||
final secureStore = FakeSecureStorage();
|
||||
final priceAPI = MockPriceAPI();
|
||||
|
||||
// set mnemonic
|
||||
await secureStore.write(
|
||||
|
@ -2367,14 +2331,14 @@ void main() {
|
|||
|
||||
// mock electrumx client calls
|
||||
when(client.getServerFeatures()).thenAnswer((_) async => {
|
||||
"hosts": {},
|
||||
"hosts": <dynamic, dynamic>{},
|
||||
"pruning": null,
|
||||
"server_version": "Unit tests",
|
||||
"protocol_min": "1.4",
|
||||
"protocol_max": "1.4.2",
|
||||
"genesis_hash": GENESIS_HASH_MAINNET,
|
||||
"hash_function": "sha256",
|
||||
"services": []
|
||||
"services": <dynamic>[]
|
||||
});
|
||||
|
||||
when(client.getLatestCoinId()).thenAnswer((_) async => 1);
|
||||
|
@ -2434,10 +2398,6 @@ void main() {
|
|||
when(client.getUTXOs(scripthash: anyNamed("scripthash")))
|
||||
.thenAnswer((_) async => []);
|
||||
|
||||
// mock price calls
|
||||
when(priceAPI.getPricesAnd24hChange(baseCurrency: "USD")).thenAnswer(
|
||||
(_) async => {Coin.firo: Tuple2(Decimal.fromInt(10), 1.0)});
|
||||
|
||||
final firo = FiroWallet(
|
||||
walletName: testWalletName,
|
||||
walletId: "${testWalletId}refresh",
|
||||
|
@ -2469,7 +2429,7 @@ void main() {
|
|||
// final client = MockElectrumX();
|
||||
// final cachedClient = MockCachedElectrumX();
|
||||
// final secureStore = FakeSecureStorage();
|
||||
// final priceAPI = MockPriceAPI();
|
||||
//
|
||||
//
|
||||
// String expectedTxid = "-1";
|
||||
// when(client.getLatestCoinId()).thenAnswer((_) async => 1);
|
||||
|
@ -2651,7 +2611,7 @@ void main() {
|
|||
final client = MockElectrumX();
|
||||
final cachedClient = MockCachedElectrumX();
|
||||
final secureStore = FakeSecureStorage();
|
||||
final priceAPI = MockPriceAPI();
|
||||
|
||||
when(client.getLatestCoinId()).thenAnswer((_) async => 1);
|
||||
when(client.getBlockHeadTip()).thenAnswer(
|
||||
(_) async => {"height": 459185, "hex": "... some block hex ..."});
|
||||
|
@ -2679,10 +2639,6 @@ void main() {
|
|||
coin: Coin.firo,
|
||||
)).thenAnswer((_) async => GetAnonymitySetSampleData.data);
|
||||
|
||||
// mock price calls
|
||||
when(priceAPI.getPricesAnd24hChange(baseCurrency: "USD")).thenAnswer(
|
||||
(_) async => {Coin.firo: Tuple2(Decimal.fromInt(10), 1.0)});
|
||||
|
||||
// mock transaction calls
|
||||
when(cachedClient.getTransaction(
|
||||
txHash: SampleGetTransactionData.txHash0,
|
||||
|
@ -2805,8 +2761,8 @@ void main() {
|
|||
.thenAnswer((_) async => data);
|
||||
}
|
||||
|
||||
await wallet.put('_lelantus_coins', []);
|
||||
await wallet.put('jindex', []);
|
||||
await wallet.put('_lelantus_coins', <dynamic>[]);
|
||||
await wallet.put('jindex', <dynamic>[]);
|
||||
await wallet.put('mintIndex', 0);
|
||||
await wallet.put('receivingAddresses', [
|
||||
"a8VV7vMzJdTQj1eLEJNskhLEBUxfNWhpAg",
|
||||
|
@ -2831,7 +2787,7 @@ void main() {
|
|||
final client = MockElectrumX();
|
||||
final cachedClient = MockCachedElectrumX();
|
||||
final secureStore = FakeSecureStorage();
|
||||
final priceAPI = MockPriceAPI();
|
||||
|
||||
when(client.getLatestCoinId()).thenAnswer((_) async => 1);
|
||||
when(client.getBlockHeadTip()).thenAnswer(
|
||||
(_) async => {"height": 459185, "hex": "... some block hex ..."});
|
||||
|
@ -2849,10 +2805,6 @@ void main() {
|
|||
coin: Coin.firo,
|
||||
)).thenAnswer((_) async => GetAnonymitySetSampleData.data);
|
||||
|
||||
// mock price calls
|
||||
when(priceAPI.getPricesAnd24hChange(baseCurrency: "USD")).thenAnswer(
|
||||
(_) async => {Coin.firo: Tuple2(Decimal.fromInt(10), 1.0)});
|
||||
|
||||
// mock transaction calls
|
||||
when(cachedClient.getTransaction(
|
||||
txHash: SampleGetTransactionData.txHash0,
|
||||
|
@ -2985,11 +2937,6 @@ void main() {
|
|||
]);
|
||||
await wallet
|
||||
.put('changeAddresses', ["a5V5r6We6mNZzWJwGwEeRML3mEYLjvK39w"]);
|
||||
|
||||
expect(
|
||||
() async => await firo.send(
|
||||
toAddress: "aHZJsucDrhr4Uzzx6XXrKnaTgLxsEAokvV", amount: 100),
|
||||
throwsA(isA<Exception>()));
|
||||
}, timeout: const Timeout(Duration(minutes: 3)));
|
||||
|
||||
test("wallet balances", () async {
|
||||
|
@ -2999,10 +2946,6 @@ void main() {
|
|||
|
||||
final client = MockElectrumX();
|
||||
final cachedClient = MockCachedElectrumX();
|
||||
final priceAPI = MockPriceAPI();
|
||||
// mock price calls
|
||||
when(priceAPI.getPricesAnd24hChange(baseCurrency: "USD")).thenAnswer(
|
||||
(_) async => {Coin.firo: Tuple2(Decimal.fromInt(10), 1.0)});
|
||||
|
||||
// mock history calls
|
||||
when(client.getHistory(scripthash: SampleGetHistoryData.scripthash0))
|
||||
|
@ -3084,7 +3027,6 @@ void main() {
|
|||
final client = MockElectrumX();
|
||||
final cachedClient = MockCachedElectrumX();
|
||||
final secureStore = FakeSecureStorage();
|
||||
final priceAPI = MockPriceAPI();
|
||||
|
||||
// set mnemonic
|
||||
await secureStore.write(
|
||||
|
@ -3093,14 +3035,14 @@ void main() {
|
|||
|
||||
// mock electrumx client calls
|
||||
when(client.getServerFeatures()).thenAnswer((_) async => {
|
||||
"hosts": {},
|
||||
"hosts": <dynamic, dynamic>{},
|
||||
"pruning": null,
|
||||
"server_version": "Unit tests",
|
||||
"protocol_min": "1.4",
|
||||
"protocol_max": "1.4.2",
|
||||
"genesis_hash": GENESIS_HASH_MAINNET,
|
||||
"hash_function": "sha256",
|
||||
"services": []
|
||||
"services": <dynamic>[]
|
||||
});
|
||||
|
||||
when(client.getLatestCoinId()).thenAnswer((_) async => 1);
|
||||
|
@ -3160,10 +3102,6 @@ void main() {
|
|||
when(client.getUTXOs(scripthash: anyNamed("scripthash")))
|
||||
.thenAnswer((_) async => []);
|
||||
|
||||
// mock price calls
|
||||
when(priceAPI.getPricesAnd24hChange(baseCurrency: "USD")).thenAnswer(
|
||||
(_) async => {Coin.firo: Tuple2(Decimal.fromInt(10), 1.0)});
|
||||
|
||||
final firo = FiroWallet(
|
||||
walletName: testWalletName,
|
||||
walletId: "${testWalletId}transactionData",
|
||||
|
@ -3174,7 +3112,8 @@ void main() {
|
|||
tracker: MockTransactionNotificationTracker(),
|
||||
);
|
||||
|
||||
final wallet = await Hive.openBox("${testWalletId}transactionData");
|
||||
final wallet =
|
||||
await Hive.openBox<dynamic>("${testWalletId}transactionData");
|
||||
await wallet.put(
|
||||
'receivingAddresses', RefreshTestParams.receivingAddresses);
|
||||
await wallet.put('changeAddresses', RefreshTestParams.changeAddresses);
|
||||
|
@ -3195,18 +3134,18 @@ void main() {
|
|||
// final client = MockElectrumX();
|
||||
// final cachedClient = MockCachedElectrumX();
|
||||
// final secureStore = FakeSecureStorage();
|
||||
// final priceAPI = MockPriceAPI();
|
||||
//
|
||||
//
|
||||
// // mock electrumx client calls
|
||||
// when(client.getServerFeatures()).thenAnswer((_) async => {
|
||||
// "hosts": {},
|
||||
// "hosts": <dynamic, dynamic>{},
|
||||
// "pruning": null,
|
||||
// "server_version": "Unit tests",
|
||||
// "protocol_min": "1.4",
|
||||
// "protocol_max": "1.4.2",
|
||||
// "genesis_hash": GENESIS_HASH_MAINNET,
|
||||
// "hash_function": "sha256",
|
||||
// "services": []
|
||||
// "services": <dynamic>[]
|
||||
// });
|
||||
//
|
||||
// when(client.getBlockHeadTip()).thenAnswer(
|
||||
|
@ -3515,7 +3454,7 @@ void main() {
|
|||
test("fetch and convert properly stored mnemonic to list of words",
|
||||
() async {
|
||||
final store = FakeSecureStorage();
|
||||
store.write(
|
||||
await store.write(
|
||||
key: "some id_mnemonic",
|
||||
value: "some test mnemonic string of words");
|
||||
|
||||
|
@ -3543,7 +3482,7 @@ void main() {
|
|||
test("attempt fetch and convert non existent mnemonic to list of words",
|
||||
() async {
|
||||
final store = FakeSecureStorage();
|
||||
store.write(
|
||||
await store.write(
|
||||
key: "some id_mnemonic",
|
||||
value: "some test mnemonic string of words");
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ void main() async {
|
|||
Hive.registerAdapter(WalletTypeAdapter());
|
||||
Hive.registerAdapter(UnspentCoinsInfoAdapter());
|
||||
|
||||
final wallets = await Hive.openBox('wallets');
|
||||
final wallets = await Hive.openBox<dynamic>('wallets');
|
||||
await wallets.put('currentWalletName', name);
|
||||
|
||||
_walletInfoSource = await Hive.openBox<WalletInfo>(WalletInfo.boxName);
|
||||
|
|
|
@ -225,8 +225,8 @@ void main() {
|
|||
});
|
||||
|
||||
group("basic getters, setters, and functions", () {
|
||||
final testWalletId = "NMCtestWalletID";
|
||||
final testWalletName = "NMCWallet";
|
||||
const testWalletId = "NMCtestWalletID";
|
||||
const testWalletName = "NMCWallet";
|
||||
|
||||
MockElectrumX? client;
|
||||
MockCachedElectrumX? cachedClient;
|
||||
|
@ -324,14 +324,14 @@ void main() {
|
|||
test("get fees succeeds", () async {
|
||||
when(client?.ping()).thenAnswer((_) async => true);
|
||||
when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
"hosts": {},
|
||||
"hosts": <dynamic, dynamic>{},
|
||||
"pruning": null,
|
||||
"server_version": "Unit tests",
|
||||
"protocol_min": "1.4",
|
||||
"protocol_max": "1.4.2",
|
||||
"genesis_hash": GENESIS_HASH_MAINNET,
|
||||
"hash_function": "sha256",
|
||||
"services": []
|
||||
"services": <dynamic>[]
|
||||
});
|
||||
when(client?.estimateFee(blocks: 1))
|
||||
.thenAnswer((realInvocation) async => Decimal.zero);
|
||||
|
@ -357,14 +357,14 @@ void main() {
|
|||
test("get fees fails", () async {
|
||||
when(client?.ping()).thenAnswer((_) async => true);
|
||||
when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
"hosts": {},
|
||||
"hosts": <dynamic, dynamic>{},
|
||||
"pruning": null,
|
||||
"server_version": "Unit tests",
|
||||
"protocol_min": "1.4",
|
||||
"protocol_max": "1.4.2",
|
||||
"genesis_hash": GENESIS_HASH_MAINNET,
|
||||
"hash_function": "sha256",
|
||||
"services": []
|
||||
"services": <dynamic>[]
|
||||
});
|
||||
when(client?.estimateFee(blocks: 1))
|
||||
.thenAnswer((realInvocation) async => Decimal.zero);
|
||||
|
@ -393,14 +393,14 @@ void main() {
|
|||
// test("get maxFee", () async {
|
||||
// when(client?.ping()).thenAnswer((_) async => true);
|
||||
// when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
// "hosts": {},
|
||||
// "hosts": <dynamic, dynamic>{},
|
||||
// "pruning": null,
|
||||
// "server_version": "Unit tests",
|
||||
// "protocol_min": "1.4",
|
||||
// "protocol_max": "1.4.2",
|
||||
// "genesis_hash": GENESIS_HASH_TESTNET,
|
||||
// "hash_function": "sha256",
|
||||
// "services": []
|
||||
// "services": <dynamic>[]
|
||||
// });
|
||||
// when(client?.estimateFee(blocks: 20))
|
||||
// .thenAnswer((realInvocation) async => Decimal.zero);
|
||||
|
@ -424,8 +424,8 @@ void main() {
|
|||
});
|
||||
|
||||
group("Namecoin service class functions that depend on shared storage", () {
|
||||
final testWalletId = "NMCtestWalletID";
|
||||
final testWalletName = "NMCWallet";
|
||||
const testWalletId = "NMCtestWalletID";
|
||||
const testWalletName = "NMCWallet";
|
||||
|
||||
bool hiveAdaptersRegistered = false;
|
||||
|
||||
|
@ -454,7 +454,7 @@ void main() {
|
|||
Hive.registerAdapter(UtxoObjectAdapter());
|
||||
Hive.registerAdapter(StatusAdapter());
|
||||
|
||||
final wallets = await Hive.openBox('wallets');
|
||||
final wallets = await Hive.openBox<dynamic>('wallets');
|
||||
await wallets.put('currentWalletName', testWalletName);
|
||||
}
|
||||
|
||||
|
@ -499,17 +499,17 @@ void main() {
|
|||
test("initializeWallet mainnet throws bad network", () async {
|
||||
when(client?.ping()).thenAnswer((_) async => true);
|
||||
when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
"hosts": {},
|
||||
"hosts": <dynamic, dynamic>{},
|
||||
"pruning": null,
|
||||
"server_version": "Unit tests",
|
||||
"protocol_min": "1.4",
|
||||
"protocol_max": "1.4.2",
|
||||
"genesis_hash": GENESIS_HASH_MAINNET,
|
||||
"hash_function": "sha256",
|
||||
"services": []
|
||||
"services": <dynamic>[]
|
||||
});
|
||||
// await nmc?.initializeNew();
|
||||
final wallets = await Hive.openBox<dynamic>(testWalletId);
|
||||
await Hive.openBox<dynamic>(testWalletId);
|
||||
|
||||
await expectLater(
|
||||
() => nmc?.initializeExisting(), throwsA(isA<Exception>()))
|
||||
|
@ -525,19 +525,19 @@ void main() {
|
|||
test("initializeWallet throws mnemonic overwrite exception", () async {
|
||||
when(client?.ping()).thenAnswer((_) async => true);
|
||||
when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
"hosts": {},
|
||||
"hosts": <dynamic, dynamic>{},
|
||||
"pruning": null,
|
||||
"server_version": "Unit tests",
|
||||
"protocol_min": "1.4",
|
||||
"protocol_max": "1.4.2",
|
||||
"genesis_hash": GENESIS_HASH_MAINNET,
|
||||
"hash_function": "sha256",
|
||||
"services": []
|
||||
"services": <dynamic>[]
|
||||
});
|
||||
await secureStore.write(
|
||||
key: "${testWalletId}_mnemonic", value: "some mnemonic");
|
||||
|
||||
final wallets = await Hive.openBox<dynamic>(testWalletId);
|
||||
await Hive.openBox<dynamic>(testWalletId);
|
||||
await expectLater(
|
||||
() => nmc?.initializeExisting(), throwsA(isA<Exception>()))
|
||||
.then((_) {
|
||||
|
@ -553,14 +553,14 @@ void main() {
|
|||
// "recoverFromMnemonic using empty seed on mainnet fails due to bad genesis hash match",
|
||||
// () async {
|
||||
// when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
// "hosts": {},
|
||||
// "hosts": <dynamic, dynamic>{},
|
||||
// "pruning": null,
|
||||
// "server_version": "Unit tests",
|
||||
// "protocol_min": "1.4",
|
||||
// "protocol_max": "1.4.2",
|
||||
// "genesis_hash": GENESIS_HASH_TESTNET,
|
||||
// "hash_function": "sha256",
|
||||
// "services": []
|
||||
// "services": <dynamic>[]
|
||||
// });
|
||||
//
|
||||
// bool hasThrown = false;
|
||||
|
@ -587,14 +587,14 @@ void main() {
|
|||
"recoverFromMnemonic using empty seed on mainnet fails due to attempted overwrite of mnemonic",
|
||||
() async {
|
||||
when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
"hosts": {},
|
||||
"hosts": <dynamic, dynamic>{},
|
||||
"pruning": null,
|
||||
"server_version": "Unit tests",
|
||||
"protocol_min": "1.4",
|
||||
"protocol_max": "1.4.2",
|
||||
"genesis_hash": GENESIS_HASH_MAINNET,
|
||||
"hash_function": "sha256",
|
||||
"services": []
|
||||
"services": <dynamic>[]
|
||||
});
|
||||
|
||||
await secureStore.write(
|
||||
|
@ -621,14 +621,14 @@ void main() {
|
|||
|
||||
test("recoverFromMnemonic using empty seed on mainnet succeeds", () async {
|
||||
when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
"hosts": {},
|
||||
"hosts": <dynamic, dynamic>{},
|
||||
"pruning": null,
|
||||
"server_version": "Unit tests",
|
||||
"protocol_min": "1.4",
|
||||
"protocol_max": "1.4.2",
|
||||
"genesis_hash": GENESIS_HASH_MAINNET,
|
||||
"hash_function": "sha256",
|
||||
"services": []
|
||||
"services": <dynamic>[]
|
||||
});
|
||||
when(client?.getBatchHistory(args: historyBatchArgs0))
|
||||
.thenAnswer((_) async => emptyHistoryBatchResponse);
|
||||
|
@ -643,7 +643,7 @@ void main() {
|
|||
when(client?.getBatchHistory(args: historyBatchArgs5))
|
||||
.thenAnswer((_) async => emptyHistoryBatchResponse);
|
||||
await DB.instance.init();
|
||||
final wallet = await Hive.openBox<dynamic>(testWalletId);
|
||||
await Hive.openBox<dynamic>(testWalletId);
|
||||
bool hasThrown = false;
|
||||
try {
|
||||
await nmc?.recoverFromMnemonic(
|
||||
|
@ -675,14 +675,14 @@ void main() {
|
|||
|
||||
test("get mnemonic list", () async {
|
||||
when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
"hosts": {},
|
||||
"hosts": <dynamic, dynamic>{},
|
||||
"pruning": null,
|
||||
"server_version": "Unit tests",
|
||||
"protocol_min": "1.4",
|
||||
"protocol_max": "1.4.2",
|
||||
"genesis_hash": GENESIS_HASH_MAINNET,
|
||||
"hash_function": "sha256",
|
||||
"services": []
|
||||
"services": <dynamic>[]
|
||||
});
|
||||
when(client?.getBatchHistory(args: historyBatchArgs0))
|
||||
.thenAnswer((_) async => emptyHistoryBatchResponse);
|
||||
|
@ -697,7 +697,7 @@ void main() {
|
|||
when(client?.getBatchHistory(args: historyBatchArgs5))
|
||||
.thenAnswer((_) async => emptyHistoryBatchResponse);
|
||||
|
||||
final wallet = await Hive.openBox<dynamic>(testWalletId);
|
||||
await Hive.openBox<dynamic>(testWalletId);
|
||||
|
||||
await nmc?.recoverFromMnemonic(
|
||||
mnemonic: TEST_MNEMONIC,
|
||||
|
@ -722,14 +722,14 @@ void main() {
|
|||
test("recoverFromMnemonic using non empty seed on mainnet succeeds",
|
||||
() async {
|
||||
when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
"hosts": {},
|
||||
"hosts": <dynamic, dynamic>{},
|
||||
"pruning": null,
|
||||
"server_version": "Unit tests",
|
||||
"protocol_min": "1.4",
|
||||
"protocol_max": "1.4.2",
|
||||
"genesis_hash": GENESIS_HASH_MAINNET,
|
||||
"hash_function": "sha256",
|
||||
"services": []
|
||||
"services": <dynamic>[]
|
||||
});
|
||||
when(client?.getBatchHistory(args: historyBatchArgs0))
|
||||
.thenAnswer((_) async => historyBatchResponse);
|
||||
|
@ -796,14 +796,14 @@ void main() {
|
|||
|
||||
test("fullRescan succeeds", () async {
|
||||
when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
"hosts": {},
|
||||
"hosts": <dynamic, dynamic>{},
|
||||
"pruning": null,
|
||||
"server_version": "Unit tests",
|
||||
"protocol_min": "1.4",
|
||||
"protocol_max": "1.4.2",
|
||||
"genesis_hash": GENESIS_HASH_MAINNET,
|
||||
"hash_function": "sha256",
|
||||
"services": []
|
||||
"services": <dynamic>[]
|
||||
});
|
||||
when(client?.getBatchHistory(args: historyBatchArgs0))
|
||||
.thenAnswer((_) async => historyBatchResponse);
|
||||
|
@ -1062,14 +1062,14 @@ void main() {
|
|||
|
||||
test("fullRescan fails", () async {
|
||||
when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
"hosts": {},
|
||||
"hosts": <dynamic, dynamic>{},
|
||||
"pruning": null,
|
||||
"server_version": "Unit tests",
|
||||
"protocol_min": "1.4",
|
||||
"protocol_max": "1.4.2",
|
||||
"genesis_hash": GENESIS_HASH_MAINNET,
|
||||
"hash_function": "sha256",
|
||||
"services": []
|
||||
"services": <dynamic>[]
|
||||
});
|
||||
|
||||
when(client?.getBatchHistory(args: historyBatchArgs0))
|
||||
|
@ -1275,14 +1275,14 @@ void main() {
|
|||
|
||||
test("prepareSend fails", () async {
|
||||
when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
"hosts": {},
|
||||
"hosts": <dynamic, dynamic>{},
|
||||
"pruning": null,
|
||||
"server_version": "Unit tests",
|
||||
"protocol_min": "1.4",
|
||||
"protocol_max": "1.4.2",
|
||||
"genesis_hash": GENESIS_HASH_MAINNET,
|
||||
"hash_function": "sha256",
|
||||
"services": []
|
||||
"services": <dynamic>[]
|
||||
});
|
||||
when(client?.getBatchHistory(args: historyBatchArgs0))
|
||||
.thenAnswer((_) async => historyBatchResponse);
|
||||
|
@ -1558,14 +1558,14 @@ void main() {
|
|||
|
||||
test("refresh wallet mutex locked", () async {
|
||||
when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
"hosts": {},
|
||||
"hosts": <dynamic, dynamic>{},
|
||||
"pruning": null,
|
||||
"server_version": "Unit tests",
|
||||
"protocol_min": "1.4",
|
||||
"protocol_max": "1.4.2",
|
||||
"genesis_hash": GENESIS_HASH_MAINNET,
|
||||
"hash_function": "sha256",
|
||||
"services": []
|
||||
"services": <dynamic>[]
|
||||
});
|
||||
when(client?.getBatchHistory(args: historyBatchArgs0))
|
||||
.thenAnswer((_) async => historyBatchResponse);
|
||||
|
@ -1634,14 +1634,14 @@ void main() {
|
|||
when(client?.getBlockHeadTip()).thenAnswer((realInvocation) async =>
|
||||
{"height": 520481, "hex": "some block hex"});
|
||||
when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
"hosts": {},
|
||||
"hosts": <dynamic, dynamic>{},
|
||||
"pruning": null,
|
||||
"server_version": "Unit tests",
|
||||
"protocol_min": "1.4",
|
||||
"protocol_max": "1.4.2",
|
||||
"genesis_hash": GENESIS_HASH_MAINNET,
|
||||
"hash_function": "sha256",
|
||||
"services": []
|
||||
"services": <dynamic>[]
|
||||
});
|
||||
when(client?.getHistory(scripthash: anyNamed("scripthash")))
|
||||
.thenAnswer((_) async => []);
|
||||
|
|
|
@ -272,8 +272,8 @@ void main() {
|
|||
});
|
||||
|
||||
group("basic getters, setters, and functions", () {
|
||||
final testWalletId = "ParticltestWalletID";
|
||||
final testWalletName = "ParticlWallet";
|
||||
const testWalletId = "ParticltestWalletID";
|
||||
const testWalletName = "ParticlWallet";
|
||||
|
||||
MockElectrumX? client;
|
||||
MockCachedElectrumX? cachedClient;
|
||||
|
@ -371,14 +371,14 @@ void main() {
|
|||
test("get fees succeeds", () async {
|
||||
when(client?.ping()).thenAnswer((_) async => true);
|
||||
when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
"hosts": {},
|
||||
"hosts": <dynamic, dynamic>{},
|
||||
"pruning": null,
|
||||
"server_version": "Unit tests",
|
||||
"protocol_min": "1.4",
|
||||
"protocol_max": "1.4.2",
|
||||
"genesis_hash": GENESIS_HASH_MAINNET,
|
||||
"hash_function": "sha256",
|
||||
"services": []
|
||||
"services": <dynamic>[]
|
||||
});
|
||||
when(client?.estimateFee(blocks: 1))
|
||||
.thenAnswer((realInvocation) async => Decimal.zero);
|
||||
|
@ -404,14 +404,14 @@ void main() {
|
|||
test("get fees fails", () async {
|
||||
when(client?.ping()).thenAnswer((_) async => true);
|
||||
when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
"hosts": {},
|
||||
"hosts": <dynamic, dynamic>{},
|
||||
"pruning": null,
|
||||
"server_version": "Unit tests",
|
||||
"protocol_min": "1.4",
|
||||
"protocol_max": "1.4.2",
|
||||
"genesis_hash": GENESIS_HASH_MAINNET,
|
||||
"hash_function": "sha256",
|
||||
"services": []
|
||||
"services": <dynamic>[]
|
||||
});
|
||||
when(client?.estimateFee(blocks: 1))
|
||||
.thenAnswer((realInvocation) async => Decimal.zero);
|
||||
|
@ -440,14 +440,14 @@ void main() {
|
|||
// test("get maxFee", () async {
|
||||
// when(client?.ping()).thenAnswer((_) async => true);
|
||||
// when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
// "hosts": {},
|
||||
// "hosts": <dynamic, dynamic>{},
|
||||
// "pruning": null,
|
||||
// "server_version": "Unit tests",
|
||||
// "protocol_min": "1.4",
|
||||
// "protocol_max": "1.4.2",
|
||||
// "genesis_hash": GENESIS_HASH_TESTNET,
|
||||
// "hash_function": "sha256",
|
||||
// "services": []
|
||||
// "services": <dynamic>[]
|
||||
// });
|
||||
// when(client?.estimateFee(blocks: 20))
|
||||
// .thenAnswer((realInvocation) async => Decimal.zero);
|
||||
|
@ -501,7 +501,7 @@ void main() {
|
|||
Hive.registerAdapter(UtxoObjectAdapter());
|
||||
Hive.registerAdapter(StatusAdapter());
|
||||
|
||||
final wallets = await Hive.openBox('wallets');
|
||||
final wallets = await Hive.openBox<dynamic>('wallets');
|
||||
await wallets.put('currentWalletName', testWalletName);
|
||||
}
|
||||
|
||||
|
@ -534,7 +534,7 @@ void main() {
|
|||
|
||||
// test("initializeWallet no network exception", () async {
|
||||
// when(client?.ping()).thenThrow(Exception("Network connection failed"));
|
||||
// final wallets = await Hive.openBox(testWalletId);
|
||||
// final wallets = await Hive.openBox<dynamic> (testWalletId);
|
||||
// expect(await nmc?.initializeExisting(), false);
|
||||
// expect(secureStore.interactions, 0);
|
||||
// verify(client?.ping()).called(1);
|
||||
|
@ -546,16 +546,16 @@ void main() {
|
|||
test("initializeWallet mainnet throws bad network", () async {
|
||||
when(client?.ping()).thenAnswer((_) async => true);
|
||||
when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
"hosts": {},
|
||||
"hosts": <dynamic, dynamic>{},
|
||||
"pruning": null,
|
||||
"server_version": "Unit tests",
|
||||
"protocol_min": "1.4",
|
||||
"protocol_max": "1.4.2",
|
||||
"genesis_hash": GENESIS_HASH_MAINNET,
|
||||
"hash_function": "sha256",
|
||||
"services": []
|
||||
"services": <dynamic>[]
|
||||
});
|
||||
await Hive.openBox(testWalletId);
|
||||
await Hive.openBox<dynamic>(testWalletId);
|
||||
|
||||
await expectLater(
|
||||
() => part?.initializeExisting(), throwsA(isA<Exception>()))
|
||||
|
@ -569,19 +569,19 @@ void main() {
|
|||
test("initializeWallet throws mnemonic overwrite exception", () async {
|
||||
when(client?.ping()).thenAnswer((_) async => true);
|
||||
when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
"hosts": {},
|
||||
"hosts": <dynamic, dynamic>{},
|
||||
"pruning": null,
|
||||
"server_version": "Unit tests",
|
||||
"protocol_min": "1.4",
|
||||
"protocol_max": "1.4.2",
|
||||
"genesis_hash": GENESIS_HASH_MAINNET,
|
||||
"hash_function": "sha256",
|
||||
"services": []
|
||||
"services": <dynamic>[]
|
||||
});
|
||||
await secureStore.write(
|
||||
key: "${testWalletId}_mnemonic", value: "some mnemonic");
|
||||
|
||||
await Hive.openBox(testWalletId);
|
||||
await Hive.openBox<dynamic>(testWalletId);
|
||||
await expectLater(
|
||||
() => part?.initializeExisting(), throwsA(isA<Exception>()))
|
||||
.then((_) {
|
||||
|
@ -595,14 +595,14 @@ void main() {
|
|||
"recoverFromMnemonic using empty seed on mainnet fails due to bad genesis hash match",
|
||||
() async {
|
||||
when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
"hosts": {},
|
||||
"hosts": <dynamic, dynamic>{},
|
||||
"pruning": null,
|
||||
"server_version": "Unit tests",
|
||||
"protocol_min": "1.4",
|
||||
"protocol_max": "1.4.2",
|
||||
"genesis_hash": GENESIS_HASH_TESTNET,
|
||||
"hash_function": "sha256",
|
||||
"services": []
|
||||
"services": <dynamic>[]
|
||||
});
|
||||
|
||||
bool hasThrown = false;
|
||||
|
@ -628,14 +628,14 @@ void main() {
|
|||
"recoverFromMnemonic using empty seed on mainnet fails due to attempted overwrite of mnemonic",
|
||||
() async {
|
||||
when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
"hosts": {},
|
||||
"hosts": <dynamic, dynamic>{},
|
||||
"pruning": null,
|
||||
"server_version": "Unit tests",
|
||||
"protocol_min": "1.4",
|
||||
"protocol_max": "1.4.2",
|
||||
"genesis_hash": GENESIS_HASH_MAINNET,
|
||||
"hash_function": "sha256",
|
||||
"services": []
|
||||
"services": <dynamic>[]
|
||||
});
|
||||
|
||||
await secureStore.write(
|
||||
|
@ -662,14 +662,14 @@ void main() {
|
|||
|
||||
test("recoverFromMnemonic using empty seed on mainnet succeeds", () async {
|
||||
when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
"hosts": {},
|
||||
"hosts": <dynamic, dynamic>{},
|
||||
"pruning": null,
|
||||
"server_version": "Unit tests",
|
||||
"protocol_min": "1.4",
|
||||
"protocol_max": "1.4.2",
|
||||
"genesis_hash": GENESIS_HASH_MAINNET,
|
||||
"hash_function": "sha256",
|
||||
"services": []
|
||||
"services": <dynamic>[]
|
||||
});
|
||||
when(client?.getBatchHistory(args: historyBatchArgs0))
|
||||
.thenAnswer((_) async => emptyHistoryBatchResponse);
|
||||
|
@ -681,7 +681,7 @@ void main() {
|
|||
.thenAnswer((_) async => emptyHistoryBatchResponse);
|
||||
|
||||
// await DB.instance.init();
|
||||
final wallet = await Hive.openBox(testWalletId);
|
||||
await Hive.openBox<dynamic>(testWalletId);
|
||||
bool hasThrown = false;
|
||||
try {
|
||||
await part?.recoverFromMnemonic(
|
||||
|
@ -711,14 +711,14 @@ void main() {
|
|||
|
||||
test("get mnemonic list", () async {
|
||||
when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
"hosts": {},
|
||||
"hosts": <dynamic, dynamic>{},
|
||||
"pruning": null,
|
||||
"server_version": "Unit tests",
|
||||
"protocol_min": "1.4",
|
||||
"protocol_max": "1.4.2",
|
||||
"genesis_hash": GENESIS_HASH_MAINNET,
|
||||
"hash_function": "sha256",
|
||||
"services": []
|
||||
"services": <dynamic>[]
|
||||
});
|
||||
when(client?.getBatchHistory(args: historyBatchArgs0))
|
||||
.thenAnswer((_) async => emptyHistoryBatchResponse);
|
||||
|
@ -729,7 +729,7 @@ void main() {
|
|||
when(client?.getBatchHistory(args: historyBatchArgs3))
|
||||
.thenAnswer((_) async => emptyHistoryBatchResponse);
|
||||
|
||||
await Hive.openBox(testWalletId);
|
||||
await Hive.openBox<dynamic>(testWalletId);
|
||||
|
||||
await part?.recoverFromMnemonic(
|
||||
mnemonic: TEST_MNEMONIC,
|
||||
|
@ -752,14 +752,14 @@ void main() {
|
|||
test("recoverFromMnemonic using non empty seed on mainnet succeeds",
|
||||
() async {
|
||||
when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
"hosts": {},
|
||||
"hosts": <dynamic, dynamic>{},
|
||||
"pruning": null,
|
||||
"server_version": "Unit tests",
|
||||
"protocol_min": "1.4",
|
||||
"protocol_max": "1.4.2",
|
||||
"genesis_hash": GENESIS_HASH_MAINNET,
|
||||
"hash_function": "sha256",
|
||||
"services": []
|
||||
"services": <dynamic>[]
|
||||
});
|
||||
when(client?.getBatchHistory(args: historyBatchArgs0))
|
||||
.thenAnswer((_) async => historyBatchResponse);
|
||||
|
@ -819,14 +819,14 @@ void main() {
|
|||
|
||||
test("fullRescan succeeds", () async {
|
||||
when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
"hosts": {},
|
||||
"hosts": <dynamic, dynamic>{},
|
||||
"pruning": null,
|
||||
"server_version": "Unit tests",
|
||||
"protocol_min": "1.4",
|
||||
"protocol_max": "1.4.2",
|
||||
"genesis_hash": GENESIS_HASH_MAINNET,
|
||||
"hash_function": "sha256",
|
||||
"services": []
|
||||
"services": <dynamic>[]
|
||||
});
|
||||
when(client?.getBatchHistory(args: historyBatchArgs0))
|
||||
.thenAnswer((_) async => historyBatchResponse);
|
||||
|
@ -1011,14 +1011,14 @@ void main() {
|
|||
|
||||
test("fullRescan fails", () async {
|
||||
when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
"hosts": {},
|
||||
"hosts": <dynamic, dynamic>{},
|
||||
"pruning": null,
|
||||
"server_version": "Unit tests",
|
||||
"protocol_min": "1.4",
|
||||
"protocol_max": "1.4.2",
|
||||
"genesis_hash": GENESIS_HASH_MAINNET,
|
||||
"hash_function": "sha256",
|
||||
"services": []
|
||||
"services": <dynamic>[]
|
||||
});
|
||||
|
||||
when(client?.getBatchHistory(args: historyBatchArgs0))
|
||||
|
@ -1213,14 +1213,14 @@ void main() {
|
|||
|
||||
test("prepareSend fails", () async {
|
||||
when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
"hosts": {},
|
||||
"hosts": <dynamic, dynamic>{},
|
||||
"pruning": null,
|
||||
"server_version": "Unit tests",
|
||||
"protocol_min": "1.4",
|
||||
"protocol_max": "1.4.2",
|
||||
"genesis_hash": GENESIS_HASH_MAINNET,
|
||||
"hash_function": "sha256",
|
||||
"services": []
|
||||
"services": <dynamic>[]
|
||||
});
|
||||
when(client?.getBatchHistory(args: historyBatchArgs0))
|
||||
.thenAnswer((_) async => historyBatchResponse);
|
||||
|
@ -1269,15 +1269,15 @@ void main() {
|
|||
|
||||
// modify addresses to properly mock data to build a tx
|
||||
final rcv44 = await secureStore.read(
|
||||
key: testWalletId + "_receiveDerivationsP2PKH");
|
||||
key: "${testWalletId}_receiveDerivationsP2PKH");
|
||||
await secureStore.write(
|
||||
key: testWalletId + "_receiveDerivationsP2PKH",
|
||||
key: "${testWalletId}_receiveDerivationsP2PKH",
|
||||
value: rcv44?.replaceFirst("1RMSPixoLPuaXuhR2v4HsUMcRjLncKDaw",
|
||||
"16FuTPaeRSPVxxCnwQmdyx2PQWxX6HWzhQ"));
|
||||
final rcv84 = await secureStore.read(
|
||||
key: testWalletId + "_receiveDerivationsP2WPKH");
|
||||
key: "${testWalletId}_receiveDerivationsP2WPKH");
|
||||
await secureStore.write(
|
||||
key: testWalletId + "_receiveDerivationsP2WPKH",
|
||||
key: "${testWalletId}_receiveDerivationsP2WPKH",
|
||||
value: rcv84?.replaceFirst(
|
||||
"pw1qvr6ehcm44vvqe96mxy9zw9aa5sa5yezvr2r94s",
|
||||
"pw1q66xtkhqzcue808nlg8tp48uq7fshmaddljtkpy"));
|
||||
|
@ -1448,7 +1448,7 @@ void main() {
|
|||
// // );
|
||||
// //
|
||||
// // // set node
|
||||
// // final wallet = await Hive.openBox(testWalletId);
|
||||
// // final wallet = await Hive.openBox<dynamic> (testWalletId);
|
||||
// // await wallet.put("nodes", {
|
||||
// // "default": {
|
||||
// // "id": "some nodeID",
|
||||
|
@ -1484,14 +1484,14 @@ void main() {
|
|||
|
||||
test("refresh wallet mutex locked", () async {
|
||||
when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
"hosts": {},
|
||||
"hosts": <dynamic, dynamic>{},
|
||||
"pruning": null,
|
||||
"server_version": "Unit tests",
|
||||
"protocol_min": "1.4",
|
||||
"protocol_max": "1.4.2",
|
||||
"genesis_hash": GENESIS_HASH_MAINNET,
|
||||
"hash_function": "sha256",
|
||||
"services": []
|
||||
"services": <dynamic>[]
|
||||
});
|
||||
when(client?.getBatchHistory(args: historyBatchArgs0))
|
||||
.thenAnswer((_) async => historyBatchResponse);
|
||||
|
@ -1553,14 +1553,14 @@ void main() {
|
|||
when(client?.getBlockHeadTip()).thenAnswer((realInvocation) async =>
|
||||
{"height": 520481, "hex": "some block hex"});
|
||||
when(client?.getServerFeatures()).thenAnswer((_) async => {
|
||||
"hosts": {},
|
||||
"hosts": <dynamic, dynamic>{},
|
||||
"pruning": null,
|
||||
"server_version": "Unit tests",
|
||||
"protocol_min": "1.4",
|
||||
"protocol_max": "1.4.2",
|
||||
"genesis_hash": GENESIS_HASH_MAINNET,
|
||||
"hash_function": "sha256",
|
||||
"services": []
|
||||
"services": <dynamic>[]
|
||||
});
|
||||
when(client?.getHistory(scripthash: anyNamed("scripthash")))
|
||||
.thenAnswer((_) async => []);
|
||||
|
|
|
@ -66,7 +66,7 @@ void main() async {
|
|||
Hive.registerAdapter(WalletTypeAdapter());
|
||||
Hive.registerAdapter(UnspentCoinsInfoAdapter());
|
||||
|
||||
final wallets = await Hive.openBox('wallets');
|
||||
final wallets = await Hive.openBox<dynamic>('wallets');
|
||||
await wallets.put('currentWalletName', name);
|
||||
|
||||
_walletInfoSource = await Hive.openBox<WalletInfo>(WalletInfo.boxName);
|
||||
|
|
Loading…
Reference in a new issue