Files
sendico/frontend/pshared/lib/models/wallet/wallet.dart

74 lines
1.8 KiB
Dart

import 'package:pshared/models/wallet/balance.dart';
import 'package:pshared/models/wallet/money.dart';
import 'package:pshared/models/describable.dart';
class WalletAsset {
final String chain;
final String tokenSymbol;
final String contractAddress;
const WalletAsset({
required this.chain,
required this.tokenSymbol,
required this.contractAddress,
});
}
class WalletModel implements Describable {
final String walletRef;
final String organizationRef;
final String ownerRef;
final WalletAsset asset;
final String depositAddress;
final String status;
final Map<String, String>? metadata;
final DateTime? createdAt;
final DateTime? updatedAt;
final WalletBalance? balance;
final WalletMoney? availableMoney;
final Describable describable;
@override
String get name => describable.name;
@override
String? get description => describable.description;
const WalletModel({
required this.walletRef,
required this.organizationRef,
required this.ownerRef,
required this.asset,
required this.depositAddress,
required this.status,
this.metadata,
this.createdAt,
this.updatedAt,
this.balance,
this.availableMoney,
required this.describable,
});
WalletModel copyWith({
WalletBalance? balance,
WalletMoney? availableMoney,
Describable? describable,
}) {
return WalletModel(
walletRef: walletRef,
organizationRef: organizationRef,
ownerRef: ownerRef,
asset: asset,
depositAddress: depositAddress,
status: status,
metadata: metadata,
createdAt: createdAt,
updatedAt: updatedAt,
balance: balance ?? this.balance,
availableMoney: availableMoney ?? this.availableMoney,
describable: describable ?? this.describable,
);
}
}