From 9addf101a92f29e749162093029175ef0a36e8e3 Mon Sep 17 00:00:00 2001 From: julian <julian@cypherstack.com> Date: Thu, 16 Nov 2023 12:19:04 -0600 Subject: [PATCH] more build runner mocks regen --- test/cached_electrumx_test.mocks.dart | 80 ++++++- test/electrumx_test.dart | 36 +-- .../bitcoin/bitcoin_wallet_test.mocks.dart | 80 ++++++- .../bitcoincash_wallet_test.mocks.dart | 80 ++++++- .../dogecoin/dogecoin_wallet_test.mocks.dart | 80 ++++++- .../services/coins/firo/firo_wallet_test.dart | 208 +++++++++--------- .../coins/firo/firo_wallet_test.mocks.dart | 80 ++++++- .../coins/namecoin/namecoin_wallet_test.dart | 32 +-- .../namecoin/namecoin_wallet_test.mocks.dart | 80 ++++++- .../coins/particl/particl_wallet_test.dart | 32 +-- .../particl/particl_wallet_test.mocks.dart | 80 ++++++- 11 files changed, 659 insertions(+), 209 deletions(-) diff --git a/test/cached_electrumx_test.mocks.dart b/test/cached_electrumx_test.mocks.dart index cc0420469..7765a198a 100644 --- a/test/cached_electrumx_test.mocks.dart +++ b/test/cached_electrumx_test.mocks.dart @@ -302,14 +302,14 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { _i5.Future<Map<String, dynamic>>.value(<String, dynamic>{}), ) as _i5.Future<Map<String, dynamic>>); @override - _i5.Future<Map<String, dynamic>> getAnonymitySet({ + _i5.Future<Map<String, dynamic>> getLelantusAnonymitySet({ String? groupId = r'1', String? blockhash = r'', String? requestID, }) => (super.noSuchMethod( Invocation.method( - #getAnonymitySet, + #getLelantusAnonymitySet, [], { #groupId: groupId, @@ -321,13 +321,13 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { _i5.Future<Map<String, dynamic>>.value(<String, dynamic>{}), ) as _i5.Future<Map<String, dynamic>>); @override - _i5.Future<dynamic> getMintData({ + _i5.Future<dynamic> getLelantusMintData({ dynamic mints, String? requestID, }) => (super.noSuchMethod( Invocation.method( - #getMintData, + #getLelantusMintData, [], { #mints: mints, @@ -337,13 +337,13 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { returnValue: _i5.Future<dynamic>.value(), ) as _i5.Future<dynamic>); @override - _i5.Future<Map<String, dynamic>> getUsedCoinSerials({ + _i5.Future<Map<String, dynamic>> getLelantusUsedCoinSerials({ String? requestID, required int? startNumber, }) => (super.noSuchMethod( Invocation.method( - #getUsedCoinSerials, + #getLelantusUsedCoinSerials, [], { #requestID: requestID, @@ -354,9 +354,73 @@ class MockElectrumXClient extends _i1.Mock implements _i4.ElectrumXClient { _i5.Future<Map<String, dynamic>>.value(<String, dynamic>{}), ) as _i5.Future<Map<String, dynamic>>); @override - _i5.Future<int> getLatestCoinId({String? requestID}) => (super.noSuchMethod( + _i5.Future<int> getLelantusLatestCoinId({String? requestID}) => + (super.noSuchMethod( Invocation.method( - #getLatestCoinId, + #getLelantusLatestCoinId, + [], + {#requestID: requestID}, + ), + returnValue: _i5.Future<int>.value(0), + ) as _i5.Future<int>); + @override + _i5.Future<Map<String, dynamic>> getSparkAnonymitySet({ + String? coinGroupId = r'1', + String? startBlockHash = r'', + String? requestID, + }) => + (super.noSuchMethod( + Invocation.method( + #getSparkAnonymitySet, + [], + { + #coinGroupId: coinGroupId, + #startBlockHash: startBlockHash, + #requestID: requestID, + }, + ), + returnValue: + _i5.Future<Map<String, dynamic>>.value(<String, dynamic>{}), + ) as _i5.Future<Map<String, dynamic>>); + @override + _i5.Future<Map<String, dynamic>> getSparkUsedCoinsTags({ + String? requestID, + required int? startNumber, + }) => + (super.noSuchMethod( + Invocation.method( + #getSparkUsedCoinsTags, + [], + { + #requestID: requestID, + #startNumber: startNumber, + }, + ), + returnValue: + _i5.Future<Map<String, dynamic>>.value(<String, dynamic>{}), + ) as _i5.Future<Map<String, dynamic>>); + @override + _i5.Future<Map<String, dynamic>> getSparkMintMetaData({ + String? requestID, + required List<String>? sparkCoinHashes, + }) => + (super.noSuchMethod( + Invocation.method( + #getSparkMintMetaData, + [], + { + #requestID: requestID, + #sparkCoinHashes: sparkCoinHashes, + }, + ), + returnValue: + _i5.Future<Map<String, dynamic>>.value(<String, dynamic>{}), + ) as _i5.Future<Map<String, dynamic>>); + @override + _i5.Future<int> getSparkLatestCoinId({String? requestID}) => + (super.noSuchMethod( + Invocation.method( + #getSparkLatestCoinId, [], {#requestID: requestID}, ), diff --git a/test/electrumx_test.dart b/test/electrumx_test.dart index ee6ee9e01..24c4323ad 100644 --- a/test/electrumx_test.dart +++ b/test/electrumx_test.dart @@ -826,7 +826,7 @@ void main() { torService: torService, failovers: []); - final result = await client.getAnonymitySet( + final result = await client.getLelantusAnonymitySet( groupId: "1", blockhash: "", requestID: "some requestId"); expect(result, GetAnonymitySetSampleData.data); @@ -862,8 +862,8 @@ void main() { failovers: []); expect( - () => - client.getAnonymitySet(groupId: "1", requestID: "some requestId"), + () => client.getLelantusAnonymitySet( + groupId: "1", requestID: "some requestId"), throwsA(isA<Exception>())); verify(mockPrefs.wifiOnly).called(1); @@ -903,7 +903,7 @@ void main() { torService: torService, failovers: []); - final result = await client.getMintData( + final result = await client.getLelantusMintData( mints: "some mints", requestID: "some requestId"); expect(result, "mint meta data"); @@ -939,7 +939,7 @@ void main() { failovers: []); expect( - () => client.getMintData( + () => client.getLelantusMintData( mints: "some mints", requestID: "some requestId"), throwsA(isA<Exception>())); @@ -980,7 +980,7 @@ void main() { torService: torService, failovers: []); - final result = await client.getUsedCoinSerials( + final result = await client.getLelantusUsedCoinSerials( requestID: "some requestId", startNumber: 0); expect(result, GetUsedSerialsSampleData.serials); @@ -1016,7 +1016,7 @@ void main() { failovers: []); expect( - () => client.getUsedCoinSerials( + () => client.getLelantusUsedCoinSerials( requestID: "some requestId", startNumber: 0), throwsA(isA<Exception>())); @@ -1057,7 +1057,8 @@ void main() { torService: torService, failovers: []); - final result = await client.getLatestCoinId(requestID: "some requestId"); + final result = + await client.getLelantusLatestCoinId(requestID: "some requestId"); expect(result, 1); @@ -1092,7 +1093,7 @@ void main() { failovers: []); expect( - () => client.getLatestCoinId( + () => client.getLelantusLatestCoinId( requestID: "some requestId", ), throwsA(isA<Exception>())); @@ -1134,7 +1135,7 @@ void main() { torService: torService, failovers: []); - final result = await client.getAnonymitySet( + final result = await client.getLelantusAnonymitySet( groupId: "1", blockhash: "", requestID: "some requestId"); expect(result, GetAnonymitySetSampleData.data); @@ -1170,7 +1171,7 @@ void main() { failovers: []); expect( - () => client.getAnonymitySet( + () => client.getLelantusAnonymitySet( groupId: "1", requestID: "some requestId", ), @@ -1213,7 +1214,7 @@ void main() { torService: torService, failovers: []); - final result = await client.getMintData( + final result = await client.getLelantusMintData( mints: "some mints", requestID: "some requestId"); expect(result, "mint meta data"); @@ -1249,7 +1250,7 @@ void main() { failovers: []); expect( - () => client.getMintData( + () => client.getLelantusMintData( mints: "some mints", requestID: "some requestId", ), @@ -1292,7 +1293,7 @@ void main() { torService: torService, failovers: []); - final result = await client.getUsedCoinSerials( + final result = await client.getLelantusUsedCoinSerials( requestID: "some requestId", startNumber: 0); expect(result, GetUsedSerialsSampleData.serials); @@ -1328,7 +1329,7 @@ void main() { failovers: []); expect( - () => client.getUsedCoinSerials( + () => client.getLelantusUsedCoinSerials( requestID: "some requestId", startNumber: 0), throwsA(isA<Exception>())); @@ -1369,7 +1370,8 @@ void main() { torService: torService, failovers: []); - final result = await client.getLatestCoinId(requestID: "some requestId"); + final result = + await client.getLelantusLatestCoinId(requestID: "some requestId"); expect(result, 1); @@ -1403,7 +1405,7 @@ void main() { torService: torService, failovers: []); - expect(() => client.getLatestCoinId(requestID: "some requestId"), + expect(() => client.getLelantusLatestCoinId(requestID: "some requestId"), throwsA(isA<Exception>())); verify(mockPrefs.wifiOnly).called(1); diff --git a/test/services/coins/bitcoin/bitcoin_wallet_test.mocks.dart b/test/services/coins/bitcoin/bitcoin_wallet_test.mocks.dart index 3c8815484..2db6d6963 100644 --- a/test/services/coins/bitcoin/bitcoin_wallet_test.mocks.dart +++ b/test/services/coins/bitcoin/bitcoin_wallet_test.mocks.dart @@ -300,14 +300,14 @@ class MockElectrumXClient extends _i1.Mock implements _i3.ElectrumXClient { _i4.Future<Map<String, dynamic>>.value(<String, dynamic>{}), ) as _i4.Future<Map<String, dynamic>>); @override - _i4.Future<Map<String, dynamic>> getAnonymitySet({ + _i4.Future<Map<String, dynamic>> getLelantusAnonymitySet({ String? groupId = r'1', String? blockhash = r'', String? requestID, }) => (super.noSuchMethod( Invocation.method( - #getAnonymitySet, + #getLelantusAnonymitySet, [], { #groupId: groupId, @@ -319,13 +319,13 @@ class MockElectrumXClient extends _i1.Mock implements _i3.ElectrumXClient { _i4.Future<Map<String, dynamic>>.value(<String, dynamic>{}), ) as _i4.Future<Map<String, dynamic>>); @override - _i4.Future<dynamic> getMintData({ + _i4.Future<dynamic> getLelantusMintData({ dynamic mints, String? requestID, }) => (super.noSuchMethod( Invocation.method( - #getMintData, + #getLelantusMintData, [], { #mints: mints, @@ -335,13 +335,13 @@ class MockElectrumXClient extends _i1.Mock implements _i3.ElectrumXClient { returnValue: _i4.Future<dynamic>.value(), ) as _i4.Future<dynamic>); @override - _i4.Future<Map<String, dynamic>> getUsedCoinSerials({ + _i4.Future<Map<String, dynamic>> getLelantusUsedCoinSerials({ String? requestID, required int? startNumber, }) => (super.noSuchMethod( Invocation.method( - #getUsedCoinSerials, + #getLelantusUsedCoinSerials, [], { #requestID: requestID, @@ -352,9 +352,73 @@ class MockElectrumXClient extends _i1.Mock implements _i3.ElectrumXClient { _i4.Future<Map<String, dynamic>>.value(<String, dynamic>{}), ) as _i4.Future<Map<String, dynamic>>); @override - _i4.Future<int> getLatestCoinId({String? requestID}) => (super.noSuchMethod( + _i4.Future<int> getLelantusLatestCoinId({String? requestID}) => + (super.noSuchMethod( Invocation.method( - #getLatestCoinId, + #getLelantusLatestCoinId, + [], + {#requestID: requestID}, + ), + returnValue: _i4.Future<int>.value(0), + ) as _i4.Future<int>); + @override + _i4.Future<Map<String, dynamic>> getSparkAnonymitySet({ + String? coinGroupId = r'1', + String? startBlockHash = r'', + String? requestID, + }) => + (super.noSuchMethod( + Invocation.method( + #getSparkAnonymitySet, + [], + { + #coinGroupId: coinGroupId, + #startBlockHash: startBlockHash, + #requestID: requestID, + }, + ), + returnValue: + _i4.Future<Map<String, dynamic>>.value(<String, dynamic>{}), + ) as _i4.Future<Map<String, dynamic>>); + @override + _i4.Future<Map<String, dynamic>> getSparkUsedCoinsTags({ + String? requestID, + required int? startNumber, + }) => + (super.noSuchMethod( + Invocation.method( + #getSparkUsedCoinsTags, + [], + { + #requestID: requestID, + #startNumber: startNumber, + }, + ), + returnValue: + _i4.Future<Map<String, dynamic>>.value(<String, dynamic>{}), + ) as _i4.Future<Map<String, dynamic>>); + @override + _i4.Future<Map<String, dynamic>> getSparkMintMetaData({ + String? requestID, + required List<String>? sparkCoinHashes, + }) => + (super.noSuchMethod( + Invocation.method( + #getSparkMintMetaData, + [], + { + #requestID: requestID, + #sparkCoinHashes: sparkCoinHashes, + }, + ), + returnValue: + _i4.Future<Map<String, dynamic>>.value(<String, dynamic>{}), + ) as _i4.Future<Map<String, dynamic>>); + @override + _i4.Future<int> getSparkLatestCoinId({String? requestID}) => + (super.noSuchMethod( + Invocation.method( + #getSparkLatestCoinId, [], {#requestID: requestID}, ), diff --git a/test/services/coins/bitcoincash/bitcoincash_wallet_test.mocks.dart b/test/services/coins/bitcoincash/bitcoincash_wallet_test.mocks.dart index 7980e05ea..0589e39e9 100644 --- a/test/services/coins/bitcoincash/bitcoincash_wallet_test.mocks.dart +++ b/test/services/coins/bitcoincash/bitcoincash_wallet_test.mocks.dart @@ -300,14 +300,14 @@ class MockElectrumXClient extends _i1.Mock implements _i3.ElectrumXClient { _i4.Future<Map<String, dynamic>>.value(<String, dynamic>{}), ) as _i4.Future<Map<String, dynamic>>); @override - _i4.Future<Map<String, dynamic>> getAnonymitySet({ + _i4.Future<Map<String, dynamic>> getLelantusAnonymitySet({ String? groupId = r'1', String? blockhash = r'', String? requestID, }) => (super.noSuchMethod( Invocation.method( - #getAnonymitySet, + #getLelantusAnonymitySet, [], { #groupId: groupId, @@ -319,13 +319,13 @@ class MockElectrumXClient extends _i1.Mock implements _i3.ElectrumXClient { _i4.Future<Map<String, dynamic>>.value(<String, dynamic>{}), ) as _i4.Future<Map<String, dynamic>>); @override - _i4.Future<dynamic> getMintData({ + _i4.Future<dynamic> getLelantusMintData({ dynamic mints, String? requestID, }) => (super.noSuchMethod( Invocation.method( - #getMintData, + #getLelantusMintData, [], { #mints: mints, @@ -335,13 +335,13 @@ class MockElectrumXClient extends _i1.Mock implements _i3.ElectrumXClient { returnValue: _i4.Future<dynamic>.value(), ) as _i4.Future<dynamic>); @override - _i4.Future<Map<String, dynamic>> getUsedCoinSerials({ + _i4.Future<Map<String, dynamic>> getLelantusUsedCoinSerials({ String? requestID, required int? startNumber, }) => (super.noSuchMethod( Invocation.method( - #getUsedCoinSerials, + #getLelantusUsedCoinSerials, [], { #requestID: requestID, @@ -352,9 +352,73 @@ class MockElectrumXClient extends _i1.Mock implements _i3.ElectrumXClient { _i4.Future<Map<String, dynamic>>.value(<String, dynamic>{}), ) as _i4.Future<Map<String, dynamic>>); @override - _i4.Future<int> getLatestCoinId({String? requestID}) => (super.noSuchMethod( + _i4.Future<int> getLelantusLatestCoinId({String? requestID}) => + (super.noSuchMethod( Invocation.method( - #getLatestCoinId, + #getLelantusLatestCoinId, + [], + {#requestID: requestID}, + ), + returnValue: _i4.Future<int>.value(0), + ) as _i4.Future<int>); + @override + _i4.Future<Map<String, dynamic>> getSparkAnonymitySet({ + String? coinGroupId = r'1', + String? startBlockHash = r'', + String? requestID, + }) => + (super.noSuchMethod( + Invocation.method( + #getSparkAnonymitySet, + [], + { + #coinGroupId: coinGroupId, + #startBlockHash: startBlockHash, + #requestID: requestID, + }, + ), + returnValue: + _i4.Future<Map<String, dynamic>>.value(<String, dynamic>{}), + ) as _i4.Future<Map<String, dynamic>>); + @override + _i4.Future<Map<String, dynamic>> getSparkUsedCoinsTags({ + String? requestID, + required int? startNumber, + }) => + (super.noSuchMethod( + Invocation.method( + #getSparkUsedCoinsTags, + [], + { + #requestID: requestID, + #startNumber: startNumber, + }, + ), + returnValue: + _i4.Future<Map<String, dynamic>>.value(<String, dynamic>{}), + ) as _i4.Future<Map<String, dynamic>>); + @override + _i4.Future<Map<String, dynamic>> getSparkMintMetaData({ + String? requestID, + required List<String>? sparkCoinHashes, + }) => + (super.noSuchMethod( + Invocation.method( + #getSparkMintMetaData, + [], + { + #requestID: requestID, + #sparkCoinHashes: sparkCoinHashes, + }, + ), + returnValue: + _i4.Future<Map<String, dynamic>>.value(<String, dynamic>{}), + ) as _i4.Future<Map<String, dynamic>>); + @override + _i4.Future<int> getSparkLatestCoinId({String? requestID}) => + (super.noSuchMethod( + Invocation.method( + #getSparkLatestCoinId, [], {#requestID: requestID}, ), diff --git a/test/services/coins/dogecoin/dogecoin_wallet_test.mocks.dart b/test/services/coins/dogecoin/dogecoin_wallet_test.mocks.dart index ad7c308af..6b4933833 100644 --- a/test/services/coins/dogecoin/dogecoin_wallet_test.mocks.dart +++ b/test/services/coins/dogecoin/dogecoin_wallet_test.mocks.dart @@ -300,14 +300,14 @@ class MockElectrumXClient extends _i1.Mock implements _i3.ElectrumXClient { _i4.Future<Map<String, dynamic>>.value(<String, dynamic>{}), ) as _i4.Future<Map<String, dynamic>>); @override - _i4.Future<Map<String, dynamic>> getAnonymitySet({ + _i4.Future<Map<String, dynamic>> getLelantusAnonymitySet({ String? groupId = r'1', String? blockhash = r'', String? requestID, }) => (super.noSuchMethod( Invocation.method( - #getAnonymitySet, + #getLelantusAnonymitySet, [], { #groupId: groupId, @@ -319,13 +319,13 @@ class MockElectrumXClient extends _i1.Mock implements _i3.ElectrumXClient { _i4.Future<Map<String, dynamic>>.value(<String, dynamic>{}), ) as _i4.Future<Map<String, dynamic>>); @override - _i4.Future<dynamic> getMintData({ + _i4.Future<dynamic> getLelantusMintData({ dynamic mints, String? requestID, }) => (super.noSuchMethod( Invocation.method( - #getMintData, + #getLelantusMintData, [], { #mints: mints, @@ -335,13 +335,13 @@ class MockElectrumXClient extends _i1.Mock implements _i3.ElectrumXClient { returnValue: _i4.Future<dynamic>.value(), ) as _i4.Future<dynamic>); @override - _i4.Future<Map<String, dynamic>> getUsedCoinSerials({ + _i4.Future<Map<String, dynamic>> getLelantusUsedCoinSerials({ String? requestID, required int? startNumber, }) => (super.noSuchMethod( Invocation.method( - #getUsedCoinSerials, + #getLelantusUsedCoinSerials, [], { #requestID: requestID, @@ -352,9 +352,73 @@ class MockElectrumXClient extends _i1.Mock implements _i3.ElectrumXClient { _i4.Future<Map<String, dynamic>>.value(<String, dynamic>{}), ) as _i4.Future<Map<String, dynamic>>); @override - _i4.Future<int> getLatestCoinId({String? requestID}) => (super.noSuchMethod( + _i4.Future<int> getLelantusLatestCoinId({String? requestID}) => + (super.noSuchMethod( Invocation.method( - #getLatestCoinId, + #getLelantusLatestCoinId, + [], + {#requestID: requestID}, + ), + returnValue: _i4.Future<int>.value(0), + ) as _i4.Future<int>); + @override + _i4.Future<Map<String, dynamic>> getSparkAnonymitySet({ + String? coinGroupId = r'1', + String? startBlockHash = r'', + String? requestID, + }) => + (super.noSuchMethod( + Invocation.method( + #getSparkAnonymitySet, + [], + { + #coinGroupId: coinGroupId, + #startBlockHash: startBlockHash, + #requestID: requestID, + }, + ), + returnValue: + _i4.Future<Map<String, dynamic>>.value(<String, dynamic>{}), + ) as _i4.Future<Map<String, dynamic>>); + @override + _i4.Future<Map<String, dynamic>> getSparkUsedCoinsTags({ + String? requestID, + required int? startNumber, + }) => + (super.noSuchMethod( + Invocation.method( + #getSparkUsedCoinsTags, + [], + { + #requestID: requestID, + #startNumber: startNumber, + }, + ), + returnValue: + _i4.Future<Map<String, dynamic>>.value(<String, dynamic>{}), + ) as _i4.Future<Map<String, dynamic>>); + @override + _i4.Future<Map<String, dynamic>> getSparkMintMetaData({ + String? requestID, + required List<String>? sparkCoinHashes, + }) => + (super.noSuchMethod( + Invocation.method( + #getSparkMintMetaData, + [], + { + #requestID: requestID, + #sparkCoinHashes: sparkCoinHashes, + }, + ), + returnValue: + _i4.Future<Map<String, dynamic>>.value(<String, dynamic>{}), + ) as _i4.Future<Map<String, dynamic>>); + @override + _i4.Future<int> getSparkLatestCoinId({String? requestID}) => + (super.noSuchMethod( + Invocation.method( + #getSparkLatestCoinId, [], {#requestID: requestID}, ), diff --git a/test/services/coins/firo/firo_wallet_test.dart b/test/services/coins/firo/firo_wallet_test.dart index 4522771b5..97b92913b 100644 --- a/test/services/coins/firo/firo_wallet_test.dart +++ b/test/services/coins/firo/firo_wallet_test.dart @@ -37,7 +37,7 @@ import 'sample_data/transaction_data_samples.dart'; void main() { group("isolate functions", () { test("isolateRestore success", () async { - final cachedClient = MockCachedElectrumX(); + final cachedClient = MockCachedElectrumXClient(); final txDataOLD = old.TransactionData.fromJson(dateTimeChunksJson); final Map<dynamic, dynamic> setData = {}; setData[1] = GetAnonymitySetSampleData.data; @@ -195,7 +195,7 @@ void main() { "function": "estimateJoinSplit", "spendAmount": "spendAmount", "subtractFeeFromAmount": true, - "lelantusEntries": MockCachedElectrumX(), + "lelantusEntries": MockCachedElectrumXClient(), }); expect(await receivePort.first, "Error"); }); @@ -226,7 +226,7 @@ void main() { // test( // "getJMintTransactions throws Error due to some invalid transactions passed to this function", // () { - // final cachedClient = MockCachedElectrumX(); + // final cachedClient = MockCachedElectrumXClient(); // // // // mock price calls @@ -287,7 +287,7 @@ void main() { // }); // // test("getJMintTransactions success", () async { - // final cachedClient = MockCachedElectrumX(); + // final cachedClient = MockCachedElectrumXClient(); // // // // mock price calls @@ -342,7 +342,7 @@ void main() { // }); // // test("getAnonymitySet", () async { - // final cachedClient = MockCachedElectrumX(); + // final cachedClient = MockCachedElectrumXClient(); // when(cachedClient.getAnonymitySet( // groupId: "1", coin: Coin.firo, )) // .thenAnswer((_) async => { @@ -373,7 +373,7 @@ void main() { // }); test("getBlockHead", () async { - final client = MockElectrumX(); + final client = MockElectrumXClient(); when(client.getBlockHeadTip()).thenAnswer( (_) async => {"height": 4359032, "hex": "... some block hex ..."}); @@ -388,8 +388,8 @@ void main() { walletName: 'unit test', walletId: 'some id', coin: Coin.firo, - client: MockElectrumX(), - cachedClient: MockCachedElectrumX(), + client: MockElectrumXClient(), + cachedClient: MockCachedElectrumXClient(), secureStore: FakeSecureStorage(), tracker: MockTransactionNotificationTracker(), ); @@ -402,8 +402,8 @@ void main() { walletName: 'unit test', walletId: 'some id', coin: Coin.firo, - client: MockElectrumX(), - cachedClient: MockCachedElectrumX(), + client: MockElectrumXClient(), + cachedClient: MockCachedElectrumXClient(), secureStore: FakeSecureStorage(), tracker: MockTransactionNotificationTracker(), ); @@ -416,8 +416,8 @@ void main() { walletName: 'unit test', walletId: 'some id', coin: Coin.firo, - client: MockElectrumX(), - cachedClient: MockCachedElectrumX(), + client: MockElectrumXClient(), + cachedClient: MockCachedElectrumXClient(), secureStore: FakeSecureStorage(), tracker: MockTransactionNotificationTracker(), ); @@ -430,8 +430,8 @@ void main() { walletName: 'unit test', walletId: 'some id', coin: Coin.firoTestNet, - client: MockElectrumX(), - cachedClient: MockCachedElectrumX(), + client: MockElectrumXClient(), + cachedClient: MockCachedElectrumXClient(), secureStore: FakeSecureStorage(), tracker: MockTransactionNotificationTracker(), ); @@ -444,8 +444,8 @@ void main() { walletName: 'unit test', walletId: 'some id', coin: Coin.firoTestNet, - client: MockElectrumX(), - cachedClient: MockCachedElectrumX(), + client: MockElectrumXClient(), + cachedClient: MockCachedElectrumXClient(), secureStore: FakeSecureStorage(), tracker: MockTransactionNotificationTracker(), ); @@ -458,8 +458,8 @@ void main() { walletName: 'unit test', walletId: 'some id', coin: Coin.firoTestNet, - client: MockElectrumX(), - cachedClient: MockCachedElectrumX(), + client: MockElectrumXClient(), + cachedClient: MockCachedElectrumXClient(), secureStore: FakeSecureStorage(), tracker: MockTransactionNotificationTracker(), ); @@ -470,7 +470,7 @@ void main() { group("testNetworkConnection", () { test("attempted connection fails due to server error", () async { - final client = MockElectrumX(); + final client = MockElectrumXClient(); when(client.ping()).thenAnswer((_) async => false); final firo = FiroWallet( @@ -478,7 +478,7 @@ void main() { walletId: 'some id', coin: Coin.firo, client: client, - cachedClient: MockCachedElectrumX(), + cachedClient: MockCachedElectrumXClient(), secureStore: FakeSecureStorage(), tracker: MockTransactionNotificationTracker(), ); @@ -488,7 +488,7 @@ void main() { }); test("attempted connection fails due to exception", () async { - final client = MockElectrumX(); + final client = MockElectrumXClient(); when(client.ping()).thenThrow(Exception); final firo = FiroWallet( @@ -496,7 +496,7 @@ void main() { walletId: 'some id', coin: Coin.firo, client: client, - cachedClient: MockCachedElectrumX(), + cachedClient: MockCachedElectrumXClient(), secureStore: FakeSecureStorage(), tracker: MockTransactionNotificationTracker(), ); @@ -506,7 +506,7 @@ void main() { }); test("attempted connection test success", () async { - final client = MockElectrumX(); + final client = MockElectrumXClient(); when(client.ping()).thenAnswer((_) async => true); final firo = FiroWallet( @@ -514,7 +514,7 @@ void main() { walletId: 'some id', coin: Coin.firoTestNet, client: client, - cachedClient: MockCachedElectrumX(), + cachedClient: MockCachedElectrumXClient(), secureStore: FakeSecureStorage(), tracker: MockTransactionNotificationTracker(), ); @@ -536,8 +536,8 @@ void main() { }); // test("initializeWallet no network", () async { - // final client = MockElectrumX(); - // final cachedClient = MockCachedElectrumX(); + // final client = MockElectrumXClient(); + // final cachedClient = MockCachedElectrumXClient(); // final secureStore = FakeSecureStorage(); // // @@ -558,8 +558,8 @@ void main() { // }); // test("initializeWallet no network exception", () async { - // final client = MockElectrumX(); - // final cachedClient = MockCachedElectrumX(); + // final client = MockElectrumXClient(); + // final cachedClient = MockCachedElectrumXClient(); // final secureStore = FakeSecureStorage(); // // @@ -581,8 +581,8 @@ void main() { // }); // // test("initializeWallet throws bad network on testnet", () async { - // final client = MockElectrumX(); - // final cachedClient = MockCachedElectrumX(); + // final client = MockElectrumXClient(); + // final cachedClient = MockCachedElectrumXClient(); // final secureStore = FakeSecureStorage(); // // @@ -615,8 +615,8 @@ void main() { // }); // // test("initializeWallet throws bad network on mainnet", () async { - // final client = MockElectrumX(); - // final cachedClient = MockCachedElectrumX(); + // final client = MockElectrumXClient(); + // final cachedClient = MockCachedElectrumXClient(); // final secureStore = FakeSecureStorage(); // // @@ -652,8 +652,8 @@ void main() { // const MethodChannel('uk.spiralarm.flutter/devicelocale') // .setMockMethodCallHandler((methodCall) async => 'en_US'); // - // final client = MockElectrumX(); - // final cachedClient = MockCachedElectrumX(); + // final client = MockElectrumXClient(); + // final cachedClient = MockCachedElectrumXClient(); // final secureStore = FakeSecureStorage(); // // when(priceAPI.getPrice(ticker: "tFIRO", baseCurrency: "USD")) @@ -724,8 +724,8 @@ void main() { // const MethodChannel('uk.spiralarm.flutter/devicelocale') // .setMockMethodCallHandler((methodCall) async => 'en_US'); // - // final client = MockElectrumX(); - // final cachedClient = MockCachedElectrumX(); + // final client = MockElectrumXClient(); + // final cachedClient = MockCachedElectrumXClient(); // final secureStore = FakeSecureStorage(); // // // when(priceAPI.getPrice(ticker: "tFIRO", baseCurrency: "USD")) @@ -830,8 +830,8 @@ void main() { // const MethodChannel('uk.spiralarm.flutter/devicelocale') // .setMockMethodCallHandler((methodCall) async => 'en_US'); // - // final client = MockElectrumX(); - // final cachedClient = MockCachedElectrumX(); + // final client = MockElectrumXClient(); + // final cachedClient = MockCachedElectrumXClient(); // final secureStore = FakeSecureStorage(); // // // mock price calls @@ -908,8 +908,8 @@ void main() { // }); // test("getAllTxsToWatch", () async { - // final client = MockElectrumX(); - // final cachedClient = MockCachedElectrumX(); + // final client = MockElectrumXClient(); + // final cachedClient = MockCachedElectrumXClient(); // final secureStore = FakeSecureStorage(); // // final tracker = MockTransactionNotificationTracker(); @@ -975,8 +975,8 @@ void main() { // const MethodChannel('uk.spiralarm.flutter/devicelocale') // .setMockMethodCallHandler((methodCall) async => 'en_US'); // - // final client = MockElectrumX(); - // final cachedClient = MockCachedElectrumX(); + // final client = MockElectrumXClient(); + // final cachedClient = MockCachedElectrumXClient(); // final secureStore = FakeSecureStorage(); // final tracker = MockTransactionNotificationTracker(); // @@ -1069,8 +1069,8 @@ void main() { // TODO: mock NotificationAPI // test("refreshIfThereIsNewData with two unconfirmed transactions", // () async { - // final client = MockElectrumX(); - // final cachedClient = MockCachedElectrumX(); + // final client = MockElectrumXClient(); + // final cachedClient = MockCachedElectrumXClient(); // final secureStore = FakeSecureStorage(); // // final tracker = MockTransactionNotificationTracker(); @@ -1126,8 +1126,8 @@ void main() { }); test("submitHexToNetwork", () async { - final client = MockElectrumX(); - final cachedClient = MockCachedElectrumX(); + final client = MockElectrumXClient(); + final cachedClient = MockCachedElectrumXClient(); final secureStore = FakeSecureStorage(); when(client.broadcastTransaction( @@ -1175,8 +1175,8 @@ void main() { ) ]; const sats = 9658; - final client = MockElectrumX(); - final cachedClient = MockCachedElectrumX(); + final client = MockElectrumXClient(); + final cachedClient = MockCachedElectrumXClient(); final secureStore = FakeSecureStorage(); final mainDB = MockMainDB(); @@ -1206,7 +1206,7 @@ void main() { when(client.getBlockHeadTip()).thenAnswer( (_) async => {"height": 455873, "hex": "this value not used here"}); - when(client.getLatestCoinId()).thenAnswer((_) async => 2); + when(client.getLelantusLatestCoinId()).thenAnswer((_) async => 2); when(mainDB.getAddress("${testWalletId}buildMintTransaction", any)) .thenAnswer((realInvocation) async => null); @@ -1255,8 +1255,8 @@ void main() { // const MethodChannel('uk.spiralarm.flutter/devicelocale') // .setMockMethodCallHandler((methodCall) async => 'en_US'); // - // final client = MockElectrumX(); - // final cachedClient = MockCachedElectrumX(); + // final client = MockElectrumXClient(); + // final cachedClient = MockCachedElectrumXClient(); // final secureStore = FakeSecureStorage(); // // // mock electrumx client calls @@ -1489,8 +1489,8 @@ void main() { // const MethodChannel('uk.spiralarm.flutter/devicelocale') // .setMockMethodCallHandler((methodCall) async => 'en_US'); // - // final client = MockElectrumX(); - // final cachedClient = MockCachedElectrumX(); + // final client = MockElectrumXClient(); + // final cachedClient = MockCachedElectrumXClient(); // final secureStore = FakeSecureStorage(); // // await secureStore.write( @@ -1698,8 +1698,8 @@ void main() { // const MethodChannel('uk.spiralarm.flutter/devicelocale') // .setMockMethodCallHandler((methodCall) async => 'en_US'); // - // final client = MockElectrumX(); - // final cachedClient = MockCachedElectrumX(); + // final client = MockElectrumXClient(); + // final cachedClient = MockCachedElectrumXClient(); // final secureStore = FakeSecureStorage(); // // await secureStore.write( @@ -1836,8 +1836,8 @@ void main() { // const MethodChannel('uk.spiralarm.flutter/devicelocale') // .setMockMethodCallHandler((methodCall) async => 'en_US'); // - // final client = MockElectrumX(); - // final cachedClient = MockCachedElectrumX(); + // final client = MockElectrumXClient(); + // final cachedClient = MockCachedElectrumXClient(); // final secureStore = FakeSecureStorage(); // // // mock electrumx client calls @@ -2110,8 +2110,8 @@ void main() { // }, timeout: const Timeout(Duration(minutes: 6))); test("recoverFromMnemonic fails testnet", () async { - final client = MockElectrumX(); - final cachedClient = MockCachedElectrumX(); + final client = MockElectrumXClient(); + final cachedClient = MockCachedElectrumXClient(); final secureStore = FakeSecureStorage(); // mock electrumx client calls @@ -2146,8 +2146,8 @@ void main() { }, timeout: const Timeout(Duration(minutes: 3))); test("recoverFromMnemonic fails mainnet", () async { - final client = MockElectrumX(); - final cachedClient = MockCachedElectrumX(); + final client = MockElectrumXClient(); + final cachedClient = MockCachedElectrumXClient(); final secureStore = FakeSecureStorage(); // mock electrumx client calls @@ -2186,8 +2186,8 @@ void main() { walletId: "${testWalletId}checkReceivingAddressForTransactions fails", walletName: testWalletName, coin: Coin.firo, - client: MockElectrumX(), - cachedClient: MockCachedElectrumX(), + client: MockElectrumXClient(), + cachedClient: MockCachedElectrumXClient(), secureStore: FakeSecureStorage(), tracker: MockTransactionNotificationTracker(), ); @@ -2202,7 +2202,7 @@ void main() { }); // test("checkReceivingAddressForTransactions numtxs >= 1", () async { - // final client = MockElectrumX(); + // final client = MockElectrumXClient(); // final secureStore = FakeSecureStorage(); // // when(client.getHistory(scripthash: SampleGetHistoryData.scripthash1)) @@ -2214,7 +2214,7 @@ void main() { // walletName: testWalletName, // coin: Coin.firo, // client: client, - // cachedClient: MockCachedElectrumX(), + // cachedClient: MockCachedElectrumXClient(), // secureStore: secureStore, // tracker: MockTransactionNotificationTracker(), // ); @@ -2237,16 +2237,16 @@ void main() { // }); test("getLatestSetId", () async { - final client = MockElectrumX(); + final client = MockElectrumXClient(); - when(client.getLatestCoinId()).thenAnswer((_) async => 1); + when(client.getLelantusLatestCoinId()).thenAnswer((_) async => 1); final firo = FiroWallet( walletId: "${testWalletId}exit", walletName: testWalletName, coin: Coin.firo, client: client, - cachedClient: MockCachedElectrumX(), + cachedClient: MockCachedElectrumXClient(), secureStore: FakeSecureStorage(), tracker: MockTransactionNotificationTracker(), ); @@ -2256,7 +2256,7 @@ void main() { }); // test("getSetData", () async { - // final client = MockElectrumX(); + // final client = MockElectrumXClient(); // // when(client.getCoinsForRecovery(setId: 1)) // .thenAnswer((_) async => getCoinsForRecoveryResponse); @@ -2266,7 +2266,7 @@ void main() { // walletName: testWalletName, // networkType: firoNetworkType, // client: client, - // cachedClient: MockCachedElectrumX(), + // cachedClient: MockCachedElectrumXClient(), // secureStore: FakeSecureStorage(), // // tracker: MockTransactionNotificationTracker(), @@ -2277,8 +2277,8 @@ void main() { // }); test("getUsedCoinSerials", () async { - final client = MockElectrumX(); - final cachedClient = MockCachedElectrumX(); + final client = MockElectrumXClient(); + final cachedClient = MockCachedElectrumXClient(); // when(client.getUsedCoinSerials(startNumber: 0)) // .thenAnswer((_) async => GetUsedSerialsSampleData.serials); @@ -2309,8 +2309,8 @@ void main() { const MethodChannel('uk.spiralarm.flutter/devicelocale') .setMockMethodCallHandler((methodCall) async => 'en_US'); - final client = MockElectrumX(); - final cachedClient = MockCachedElectrumX(); + final client = MockElectrumXClient(); + final cachedClient = MockCachedElectrumXClient(); final secureStore = FakeSecureStorage(); // set mnemonic @@ -2345,10 +2345,10 @@ void main() { "services": <dynamic>[] }); - when(client.getLatestCoinId()).thenAnswer((_) async => 1); + when(client.getLelantusLatestCoinId()).thenAnswer((_) async => 1); // when(client.getCoinsForRecovery(setId: 1)) // .thenAnswer((_) async => getCoinsForRecoveryResponse); - when(client.getUsedCoinSerials(startNumber: 0)) + when(client.getLelantusUsedCoinSerials(startNumber: 0)) .thenAnswer((_) async => GetUsedSerialsSampleData.serials); when(client.estimateFee(blocks: 1)) @@ -2430,8 +2430,8 @@ void main() { // TestWidgetsFlutterBinding.ensureInitialized(); // const MethodChannel('uk.spiralarm.flutter/devicelocale') // .setMockMethodCallHandler((methodCall) async => 'en_US'); - // final client = MockElectrumX(); - // final cachedClient = MockCachedElectrumX(); + // final client = MockElectrumXClient(); + // final cachedClient = MockCachedElectrumXClient(); // final secureStore = FakeSecureStorage(); // // @@ -2613,8 +2613,8 @@ void main() { // const MethodChannel('uk.spiralarm.flutter/devicelocale') // .setMockMethodCallHandler((methodCall) async => 'en_US'); // - // final client = MockElectrumX(); - // final cachedClient = MockCachedElectrumX(); + // final client = MockElectrumXClient(); + // final cachedClient = MockCachedElectrumXClient(); // final secureStore = FakeSecureStorage(); // // when(client.getLatestCoinId()).thenAnswer((_) async => 1); @@ -2789,8 +2789,8 @@ void main() { // const MethodChannel('uk.spiralarm.flutter/devicelocale') // .setMockMethodCallHandler((methodCall) async => 'en_US'); // - // final client = MockElectrumX(); - // final cachedClient = MockCachedElectrumX(); + // final client = MockElectrumXClient(); + // final cachedClient = MockCachedElectrumXClient(); // // // mock history calls // when(client.getHistory(scripthash: SampleGetHistoryData.scripthash0)) @@ -2869,8 +2869,8 @@ void main() { // }); // test("get transactions", () async { - // final client = MockElectrumX(); - // final cachedClient = MockCachedElectrumX(); + // final client = MockElectrumXClient(); + // final cachedClient = MockCachedElectrumXClient(); // final secureStore = FakeSecureStorage(); // // // set mnemonic @@ -2976,8 +2976,8 @@ void main() { // const MethodChannel('uk.spiralarm.flutter/devicelocale') // .setMockMethodCallHandler((methodCall) async => 'en_US'); // - // final client = MockElectrumX(); - // final cachedClient = MockCachedElectrumX(); + // final client = MockElectrumXClient(); + // final cachedClient = MockCachedElectrumXClient(); // final secureStore = FakeSecureStorage(); // // @@ -3196,8 +3196,8 @@ void main() { walletId: "${testWalletId}exit", walletName: testWalletName, coin: Coin.firo, - client: MockElectrumX(), - cachedClient: MockCachedElectrumX(), + client: MockElectrumXClient(), + cachedClient: MockCachedElectrumXClient(), secureStore: FakeSecureStorage(), tracker: MockTransactionNotificationTracker(), ); @@ -3222,7 +3222,7 @@ void main() { group("simple getters", () { group("fees", () { test("get fees succeeds", () async { - final client = MockElectrumX(); + final client = MockElectrumXClient(); when(client.estimateFee(blocks: 1)) .thenAnswer((_) async => Decimal.parse("0.00001000")); @@ -3236,7 +3236,7 @@ void main() { walletName: "some name", coin: Coin.firo, client: client, - cachedClient: MockCachedElectrumX(), + cachedClient: MockCachedElectrumXClient(), secureStore: FakeSecureStorage(), tracker: MockTransactionNotificationTracker(), ); @@ -3247,7 +3247,7 @@ void main() { }); test("get fees throws", () { - final client = MockElectrumX(); + final client = MockElectrumXClient(); when(client.estimateFee(blocks: 1)) .thenThrow(Exception("Some exception")); @@ -3257,7 +3257,7 @@ void main() { walletName: "some name", coin: Coin.firo, client: client, - cachedClient: MockCachedElectrumX(), + cachedClient: MockCachedElectrumXClient(), secureStore: FakeSecureStorage(), tracker: MockTransactionNotificationTracker(), ); @@ -3272,8 +3272,8 @@ void main() { walletId: "some id", walletName: "some name", coin: Coin.firo, - client: MockElectrumX(), - cachedClient: MockCachedElectrumX(), + client: MockElectrumXClient(), + cachedClient: MockCachedElectrumXClient(), secureStore: FakeSecureStorage(), tracker: MockTransactionNotificationTracker(), ); @@ -3286,8 +3286,8 @@ void main() { walletId: "some id", walletName: "some name", coin: Coin.firoTestNet, - client: MockElectrumX(), - cachedClient: MockCachedElectrumX(), + client: MockElectrumXClient(), + cachedClient: MockCachedElectrumXClient(), secureStore: FakeSecureStorage(), tracker: MockTransactionNotificationTracker(), ); @@ -3308,8 +3308,8 @@ void main() { walletName: 'unit test', walletId: 'some id', coin: Coin.firoTestNet, - client: MockElectrumX(), - cachedClient: MockCachedElectrumX(), + client: MockElectrumXClient(), + cachedClient: MockCachedElectrumXClient(), secureStore: store, tracker: MockTransactionNotificationTracker(), ); @@ -3336,8 +3336,8 @@ void main() { walletName: 'unit test', walletId: 'some other id', coin: Coin.firoTestNet, - client: MockElectrumX(), - cachedClient: MockCachedElectrumX(), + client: MockElectrumXClient(), + cachedClient: MockCachedElectrumXClient(), secureStore: store, tracker: MockTransactionNotificationTracker(), ); @@ -3351,8 +3351,8 @@ void main() { walletId: "some id", walletName: "some name", coin: Coin.firo, - client: MockElectrumX(), - cachedClient: MockCachedElectrumX(), + client: MockElectrumXClient(), + cachedClient: MockCachedElectrumXClient(), secureStore: FakeSecureStorage(), tracker: MockTransactionNotificationTracker(), ); @@ -3368,8 +3368,8 @@ void main() { walletId: "some id", walletName: "some name", coin: Coin.firo, - client: MockElectrumX(), - cachedClient: MockCachedElectrumX(), + client: MockElectrumXClient(), + cachedClient: MockCachedElectrumXClient(), secureStore: FakeSecureStorage(), tracker: MockTransactionNotificationTracker(), ); diff --git a/test/services/coins/firo/firo_wallet_test.mocks.dart b/test/services/coins/firo/firo_wallet_test.mocks.dart index 1a3ee4f5c..7b7155ab4 100644 --- a/test/services/coins/firo/firo_wallet_test.mocks.dart +++ b/test/services/coins/firo/firo_wallet_test.mocks.dart @@ -330,14 +330,14 @@ class MockElectrumXClient extends _i1.Mock implements _i3.ElectrumXClient { _i5.Future<Map<String, dynamic>>.value(<String, dynamic>{}), ) as _i5.Future<Map<String, dynamic>>); @override - _i5.Future<Map<String, dynamic>> getAnonymitySet({ + _i5.Future<Map<String, dynamic>> getLelantusAnonymitySet({ String? groupId = r'1', String? blockhash = r'', String? requestID, }) => (super.noSuchMethod( Invocation.method( - #getAnonymitySet, + #getLelantusAnonymitySet, [], { #groupId: groupId, @@ -349,13 +349,13 @@ class MockElectrumXClient extends _i1.Mock implements _i3.ElectrumXClient { _i5.Future<Map<String, dynamic>>.value(<String, dynamic>{}), ) as _i5.Future<Map<String, dynamic>>); @override - _i5.Future<dynamic> getMintData({ + _i5.Future<dynamic> getLelantusMintData({ dynamic mints, String? requestID, }) => (super.noSuchMethod( Invocation.method( - #getMintData, + #getLelantusMintData, [], { #mints: mints, @@ -365,13 +365,13 @@ class MockElectrumXClient extends _i1.Mock implements _i3.ElectrumXClient { returnValue: _i5.Future<dynamic>.value(), ) as _i5.Future<dynamic>); @override - _i5.Future<Map<String, dynamic>> getUsedCoinSerials({ + _i5.Future<Map<String, dynamic>> getLelantusUsedCoinSerials({ String? requestID, required int? startNumber, }) => (super.noSuchMethod( Invocation.method( - #getUsedCoinSerials, + #getLelantusUsedCoinSerials, [], { #requestID: requestID, @@ -382,9 +382,73 @@ class MockElectrumXClient extends _i1.Mock implements _i3.ElectrumXClient { _i5.Future<Map<String, dynamic>>.value(<String, dynamic>{}), ) as _i5.Future<Map<String, dynamic>>); @override - _i5.Future<int> getLatestCoinId({String? requestID}) => (super.noSuchMethod( + _i5.Future<int> getLelantusLatestCoinId({String? requestID}) => + (super.noSuchMethod( Invocation.method( - #getLatestCoinId, + #getLelantusLatestCoinId, + [], + {#requestID: requestID}, + ), + returnValue: _i5.Future<int>.value(0), + ) as _i5.Future<int>); + @override + _i5.Future<Map<String, dynamic>> getSparkAnonymitySet({ + String? coinGroupId = r'1', + String? startBlockHash = r'', + String? requestID, + }) => + (super.noSuchMethod( + Invocation.method( + #getSparkAnonymitySet, + [], + { + #coinGroupId: coinGroupId, + #startBlockHash: startBlockHash, + #requestID: requestID, + }, + ), + returnValue: + _i5.Future<Map<String, dynamic>>.value(<String, dynamic>{}), + ) as _i5.Future<Map<String, dynamic>>); + @override + _i5.Future<Map<String, dynamic>> getSparkUsedCoinsTags({ + String? requestID, + required int? startNumber, + }) => + (super.noSuchMethod( + Invocation.method( + #getSparkUsedCoinsTags, + [], + { + #requestID: requestID, + #startNumber: startNumber, + }, + ), + returnValue: + _i5.Future<Map<String, dynamic>>.value(<String, dynamic>{}), + ) as _i5.Future<Map<String, dynamic>>); + @override + _i5.Future<Map<String, dynamic>> getSparkMintMetaData({ + String? requestID, + required List<String>? sparkCoinHashes, + }) => + (super.noSuchMethod( + Invocation.method( + #getSparkMintMetaData, + [], + { + #requestID: requestID, + #sparkCoinHashes: sparkCoinHashes, + }, + ), + returnValue: + _i5.Future<Map<String, dynamic>>.value(<String, dynamic>{}), + ) as _i5.Future<Map<String, dynamic>>); + @override + _i5.Future<int> getSparkLatestCoinId({String? requestID}) => + (super.noSuchMethod( + Invocation.method( + #getSparkLatestCoinId, [], {#requestID: requestID}, ), diff --git a/test/services/coins/namecoin/namecoin_wallet_test.dart b/test/services/coins/namecoin/namecoin_wallet_test.dart index 02d28f56c..451f54885 100644 --- a/test/services/coins/namecoin/namecoin_wallet_test.dart +++ b/test/services/coins/namecoin/namecoin_wallet_test.dart @@ -47,16 +47,16 @@ void main() { }); group("validate mainnet namecoin addresses", () { - MockElectrumX? client; - MockCachedElectrumX? cachedClient; + MockElectrumXClient? client; + MockCachedElectrumXClient? cachedClient; late FakeSecureStorage secureStore; MockTransactionNotificationTracker? tracker; NamecoinWallet? mainnetWallet; setUp(() { - client = MockElectrumX(); - cachedClient = MockCachedElectrumX(); + client = MockElectrumXClient(); + cachedClient = MockCachedElectrumXClient(); secureStore = FakeSecureStorage(); tracker = MockTransactionNotificationTracker(); @@ -117,16 +117,16 @@ void main() { }); group("testNetworkConnection", () { - MockElectrumX? client; - MockCachedElectrumX? cachedClient; + MockElectrumXClient? client; + MockCachedElectrumXClient? cachedClient; late FakeSecureStorage secureStore; MockTransactionNotificationTracker? tracker; NamecoinWallet? nmc; setUp(() { - client = MockElectrumX(); - cachedClient = MockCachedElectrumX(); + client = MockElectrumXClient(); + cachedClient = MockCachedElectrumXClient(); secureStore = FakeSecureStorage(); tracker = MockTransactionNotificationTracker(); @@ -176,8 +176,8 @@ void main() { const testWalletId = "NMCtestWalletID"; const testWalletName = "NMCWallet"; - MockElectrumX? client; - MockCachedElectrumX? cachedClient; + MockElectrumXClient? client; + MockCachedElectrumXClient? cachedClient; late FakeSecureStorage secureStore; MockTransactionNotificationTracker? tracker; @@ -185,8 +185,8 @@ void main() { NamecoinWallet? nmc; setUp(() async { - client = MockElectrumX(); - cachedClient = MockCachedElectrumX(); + client = MockElectrumXClient(); + cachedClient = MockCachedElectrumXClient(); secureStore = FakeSecureStorage(); tracker = MockTransactionNotificationTracker(); @@ -377,8 +377,8 @@ void main() { bool hiveAdaptersRegistered = false; - MockElectrumX? client; - MockCachedElectrumX? cachedClient; + MockElectrumXClient? client; + MockCachedElectrumXClient? cachedClient; late FakeSecureStorage secureStore; MockTransactionNotificationTracker? tracker; @@ -394,8 +394,8 @@ void main() { await wallets.put('currentWalletName', testWalletName); } - client = MockElectrumX(); - cachedClient = MockCachedElectrumX(); + client = MockElectrumXClient(); + cachedClient = MockCachedElectrumXClient(); secureStore = FakeSecureStorage(); tracker = MockTransactionNotificationTracker(); diff --git a/test/services/coins/namecoin/namecoin_wallet_test.mocks.dart b/test/services/coins/namecoin/namecoin_wallet_test.mocks.dart index 9eb87f06b..c84c014cc 100644 --- a/test/services/coins/namecoin/namecoin_wallet_test.mocks.dart +++ b/test/services/coins/namecoin/namecoin_wallet_test.mocks.dart @@ -300,14 +300,14 @@ class MockElectrumXClient extends _i1.Mock implements _i3.ElectrumXClient { _i4.Future<Map<String, dynamic>>.value(<String, dynamic>{}), ) as _i4.Future<Map<String, dynamic>>); @override - _i4.Future<Map<String, dynamic>> getAnonymitySet({ + _i4.Future<Map<String, dynamic>> getLelantusAnonymitySet({ String? groupId = r'1', String? blockhash = r'', String? requestID, }) => (super.noSuchMethod( Invocation.method( - #getAnonymitySet, + #getLelantusAnonymitySet, [], { #groupId: groupId, @@ -319,13 +319,13 @@ class MockElectrumXClient extends _i1.Mock implements _i3.ElectrumXClient { _i4.Future<Map<String, dynamic>>.value(<String, dynamic>{}), ) as _i4.Future<Map<String, dynamic>>); @override - _i4.Future<dynamic> getMintData({ + _i4.Future<dynamic> getLelantusMintData({ dynamic mints, String? requestID, }) => (super.noSuchMethod( Invocation.method( - #getMintData, + #getLelantusMintData, [], { #mints: mints, @@ -335,13 +335,13 @@ class MockElectrumXClient extends _i1.Mock implements _i3.ElectrumXClient { returnValue: _i4.Future<dynamic>.value(), ) as _i4.Future<dynamic>); @override - _i4.Future<Map<String, dynamic>> getUsedCoinSerials({ + _i4.Future<Map<String, dynamic>> getLelantusUsedCoinSerials({ String? requestID, required int? startNumber, }) => (super.noSuchMethod( Invocation.method( - #getUsedCoinSerials, + #getLelantusUsedCoinSerials, [], { #requestID: requestID, @@ -352,9 +352,73 @@ class MockElectrumXClient extends _i1.Mock implements _i3.ElectrumXClient { _i4.Future<Map<String, dynamic>>.value(<String, dynamic>{}), ) as _i4.Future<Map<String, dynamic>>); @override - _i4.Future<int> getLatestCoinId({String? requestID}) => (super.noSuchMethod( + _i4.Future<int> getLelantusLatestCoinId({String? requestID}) => + (super.noSuchMethod( Invocation.method( - #getLatestCoinId, + #getLelantusLatestCoinId, + [], + {#requestID: requestID}, + ), + returnValue: _i4.Future<int>.value(0), + ) as _i4.Future<int>); + @override + _i4.Future<Map<String, dynamic>> getSparkAnonymitySet({ + String? coinGroupId = r'1', + String? startBlockHash = r'', + String? requestID, + }) => + (super.noSuchMethod( + Invocation.method( + #getSparkAnonymitySet, + [], + { + #coinGroupId: coinGroupId, + #startBlockHash: startBlockHash, + #requestID: requestID, + }, + ), + returnValue: + _i4.Future<Map<String, dynamic>>.value(<String, dynamic>{}), + ) as _i4.Future<Map<String, dynamic>>); + @override + _i4.Future<Map<String, dynamic>> getSparkUsedCoinsTags({ + String? requestID, + required int? startNumber, + }) => + (super.noSuchMethod( + Invocation.method( + #getSparkUsedCoinsTags, + [], + { + #requestID: requestID, + #startNumber: startNumber, + }, + ), + returnValue: + _i4.Future<Map<String, dynamic>>.value(<String, dynamic>{}), + ) as _i4.Future<Map<String, dynamic>>); + @override + _i4.Future<Map<String, dynamic>> getSparkMintMetaData({ + String? requestID, + required List<String>? sparkCoinHashes, + }) => + (super.noSuchMethod( + Invocation.method( + #getSparkMintMetaData, + [], + { + #requestID: requestID, + #sparkCoinHashes: sparkCoinHashes, + }, + ), + returnValue: + _i4.Future<Map<String, dynamic>>.value(<String, dynamic>{}), + ) as _i4.Future<Map<String, dynamic>>); + @override + _i4.Future<int> getSparkLatestCoinId({String? requestID}) => + (super.noSuchMethod( + Invocation.method( + #getSparkLatestCoinId, [], {#requestID: requestID}, ), diff --git a/test/services/coins/particl/particl_wallet_test.dart b/test/services/coins/particl/particl_wallet_test.dart index 69c20593f..87b8db5df 100644 --- a/test/services/coins/particl/particl_wallet_test.dart +++ b/test/services/coins/particl/particl_wallet_test.dart @@ -48,8 +48,8 @@ void main() { }); group("validate mainnet particl addresses", () { - MockElectrumX? client; - MockCachedElectrumX? cachedClient; + MockElectrumXClient? client; + MockCachedElectrumXClient? cachedClient; late FakeSecureStorage secureStore; MockTransactionNotificationTracker? tracker; @@ -58,8 +58,8 @@ void main() { mainnetWallet; // TODO reimplement testnet, see 9baa30c1a40b422bb5f4746efc1220b52691ace6 and sneurlax/stack_wallet#ec399ade0aef1d9ab2dd78876a2d20819dae4ba0 setUp(() { - client = MockElectrumX(); - cachedClient = MockCachedElectrumX(); + client = MockElectrumXClient(); + cachedClient = MockCachedElectrumXClient(); secureStore = FakeSecureStorage(); tracker = MockTransactionNotificationTracker(); @@ -165,8 +165,8 @@ void main() { }); group("testNetworkConnection", () { - MockElectrumX? client; - MockCachedElectrumX? cachedClient; + MockElectrumXClient? client; + MockCachedElectrumXClient? cachedClient; late FakeSecureStorage secureStore; MockTransactionNotificationTracker? tracker; @@ -174,8 +174,8 @@ void main() { ParticlWallet? part; setUp(() { - client = MockElectrumX(); - cachedClient = MockCachedElectrumX(); + client = MockElectrumXClient(); + cachedClient = MockCachedElectrumXClient(); secureStore = FakeSecureStorage(); tracker = MockTransactionNotificationTracker(); @@ -226,8 +226,8 @@ void main() { const testWalletId = "ParticltestWalletID"; const testWalletName = "ParticlWallet"; - MockElectrumX? client; - MockCachedElectrumX? cachedClient; + MockElectrumXClient? client; + MockCachedElectrumXClient? cachedClient; late FakeSecureStorage secureStore; MockTransactionNotificationTracker? tracker; @@ -235,8 +235,8 @@ void main() { ParticlWallet? part; setUp(() async { - client = MockElectrumX(); - cachedClient = MockCachedElectrumX(); + client = MockElectrumXClient(); + cachedClient = MockCachedElectrumXClient(); secureStore = FakeSecureStorage(); tracker = MockTransactionNotificationTracker(); @@ -427,8 +427,8 @@ void main() { bool hiveAdaptersRegistered = false; - MockElectrumX? client; - MockCachedElectrumX? cachedClient; + MockElectrumXClient? client; + MockCachedElectrumXClient? cachedClient; late FakeSecureStorage secureStore; MockTransactionNotificationTracker? tracker; @@ -444,8 +444,8 @@ void main() { await wallets.put('currentWalletName', testWalletName); } - client = MockElectrumX(); - cachedClient = MockCachedElectrumX(); + client = MockElectrumXClient(); + cachedClient = MockCachedElectrumXClient(); secureStore = FakeSecureStorage(); tracker = MockTransactionNotificationTracker(); diff --git a/test/services/coins/particl/particl_wallet_test.mocks.dart b/test/services/coins/particl/particl_wallet_test.mocks.dart index 315f26e53..24fb5106f 100644 --- a/test/services/coins/particl/particl_wallet_test.mocks.dart +++ b/test/services/coins/particl/particl_wallet_test.mocks.dart @@ -300,14 +300,14 @@ class MockElectrumXClient extends _i1.Mock implements _i3.ElectrumXClient { _i4.Future<Map<String, dynamic>>.value(<String, dynamic>{}), ) as _i4.Future<Map<String, dynamic>>); @override - _i4.Future<Map<String, dynamic>> getAnonymitySet({ + _i4.Future<Map<String, dynamic>> getLelantusAnonymitySet({ String? groupId = r'1', String? blockhash = r'', String? requestID, }) => (super.noSuchMethod( Invocation.method( - #getAnonymitySet, + #getLelantusAnonymitySet, [], { #groupId: groupId, @@ -319,13 +319,13 @@ class MockElectrumXClient extends _i1.Mock implements _i3.ElectrumXClient { _i4.Future<Map<String, dynamic>>.value(<String, dynamic>{}), ) as _i4.Future<Map<String, dynamic>>); @override - _i4.Future<dynamic> getMintData({ + _i4.Future<dynamic> getLelantusMintData({ dynamic mints, String? requestID, }) => (super.noSuchMethod( Invocation.method( - #getMintData, + #getLelantusMintData, [], { #mints: mints, @@ -335,13 +335,13 @@ class MockElectrumXClient extends _i1.Mock implements _i3.ElectrumXClient { returnValue: _i4.Future<dynamic>.value(), ) as _i4.Future<dynamic>); @override - _i4.Future<Map<String, dynamic>> getUsedCoinSerials({ + _i4.Future<Map<String, dynamic>> getLelantusUsedCoinSerials({ String? requestID, required int? startNumber, }) => (super.noSuchMethod( Invocation.method( - #getUsedCoinSerials, + #getLelantusUsedCoinSerials, [], { #requestID: requestID, @@ -352,9 +352,73 @@ class MockElectrumXClient extends _i1.Mock implements _i3.ElectrumXClient { _i4.Future<Map<String, dynamic>>.value(<String, dynamic>{}), ) as _i4.Future<Map<String, dynamic>>); @override - _i4.Future<int> getLatestCoinId({String? requestID}) => (super.noSuchMethod( + _i4.Future<int> getLelantusLatestCoinId({String? requestID}) => + (super.noSuchMethod( Invocation.method( - #getLatestCoinId, + #getLelantusLatestCoinId, + [], + {#requestID: requestID}, + ), + returnValue: _i4.Future<int>.value(0), + ) as _i4.Future<int>); + @override + _i4.Future<Map<String, dynamic>> getSparkAnonymitySet({ + String? coinGroupId = r'1', + String? startBlockHash = r'', + String? requestID, + }) => + (super.noSuchMethod( + Invocation.method( + #getSparkAnonymitySet, + [], + { + #coinGroupId: coinGroupId, + #startBlockHash: startBlockHash, + #requestID: requestID, + }, + ), + returnValue: + _i4.Future<Map<String, dynamic>>.value(<String, dynamic>{}), + ) as _i4.Future<Map<String, dynamic>>); + @override + _i4.Future<Map<String, dynamic>> getSparkUsedCoinsTags({ + String? requestID, + required int? startNumber, + }) => + (super.noSuchMethod( + Invocation.method( + #getSparkUsedCoinsTags, + [], + { + #requestID: requestID, + #startNumber: startNumber, + }, + ), + returnValue: + _i4.Future<Map<String, dynamic>>.value(<String, dynamic>{}), + ) as _i4.Future<Map<String, dynamic>>); + @override + _i4.Future<Map<String, dynamic>> getSparkMintMetaData({ + String? requestID, + required List<String>? sparkCoinHashes, + }) => + (super.noSuchMethod( + Invocation.method( + #getSparkMintMetaData, + [], + { + #requestID: requestID, + #sparkCoinHashes: sparkCoinHashes, + }, + ), + returnValue: + _i4.Future<Map<String, dynamic>>.value(<String, dynamic>{}), + ) as _i4.Future<Map<String, dynamic>>); + @override + _i4.Future<int> getSparkLatestCoinId({String? requestID}) => + (super.noSuchMethod( + Invocation.method( + #getSparkLatestCoinId, [], {#requestID: requestID}, ),