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

feat: send token #1524

Draft
wants to merge 285 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
285 commits
Select commit Hold shift + click to select a range
bc69045
wip: styling
Jaxiii Jun 11, 2024
ad18263
wip: csv init
Jaxiii Jun 11, 2024
b335ea8
fix: styling
Jaxiii Jun 11, 2024
6936161
wip: localdb calls
Jaxiii Jun 13, 2024
63b7829
wip: move csv files to assets
Jaxiii Jun 13, 2024
797d6fc
feat: add csv as an asset
Jaxiii Jun 13, 2024
d5983d4
Merge branch 'master' into feat/store-token-list-localdb
Jaxiii Jun 13, 2024
ee36ffa
wip: paddings and placements
Jaxiii Jun 13, 2024
e6569cb
Merge branch 'master' into token-details-page
Jaxiii Jun 13, 2024
7d7b978
wip: linter
Jaxiii Jun 13, 2024
dc52a98
wip: linter
Jaxiii Jun 13, 2024
972ca37
wip: linter
Jaxiii Jun 13, 2024
5f7b720
wip: remove dto and memory list methods
Jaxiii Jun 14, 2024
43036de
wip: remove explicitly font family styling
Jaxiii Jun 14, 2024
463c075
wip: add header - titles to csv
Jaxiii Jun 14, 2024
f686021
wip: add isolate to init token db row
Jaxiii Jun 14, 2024
9a7536e
wip: add isolate and transaction to insert token, clean up tests
Jaxiii Jun 14, 2024
12f2419
wip: populate db on list change
Jaxiii Jun 14, 2024
2c148a4
wip: change datetime to millisecs since epoch
Jaxiii Jun 15, 2024
48ba80f
timestamp on filename
Jaxiii Jun 17, 2024
6d3e9fb
wip: info dialog
Jaxiii Jun 17, 2024
179d804
fix: styling
Jaxiii Jun 17, 2024
0cd8cf3
fix: linter
Jaxiii Jun 17, 2024
248ac31
Merge branch 'master' into token-details-page
Jaxiii Jun 17, 2024
ce311e3
wip: timestamped csv file and timespamp based init
Jaxiii Jun 17, 2024
cabc328
fix: linter
Jaxiii Jun 17, 2024
e15eb35
Merge branch 'master' into feat/store-token-list-localdb
Jaxiii Jun 17, 2024
0e0da4f
wip: sync getToken
Jaxiii Jun 18, 2024
38180f9
wip: remove in memory json
Jaxiii Jun 18, 2024
3c26aa6
remove unused files
justinenerio Jun 18, 2024
a78fced
wip: getToken async
Jaxiii Jun 18, 2024
cc7614c
feat: token info dark background
Jaxiii Jun 19, 2024
1c7cc4c
wip: recent activity
Jaxiii Jun 20, 2024
be3c7e9
feat: token mint address
Jaxiii Jun 20, 2024
8c352bb
wip: token tx list
Jaxiii Jun 22, 2024
d133768
wip: polish
Jaxiii Jun 22, 2024
d338fc3
wip: scroll animation and amount value
Jaxiii Jun 23, 2024
173cf9b
fix: styling
Jaxiii Jun 23, 2024
7e65826
fix: stylinh
Jaxiii Jun 23, 2024
21fd4ae
fix: linter
Jaxiii Jun 23, 2024
26599fc
fix: dep cycle
Jaxiii Jun 23, 2024
5ff07a8
db pump version
Jaxiii Jun 23, 2024
8b77cf2
feat: getToken from localdb
Jaxiii Jun 24, 2024
18c61b5
fix: tests
Jaxiii Jun 24, 2024
6a498de
fix: styling
Jaxiii Jun 24, 2024
c1d7be2
fix: comments
Jaxiii Jun 24, 2024
9bb6135
fix: imports
Jaxiii Jun 24, 2024
72ccf55
fix: tests
Jaxiii Jun 24, 2024
6ea9b7f
fix: tests
Jaxiii Jun 24, 2024
9ed46a9
wip: move init and getToken to repository
Jaxiii Jun 25, 2024
4c03680
wip: move TokenListRepo outside model scope
Jaxiii Jun 25, 2024
4bb164b
wip: chuncked stream data to isolate
Jaxiii Jun 26, 2024
e5637fc
feat: token conversion rate refresh
Jaxiii Jun 28, 2024
45be1b6
fix: styling
Jaxiii Jun 28, 2024
9350050
fix: transaction collision
Jaxiii Jun 28, 2024
ac3909f
fix: linter & styling
Jaxiii Jun 28, 2024
4444295
wip: send token layout
Jaxiii Jun 30, 2024
3b50d0f
wip: remove token service
Jaxiii Jul 1, 2024
b2dab55
fix: remove future from build method
Jaxiii Jul 1, 2024
7ea3202
fix: mount on async gap
Jaxiii Jul 1, 2024
89cbcf4
fix: tests
Jaxiii Jul 1, 2024
70387fd
feat: mocked and memory test
Jaxiii Jul 1, 2024
96f039d
fix: first opening price fetch
Jaxiii Jul 1, 2024
160a1e5
wip: get token list file from ec_backend
Jaxiii Jul 3, 2024
d5683b4
fix: naming
Jaxiii Jul 3, 2024
6467472
wip: network stream token list
Jaxiii Jul 7, 2024
76f98f6
wip: remove unused dto
Jaxiii Jul 7, 2024
3ccff66
wip: remove token assets from pubspec
Jaxiii Jul 7, 2024
4da836d
wip: intl version
Jaxiii Jul 7, 2024
6b3eba4
wip: add .g client
Jaxiii Jul 8, 2024
97e471b
Merge branch 'master' into feat/store-token-list-localdb
Jaxiii Jul 8, 2024
e64c931
Merge branch 'master' into token-details-page
Jaxiii Jul 8, 2024
6b437ee
fix: merge imports
Jaxiii Jul 8, 2024
96d1a79
fix: details screen textspan fiat amount null checker
Jaxiii Jul 8, 2024
6dd5fee
feat: md5 hash
Jaxiii Jul 9, 2024
02fd984
feat: md5 hash
Jaxiii Jul 9, 2024
7e3626a
fix: analyzer and dcm
Jaxiii Jul 9, 2024
67c4617
fix: parseTags & parseExtensions
Jaxiii Jul 10, 2024
57bf0e8
fix: remove unused endpoint ref
Jaxiii Jul 10, 2024
0ff6ace
Merge branch 'feat/store-token-list-localdb' into token-details-page
Jaxiii Jul 10, 2024
6c85379
feat: local token db and better tx updater
Jaxiii Jul 11, 2024
2c2b592
fix: db bump and dcm
Jaxiii Jul 11, 2024
ce507ce
fix: db_schemas
Jaxiii Jul 11, 2024
55e54e3
Merge branch 'master' into feat/store-token-list-localdb
Jaxiii Jul 11, 2024
eb7880a
wip: update call
Jaxiii Jul 11, 2024
ac9aa96
fix: api calls naming
Jaxiii Jul 11, 2024
a9da75c
refact: naming
Jaxiii Jul 12, 2024
f43f8fd
refact: api
Jaxiii Jul 12, 2024
de304f4
Merge branch 'master' into feat/store-token-list-localdb
Jaxiii Jul 12, 2024
003bc53
Merge branch 'feat/store-token-list-localdb' into token-details-page
Jaxiii Jul 12, 2024
95eb4b4
refact: naming
Jaxiii Jul 12, 2024
59a0fd4
Merge branch 'token-details-page' into feat/send-token
Jaxiii Jul 12, 2024
5bfaeca
fix: naming and amount decimals
Jaxiii Jul 12, 2024
29c611c
feat: i10n
Jaxiii Jul 13, 2024
acc546b
feat: i10l file
Jaxiii Jul 13, 2024
623e835
refact: convert screen to stateless
Jaxiii Jul 13, 2024
e207875
fix: dcm styling
Jaxiii Jul 14, 2024
be21a21
Merge branch 'token-details-page' into feat/send-token
Jaxiii Jul 14, 2024
ca21de5
wip: balance loader
Jaxiii Jul 14, 2024
52be837
Merge branch 'master' into feat/store-token-list-localdb
ookami-kb Jul 15, 2024
a0bddbf
wip: send token flow
Jaxiii Jul 15, 2024
ac656ed
fix: clean up
Jaxiii Jul 15, 2024
269079c
fix: clean up
Jaxiii Jul 15, 2024
d88a79c
fix: clean up
Jaxiii Jul 15, 2024
097a9e7
Merge branch 'feat/store-token-list-localdb' into token-details-page
Jaxiii Jul 15, 2024
66eb39e
fix: remove solana pkg changes
Jaxiii Jul 15, 2024
bc0d304
fix: format codec exception
Jaxiii Jul 15, 2024
01a735e
Merge branch 'master' into feat/store-token-list-localdb
Jaxiii Jul 15, 2024
fbea8ae
fix: token file stream codec error
Jaxiii Jul 16, 2024
48249e8
Merge branch 'feat/store-token-list-localdb' into token-details-page
Jaxiii Jul 16, 2024
cdda44d
refact: arg naming style
Jaxiii Jul 16, 2024
38e2d94
Merge branch 'feat/store-token-list-localdb' into token-details-page
Jaxiii Jul 16, 2024
e989cbf
wip: moving tx init
Jaxiii Jul 17, 2024
6efacdd
fix: remove future from build method
Jaxiii Jul 17, 2024
2ebf21c
Merge branch 'feat/store-token-list-localdb' into token-details-page
Jaxiii Jul 17, 2024
7ba20cb
fix: analyzer
Jaxiii Jul 17, 2024
10900c1
refact: transaction repo init
Jaxiii Jul 18, 2024
ef8ab00
refact: transaction repo init
Jaxiii Jul 18, 2024
6e9ecac
Merge branch 'token-details-page' into feat/send-token
Jaxiii Jul 18, 2024
54c2dca
wip: send token flow
Jaxiii Jul 19, 2024
8ec0101
wip: send token flow
Jaxiii Jul 19, 2024
9536499
minor upd
justinenerio Jul 23, 2024
14bbe6d
refactor: polish
Jaxiii Jul 26, 2024
841a0a1
refact: remove async cache
Jaxiii Jul 26, 2024
b1bb454
refactor to services
justinenerio Jul 26, 2024
3417fcc
upd
justinenerio Jul 26, 2024
6ff06c2
Merge branch 'feat/store-token-list-localdb' into token-details-page
Jaxiii Jul 26, 2024
e6d9ff4
refact: remove unused wrapper
Jaxiii Jul 26, 2024
9dfd8e6
fix: remove unused var
Jaxiii Jul 26, 2024
e5c69c7
Merge branch 'token-details-page' into feat/send-token
Jaxiii Jul 26, 2024
2f9716a
fix: remove unused param
Jaxiii Jul 26, 2024
d32dd02
fix: remove unused param
Jaxiii Jul 26, 2024
a37ab9c
Merge branch 'token-details-page' into feat/send-token
Jaxiii Jul 26, 2024
1b0518f
Merge branch 'master' into feat/store-token-list-localdb
Jaxiii Jul 31, 2024
50fb0f4
add schema
Jaxiii Jul 31, 2024
1a7e6e6
Merge branch 'feat/store-token-list-localdb' into token-details-page
Jaxiii Jul 31, 2024
7612dc7
add schema
Jaxiii Jul 31, 2024
2f74a10
Merge branch 'token-details-page' into feat/send-token
Jaxiii Aug 1, 2024
37e3d39
upd
ookami-kb Aug 1, 2024
9851a7b
upd
ookami-kb Aug 1, 2024
052ac50
fix: watch activity
Jaxiii Aug 1, 2024
3b63a27
fix: linter
Jaxiii Aug 2, 2024
38f1f9c
fix: remove unused import
Jaxiii Aug 2, 2024
da1b61c
Merge branch 'feat/store-token-list-localdb' into token-details-page
Jaxiii Aug 2, 2024
19b1cea
Merge branch 'token-details-page' into feat/send-token
Jaxiii Aug 2, 2024
eed63b8
feat: quant input validation
Jaxiii Aug 2, 2024
ba3f144
feat: input locale
Jaxiii Aug 2, 2024
6ddbff3
feat: usdc equivalent token value
Jaxiii Aug 2, 2024
9851d12
upd
ookami-kb Aug 2, 2024
bf32d1e
remove extensions
ookami-kb Aug 2, 2024
8cdbe57
remove extensions
ookami-kb Aug 2, 2024
9a3563e
update schema
ookami-kb Aug 2, 2024
41fb4b1
refact: validate func
Jaxiii Aug 3, 2024
51a7f04
wip: isolate token list
Jaxiii Aug 9, 2024
f959990
wip: 2 step init token db
Jaxiii Aug 9, 2024
08454e0
fix: dcm
Jaxiii Aug 12, 2024
a6a7059
Merge branch 'master' into feat/store-token-list-localdb
Jaxiii Aug 12, 2024
052a45a
fix: null checker
Jaxiii Aug 13, 2024
3966ae1
fix: isolate scope & file hash
Jaxiii Aug 13, 2024
6e60d45
upd
Jaxiii Aug 14, 2024
ad110f1
Merge branch 'feat/store-token-list-localdb' into token-details-page
Jaxiii Aug 14, 2024
a4ee191
refact: rmv single upd
Jaxiii Aug 14, 2024
864eb41
upd schema
Jaxiii Aug 14, 2024
b30eb5a
Merge branch 'token-details-page' into feat/send-token
Jaxiii Aug 14, 2024
dd363aa
Merge branch 'master' into feat/store-token-list-localdb
Jaxiii Aug 15, 2024
0248745
Merge branch 'feat/store-token-list-localdb' into token-details-page
Jaxiii Aug 15, 2024
ed9941c
Merge branch 'token-details-page' into feat/send-token
Jaxiii Aug 15, 2024
d5a87d5
upd
Jaxiii Aug 15, 2024
5b37614
upd
Jaxiii Aug 15, 2024
17b8408
Merge branch 'master' into feat/store-token-list-localdb
Jaxiii Aug 16, 2024
327699a
upd
Jaxiii Aug 16, 2024
1e7b428
Merge branch 'feat/store-token-list-localdb' into token-details-page
Jaxiii Aug 16, 2024
e9c1539
Merge branch 'token-details-page' into feat/send-token
Jaxiii Aug 16, 2024
a6a05df
Merge branch 'master' into feat/store-token-list-localdb
Jaxiii Aug 21, 2024
02e6658
Merge branch 'feat/store-token-list-localdb' into token-details-page
Jaxiii Aug 21, 2024
1721e07
upd schema
Jaxiii Aug 21, 2024
96c5f0f
Merge branch 'token-details-page' into feat/send-token
Jaxiii Aug 21, 2024
41effb2
wip
Jaxiii Aug 23, 2024
7e267c4
wip
Jaxiii Aug 23, 2024
99caf28
wip
Jaxiii Aug 23, 2024
9fa7535
wip
Jaxiii Aug 23, 2024
a662631
fix cycle
Jaxiii Aug 23, 2024
f02ec0d
upd schemas
Jaxiii Aug 23, 2024
1f98191
Merge branch 'feat/store-token-list-localdb' into token-details-page
Jaxiii Aug 23, 2024
47fcc5f
Merge branch 'token-details-page' into feat/send-token
Jaxiii Aug 23, 2024
345a0c1
upd schema
Jaxiii Aug 23, 2024
02430a6
Merge branch 'token-details-page' into feat/send-token
Jaxiii Aug 23, 2024
d4b7ee4
upd
Jaxiii Aug 23, 2024
23b2941
Merge branch 'token-details-page' into feat/send-token
Jaxiii Aug 23, 2024
c40f85f
upd
Jaxiii Aug 23, 2024
70c3ee8
Merge branch 'token-details-page' into feat/send-token
Jaxiii Aug 23, 2024
a2712a6
Merge commit '6be502c4f2d56ead3df879f22dd84c6df40601c1' into token-de…
justinenerio Sep 13, 2024
223b571
upd
justinenerio Sep 13, 2024
7b95306
upd
justinenerio Sep 13, 2024
fd77179
upd
justinenerio Sep 13, 2024
73a3b08
upd
justinenerio Sep 13, 2024
d63f3df
upd
justinenerio Sep 13, 2024
41d3df7
upd
justinenerio Sep 13, 2024
52d210b
upd
justinenerio Sep 13, 2024
c7f060e
upd
justinenerio Sep 13, 2024
f266f30
upd
justinenerio Sep 13, 2024
7f51890
Merge branch 'master' into token-details-page
Merculiar Dec 12, 2024
bdd56f8
upd
Merculiar Dec 12, 2024
d298962
revert
Merculiar Dec 12, 2024
d32496e
upd
Merculiar Dec 12, 2024
0acc99c
removed double check for carousel
Merculiar Dec 13, 2024
a16c4cb
upd
Merculiar Dec 13, 2024
bf7acaa
upd
Merculiar Dec 13, 2024
f392d09
Merge branch 'master' into token-details-page
Merculiar Dec 16, 2024
027e3d6
upd
Merculiar Dec 16, 2024
572f6fb
Merge branch 'master' into token-details-page
Merculiar Dec 16, 2024
a21fb86
Merge branch 'token-details-page' into feat/send-token
Merculiar Dec 16, 2024
b791eeb
formatting
Merculiar Dec 16, 2024
016907c
formatting
Merculiar Dec 16, 2024
6409ce6
upd
Merculiar Dec 16, 2024
0380102
upd
Merculiar Dec 16, 2024
9419625
refactoring
Merculiar Dec 17, 2024
fae2c58
upd
Merculiar Dec 17, 2024
b2cd7b7
upd
Merculiar Dec 17, 2024
5101e67
upd
Merculiar Dec 17, 2024
83094d8
Merge branch 'master' into token-details-page
Merculiar Dec 18, 2024
da9ad39
Merge branch 'token-details-page' into feat/send-token
Merculiar Dec 18, 2024
1fe6f8f
update fetch limit
Merculiar Dec 18, 2024
c1419a8
upd
Merculiar Dec 19, 2024
6743b85
upd
Merculiar Dec 20, 2024
ff407be
Merge branch 'token-details-page' into feat/send-token
Merculiar Dec 20, 2024
7ab4830
upd
Merculiar Dec 20, 2024
fce887d
added chunks to avoid limit requests per seconds
Merculiar Dec 20, 2024
718ee2d
Merge branch 'token-details-page' into feat/send-token
Merculiar Dec 20, 2024
02a2fc6
upd
Merculiar Dec 20, 2024
8fc2047
Merge branch 'token-details-page' into feat/send-token
Merculiar Dec 20, 2024
7b4e49b
upd
Merculiar Dec 20, 2024
bfcae63
Merge branch 'master' into token-details-page
Merculiar Dec 20, 2024
e24301d
Merge branch 'master' into token-details-page
Merculiar Dec 23, 2024
75bdb94
Merge branch 'token-details-page' into feat/send-token
Merculiar Dec 23, 2024
6068eb2
upd
Merculiar Dec 24, 2024
1a5bbc8
upd
Merculiar Dec 24, 2024
c9ae1f8
upd
Merculiar Dec 24, 2024
94bc4fa
upd
Merculiar Dec 24, 2024
1a5efec
upd
Merculiar Dec 24, 2024
3c2a21a
Merge branch 'master' into token-details-page
Merculiar Dec 24, 2024
b33ecbc
Merge branch 'token-details-page' into feat/send-token
Merculiar Dec 24, 2024
9a9168a
upd
Merculiar Dec 27, 2024
e6d522b
upd
Merculiar Dec 27, 2024
c71d6ff
upd
Merculiar Dec 27, 2024
b992771
reogranisation
Merculiar Dec 27, 2024
a1424ea
upd
Merculiar Jan 2, 2025
169d7c5
upd
Merculiar Jan 2, 2025
ea517ca
upd
Merculiar Jan 3, 2025
128ea8a
remove redundant code
Merculiar Jan 3, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions packages/espressocash_app/lib/data/db/db.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:drift/drift.dart';
import 'package:injectable/injectable.dart';

import '../../features/activities/models/transaction.dart';
import '../../features/currency/models/currency.dart';
import '../../features/incoming_link_payments/data/ilp_repository.dart';
import '../../features/outgoing_direct_payments/data/repository.dart';
import '../../features/outgoing_link_payments/data/repository.dart';
Expand All @@ -24,7 +25,7 @@ class OutgoingTransferRows extends Table {
Set<Column<Object>> get primaryKey => {id};
}

const int latestVersion = 60;
const int latestVersion = 61;

const _tables = [
OutgoingTransferRows,
Expand Down Expand Up @@ -117,11 +118,9 @@ class MyDatabase extends _$MyDatabase {
if (from < 51) {
await m.addColumn(transactionRows, transactionRows.amount);
}

if (from < 52) {
await m.createTable(tokenBalanceRows);
}

if (from < 53) {
await m.addColumn(onRampOrderRows, onRampOrderRows.authToken);
await m.addColumn(onRampOrderRows, onRampOrderRows.moreInfoUrl);
Expand Down Expand Up @@ -171,6 +170,14 @@ class MyDatabase extends _$MyDatabase {
if (from >= 39 && from < 60) {
await m.addColumn(iLPRows, iLPRows.receiveAmount);
}
if (from < 61) {
await m.addColumn(transactionRows, transactionRows.token);

await customStatement(
'UPDATE ${transactionRows.actualTableName} SET token = ?',
[Currency.usdc.token.address],
);
}
},
);
}
Expand Down Expand Up @@ -306,6 +313,7 @@ class TransactionRows extends Table {
TextColumn get encodedTx => text()();
IntColumn get status => intEnum<TxCommonStatus>()();
IntColumn get amount => integer().nullable()();
TextColumn get token => text().nullable()();

@override
Set<Column<Object>> get primaryKey => {id};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,19 @@ import 'package:dfunc/dfunc.dart';
import 'package:drift/drift.dart';
import 'package:fast_immutable_collections/fast_immutable_collections.dart';
import 'package:injectable/injectable.dart';
import 'package:intl/intl.dart';
import 'package:rxdart/rxdart.dart';
import 'package:solana/encoder.dart';

import '../../../data/db/db.dart';
import '../../../di.dart';
import '../../currency/models/amount.dart';
import '../../currency/models/currency.dart';
import '../../outgoing_direct_payments/data/repository.dart';
import '../../outgoing_link_payments/data/repository.dart';
import '../../payment_request/data/repository.dart';
import '../../tokens/data/token_repository.dart';
import '../../tokens/token.dart';
import '../../transaction_request/service/tr_service.dart';
import '../models/activity.dart';
import '../models/transaction.dart';
Expand All @@ -32,6 +36,38 @@ class TransactionRepository {
return query.map((row) => row.id).watch().map((event) => event.toIList());
}

Stream<IList<String>> watchByAddress(String tokenAddress) {
final query = _db.select(_db.transactionRows)
..where((t) => t.token.equals(tokenAddress))
..orderBy([(t) => OrderingTerm.desc(t.created)]);

return query.map((row) => row.id).watch().map((event) => event.toIList());
}

Stream<Map<String, IList<TxCommon>>> watchGroupedByDate(String tokenAddress) {
final query = _db.select(_db.transactionRows)
..where((t) => t.token.equals(tokenAddress))
..orderBy([(t) => OrderingTerm.desc(t.created)]);

return query.watch().asyncMap((rows) async {
final grouped = <String, IList<TxCommon>>{};
for (final row in rows) {
final model = await row.toModel();
final created = model.created;
if (created != null) {
final date = DateFormat('yyyy-MM-dd').format(created);
grouped.update(
date,
(list) => list.add(model),
ifAbsent: () => IList([model]),
);
}
}

return grouped;
});
}

Stream<IList<String>> watchCount(int count) {
final query = _db.select(_db.transactionRows)
..limit(count)
Expand All @@ -44,7 +80,9 @@ class TransactionRepository {
final query = _db.select(_db.transactionRows)
..where((tbl) => tbl.id.equals(id));

return query.watchSingle().asyncExpand((row) => _match(row.toModel()));
return query.watchSingle().asyncMap(
(row) async => row.toModel().then((value) => _match(value).first),
);
}

Future<void> saveAll(
Expand Down Expand Up @@ -147,14 +185,26 @@ class TransactionRepository {
}

extension TransactionRowExt on TransactionRow {
TxCommon toModel() => TxCommon(
SignedTx.decode(encodedTx),
created: created,
status: status,
amount: amount?.let(
(it) => CryptoAmount(value: it, cryptoCurrency: Currency.usdc),
Future<TxCommon> toModel() async {
final tokenAddress = this.token;
Token? token;

if (tokenAddress != null) {
token = await sl<TokenRepository>().getToken(tokenAddress);
}

return TxCommon(
SignedTx.decode(encodedTx),
created: created,
status: status,
amount: amount?.let(
(it) => CryptoAmount(
value: it,
cryptoCurrency: CryptoCurrency(token: token ?? Token.unk),
),
);
),
);
}
}

extension on TxCommon {
Expand All @@ -164,6 +214,7 @@ extension on TxCommon {
encodedTx: tx.encode(),
status: status,
amount: amount?.value,
token: amount?.cryptoCurrency.token.address,
);
}

Expand Down
Loading
Loading