Skip to content

Commit 3786f36

Browse files
committed
chore: dart format
1 parent 969e8e5 commit 3786f36

163 files changed

Lines changed: 14663 additions & 16087 deletions

File tree

Some content is hidden

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

lib/db/db_version_migration.dart

Lines changed: 48 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -170,12 +170,11 @@ class DbVersionMigrator with WalletDB {
170170
final count = await MainDB.instance.isar.addresses.count();
171171
// add change/receiving tags to address labels
172172
for (var i = 0; i < count; i += 50) {
173-
final addresses =
174-
await MainDB.instance.isar.addresses
175-
.where()
176-
.offset(i)
177-
.limit(50)
178-
.findAll();
173+
final addresses = await MainDB.instance.isar.addresses
174+
.where()
175+
.offset(i)
176+
.limit(50)
177+
.findAll();
179178

180179
final List<isar_models.AddressLabel> labels = [];
181180
for (final address in addresses) {
@@ -203,14 +202,13 @@ class DbVersionMigrator with WalletDB {
203202

204203
// update/create label if tags is not empty
205204
if (tags != null) {
206-
isar_models.AddressLabel? label =
207-
await MainDB.instance.isar.addressLabels
208-
.where()
209-
.addressStringWalletIdEqualTo(
210-
address.value,
211-
address.walletId,
212-
)
213-
.findFirst();
205+
isar_models.AddressLabel? label = await MainDB
206+
.instance
207+
.isar
208+
.addressLabels
209+
.where()
210+
.addressStringWalletIdEqualTo(address.value, address.walletId)
211+
.findFirst();
214212
if (label == null) {
215213
label = isar_models.AddressLabel(
216214
walletId: address.walletId,
@@ -268,13 +266,12 @@ class DbVersionMigrator with WalletDB {
268266
Bitcoincash(CryptoCurrencyNetwork.main).identifier ||
269267
info.coinIdentifier ==
270268
Bitcoincash(CryptoCurrencyNetwork.test).identifier) {
271-
final ids =
272-
await MainDB.instance
273-
.getAddresses(walletId)
274-
.filter()
275-
.typeEqualTo(isar_models.AddressType.p2sh)
276-
.idProperty()
277-
.findAll();
269+
final ids = await MainDB.instance
270+
.getAddresses(walletId)
271+
.filter()
272+
.typeEqualTo(isar_models.AddressType.p2sh)
273+
.idProperty()
274+
.findAll();
278275

279276
await MainDB.instance.isar.writeTxn(() async {
280277
await MainDB.instance.isar.addresses.deleteAll(ids);
@@ -421,17 +418,15 @@ class DbVersionMigrator with WalletDB {
421418
walletId: walletId,
422419
txid: tx.txid,
423420
timestamp: tx.timestamp,
424-
type:
425-
isIncoming
426-
? isar_models.TransactionType.incoming
427-
: isar_models.TransactionType.outgoing,
421+
type: isIncoming
422+
? isar_models.TransactionType.incoming
423+
: isar_models.TransactionType.outgoing,
428424
subType: isar_models.TransactionSubType.none,
429425
amount: tx.amount,
430-
amountString:
431-
Amount(
432-
rawValue: BigInt.from(tx.amount),
433-
fractionDigits: epic.fractionDigits,
434-
).toJsonString(),
426+
amountString: Amount(
427+
rawValue: BigInt.from(tx.amount),
428+
fractionDigits: epic.fractionDigits,
429+
).toJsonString(),
435430
fee: tx.fees,
436431
height: tx.height,
437432
isCancelled: tx.isCancelled,
@@ -453,14 +448,12 @@ class DbVersionMigrator with WalletDB {
453448
publicKey: [],
454449
derivationIndex: isIncoming ? rcvIndex : -1,
455450
derivationPath: null,
456-
type:
457-
isIncoming
458-
? isar_models.AddressType.mimbleWimble
459-
: isar_models.AddressType.unknown,
460-
subType:
461-
isIncoming
462-
? isar_models.AddressSubType.receiving
463-
: isar_models.AddressSubType.unknown,
451+
type: isIncoming
452+
? isar_models.AddressType.mimbleWimble
453+
: isar_models.AddressType.unknown,
454+
subType: isIncoming
455+
? isar_models.AddressSubType.receiving
456+
: isar_models.AddressSubType.unknown,
464457
);
465458
transactionsData.add(Tuple2(iTx, address));
466459
}
@@ -518,28 +511,25 @@ class DbVersionMigrator with WalletDB {
518511
final crypto = AppConfig.getCryptoCurrencyFor(info.coinIdentifier)!;
519512

520513
for (var i = 0; i < count; i += 50) {
521-
final txns =
522-
await MainDB.instance
523-
.getTransactions(walletId)
524-
.offset(i)
525-
.limit(50)
526-
.findAll();
514+
final txns = await MainDB.instance
515+
.getTransactions(walletId)
516+
.offset(i)
517+
.limit(50)
518+
.findAll();
527519

528520
// migrate amount to serialized amount string
529-
final txnsData =
530-
txns
531-
.map(
532-
(tx) => Tuple2(
533-
tx
534-
..amountString =
535-
Amount(
536-
rawValue: BigInt.from(tx.amount),
537-
fractionDigits: crypto.fractionDigits,
538-
).toJsonString(),
539-
tx.address.value,
540-
),
541-
)
542-
.toList();
521+
final txnsData = txns
522+
.map(
523+
(tx) => Tuple2(
524+
tx
525+
..amountString = Amount(
526+
rawValue: BigInt.from(tx.amount),
527+
fractionDigits: crypto.fractionDigits,
528+
).toJsonString(),
529+
tx.address.value,
530+
),
531+
)
532+
.toList();
543533

544534
// update db records
545535
await MainDB.instance.addNewTransactionData(txnsData, walletId);

lib/electrumx_rpc/cached_electrumx_client.dart

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,13 @@ class CachedElectrumXClient {
2626
required ElectrumXClient electrumXClient,
2727
}) => CachedElectrumXClient(electrumXClient: electrumXClient);
2828

29-
String base64ToHex(String source) =>
30-
base64Decode(
31-
LineSplitter.split(source).join(),
32-
).map((e) => e.toRadixString(16).padLeft(2, '0')).join();
29+
String base64ToHex(String source) => base64Decode(
30+
LineSplitter.split(source).join(),
31+
).map((e) => e.toRadixString(16).padLeft(2, '0')).join();
3332

34-
String base64ToReverseHex(String source) =>
35-
base64Decode(
36-
LineSplitter.split(source).join(),
37-
).reversed.map((e) => e.toRadixString(16).padLeft(2, '0')).join();
33+
String base64ToReverseHex(String source) => base64Decode(
34+
LineSplitter.split(source).join(),
35+
).reversed.map((e) => e.toRadixString(16).padLeft(2, '0')).join();
3836

3937
/// Call electrumx getTransaction on a per coin basis, storing the result in local db if not already there.
4038
///

lib/models/balance.dart

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,11 @@ class Balance {
4141
}
4242

4343
String toJsonIgnoreCoin() => jsonEncode({
44-
"total": total.toJsonString(),
45-
"spendable": spendable.toJsonString(),
46-
"blockedTotal": blockedTotal.toJsonString(),
47-
"pendingSpendable": pendingSpendable.toJsonString(),
48-
});
44+
"total": total.toJsonString(),
45+
"spendable": spendable.toJsonString(),
46+
"blockedTotal": blockedTotal.toJsonString(),
47+
"pendingSpendable": pendingSpendable.toJsonString(),
48+
});
4949

5050
// need to fall back to parsing from int due to cached balances being previously
5151
// stored as int values instead of Amounts
@@ -82,11 +82,11 @@ class Balance {
8282
}
8383

8484
Map<String, dynamic> toMap() => {
85-
"total": total,
86-
"spendable": spendable,
87-
"blockedTotal": blockedTotal,
88-
"pendingSpendable": pendingSpendable,
89-
};
85+
"total": total,
86+
"spendable": spendable,
87+
"blockedTotal": blockedTotal,
88+
"pendingSpendable": pendingSpendable,
89+
};
9090

9191
@override
9292
String toString() {

lib/models/isar/models/blockchain_data/transaction.dart

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -218,14 +218,12 @@ class Transaction {
218218
slateId: json["slateId"] as String?,
219219
otherData: json["otherData"] as String?,
220220
nonce: json["nonce"] as int?,
221-
inputs:
222-
List<String>.from(
223-
json["inputs"] as List,
224-
).map((e) => Input.fromJsonString(e)).toList(),
225-
outputs:
226-
List<String>.from(
227-
json["outputs"] as List,
228-
).map((e) => Output.fromJsonString(e)).toList(),
221+
inputs: List<String>.from(
222+
json["inputs"] as List,
223+
).map((e) => Input.fromJsonString(e)).toList(),
224+
outputs: List<String>.from(
225+
json["outputs"] as List,
226+
).map((e) => Output.fromJsonString(e)).toList(),
229227
numberOfMessages: json["numberOfMessages"] as int,
230228
);
231229
if (json["address"] == null) {

lib/models/isar/models/ethereum/eth_contract.dart

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -50,21 +50,16 @@ class EthContract extends Contract {
5050
List<String>? walletIds,
5151
String? abi,
5252
String? otherData,
53-
}) =>
54-
EthContract(
55-
address: address ?? this.address,
56-
name: name ?? this.name,
57-
symbol: symbol ?? this.symbol,
58-
decimals: decimals ?? this.decimals,
59-
type: type ?? this.type,
60-
abi: abi ?? this.abi,
61-
)..id = id ?? this.id;
53+
}) => EthContract(
54+
address: address ?? this.address,
55+
name: name ?? this.name,
56+
symbol: symbol ?? this.symbol,
57+
decimals: decimals ?? this.decimals,
58+
type: type ?? this.type,
59+
abi: abi ?? this.abi,
60+
)..id = id ?? this.id;
6261
}
6362

6463
// Used in Isar db and stored there as int indexes so adding/removing values
6564
// in this definition should be done extremely carefully in production
66-
enum EthContractType {
67-
unknown,
68-
erc20,
69-
erc721;
70-
}
65+
enum EthContractType { unknown, erc20, erc721 }

lib/models/keys/view_only_wallet_data.dart

Lines changed: 14 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,15 @@ import '../../wallets/wallet/wallet_mixin_interfaces/extended_keys_interface.dar
44
import 'key_data_interface.dart';
55

66
// do not remove or change the order of these enum values
7-
enum ViewOnlyWalletType {
8-
cryptonote,
9-
addressOnly,
10-
xPub;
11-
}
7+
enum ViewOnlyWalletType { cryptonote, addressOnly, xPub }
128

139
sealed class ViewOnlyWalletData with KeyDataInterface {
1410
@override
1511
final String walletId;
1612

1713
ViewOnlyWalletType get type;
1814

19-
ViewOnlyWalletData({
20-
required this.walletId,
21-
});
15+
ViewOnlyWalletData({required this.walletId});
2216

2317
static ViewOnlyWalletData fromJsonEncodedString(
2418
String jsonEncodedString, {
@@ -81,10 +75,10 @@ class CryptonoteViewOnlyWalletData extends ViewOnlyWalletData {
8175

8276
@override
8377
String toJsonEncodedString() => jsonEncode({
84-
"type": type.index,
85-
"address": address,
86-
"privateViewKey": privateViewKey,
87-
});
78+
"type": type.index,
79+
"address": address,
80+
"privateViewKey": privateViewKey,
81+
});
8882
}
8983

9084
class AddressViewOnlyWalletData extends ViewOnlyWalletData {
@@ -93,10 +87,7 @@ class AddressViewOnlyWalletData extends ViewOnlyWalletData {
9387

9488
final String address;
9589

96-
AddressViewOnlyWalletData({
97-
required super.walletId,
98-
required this.address,
99-
});
90+
AddressViewOnlyWalletData({required super.walletId, required this.address});
10091

10192
static AddressViewOnlyWalletData fromJsonEncodedString(
10293
String jsonEncodedString, {
@@ -112,10 +103,8 @@ class AddressViewOnlyWalletData extends ViewOnlyWalletData {
112103
}
113104

114105
@override
115-
String toJsonEncodedString() => jsonEncode({
116-
"type": type.index,
117-
"address": address,
118-
});
106+
String toJsonEncodedString() =>
107+
jsonEncode({"type": type.index, "address": address});
119108
}
120109

121110
class ExtendedKeysViewOnlyWalletData extends ViewOnlyWalletData {
@@ -151,14 +140,9 @@ class ExtendedKeysViewOnlyWalletData extends ViewOnlyWalletData {
151140

152141
@override
153142
String toJsonEncodedString() => jsonEncode({
154-
"type": type.index,
155-
"xPubs": [
156-
...xPubs.map(
157-
(e) => {
158-
"path": e.path,
159-
"encoded": e.encoded,
160-
},
161-
),
162-
],
163-
});
143+
"type": type.index,
144+
"xPubs": [
145+
...xPubs.map((e) => {"path": e.path, "encoded": e.encoded}),
146+
],
147+
});
164148
}

0 commit comments

Comments
 (0)