Skip to content

Commit a83b8d9

Browse files
committed
🐛 Fix freezing
1 parent f3b5b3c commit a83b8d9

13 files changed

+285
-209
lines changed

packages/agent_dart_base/lib/agent/ord/address_stats.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ import 'package:freezed_annotation/freezed_annotation.dart';
2121
part 'address_stats.freezed.dart';
2222
part 'address_stats.g.dart';
2323

24-
@unfreezed
24+
@freezed
2525
class AddressStats with _$AddressStats {
26-
factory AddressStats({
26+
const factory AddressStats({
2727
required String address,
2828
@JsonKey(name: 'chain_stats') required StatsItem chainStats,
2929
@JsonKey(name: 'mempool_stats') required StatsItem mempoolStats,
@@ -35,7 +35,7 @@ class AddressStats with _$AddressStats {
3535

3636
@freezed
3737
class StatsItem with _$StatsItem {
38-
factory StatsItem({
38+
const factory StatsItem({
3939
@JsonKey(name: 'funded_utxo_count') required int fundedUtxoCount,
4040
@JsonKey(name: 'funded_utxo_sum') required int fundedUtxoSum,
4141
@JsonKey(name: 'spent_utxo_count') required int spentUtxoCount,

packages/agent_dart_base/lib/agent/ord/address_stats.freezed.dart

Lines changed: 28 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,10 @@ AddressStats _$AddressStatsFromJson(Map<String, dynamic> json) {
2121
/// @nodoc
2222
mixin _$AddressStats {
2323
String get address => throw _privateConstructorUsedError;
24-
set address(String value) => throw _privateConstructorUsedError;
2524
@JsonKey(name: 'chain_stats')
2625
StatsItem get chainStats => throw _privateConstructorUsedError;
27-
@JsonKey(name: 'chain_stats')
28-
set chainStats(StatsItem value) => throw _privateConstructorUsedError;
2926
@JsonKey(name: 'mempool_stats')
3027
StatsItem get mempoolStats => throw _privateConstructorUsedError;
31-
@JsonKey(name: 'mempool_stats')
32-
set mempoolStats(StatsItem value) => throw _privateConstructorUsedError;
3328

3429
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
3530
@JsonKey(ignore: true)
@@ -156,7 +151,7 @@ class __$$AddressStatsImplCopyWithImpl<$Res>
156151
/// @nodoc
157152
@JsonSerializable()
158153
class _$AddressStatsImpl implements _AddressStats {
159-
_$AddressStatsImpl(
154+
const _$AddressStatsImpl(
160155
{required this.address,
161156
@JsonKey(name: 'chain_stats') required this.chainStats,
162157
@JsonKey(name: 'mempool_stats') required this.mempoolStats});
@@ -165,19 +160,36 @@ class _$AddressStatsImpl implements _AddressStats {
165160
_$$AddressStatsImplFromJson(json);
166161

167162
@override
168-
String address;
163+
final String address;
169164
@override
170165
@JsonKey(name: 'chain_stats')
171-
StatsItem chainStats;
166+
final StatsItem chainStats;
172167
@override
173168
@JsonKey(name: 'mempool_stats')
174-
StatsItem mempoolStats;
169+
final StatsItem mempoolStats;
175170

176171
@override
177172
String toString() {
178173
return 'AddressStats(address: $address, chainStats: $chainStats, mempoolStats: $mempoolStats)';
179174
}
180175

176+
@override
177+
bool operator ==(Object other) {
178+
return identical(this, other) ||
179+
(other.runtimeType == runtimeType &&
180+
other is _$AddressStatsImpl &&
181+
(identical(other.address, address) || other.address == address) &&
182+
(identical(other.chainStats, chainStats) ||
183+
other.chainStats == chainStats) &&
184+
(identical(other.mempoolStats, mempoolStats) ||
185+
other.mempoolStats == mempoolStats));
186+
}
187+
188+
@JsonKey(ignore: true)
189+
@override
190+
int get hashCode =>
191+
Object.hash(runtimeType, address, chainStats, mempoolStats);
192+
181193
@JsonKey(ignore: true)
182194
@override
183195
@pragma('vm:prefer-inline')
@@ -193,28 +205,23 @@ class _$AddressStatsImpl implements _AddressStats {
193205
}
194206

195207
abstract class _AddressStats implements AddressStats {
196-
factory _AddressStats(
197-
{required String address,
198-
@JsonKey(name: 'chain_stats') required StatsItem chainStats,
199-
@JsonKey(name: 'mempool_stats') required StatsItem mempoolStats}) =
200-
_$AddressStatsImpl;
208+
const factory _AddressStats(
209+
{required final String address,
210+
@JsonKey(name: 'chain_stats') required final StatsItem chainStats,
211+
@JsonKey(name: 'mempool_stats')
212+
required final StatsItem mempoolStats}) = _$AddressStatsImpl;
201213

202214
factory _AddressStats.fromJson(Map<String, dynamic> json) =
203215
_$AddressStatsImpl.fromJson;
204216

205217
@override
206218
String get address;
207-
set address(String value);
208219
@override
209220
@JsonKey(name: 'chain_stats')
210221
StatsItem get chainStats;
211-
@JsonKey(name: 'chain_stats')
212-
set chainStats(StatsItem value);
213222
@override
214223
@JsonKey(name: 'mempool_stats')
215224
StatsItem get mempoolStats;
216-
@JsonKey(name: 'mempool_stats')
217-
set mempoolStats(StatsItem value);
218225
@override
219226
@JsonKey(ignore: true)
220227
_$$AddressStatsImplCopyWith<_$AddressStatsImpl> get copyWith =>
@@ -362,7 +369,7 @@ class __$$StatsItemImplCopyWithImpl<$Res>
362369
/// @nodoc
363370
@JsonSerializable()
364371
class _$StatsItemImpl implements _StatsItem {
365-
_$StatsItemImpl(
372+
const _$StatsItemImpl(
366373
{@JsonKey(name: 'funded_utxo_count') required this.fundedUtxoCount,
367374
@JsonKey(name: 'funded_utxo_sum') required this.fundedUtxoSum,
368375
@JsonKey(name: 'spent_utxo_count') required this.spentUtxoCount,
@@ -429,7 +436,7 @@ class _$StatsItemImpl implements _StatsItem {
429436
}
430437

431438
abstract class _StatsItem implements StatsItem {
432-
factory _StatsItem(
439+
const factory _StatsItem(
433440
{@JsonKey(name: 'funded_utxo_count') required final int fundedUtxoCount,
434441
@JsonKey(name: 'funded_utxo_sum') required final int fundedUtxoSum,
435442
@JsonKey(name: 'spent_utxo_count') required final int spentUtxoCount,

packages/agent_dart_base/lib/agent/ord/address_utxo.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ part 'address_utxo.g.dart';
2929

3030
@freezed
3131
class AddressUtxo with _$AddressUtxo {
32-
factory AddressUtxo({
32+
const factory AddressUtxo({
3333
required String txid,
3434
required int vout,
3535
required int value,
@@ -40,13 +40,13 @@ class AddressUtxo with _$AddressUtxo {
4040
_$AddressUtxoFromJson(json);
4141
}
4242

43-
@unfreezed
43+
@freezed
4444
class TxStatus with _$TxStatus {
4545
const factory TxStatus({
4646
required bool confirmed,
47-
@JsonKey(name: 'block_height') int? blockHeight,
48-
@JsonKey(name: 'block_hash') String? blockHash,
49-
@JsonKey(name: 'block_time') int? blockTime,
47+
@JsonKey(name: 'block_height') required int? blockHeight,
48+
@JsonKey(name: 'block_hash') required String? blockHash,
49+
@JsonKey(name: 'block_time') required int? blockTime,
5050
}) = _TxStatus;
5151

5252
factory TxStatus.fromJson(Map<String, dynamic> json) =>

packages/agent_dart_base/lib/agent/ord/address_utxo.freezed.dart

Lines changed: 34 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ class __$$AddressUtxoImplCopyWithImpl<$Res>
143143
/// @nodoc
144144
@JsonSerializable()
145145
class _$AddressUtxoImpl implements _AddressUtxo {
146-
_$AddressUtxoImpl(
146+
const _$AddressUtxoImpl(
147147
{required this.txid,
148148
required this.vout,
149149
required this.value,
@@ -196,7 +196,7 @@ class _$AddressUtxoImpl implements _AddressUtxo {
196196
}
197197

198198
abstract class _AddressUtxo implements AddressUtxo {
199-
factory _AddressUtxo(
199+
const factory _AddressUtxo(
200200
{required final String txid,
201201
required final int vout,
202202
required final int value,
@@ -226,19 +226,12 @@ TxStatus _$TxStatusFromJson(Map<String, dynamic> json) {
226226
/// @nodoc
227227
mixin _$TxStatus {
228228
bool get confirmed => throw _privateConstructorUsedError;
229-
set confirmed(bool value) => throw _privateConstructorUsedError;
230229
@JsonKey(name: 'block_height')
231230
int? get blockHeight => throw _privateConstructorUsedError;
232-
@JsonKey(name: 'block_height')
233-
set blockHeight(int? value) => throw _privateConstructorUsedError;
234231
@JsonKey(name: 'block_hash')
235232
String? get blockHash => throw _privateConstructorUsedError;
236-
@JsonKey(name: 'block_hash')
237-
set blockHash(String? value) => throw _privateConstructorUsedError;
238233
@JsonKey(name: 'block_time')
239234
int? get blockTime => throw _privateConstructorUsedError;
240-
@JsonKey(name: 'block_time')
241-
set blockTime(int? value) => throw _privateConstructorUsedError;
242235

243236
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
244237
@JsonKey(ignore: true)
@@ -354,30 +347,50 @@ class __$$TxStatusImplCopyWithImpl<$Res>
354347
class _$TxStatusImpl implements _TxStatus {
355348
const _$TxStatusImpl(
356349
{required this.confirmed,
357-
@JsonKey(name: 'block_height') this.blockHeight,
358-
@JsonKey(name: 'block_hash') this.blockHash,
359-
@JsonKey(name: 'block_time') this.blockTime});
350+
@JsonKey(name: 'block_height') required this.blockHeight,
351+
@JsonKey(name: 'block_hash') required this.blockHash,
352+
@JsonKey(name: 'block_time') required this.blockTime});
360353

361354
factory _$TxStatusImpl.fromJson(Map<String, dynamic> json) =>
362355
_$$TxStatusImplFromJson(json);
363356

364357
@override
365-
bool confirmed;
358+
final bool confirmed;
366359
@override
367360
@JsonKey(name: 'block_height')
368-
int? blockHeight;
361+
final int? blockHeight;
369362
@override
370363
@JsonKey(name: 'block_hash')
371-
String? blockHash;
364+
final String? blockHash;
372365
@override
373366
@JsonKey(name: 'block_time')
374-
int? blockTime;
367+
final int? blockTime;
375368

376369
@override
377370
String toString() {
378371
return 'TxStatus(confirmed: $confirmed, blockHeight: $blockHeight, blockHash: $blockHash, blockTime: $blockTime)';
379372
}
380373

374+
@override
375+
bool operator ==(Object other) {
376+
return identical(this, other) ||
377+
(other.runtimeType == runtimeType &&
378+
other is _$TxStatusImpl &&
379+
(identical(other.confirmed, confirmed) ||
380+
other.confirmed == confirmed) &&
381+
(identical(other.blockHeight, blockHeight) ||
382+
other.blockHeight == blockHeight) &&
383+
(identical(other.blockHash, blockHash) ||
384+
other.blockHash == blockHash) &&
385+
(identical(other.blockTime, blockTime) ||
386+
other.blockTime == blockTime));
387+
}
388+
389+
@JsonKey(ignore: true)
390+
@override
391+
int get hashCode =>
392+
Object.hash(runtimeType, confirmed, blockHeight, blockHash, blockTime);
393+
381394
@JsonKey(ignore: true)
382395
@override
383396
@pragma('vm:prefer-inline')
@@ -394,32 +407,26 @@ class _$TxStatusImpl implements _TxStatus {
394407

395408
abstract class _TxStatus implements TxStatus {
396409
const factory _TxStatus(
397-
{required bool confirmed,
398-
@JsonKey(name: 'block_height') int? blockHeight,
399-
@JsonKey(name: 'block_hash') String? blockHash,
400-
@JsonKey(name: 'block_time') int? blockTime}) = _$TxStatusImpl;
410+
{required final bool confirmed,
411+
@JsonKey(name: 'block_height') required final int? blockHeight,
412+
@JsonKey(name: 'block_hash') required final String? blockHash,
413+
@JsonKey(name: 'block_time') required final int? blockTime}) =
414+
_$TxStatusImpl;
401415

402416
factory _TxStatus.fromJson(Map<String, dynamic> json) =
403417
_$TxStatusImpl.fromJson;
404418

405419
@override
406420
bool get confirmed;
407-
set confirmed(bool value);
408421
@override
409422
@JsonKey(name: 'block_height')
410423
int? get blockHeight;
411-
@JsonKey(name: 'block_height')
412-
set blockHeight(int? value);
413424
@override
414425
@JsonKey(name: 'block_hash')
415426
String? get blockHash;
416-
@JsonKey(name: 'block_hash')
417-
set blockHash(String? value);
418427
@override
419428
@JsonKey(name: 'block_time')
420429
int? get blockTime;
421-
@JsonKey(name: 'block_time')
422-
set blockTime(int? value);
423430
@override
424431
@JsonKey(ignore: true)
425432
_$$TxStatusImplCopyWith<_$TxStatusImpl> get copyWith =>

packages/agent_dart_base/lib/agent/ord/inscription.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ part 'inscription.g.dart';
55

66
@freezed
77
class Inscription with _$Inscription {
8-
factory Inscription({
8+
const factory Inscription({
99
required String id,
1010
required int offset,
11-
int? number,
12-
int? num,
11+
required int? number,
12+
required int? num,
1313
}) = _Inscription;
1414

1515
factory Inscription.fromJson(Map<String, dynamic> json) =>

packages/agent_dart_base/lib/agent/ord/inscription.freezed.dart

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,11 @@ class __$$InscriptionImplCopyWithImpl<$Res>
130130
/// @nodoc
131131
@JsonSerializable()
132132
class _$InscriptionImpl implements _Inscription {
133-
_$InscriptionImpl(
134-
{required this.id, required this.offset, this.number, this.num});
133+
const _$InscriptionImpl(
134+
{required this.id,
135+
required this.offset,
136+
required this.number,
137+
required this.num});
135138

136139
factory _$InscriptionImpl.fromJson(Map<String, dynamic> json) =>
137140
_$$InscriptionImplFromJson(json);
@@ -180,11 +183,11 @@ class _$InscriptionImpl implements _Inscription {
180183
}
181184

182185
abstract class _Inscription implements Inscription {
183-
factory _Inscription(
186+
const factory _Inscription(
184187
{required final String id,
185188
required final int offset,
186-
final int? number,
187-
final int? num}) = _$InscriptionImpl;
189+
required final int? number,
190+
required final int? num}) = _$InscriptionImpl;
188191

189192
factory _Inscription.fromJson(Map<String, dynamic> json) =
190193
_$InscriptionImpl.fromJson;

packages/agent_dart_base/lib/agent/ord/inscription_item.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ class InscriptionItem with _$InscriptionItem {
3131
const factory InscriptionItem({
3232
required String id,
3333
required InscriptionDetail detail,
34-
int? number,
35-
int? num,
34+
required int? number,
35+
required int? num,
3636
}) = _InscriptionItem;
3737

3838
factory InscriptionItem.fromJson(Map<String, dynamic> json) =>

packages/agent_dart_base/lib/agent/ord/inscription_item.freezed.dart

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,10 @@ class __$$InscriptionItemImplCopyWithImpl<$Res>
144144
@JsonSerializable()
145145
class _$InscriptionItemImpl implements _InscriptionItem {
146146
const _$InscriptionItemImpl(
147-
{required this.id, required this.detail, this.number, this.num});
147+
{required this.id,
148+
required this.detail,
149+
required this.number,
150+
required this.num});
148151

149152
factory _$InscriptionItemImpl.fromJson(Map<String, dynamic> json) =>
150153
_$$InscriptionItemImplFromJson(json);
@@ -197,8 +200,8 @@ abstract class _InscriptionItem implements InscriptionItem {
197200
const factory _InscriptionItem(
198201
{required final String id,
199202
required final InscriptionDetail detail,
200-
final int? number,
201-
final int? num}) = _$InscriptionItemImpl;
203+
required final int? number,
204+
required final int? num}) = _$InscriptionItemImpl;
202205

203206
factory _InscriptionItem.fromJson(Map<String, dynamic> json) =
204207
_$InscriptionItemImpl.fromJson;

0 commit comments

Comments
 (0)