mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-01-10 12:44:31 +00:00
fix: default coin units length and banano unit names
This commit is contained in:
parent
00d4ab11c9
commit
b6ed690eb6
3 changed files with 94 additions and 92 deletions
|
@ -46,6 +46,7 @@ class _ChooseUnitSheetState extends ConsumerState<ChooseUnitSheet> {
|
|||
top: 10,
|
||||
bottom: 0,
|
||||
),
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
|
@ -71,7 +72,7 @@ class _ChooseUnitSheetState extends ConsumerState<ChooseUnitSheet> {
|
|||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
"Phrase length",
|
||||
"Coin units",
|
||||
style: STextStyles.pageTitleH2(context),
|
||||
textAlign: TextAlign.left,
|
||||
),
|
||||
|
@ -137,6 +138,7 @@ class _ChooseUnitSheetState extends ConsumerState<ChooseUnitSheet> {
|
|||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -81,7 +81,8 @@ extension AmountUnitExt on AmountUnit {
|
|||
return "gwei";
|
||||
} else if (coin == Coin.wownero ||
|
||||
coin == Coin.monero ||
|
||||
coin == Coin.nano) {
|
||||
coin == Coin.nano ||
|
||||
coin == Coin.banano) {
|
||||
return "n${coin.ticker}";
|
||||
} else {
|
||||
return "sats";
|
||||
|
@ -91,7 +92,8 @@ extension AmountUnitExt on AmountUnit {
|
|||
return "mwei";
|
||||
} else if (coin == Coin.wownero ||
|
||||
coin == Coin.monero ||
|
||||
coin == Coin.nano) {
|
||||
coin == Coin.nano ||
|
||||
coin == Coin.banano) {
|
||||
return "p${coin.ticker}";
|
||||
} else {
|
||||
return "invalid";
|
||||
|
@ -99,7 +101,7 @@ extension AmountUnitExt on AmountUnit {
|
|||
case AmountUnit.femto:
|
||||
if (coin == Coin.ethereum) {
|
||||
return "kwei";
|
||||
} else if (coin == Coin.nano) {
|
||||
} else if (coin == Coin.nano || coin == Coin.banano) {
|
||||
return "f${coin.ticker}";
|
||||
} else {
|
||||
return "invalid";
|
||||
|
@ -107,31 +109,31 @@ extension AmountUnitExt on AmountUnit {
|
|||
case AmountUnit.atto:
|
||||
if (coin == Coin.ethereum) {
|
||||
return "wei";
|
||||
} else if (coin == Coin.nano) {
|
||||
} else if (coin == Coin.nano || coin == Coin.banano) {
|
||||
return "a${coin.ticker}";
|
||||
} else {
|
||||
return "invalid";
|
||||
}
|
||||
case AmountUnit.zepto:
|
||||
if (coin == Coin.nano) {
|
||||
if (coin == Coin.nano || coin == Coin.banano) {
|
||||
return "z${coin.ticker}";
|
||||
} else {
|
||||
return "invalid";
|
||||
}
|
||||
case AmountUnit.yocto:
|
||||
if (coin == Coin.nano) {
|
||||
if (coin == Coin.nano || coin == Coin.banano) {
|
||||
return "y${coin.ticker}";
|
||||
} else {
|
||||
return "invalid";
|
||||
}
|
||||
case AmountUnit.ronto:
|
||||
if (coin == Coin.nano) {
|
||||
if (coin == Coin.nano || coin == Coin.banano) {
|
||||
return "r${coin.ticker}";
|
||||
} else {
|
||||
return "invalid";
|
||||
}
|
||||
case AmountUnit.quecto:
|
||||
if (coin == Coin.nano) {
|
||||
if (coin == Coin.nano || coin == Coin.banano) {
|
||||
return "q${coin.ticker}";
|
||||
} else {
|
||||
return "invalid";
|
||||
|
|
|
@ -8,8 +8,6 @@
|
|||
*
|
||||
*/
|
||||
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:stackwallet/db/hive/db.dart';
|
||||
import 'package:stackwallet/utilities/amount/amount_unit.dart';
|
||||
|
@ -866,8 +864,8 @@ class Prefs extends ChangeNotifier {
|
|||
boxName: DB.boxNamePrefs,
|
||||
key: "maxDecimalsFor${coin.name}",
|
||||
) as int? ??
|
||||
max(coin.decimals,
|
||||
18); // use some sane max rather than up to 30 that nano uses
|
||||
(coin.decimals > 18 ? 18 : coin.decimals);
|
||||
// use some sane max rather than up to 30 that nano uses
|
||||
_amountDecimals[coin] = decimals;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue