Skip to content

Commit ffaa90c

Browse files
maznnwellkossmmos
andauthored
Rearchitecture transfer (#135)
* feat: Create dev run configuration * refactor: dashboard blocs. * mods: delegation cubit. tests. * mods: delegation cubit - tests. * feat: Improve the DashboardCubit class * feat: Finish the delegation widgets * feat: Use a CardData object to hold the title and description of a card * feat: Fill up the balance widgets * fix: Assign the correct card data to the CardType.balance value * feat: Improve the DashboardCubit so that the cubits that implement it can specify the state * feat: Fill up the dual coin stats widgets * fix: Navigate after the current frame finished rendering * fix: Apply fixes with dart fix --apply * fix: Use the super parameters * refactor: Replace deprecated methods or classes * feat: Use very_good_analysis for linter rules and solve some issues with dart fix --apply * feat: Add localization * feat: Exemplify how to use AppLocalizations * feat: Enable l10n for the dev entry point also * fix: Regenerate the windows folder * refactor: Delete unused widgets * feat: Add documentation of public members inside the dual_coin_stats folder * feat: Replace Pillars with PillarsCard * feat: Replace RealtimeStatistics with RealtimeStatisticsCard * feat: Fill up the sentinels widgets * refactor: Change fields' order * fix: Documentation * feat: Fill the staking widgets * fix: Documentation * feat: Fill up the total hourly transactions widgets * feat: Delete unused blocs * feat: Tweak balance features * refactor: Delete unused bloc * feat: Create the node sync status feature * feat: Delete unused class * feat: Adapt Transfer widget to the new architecture * chore: Redo dashboard.dart exports * chore: Delete unused feature balance_dashboard * feat: Use localization version strings for generating CardData objects * chore: Improve documentation * chore: Rename CubitStatus class to DashboardStatus * chore: Improve documentation of the balance feature * feat: transfer BLoC rearchitecture + localizations * chore: Improve documentation and solve linter issues * feat: transfer BLoC rearchitecture complete. added receive_transaction & transfer_widget_balance * feat: Make the DashboardCubit a HydratedCubit * feat: Make custom exceptions serializable and move them to separated feature folders * feat: Structure the error handling mechanism * feat: Localize some strings * refactor: Make custom exceptions extend from DashboardCubitException * refactor: Restructure new code in a single folder * transfer tab unit testing wip * transfer tab unit testing wip * chore: Move node_sync_status inside features folder * chore: Improve documentation * feat: Add always_specify_types to the linter rules and run dart fix * chore: Solve linter hints in rearchitecture folder * chore: Improve documentation * chore: Create and use the state_copy_with documentation template * feat: transfer BLoC rearchitecture complete. added receive_transaction & transfer_widget_balance * feat: Add tests for delegation cubit * feat: Add asserts for the TimerState class * feat: Restructure exceptions * feat: Improve error logging * chore: Update Zenon SDK * chore: Delete flutter_lints dependency * chore: Update dependencies * feat: Change the interval at which the node sync status is fetched * chore: Rename and change location of a refresh interval constant * feat: Don't emit the loading state if the current one has a success status * feat: Add required named parameters to the TimerCubit constructor * feat: Run dart format in rearchitecture folder * feat: Delete the CubitException class * testing dashboard wip * chore: Improve documentation * testing dashboard wip * feat: Create constants for specific UI gaps * transfer tab wip * feat: dashboard unit testing added * removed unused import * node sync status tests added * feat: Create the new app themes and improve the UI of the back of the new card scaffold * feat: Create a cubit for hiding the front widget of the NewCardScaffold * feat: Log errors * feat: Make password field obscure text by default * feat: Create the newTheme and isDarkMode getters to the BuildContextExtension * feat: Rename local variable * feat: Delete the font specification from the new themes * fix: Getting setting and getting the new theme * chore: Rename 'newTheme' getter to 'theme' * feat: Adapt widgets to the new theme data * chore: Rename getter 'theme' to 'themeData' * refactor: Cubit initializations * chore: Use documentation templates for cubit state's fromJson and toJson * fix: Some tests * feat: json serialization added * feat: unit tests reworked; comments add * chore: Improve documentation * feat: Align the text field and the button on the center axis * feat: unit tests reworked; comments add * chore: Repair dart analysis hints * feat: dependency injection helpers added * feat: unit tests added * todo rewrite * feat: Create a bloc to manage the 'Send' and 'Receive' card dimensions and move the send payment bloc files * refactor: Rename 'DimensionCard' class to 'CardDimension' * refactor: Rename feature transfer_balance to multiple_balance * feat: Tweak multiple balance feature * feat: Create the SendCard widget * feat: Create the other send medium widgets * feat: Use the new send payment bloc * feat: Rename the new send payment feature to send transaction * feat: Use only one version of send and receive widgets - WIP * feat: Modify the 'Send' large widget and tweak send transaction bloc * feat: Have only one variant of send widget * refactor: Improve code styling * feat: Sketch the new receive feature * refactor: Add some missing exports * feat: Finish receive feature * fix: Tests from send feature * feat: Delete some old blocs * fix: Test * refactor: Move the multiple balance feature directory * refactor: Rename CubitFailureException to FailureException * feat: Sketch the latest transactions feature * feat: Create a new variant of infinite table * feat: Tweak the latest transaction table design * feat: Regenerate file * feat: Transform pending transactions cubit into a bloc * fix: Tests * feat: Redone 'Pending Transactions' card design * feat: Use some of the global constants * refactor: Delete unused blocs and widgets * feat: Refresh latest and pending transactions list after a block was received * feat: Create the LatestTransactionsMoreRequested event * feat: Create a generic infinite list bloc * fix: Latest transactions bloc tests * refactor: Make PendingTransactionsBloc extend from InfiniteListBloc * feat: Improve tests * feat: Make the CopyToClipboardIcon an IconButton * feat: Refresh pending transactions list when an unreceived transaction hash is found * feat: Use the parameter for the page size * feat: Log bloc errors * feat: Always feed the new data to the view when the InfiniteListRequested event is called * feat: Refresh the multiple balance bloc data after a new address was generated * refactor: Delete unused bloc * feat: Add RefreshBlocMixin to the InfiniteListBloc class * feat: Add the hash of the new block in the transfer notification details * refactor: Improve InfiniteScrollTable and InfiniteScrollTableCell classes * fix: Show the proper message when there are no more new items * feat: Add documentation * fix: Dart analysis hint * feat: Add documentation * feat: Use icons from the SDK * feat: Also refresh the MultipleBalanceBloc stream when needed * feat: Add some documentation * fix: Some Dart Analysis hints * feat: Create new send and receive transaction icons * feat: Remove chip * feat: Add tooltip * feat: Tweak asset column * refactor: Create separate column classes * refactor: Create column types * feat: Tweak the asset cell * feat: Tweak padding * feat: Tweak text style * feat: Change the color of columns * feat: Change how the date is formatted * feat: Enable searching and sorting the dropdown items * feat: Make ZNN the default token in the receive card * feat: Tweak tokens initialization * feat: Make methods non-static, so that they can be mocked * fix: Dart analysis hints * feat: Improve the sorting functions * refactor: Remove unused imports * refactor: Create separete cell classes * feat: Add some tooltips * fix: Tests * fix: Receive QR code * feat: Remove styling from left side chart titles and use the default generated Y interval * feat: Revert some Windows changes * feat: Associated a custom URL deep linking scheme with the app - on Windows * feat: Restore bundling local libraries * feat: Restore updating Git metadata * fix: Fetching the dlls that will be installed in the Windows app folder and re-enable the generation of git metadata * shell script modified * build generated changes * fix: Fetching the dlls that will be installed in the Linux app folder * fix: Finding the correct path for .so files * feat: Update znn sdk and ledger * feat: Reset local git metadata * feat: Init kNumOfPillars * feat: Upgrade dependecies for Flutter 3.27 * fix: Seed input fields * fix: Errors after merge * feat: Decrease the size of copy to clipboard icon inside the tables * feat: Get the type of the tx from the transaction block * feat: Disable filtering of dropdown entries and add menu height * feat: Improve Send and Receive cards description * feat: Add buttons to share and save the receive QR * feat: Remove local Git metadata * feat: Use the data from the network to hardcode ZNN and QSR coins * feat: Show the coins first in the ZtsDropdown * feat: Add a prefix to the token labels * feat: Delete unused image * feat: Localize string * feat: Change the logic of showDialogWithNoAndYesOptions function * feat: Check if the bloc emitter is closed * feat: Refresh pending txs when changing the default address * feat: Sort also the tokens inside the 'Send' card and improve sorting of the assets * feat: Add support for refreshing the token list * feat: Add support for refreshing the 'Send' card data * feat: Change the ZNN, QSR, token and error colors * feat: Add the token standard to the coin label * feat: Add an icon for the coin label * feat: Check if splash initialization has been done * fix: Register the latest transactions bloc upper in the widget tree * feat: Move registering singletons higher up the widget tree * feat: Change the token label in the dropdown * feat: Add missing end of line * feat: Override function * feat: Add files to .gitignore * feat: Use the token symbol instead of the name --------- Co-authored-by: kossmmos <[email protected]>
1 parent 4aee62e commit ffaa90c

File tree

199 files changed

+5890
-3779
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

199 files changed

+5890
-3779
lines changed

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,4 +130,7 @@ app.*.symbols
130130
!**/ios/**/default.perspectivev3
131131
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
132132
!/dev/ci/**/Gemfile.lock
133-
!.vscode/settings.json
133+
!.vscode/settings.json
134+
/macos/libargon2_ffi.dylib
135+
/macos/libledger_ffi.dylib
136+
/macos/libpow_links.dylib

analysis_options.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,5 @@ linter:
1818
always_specify_types: true
1919
# This rule is in contradiction with always_specify_types, so it must be disabled if the other
2020
# one is enabled
21-
omit_local_variable_types: false
21+
omit_local_variable_types: false
22+
no_default_cases: false
-8.36 KB
Binary file not shown.
5.81 KB
Loading

lib/blocs/accelerator/create_phase_bloc.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class CreatePhaseBloc extends BaseBloc<AccountBlockTemplate?> {
2323
znnFundsNeeded,
2424
qsrFundsNeeded,
2525
);
26-
AccountBlockUtils.createAccountBlock(transactionParams, 'create phase')
26+
AccountBlockUtils().createAccountBlock(transactionParams, 'create phase')
2727
.then(
2828
addEvent,
2929
)

lib/blocs/accelerator/create_project_bloc.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ class CreateProjectBloc extends BaseBloc<AccountBlockTemplate?> {
2323
znnFundsNeeded,
2424
qsrFundsNeeded,
2525
);
26-
AccountBlockUtils.createAccountBlock(
26+
AccountBlockUtils().createAccountBlock(
2727
transactionParams,
2828
'creating project',
2929
).then(
3030
(AccountBlockTemplate block) {
31-
ZenonAddressUtils.refreshBalance();
31+
ZenonAddressUtils().refreshBalance();
3232
addEvent(block);
3333
},
3434
).onError(

lib/blocs/accelerator/submit_donation_bloc.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class SubmitDonationBloc extends BaseBloc<AccountBlockTemplate?> {
2727

2828
Future<void> _sendDonationBlock(
2929
AccountBlockTemplate transactionParams,) async {
30-
await AccountBlockUtils.createAccountBlock(
30+
await AccountBlockUtils().createAccountBlock(
3131
transactionParams,
3232
'donate for accelerator',
3333
).then(

lib/blocs/accelerator/update_phase_bloc.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class UpdatePhaseBloc extends BaseBloc<AccountBlockTemplate?> {
1717
znnFundsNeeded,
1818
qsrFundsNeeded,
1919
);
20-
AccountBlockUtils.createAccountBlock(transactionParams, 'update phase')
20+
AccountBlockUtils().createAccountBlock(transactionParams, 'update phase')
2121
.then(
2222
addEvent,
2323
)

lib/blocs/accelerator/vote_project_bloc.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class VoteProjectBloc extends BaseBloc<AccountBlockTemplate?> {
1818
pillarInfo.name,
1919
vote.index,
2020
);
21-
AccountBlockUtils.createAccountBlock(
21+
AccountBlockUtils().createAccountBlock(
2222
transactionParams,
2323
'vote for project',
2424
)

lib/blocs/auto_receive_tx_worker.dart

Lines changed: 41 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ import 'package:zenon_syrius_wallet_flutter/blocs/auto_unlock_htlc_worker.dart';
77
import 'package:zenon_syrius_wallet_flutter/blocs/blocs.dart';
88
import 'package:zenon_syrius_wallet_flutter/main.dart';
99
import 'package:zenon_syrius_wallet_flutter/model/model.dart';
10-
import 'package:zenon_syrius_wallet_flutter/utils/account_block_utils.dart';
11-
import 'package:zenon_syrius_wallet_flutter/utils/address_utils.dart';
12-
import 'package:zenon_syrius_wallet_flutter/utils/constants.dart';
10+
import 'package:zenon_syrius_wallet_flutter/rearchitecture/features/features.dart';
11+
import 'package:zenon_syrius_wallet_flutter/rearchitecture/utils/blocs/blocs.dart';
12+
import 'package:zenon_syrius_wallet_flutter/utils/utils.dart';
1313
import 'package:znn_sdk_dart/znn_sdk_dart.dart';
1414

1515
class AutoReceiveTxWorker extends BaseBloc<WalletNotification> {
@@ -23,23 +23,25 @@ class AutoReceiveTxWorker extends BaseBloc<WalletNotification> {
2323
}
2424

2525
Future<AccountBlockTemplate?> autoReceiveTransactionHash(
26-
Hash currentHash,) async {
26+
Hash currentHash,
27+
) async {
2728
if (!running) {
2829
running = true;
2930
try {
3031
final Address toAddress =
3132
(await zenon!.ledger.getAccountBlockByHash(currentHash))!.toAddress;
32-
final AccountBlockTemplate transactionParams = AccountBlockTemplate.receive(
33+
final AccountBlockTemplate transactionParams =
34+
AccountBlockTemplate.receive(
3335
currentHash,
3436
);
3537
final AccountBlockTemplate response =
36-
await AccountBlockUtils.createAccountBlock(
38+
await AccountBlockUtils().createAccountBlock(
3739
transactionParams,
3840
'receive transaction',
3941
address: toAddress,
4042
waitForRequiredPlasma: true,
4143
);
42-
_sendSuccessNotification(response, toAddress.toString());
44+
_onSuccess(response, toAddress.toString());
4345
return response;
4446
} on RpcException catch (e, stackTrace) {
4547
_sendErrorNotification(e.toString());
@@ -54,9 +56,10 @@ class AutoReceiveTxWorker extends BaseBloc<WalletNotification> {
5456

5557
Future<void> autoReceive() async {
5658
if (sharedPrefsService!.get(
57-
kAutoReceiveKey,
58-
defaultValue: kAutoReceiveDefaultValue,
59-
) == false) {
59+
kAutoReceiveKey,
60+
defaultValue: kAutoReceiveDefaultValue,
61+
) ==
62+
false) {
6063
pool.clear();
6164
return;
6265
}
@@ -68,17 +71,18 @@ class AutoReceiveTxWorker extends BaseBloc<WalletNotification> {
6871
try {
6972
final Address toAddress =
7073
(await zenon!.ledger.getAccountBlockByHash(currentHash))!.toAddress;
71-
final AccountBlockTemplate transactionParams = AccountBlockTemplate.receive(
74+
final AccountBlockTemplate transactionParams =
75+
AccountBlockTemplate.receive(
7276
currentHash,
7377
);
7478
final AccountBlockTemplate response =
75-
await AccountBlockUtils.createAccountBlock(
79+
await AccountBlockUtils().createAccountBlock(
7680
transactionParams,
7781
'receive transaction',
7882
address: toAddress,
7983
waitForRequiredPlasma: true,
8084
);
81-
_sendSuccessNotification(response, toAddress.toString());
85+
_onSuccess(response, toAddress.toString());
8286
if (pool.isNotEmpty) {
8387
pool.removeFirst();
8488
}
@@ -111,6 +115,11 @@ class AutoReceiveTxWorker extends BaseBloc<WalletNotification> {
111115
(syncInfo.targetHeight > 0 &&
112116
syncInfo.currentHeight > 0 &&
113117
(syncInfo.targetHeight - syncInfo.currentHeight) < 3))) {
118+
sl.get<PendingTransactionsBloc>().add(
119+
InfiniteListRefreshRequested(
120+
address: Address.parse(kSelectedAddress!),
121+
),
122+
);
114123
pool.add(hash);
115124
}
116125
});
@@ -127,6 +136,25 @@ class AutoReceiveTxWorker extends BaseBloc<WalletNotification> {
127136
);
128137
}
129138

139+
void _onSuccess(AccountBlockTemplate block, String toAddress) {
140+
sl.get<MultipleBalanceBloc>().add(
141+
MultipleBalanceFetch(
142+
addresses: kDefaultAddressList.map((String? e) => e!).toList(),
143+
),
144+
);
145+
146+
final Address address = Address.parse(kSelectedAddress!);
147+
sl.get<LatestTransactionsBloc>().add(
148+
InfiniteListRefreshRequested(address: address),
149+
);
150+
sl.get<PendingTransactionsBloc>().add(
151+
InfiniteListRefreshRequested(
152+
address: address,
153+
),
154+
);
155+
_sendSuccessNotification(block, toAddress);
156+
}
157+
130158
void _sendSuccessNotification(AccountBlockTemplate block, String toAddress) {
131159
addEvent(
132160
WalletNotification(

0 commit comments

Comments
 (0)