refactor of money utils with new money2 package
This commit is contained in:
@@ -1,18 +0,0 @@
|
||||
import 'package:pshared/models/currency.dart';
|
||||
import 'package:pshared/utils/currency.dart';
|
||||
|
||||
|
||||
class Asset {
|
||||
final Currency currency;
|
||||
final double amount;
|
||||
|
||||
const Asset({
|
||||
required this.currency,
|
||||
required this.amount,
|
||||
});
|
||||
}
|
||||
|
||||
Asset createAsset(String currencyCode, String amount) => Asset(
|
||||
currency: currencyStringToCode(currencyCode),
|
||||
amount: double.parse(amount),
|
||||
);
|
||||
@@ -1 +1 @@
|
||||
enum Currency {usd, eur, rub, usdt, usdc}
|
||||
enum CurrencyCode {usd, eur, rub, usdt, usdc}
|
||||
@@ -1,4 +1,4 @@
|
||||
import 'package:pshared/models/money.dart';
|
||||
import 'package:money2/money2.dart';
|
||||
|
||||
|
||||
class LedgerBalance {
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
class Money {
|
||||
final String amount;
|
||||
final String currency;
|
||||
|
||||
const Money({
|
||||
required this.amount,
|
||||
required this.currency,
|
||||
});
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import 'package:pshared/models/money.dart';
|
||||
import 'package:money2/money2.dart';
|
||||
|
||||
|
||||
class PaymentExecutionOperation {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import 'package:pshared/models/money.dart';
|
||||
import 'package:money2/money2.dart';
|
||||
|
||||
|
||||
class FeeLine {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'package:pshared/models/money.dart';
|
||||
import 'package:money2/money2.dart';
|
||||
|
||||
|
||||
class FxQuote {
|
||||
final String? quoteRef;
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
import 'package:money2/money2.dart';
|
||||
|
||||
import 'package:pshared/models/payment/fees/treatment.dart';
|
||||
import 'package:pshared/models/payment/fx/intent.dart';
|
||||
import 'package:pshared/models/payment/kind.dart';
|
||||
import 'package:pshared/models/payment/customer.dart';
|
||||
import 'package:pshared/models/payment/methods/data.dart';
|
||||
import 'package:pshared/models/money.dart';
|
||||
import 'package:pshared/models/payment/settlement_mode.dart';
|
||||
|
||||
|
||||
class PaymentIntent {
|
||||
final PaymentKind kind;
|
||||
final String? sourceRef;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'package:pshared/models/money.dart';
|
||||
import 'package:money2/money2.dart';
|
||||
|
||||
|
||||
class QuoteAmounts {
|
||||
final Money? sourcePrincipal;
|
||||
|
||||
@@ -7,7 +7,7 @@ class Wallet implements Describable {
|
||||
final String id;
|
||||
final String walletUserID; // ID or number that we show the user
|
||||
final double balance;
|
||||
final Currency currency;
|
||||
final CurrencyCode currency;
|
||||
final DateTime calculatedAt;
|
||||
final String? depositAddress;
|
||||
final ChainNetwork? network;
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
import 'package:pshared/models/wallet/chain_asset.dart';
|
||||
import 'package:pshared/models/payment/chain_network.dart';
|
||||
|
||||
|
||||
class WalletAsset extends ChainAsset {
|
||||
class WalletAsset {
|
||||
final ChainNetwork chain;
|
||||
final String tokenSymbol;
|
||||
final String contractAddress;
|
||||
|
||||
const WalletAsset({
|
||||
required super.chain,
|
||||
required super.tokenSymbol,
|
||||
required this.chain,
|
||||
required this.tokenSymbol,
|
||||
required this.contractAddress,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import 'package:pshared/models/money.dart';
|
||||
import 'package:money2/money2.dart';
|
||||
|
||||
|
||||
class WalletBalance {
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
import 'package:pshared/models/payment/chain_network.dart';
|
||||
|
||||
|
||||
class ChainAsset {
|
||||
final ChainNetwork chain;
|
||||
final String tokenSymbol;
|
||||
|
||||
const ChainAsset({
|
||||
required this.chain,
|
||||
required this.tokenSymbol,
|
||||
});
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
import 'package:pshared/models/describable.dart';
|
||||
import 'package:pshared/models/money.dart';
|
||||
import 'package:money2/money2.dart';
|
||||
import 'package:pshared/models/wallet/asset.dart';
|
||||
import 'package:pshared/models/wallet/balance.dart';
|
||||
|
||||
@@ -39,9 +39,7 @@ class WalletModel implements Describable {
|
||||
required this.describable,
|
||||
});
|
||||
|
||||
WalletModel copyWith({
|
||||
Describable? describable,
|
||||
}) => WalletModel(
|
||||
WalletModel copyWith({Describable? describable}) => WalletModel(
|
||||
walletRef: walletRef,
|
||||
organizationRef: organizationRef,
|
||||
ownerRef: ownerRef,
|
||||
|
||||
Reference in New Issue
Block a user