refactor of money utils with new money2 package
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
import 'package:pshared/data/mapper/wallet/ui.dart';
|
||||
import 'package:pshared/models/currency.dart';
|
||||
import 'package:pshared/models/describable.dart';
|
||||
import 'package:pshared/models/payment/chain_network.dart';
|
||||
import 'package:pshared/models/payment/wallet.dart';
|
||||
import 'package:pshared/models/wallet/chain_asset.dart';
|
||||
import 'package:pshared/service/wallet.dart' as shared_wallet_service;
|
||||
import 'package:pshared/utils/money.dart';
|
||||
|
||||
|
||||
abstract class WalletsService {
|
||||
@@ -12,7 +12,8 @@ abstract class WalletsService {
|
||||
Future<void> create({
|
||||
required String organizationRef,
|
||||
required Describable describable,
|
||||
required ChainAsset asset,
|
||||
required ChainNetwork chain,
|
||||
required CurrencyCode currency,
|
||||
required String? ownerRef,
|
||||
});
|
||||
}
|
||||
@@ -30,19 +31,21 @@ class ApiWalletsService implements WalletsService {
|
||||
organizationRef: organizationRef,
|
||||
walletRef: walletRef,
|
||||
);
|
||||
return parseMoneyAmount(balance.available?.amount);
|
||||
return balance.available?.toDouble() ?? 0;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> create({
|
||||
required String organizationRef,
|
||||
required Describable describable,
|
||||
required ChainAsset asset,
|
||||
required ChainNetwork chain,
|
||||
required CurrencyCode currency,
|
||||
required String? ownerRef,
|
||||
}) => shared_wallet_service.WalletService.create(
|
||||
organizationRef: organizationRef,
|
||||
describable: describable,
|
||||
asset: asset,
|
||||
chain: chain,
|
||||
currency: currency,
|
||||
ownerRef: ownerRef,
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user