mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-22 06:28:39 +02:00
minor fixes
This commit is contained in:
@@ -17,29 +17,16 @@ import 'package:cw_core/utils/print_verbose.dart';
|
||||
import 'package:cw_core/utils/proxy_wrapper.dart';
|
||||
|
||||
class JupiterExchangeProvider extends ExchangeProvider {
|
||||
JupiterExchangeProvider() : super(pairList: _getSupportedPairs());
|
||||
JupiterExchangeProvider();
|
||||
|
||||
// Jupiter only supports Solana tokens
|
||||
static const List<CryptoCurrency> _notSupported = [];
|
||||
|
||||
static List<ExchangePair> _getSupportedPairs() {
|
||||
// Only support Solana and Solana tokens
|
||||
final solanaCurrencies = CryptoCurrency.all
|
||||
static final List<CryptoCurrency> _supportedCurrencies = CryptoCurrency.all
|
||||
.where((c) => c.tag == 'SOL' || c == CryptoCurrency.sol)
|
||||
.where((c) => !_notSupported.contains(c))
|
||||
.toList();
|
||||
|
||||
final pairs = <ExchangePair>[];
|
||||
for (final from in solanaCurrencies) {
|
||||
for (final to in solanaCurrencies) {
|
||||
if (from != to) {
|
||||
pairs.add(ExchangePair(from: from, to: to, reverse: true));
|
||||
}
|
||||
}
|
||||
}
|
||||
return pairs;
|
||||
}
|
||||
|
||||
static const _baseUrl = 'api.jup.ag';
|
||||
static const _orderPath = '/ultra/v1/order';
|
||||
static const _executePath = '/ultra/v1/execute';
|
||||
@@ -148,6 +135,10 @@ class JupiterExchangeProvider extends ExchangeProvider {
|
||||
required bool isReceiveAmount,
|
||||
}) async {
|
||||
try {
|
||||
// must support both
|
||||
if (!_supportedCurrencies.contains(from) || !_supportedCurrencies.contains(to)) {
|
||||
return 0.0;
|
||||
}
|
||||
final inputMint = _getTokenMint(from);
|
||||
final outputMint = _getTokenMint(to);
|
||||
|
||||
@@ -235,6 +226,12 @@ class JupiterExchangeProvider extends ExchangeProvider {
|
||||
required bool isSendAll,
|
||||
}) async {
|
||||
try {
|
||||
// must support both
|
||||
if (!_supportedCurrencies.contains(request.fromCurrency) ||
|
||||
!_supportedCurrencies.contains(request.toCurrency)) {
|
||||
throw "not supported currencies";
|
||||
}
|
||||
|
||||
final inputMint = _getTokenMint(request.fromCurrency);
|
||||
final outputMint = _getTokenMint(request.toCurrency);
|
||||
|
||||
|
||||
@@ -300,7 +300,7 @@ class _AdvancedPrivacySettingsBodyState extends State<_AdvancedPrivacySettingsBo
|
||||
bottomSectionPadding: EdgeInsets.all(24),
|
||||
bottomSection: Column(
|
||||
children: [
|
||||
const SizedBox(height: 24),
|
||||
const SizedBox(height: 4),
|
||||
LayoutBuilder(
|
||||
builder: (_, constraints) => SizedBox(
|
||||
width: constraints.maxWidth * 0.8,
|
||||
|
||||
@@ -361,7 +361,9 @@ class SendCardState extends State<SendCard> with AutomaticKeepAliveClientMixin<S
|
||||
}
|
||||
|
||||
await Future.delayed(const Duration(seconds: 2));
|
||||
if (loadingBottomSheetContext != null && loadingBottomSheetContext!.mounted) {
|
||||
if (loadingBottomSheetContext != null &&
|
||||
loadingBottomSheetContext!.mounted &&
|
||||
Navigator.canPop(loadingBottomSheetContext!)) {
|
||||
Navigator.of(loadingBottomSheetContext!).pop();
|
||||
}
|
||||
|
||||
|
||||
@@ -213,7 +213,7 @@ abstract class ExchangeViewModelBase extends WalletChangeListenerViewModel with
|
||||
].contains(wallet.type);
|
||||
|
||||
bool get hideAddressAfterExchange =>
|
||||
[WalletType.monero, WalletType.wownero].contains(wallet.type);
|
||||
[WalletType.monero, WalletType.wownero, WalletType.zcash].contains(wallet.type);
|
||||
|
||||
bool _useTorOnly;
|
||||
final Box<Trade> trades;
|
||||
|
||||
Reference in New Issue
Block a user