mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-12-23 11:59:30 +00:00
take into account tickers and coin names as possible pay in currencies
This commit is contained in:
parent
0ce0b1d30e
commit
1387a71f4a
1 changed files with 17 additions and 5 deletions
|
@ -87,8 +87,11 @@ class _TradeDetailsViewState extends ConsumerState<TradeDetailsView> {
|
|||
String _note = "";
|
||||
|
||||
bool isStackCoin(String ticker) {
|
||||
try {
|
||||
try {
|
||||
coinFromTickerCaseInsensitive(ticker);
|
||||
} catch (_) {}
|
||||
coinFromPrettyName(ticker);
|
||||
return true;
|
||||
} on ArgumentError catch (_) {
|
||||
return false;
|
||||
|
@ -272,8 +275,13 @@ class _TradeDetailsViewState extends ConsumerState<TradeDetailsView> {
|
|||
label: "Send from Stack",
|
||||
buttonHeight: ButtonHeight.l,
|
||||
onPressed: () {
|
||||
final coin =
|
||||
coinFromTickerCaseInsensitive(trade.payInCurrency);
|
||||
Coin coin;
|
||||
try {
|
||||
coin = coinFromTickerCaseInsensitive(
|
||||
trade.payInCurrency);
|
||||
} catch (_) {
|
||||
coin = coinFromPrettyName(trade.payInCurrency);
|
||||
}
|
||||
final amount = Amount.fromDecimal(
|
||||
sendAmount,
|
||||
fractionDigits: coin.decimals,
|
||||
|
@ -1349,8 +1357,12 @@ class _TradeDetailsViewState extends ConsumerState<TradeDetailsView> {
|
|||
SecondaryButton(
|
||||
label: "Send from Stack",
|
||||
onPressed: () {
|
||||
final coin =
|
||||
coinFromTickerCaseInsensitive(trade.payInCurrency);
|
||||
Coin coin;
|
||||
try {
|
||||
coin = coinFromTickerCaseInsensitive(trade.payInCurrency);
|
||||
} catch (_) {
|
||||
coin = coinFromPrettyName(trade.payInCurrency);
|
||||
}
|
||||
final amount = Amount.fromDecimal(
|
||||
sendAmount,
|
||||
fractionDigits: coin.decimals,
|
||||
|
|
Loading…
Reference in a new issue