mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-28 06:28:41 +01:00
fix: update DFX Buy provider currency support and parsing logic (#2516)
* fix: update DFX Buy provider currency support and parsing logic * fix: adjust Monero node URI handling for consistency with query parameters * fix: correct German translations for wallet-related text and terminology
This commit is contained in:
@@ -41,8 +41,22 @@ class DFXBuyProvider extends BuyProvider {
|
||||
static const _authPath = '/v1/auth';
|
||||
static const walletName = 'CakeWallet';
|
||||
|
||||
static const List<CryptoCurrency> _notSupportedCrypto = [];
|
||||
static const List<FiatCurrency> _notSupportedFiat = [];
|
||||
static final List<CryptoCurrency> _supportedCrypto = [
|
||||
CryptoCurrency.xmr,
|
||||
CryptoCurrency.btc,
|
||||
CryptoCurrency.eth,
|
||||
CryptoCurrency.maticpoly,
|
||||
CryptoCurrency.sol,
|
||||
CryptoCurrency.zano,
|
||||
CryptoCurrency.trx,
|
||||
];
|
||||
static final List<CryptoCurrency> _notSupportedCrypto = CryptoCurrency.all
|
||||
.where((crypto) => !_supportedCrypto.contains(crypto) || ["ETH", "POL"].contains(crypto.tag))
|
||||
.toList();
|
||||
|
||||
static final List<FiatCurrency> _supportedFiat = [FiatCurrency.chf, FiatCurrency.eur];
|
||||
static final List<FiatCurrency> _notSupportedFiat =
|
||||
FiatCurrency.all.where((fiat) => !_supportedFiat.contains(fiat)).toList();
|
||||
|
||||
@override
|
||||
String get title => 'DFX.swiss';
|
||||
@@ -406,7 +420,7 @@ class DFXBuyProvider extends BuyProvider {
|
||||
final responseBody = jsonDecode(body) as Map<String, dynamic>;
|
||||
final message = responseBody['message']?.toString() ?? '';
|
||||
|
||||
if (message.contains("address must match")) {
|
||||
if (message.contains("address must match") || message.contains("signature must match")) {
|
||||
return "The wallet type must match the selected currency";
|
||||
}
|
||||
|
||||
|
||||
@@ -236,6 +236,7 @@ abstract class NodeCreateOrEditViewModelBase with Store {
|
||||
throw Exception('Unexpected scan QR code value: value is empty');
|
||||
}
|
||||
|
||||
if (code.startsWith("monero_node:")) code = code.replaceFirst("monero_node:", "tcp://");
|
||||
if (!code.contains('://')) code = 'tcp://$code';
|
||||
|
||||
final uri = Uri.tryParse(code);
|
||||
@@ -243,19 +244,31 @@ abstract class NodeCreateOrEditViewModelBase with Store {
|
||||
throw Exception('Invalid QR code: Unable to parse or missing host.');
|
||||
}
|
||||
|
||||
final queryParams = uri.queryParameters;
|
||||
final ipAddress = uri.host;
|
||||
final port = uri.hasPort ? uri.port.toString() : '';
|
||||
final path = uri.path;
|
||||
final userInfo = uri.userInfo;
|
||||
var port = uri.hasPort ? uri.port.toString() : '';
|
||||
var rpcUser = userInfo.length == 2 ? userInfo[0] : '';
|
||||
var rpcPassword = userInfo.length == 2 ? userInfo[1] : '';
|
||||
|
||||
if (uri.scheme == "monero_node" && rpcUser.isEmpty && rpcPassword.isEmpty) {
|
||||
final queryParams = uri.queryParameters;
|
||||
if (rpcUser.isEmpty && rpcPassword.isEmpty) {
|
||||
rpcUser = queryParams['username'] ?? '';
|
||||
rpcPassword = queryParams['password'] ?? '';
|
||||
}
|
||||
|
||||
if (port.isEmpty) {
|
||||
port = queryParams['port'] ?? '';
|
||||
}
|
||||
|
||||
if (queryParams['protocol'] == 'https') {
|
||||
setSSL(true);
|
||||
}
|
||||
|
||||
if (queryParams['trusted'] == 'true') {
|
||||
setTrusted(true);
|
||||
}
|
||||
|
||||
await Future.delayed(Duration(milliseconds: 345));
|
||||
|
||||
setAddress(ipAddress);
|
||||
|
||||
Reference in New Issue
Block a user