mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-06-29 12:59:52 +00:00
Cw 805 fix bch refund address (#1782)
* fix bch address format for exolix, stealth, thorchain, simpleswap * exclude SP and MWEB from the exchange address book * address pr review comments
This commit is contained in:
parent
b8ffd47f06
commit
459f0d352d
6 changed files with 32 additions and 18 deletions
|
@ -141,8 +141,8 @@ class ExolixExchangeProvider extends ExchangeProvider {
|
|||
'coinTo': _normalizeCurrency(request.toCurrency),
|
||||
'networkFrom': _networkFor(request.fromCurrency),
|
||||
'networkTo': _networkFor(request.toCurrency),
|
||||
'withdrawalAddress': request.toAddress,
|
||||
'refundAddress': request.refundAddress,
|
||||
'withdrawalAddress': _normalizeAddress(request.toAddress),
|
||||
'refundAddress': _normalizeAddress(request.refundAddress),
|
||||
'rateType': _getRateType(isFixedRateMode),
|
||||
'apiToken': apiKey,
|
||||
};
|
||||
|
@ -275,4 +275,7 @@ class ExolixExchangeProvider extends ExchangeProvider {
|
|||
return tag;
|
||||
}
|
||||
}
|
||||
|
||||
String _normalizeAddress(String address) =>
|
||||
address.startsWith('bitcoincash:') ? address.replaceFirst('bitcoincash:', '') : address;
|
||||
}
|
||||
|
|
|
@ -129,8 +129,8 @@ class SimpleSwapExchangeProvider extends ExchangeProvider {
|
|||
"currency_to": _normalizeCurrency(request.toCurrency),
|
||||
"amount": request.fromAmount,
|
||||
"fixed": isFixedRateMode,
|
||||
"user_refund_address": request.refundAddress,
|
||||
"address_to": request.toAddress
|
||||
"user_refund_address": _normalizeAddress(request.refundAddress),
|
||||
"address_to": _normalizeAddress(request.toAddress)
|
||||
};
|
||||
final uri = Uri.https(apiAuthority, createExchangePath, params);
|
||||
|
||||
|
@ -243,4 +243,7 @@ class SimpleSwapExchangeProvider extends ExchangeProvider {
|
|||
return currency.title.toLowerCase();
|
||||
}
|
||||
}
|
||||
|
||||
String _normalizeAddress(String address) =>
|
||||
address.startsWith('bitcoincash:') ? address.replaceFirst('bitcoincash:', '') : address;
|
||||
}
|
||||
|
|
|
@ -129,8 +129,8 @@ class StealthExExchangeProvider extends ExchangeProvider {
|
|||
if (isFixedRateMode) 'rate_id': rateId,
|
||||
'amount':
|
||||
isFixedRateMode ? double.parse(request.toAmount) : double.parse(request.fromAmount),
|
||||
'address': request.toAddress,
|
||||
'refund_address': request.refundAddress,
|
||||
'address': _normalizeAddress(request.toAddress),
|
||||
'refund_address': _normalizeAddress(request.refundAddress),
|
||||
'additional_fee_percent': _additionalFeePercent,
|
||||
};
|
||||
|
||||
|
@ -296,4 +296,7 @@ class StealthExExchangeProvider extends ExchangeProvider {
|
|||
|
||||
return currency.tag!.toLowerCase();
|
||||
}
|
||||
|
||||
String _normalizeAddress(String address) =>
|
||||
address.startsWith('bitcoincash:') ? address.replaceFirst('bitcoincash:', '') : address;
|
||||
}
|
||||
|
|
|
@ -116,9 +116,7 @@ class ThorChainExchangeProvider extends ExchangeProvider {
|
|||
required bool isFixedRateMode,
|
||||
required bool isSendAll,
|
||||
}) async {
|
||||
String formattedToAddress = request.toAddress.startsWith('bitcoincash:')
|
||||
? request.toAddress.replaceFirst('bitcoincash:', '')
|
||||
: request.toAddress;
|
||||
|
||||
|
||||
final formattedFromAmount = double.parse(request.fromAmount);
|
||||
|
||||
|
@ -126,11 +124,11 @@ class ThorChainExchangeProvider extends ExchangeProvider {
|
|||
'from_asset': _normalizeCurrency(request.fromCurrency),
|
||||
'to_asset': _normalizeCurrency(request.toCurrency),
|
||||
'amount': _doubleToThorChainString(formattedFromAmount),
|
||||
'destination': formattedToAddress,
|
||||
'destination': _normalizeAddress(request.toAddress),
|
||||
'affiliate': _affiliateName,
|
||||
'affiliate_bps': _affiliateBps,
|
||||
'refund_address':
|
||||
isRefundAddressSupported.contains(request.fromCurrency) ? request.refundAddress : '',
|
||||
isRefundAddressSupported.contains(request.fromCurrency) ? _normalizeAddress(request.refundAddress) : '',
|
||||
};
|
||||
|
||||
final responseJSON = await _getSwapQuote(params);
|
||||
|
@ -288,4 +286,7 @@ class ThorChainExchangeProvider extends ExchangeProvider {
|
|||
|
||||
return currentState;
|
||||
}
|
||||
|
||||
String _normalizeAddress(String address) =>
|
||||
address.startsWith('bitcoincash:') ? address.replaceFirst('bitcoincash:', '') : address;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue