Skip to content

Commit

Permalink
refactor: rename Wansee models
Browse files Browse the repository at this point in the history
  • Loading branch information
reasje committed Nov 5, 2024
1 parent 0c2eef8 commit 6adffbb
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ class MXCTransactionsUseCase extends ReactiveUseCase {
}

/// Will remove token transfer (tx that are in general transaction) from general transaction
List<WannseeTransactionModel> removeTokenTransfersFromTxList(
List<WannseeTransactionModel> txList,
List<MoonchainTransactionModel> removeTokenTransfersFromTxList(
List<MoonchainTransactionModel> txList,
List<TokenTransfer> tokenTransferList) {
return txList.where((element) {
if (element.hash != null) {
Expand All @@ -70,15 +70,15 @@ class MXCTransactionsUseCase extends ReactiveUseCase {
}).toList();
}

void addTokenTransfersToTxList(List<WannseeTransactionModel> txList,
void addTokenTransfersToTxList(List<MoonchainTransactionModel> txList,
List<TokenTransfer> tokenTransferList) {
for (int i = 0; i < tokenTransferList.length; i++) {
final item = tokenTransferList[i];
txList.add(WannseeTransactionModel(tokenTransfers: [item]));
txList.add(MoonchainTransactionModel(tokenTransfers: [item]));
}
}

void sortByDate(List<WannseeTransactionModel> txList) {
void sortByDate(List<MoonchainTransactionModel> txList) {
if (txList.isNotEmpty) {
txList.sort((a, b) {
// If not simple transaction If not token transfer Then It is pending tx
Expand All @@ -93,7 +93,7 @@ class MXCTransactionsUseCase extends ReactiveUseCase {
}

List<TransactionModel> axsTxListFromMxcTxList(
List<WannseeTransactionModel> mxcTxList, String walletAddress) {
List<MoonchainTransactionModel> mxcTxList, String walletAddress) {
return mxcTxList
.map((e) => TransactionModel.fromMXCTransaction(e, walletAddress))
.toList();
Expand Down
2 changes: 1 addition & 1 deletion lib/features/common/contract/mxc_websocket_use_case.dart
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ class MXCWebsocketUseCase extends ReactiveUseCase {
void listenToTopUpEvents(dynamic event) {
switch (event.event.value as String) {
case 'transaction':
final newMXCTx = WannseeTransactionModel.fromJson(
final newMXCTx = MoonchainTransactionModel.fromJson(
json.encode(event.payload['transactions'][0]));

final newTx =
Expand Down
6 changes: 3 additions & 3 deletions lib/features/common/contract/token_contract_use_case.dart
Original file line number Diff line number Diff line change
Expand Up @@ -71,19 +71,19 @@ class TokenContractUseCase extends ReactiveUseCase {
return await _repository.tokenContract.getEthBalance(from);
}

Future<WannseeTransactionsModel?> getTransactionsByAddress(
Future<MoonchainTransactionsModel?> getTransactionsByAddress(
String address,
) async {
return _repository.tokenContract.getTransactionsByAddress(address);
}

Future<WannseeTransactionModel?> getTransactionByHash(
Future<MoonchainTransactionModel?> getTransactionByHash(
String hash,
) async {
return _repository.tokenContract.getTransactionByHash(hash);
}

Future<WannseeTokenTransfersModel?> getTokenTransfersByAddress(
Future<MoonchainTokenTransfersResponseModel?> getTokenTransfersByAddress(
String address,
) async {
return _repository.tokenContract
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ class BridgeFunctionsHelper {
return res;
} catch (e, s) {
addError(e, s);
return null;
} finally {
loading(false);
}
Expand All @@ -101,6 +102,7 @@ class BridgeFunctionsHelper {
return res;
} catch (e, s) {
addError(e, s);
return null;
} finally {
loading(false);
}
Expand All @@ -116,6 +118,7 @@ class BridgeFunctionsHelper {
return res;
} catch (e, s) {
addError(e, s);
return null;
} finally {
loading(false);
}
Expand Down
5 changes: 3 additions & 2 deletions lib/features/wallet/presentation/wallet_page_presenter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ class WalletPresenter extends CompletePresenter<WalletState> {
switch (event.event.value as String) {
// coin transfer pending tx token transfer - coin transfer
case 'pending_transaction':
final newTx = WannseeTransactionModel.fromJson(
final newTx = MoonchainTransactionModel.fromJson(
json.encode(event.payload['transactions'][0]));
if (newTx.value != null) {
notify(() => state.txList!.insert(
Expand All @@ -146,7 +146,8 @@ class WalletPresenter extends CompletePresenter<WalletState> {
break;
// new balance
case 'balance':
final wannseeBalanceEvent = WannseeBalanceModel.fromJson(event.payload);
final wannseeBalanceEvent =
MoonchainBalanceEvenModel.fromJson(event.payload);
getWalletTokensBalance(null, true);
break;
default:
Expand Down
2 changes: 1 addition & 1 deletion packages/shared
Submodule shared updated 33 files
+1 −1 logic/lib/src/domain/entities/entities.dart
+0 −0 logic/lib/src/domain/entities/moonchain/moonchain_address_tokens_list/item.dart
+18 −17 ...lib/src/domain/entities/moonchain/moonchain_address_tokens_list/moonchain_address_tokens_list_response.dart
+0 −0 logic/lib/src/domain/entities/moonchain/moonchain_address_tokens_list/token.dart
+20 −0 logic/lib/src/domain/entities/moonchain/moonchain_balance_event_model.dart
+8 −0 logic/lib/src/domain/entities/moonchain/moonchain_models.dart
+0 −0 logic/lib/src/domain/entities/moonchain/moonchain_nft_collection_detail_response/attribute.dart
+0 −0 logic/lib/src/domain/entities/moonchain/moonchain_nft_collection_detail_response/item.dart
+0 −0 logic/lib/src/domain/entities/moonchain/moonchain_nft_collection_detail_response/metadata.dart
+11 −10 ...n/entities/moonchain/moonchain_nft_collection_detail_response/moonchain_nft_collection_detail_response.dart
+0 −0 logic/lib/src/domain/entities/moonchain/moonchain_nft_collection_detail_response/owner.dart
+0 −0 logic/lib/src/domain/entities/moonchain/moonchain_nft_collection_detail_response/token.dart
+0 −0 logic/lib/src/domain/entities/moonchain/moonchain_token_meta_data_response/attribute.dart
+10 −10 ...ib/src/domain/entities/moonchain/moonchain_token_meta_data_response/moonchain_token_meta_data_response.dart
+18 −17 ...in/entities/moonchain/moonchain_token_transfers_response_model/moonchain_token_transfer_response_model.dart
+0 −0 logic/lib/src/domain/entities/moonchain/moonchain_tokens_balance_response_model/item.dart
+17 −17 ...ain/entities/moonchain/moonchain_tokens_balance_response_model/moonchain_tokens_balance_response_model.dart
+0 −0 logic/lib/src/domain/entities/moonchain/moonchain_tokens_balance_response_model/token.dart
+0 −0 logic/lib/src/domain/entities/moonchain/moonchain_transactions_model/decoded_input.dart
+0 −0 logic/lib/src/domain/entities/moonchain/moonchain_transactions_model/fee.dart
+88 −86 logic/lib/src/domain/entities/moonchain/moonchain_transactions_model/moonchain_transaction_model.dart
+21 −21 logic/lib/src/domain/entities/moonchain/moonchain_transactions_model/moonchain_transactions_model.dart
+0 −0 logic/lib/src/domain/entities/moonchain/shared/from.dart
+0 −0 logic/lib/src/domain/entities/moonchain/shared/shared.dart
+0 −0 logic/lib/src/domain/entities/moonchain/shared/to.dart
+0 −0 logic/lib/src/domain/entities/moonchain/shared/token.dart
+0 −0 logic/lib/src/domain/entities/moonchain/shared/token_transfer.dart
+0 −0 logic/lib/src/domain/entities/moonchain/shared/total.dart
+1 −1 logic/lib/src/domain/entities/transaction_model.dart
+0 −20 logic/lib/src/domain/entities/wannsee/wannsee_balance_model.dart
+0 −8 logic/lib/src/domain/entities/wannsee/wannsee_models.dart
+6 −5 logic/lib/src/domain/repositories/wallet/nft_contract.dart
+12 −11 logic/lib/src/domain/repositories/wallet/token_contract.dart

0 comments on commit 6adffbb

Please sign in to comment.