mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-01-23 19:05:51 +00:00
WIP token buy default fill in value
This commit is contained in:
parent
7a177a6616
commit
58afc46152
2 changed files with 18 additions and 4 deletions
|
@ -10,6 +10,7 @@ import 'package:stackwallet/models/buy/response_objects/crypto.dart';
|
||||||
import 'package:stackwallet/models/buy/response_objects/fiat.dart';
|
import 'package:stackwallet/models/buy/response_objects/fiat.dart';
|
||||||
import 'package:stackwallet/models/buy/response_objects/quote.dart';
|
import 'package:stackwallet/models/buy/response_objects/quote.dart';
|
||||||
import 'package:stackwallet/models/contact_address_entry.dart';
|
import 'package:stackwallet/models/contact_address_entry.dart';
|
||||||
|
import 'package:stackwallet/models/isar/models/ethereum/eth_contract.dart';
|
||||||
import 'package:stackwallet/pages/address_book_views/address_book_view.dart';
|
import 'package:stackwallet/pages/address_book_views/address_book_view.dart';
|
||||||
import 'package:stackwallet/pages/buy_view/buy_quote_preview.dart';
|
import 'package:stackwallet/pages/buy_view/buy_quote_preview.dart';
|
||||||
import 'package:stackwallet/pages/buy_view/sub_widgets/crypto_selection_view.dart';
|
import 'package:stackwallet/pages/buy_view/sub_widgets/crypto_selection_view.dart';
|
||||||
|
@ -49,6 +50,7 @@ class BuyForm extends ConsumerStatefulWidget {
|
||||||
const BuyForm({
|
const BuyForm({
|
||||||
Key? key,
|
Key? key,
|
||||||
this.coin,
|
this.coin,
|
||||||
|
this.tokenContract,
|
||||||
this.clipboard = const ClipboardWrapper(),
|
this.clipboard = const ClipboardWrapper(),
|
||||||
this.scanner = const BarcodeScannerWrapper(),
|
this.scanner = const BarcodeScannerWrapper(),
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
@ -57,6 +59,7 @@ class BuyForm extends ConsumerStatefulWidget {
|
||||||
|
|
||||||
final ClipboardInterface clipboard;
|
final ClipboardInterface clipboard;
|
||||||
final BarcodeScannerInterface scanner;
|
final BarcodeScannerInterface scanner;
|
||||||
|
final EthContract? tokenContract;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
ConsumerState<BuyForm> createState() => _BuyFormState();
|
ConsumerState<BuyForm> createState() => _BuyFormState();
|
||||||
|
@ -461,7 +464,7 @@ class _BuyFormState extends ConsumerState<BuyForm> {
|
||||||
// TODO launch URL
|
// TODO launch URL
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
} else {
|
} else if (mounted) {
|
||||||
await showDialog<dynamic>(
|
await showDialog<dynamic>(
|
||||||
context: context,
|
context: context,
|
||||||
barrierDismissible: true,
|
barrierDismissible: true,
|
||||||
|
@ -529,7 +532,7 @@ class _BuyFormState extends ConsumerState<BuyForm> {
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else if (mounted) {
|
||||||
// Error; probably amount out of bounds
|
// Error; probably amount out of bounds
|
||||||
// String errorMessage = "${quoteResponse.exception?.errorMessage}";
|
// String errorMessage = "${quoteResponse.exception?.errorMessage}";
|
||||||
// if (errorMessage.contains('must be between')) {
|
// if (errorMessage.contains('must be between')) {
|
||||||
|
@ -744,6 +747,18 @@ class _BuyFormState extends ConsumerState<BuyForm> {
|
||||||
'name': widget.coin?.prettyName ?? 'Bitcoin'
|
'name': widget.coin?.prettyName ?? 'Bitcoin'
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// THIS IS BAD. No way to be certain the simplex ticker points to the same
|
||||||
|
// contract as the ticker symbol of this contract
|
||||||
|
// if (widget.tokenContract != null &&
|
||||||
|
// DefaultTokens.list
|
||||||
|
// .where((e) => e.address == widget.tokenContract!.address)
|
||||||
|
// .isNotEmpty) {
|
||||||
|
// selectedCrypto = Crypto.fromJson({
|
||||||
|
// 'ticker': widget.tokenContract!.symbol,
|
||||||
|
// 'name': widget.tokenContract!.name,
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
|
||||||
// TODO set initial crypto to open wallet if a wallet is open
|
// TODO set initial crypto to open wallet if a wallet is open
|
||||||
|
|
||||||
super.initState();
|
super.initState();
|
||||||
|
|
|
@ -46,8 +46,7 @@ class _BuyInWalletViewState extends State<BuyInWalletView> {
|
||||||
),
|
),
|
||||||
body: BuyView(
|
body: BuyView(
|
||||||
coin: widget.coin,
|
coin: widget.coin,
|
||||||
tokenContract,
|
tokenContract: widget.contract,
|
||||||
widget.contract,
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue