desktop send form token price fix

This commit is contained in:
julian 2023-04-11 13:03:05 -06:00
parent 6eb9651fbb
commit cefbc42715

View file

@ -370,8 +370,12 @@ class _DesktopTokenSendState extends ConsumerState<DesktopTokenSend> {
level: LogLevel.Info); level: LogLevel.Info);
_cachedAmountToSend = _amountToSend; _cachedAmountToSend = _amountToSend;
final price = final price = ref
ref.read(priceAnd24hChangeNotifierProvider).getPrice(coin).item1; .read(priceAnd24hChangeNotifierProvider)
.getTokenPrice(
ref.read(tokenServiceProvider)!.tokenContract.address,
)
.item1;
if (price > Decimal.zero) { if (price > Decimal.zero) {
final String fiatAmountString = Amount.fromDecimal( final String fiatAmountString = Amount.fromDecimal(
@ -512,8 +516,12 @@ class _DesktopTokenSendState extends ConsumerState<DesktopTokenSend> {
.toAmount(fractionDigits: 2) .toAmount(fractionDigits: 2)
: Decimal.parse(baseAmountString).toAmount(fractionDigits: 2); : Decimal.parse(baseAmountString).toAmount(fractionDigits: 2);
final Decimal _price = final Decimal _price = ref
ref.read(priceAnd24hChangeNotifierProvider).getPrice(coin).item1; .read(priceAnd24hChangeNotifierProvider)
.getTokenPrice(
ref.read(tokenServiceProvider)!.tokenContract.address,
)
.item1;
if (_price == Decimal.zero) { if (_price == Decimal.zero) {
_amountToSend = Decimal.zero.toAmount(fractionDigits: tokenDecimals); _amountToSend = Decimal.zero.toAmount(fractionDigits: tokenDecimals);