Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix transactions #259

Merged
merged 5 commits into from
Sep 22, 2023
Merged

Fix transactions #259

merged 5 commits into from
Sep 22, 2023

Conversation

gguijarro-c-chwy
Copy link
Contributor

No description provided.

@@ -38,9 +38,7 @@ sealed class TransactionModel extends Equatable {
required Map<String, dynamic> data,
}) {
return switch (actionName) {
'transfer'
when account == _hyphaTokenAccount || account == _hyphaWrapTokenAccount || account == _systemTokenAccount =>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when account == _hyphaTokenAccount || account == _hyphaWrapTokenAccount || account == _systemTokenAccount

Is this needed??

Basically this is never true when it call it for my account.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah because we recognize our own wrap token accounts

This is only identifying a transaction as a transfer

system token = TLOS or EOS
hypha token = hypha.hypha
wrap token = this isn't working yet but I think we should keep it there

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok so a transfer is any actions that includes 'transfer' as the action name

Later on we decide which one to show or not. But the model is not the one dictating this, the UI is.

The models just models data.

"code": "$tokenContract",
"symbol": "$symbol",
}''';
final requestBody = {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i removed these fake maps and created using maps.
Seems to work.

@@ -46,7 +46,9 @@ class UserAccountService {
}

Future<bool> isUserAccountAvailable(String accountName, Network network) async {
final requestBody = '{ "account_name": "$accountName" }';
final requestBody = {
'account_name': accountName
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here, fake map removed

@@ -187,10 +182,10 @@ class TransactionTransfer extends TransactionModel {
String get to => data['to'];

/// 3175.00
num get amount => data['amount'];
String get amount => (data['quantity'] as String).split(' ').first;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@n13 pls review these

@@ -12,8 +12,11 @@ class TransactionHistoryRepository {

TransactionHistoryRepository({required this.service});

Future<Result<List<TransactionModel>, HyphaError>> getTransactions(UserProfileData user, bool transferOnly,
{useV1History = false}) async {
Future<Result<List<TransactionModel>, HyphaError>> getTransactions(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

formatting

}
}

Future<Result<List<WalletTransactionTileData>, HyphaError>> getTransferTransactionsForToken({
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can now chose to show transactions for all tokens we support. or only for 1 token the user picks. Token Details page

'code': tokenContract,
'symbol': symbol
};

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you test these?

I guess the library makes proper json strings out of these... ?! the API rejects it if there's not " around all keys and values ... but that is the normal JSON spec so I'd expect it to work.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes i did.

@gguijarro-c-chwy gguijarro-c-chwy merged commit 1e5e192 into main Sep 22, 2023
1 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants