mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-01-11 05:04:35 +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 = "";
|
String _note = "";
|
||||||
|
|
||||||
bool isStackCoin(String ticker) {
|
bool isStackCoin(String ticker) {
|
||||||
|
try {
|
||||||
try {
|
try {
|
||||||
coinFromTickerCaseInsensitive(ticker);
|
coinFromTickerCaseInsensitive(ticker);
|
||||||
|
} catch (_) {}
|
||||||
|
coinFromPrettyName(ticker);
|
||||||
return true;
|
return true;
|
||||||
} on ArgumentError catch (_) {
|
} on ArgumentError catch (_) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -272,8 +275,13 @@ class _TradeDetailsViewState extends ConsumerState<TradeDetailsView> {
|
||||||
label: "Send from Stack",
|
label: "Send from Stack",
|
||||||
buttonHeight: ButtonHeight.l,
|
buttonHeight: ButtonHeight.l,
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
final coin =
|
Coin coin;
|
||||||
coinFromTickerCaseInsensitive(trade.payInCurrency);
|
try {
|
||||||
|
coin = coinFromTickerCaseInsensitive(
|
||||||
|
trade.payInCurrency);
|
||||||
|
} catch (_) {
|
||||||
|
coin = coinFromPrettyName(trade.payInCurrency);
|
||||||
|
}
|
||||||
final amount = Amount.fromDecimal(
|
final amount = Amount.fromDecimal(
|
||||||
sendAmount,
|
sendAmount,
|
||||||
fractionDigits: coin.decimals,
|
fractionDigits: coin.decimals,
|
||||||
|
@ -1349,8 +1357,12 @@ class _TradeDetailsViewState extends ConsumerState<TradeDetailsView> {
|
||||||
SecondaryButton(
|
SecondaryButton(
|
||||||
label: "Send from Stack",
|
label: "Send from Stack",
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
final coin =
|
Coin coin;
|
||||||
coinFromTickerCaseInsensitive(trade.payInCurrency);
|
try {
|
||||||
|
coin = coinFromTickerCaseInsensitive(trade.payInCurrency);
|
||||||
|
} catch (_) {
|
||||||
|
coin = coinFromPrettyName(trade.payInCurrency);
|
||||||
|
}
|
||||||
final amount = Amount.fromDecimal(
|
final amount = Amount.fromDecimal(
|
||||||
sendAmount,
|
sendAmount,
|
||||||
fractionDigits: coin.decimals,
|
fractionDigits: coin.decimals,
|
||||||
|
|
Loading…
Reference in a new issue