Skip to content

Commit

Permalink
fix(test): fix syncronization when master account has no mine tx
Browse files Browse the repository at this point in the history
  • Loading branch information
gabaldon committed Feb 16, 2024
1 parent c62760d commit cf8f166
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 19 deletions.
2 changes: 1 addition & 1 deletion integration_test/test_utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ Future<bool> tapButton(
case String:
finder = widgetByText(value);
break;
case IconDataSolid:
case IconData:
finder = widgetByIcon(value);
break;
case PaddedButton:
Expand Down
35 changes: 18 additions & 17 deletions lib/bloc/crypto/crypto_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -326,23 +326,24 @@ class CryptoBloc extends Bloc<CryptoEvent, CryptoState> {
/// retrieve any Block Hashes
final addressBlocks = await apiExplorer.address(
value: account.address,
tab: 'blocks') as PaginatedRequest<AddressBlocks>;

/// retrieve each block
for (int i = 0; i < addressBlocks.data.blocks.length; i++) {
BlockInfo blockInfo = addressBlocks.data.blocks.elementAt(i);
String _hash = blockInfo.hash;
var result = await apiExplorer.hash(_hash);

/// create a MintEntry from the BlockInfo and MintInfo
BlockDetails blockDetails = result as BlockDetails;
MintEntry mintEntry = MintEntry.fromBlockMintInfo(
blockInfo,
blockDetails,
);
account.mintHashes.add(mintEntry.blockHash);
account.mints.add(mintEntry);
await db.addMint(mintEntry);
tab: 'blocks') as PaginatedRequest<AddressBlocks?>;
if (addressBlocks.data != null) {
/// retrieve each block
for (int i = 0; i < addressBlocks.data!.blocks.length; i++) {
BlockInfo blockInfo = addressBlocks.data!.blocks.elementAt(i);
String _hash = blockInfo.hash;
var result = await apiExplorer.hash(_hash);

/// create a MintEntry from the BlockInfo and MintInfo
BlockDetails blockDetails = result as BlockDetails;
MintEntry mintEntry = MintEntry.fromBlockMintInfo(
blockInfo,
blockDetails,
);
account.mintHashes.add(mintEntry.blockHash);
account.mints.add(mintEntry);
await db.addMint(mintEntry);
}
}
return account;
} catch (e) {
Expand Down
2 changes: 1 addition & 1 deletion lib/bloc/explorer/explorer_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ class ExplorerBloc extends Bloc<ExplorerEvent, ExplorerState> {

if (mintEntry != null) {
/// this mintEntry.status check for "confirmed" is in the local database
if (mintEntry.status != "confirmed") {
if (mintEntry.status != TxStatusLabel.confirmed) {
MintEntry mintEntry = await explorer.getMint(blockInfo);
await account.addMint(mintEntry);
}
Expand Down

0 comments on commit cf8f166

Please sign in to comment.