From 48c48bd3db3ec2c309d373d3017a27ecc4377449 Mon Sep 17 00:00:00 2001 From: M Date: Tue, 15 Dec 2020 20:41:06 +0200 Subject: [PATCH 1/3] Force added User-Agent header field to all requests to xmr.to --- .../xmrto/xmrto_exchange_provider.dart | 26 +++++++++---------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/lib/exchange/xmrto/xmrto_exchange_provider.dart b/lib/exchange/xmrto/xmrto_exchange_provider.dart index 26adaedef..cc63ff1a3 100644 --- a/lib/exchange/xmrto/xmrto_exchange_provider.dart +++ b/lib/exchange/xmrto/xmrto_exchange_provider.dart @@ -27,11 +27,14 @@ class XMRTOExchangeProvider extends ExchangeProvider { static const _orderParameterUriSuffix = '/order_parameter_query'; static const _orderStatusUriSuffix = '/order_status_query/'; static const _orderCreateUriSuffix = '/order_create/'; + static const _headers = { + 'Content-Type': 'application/json', + 'User-Agent': userAgent + }; static Future _checkIsAvailable() async { const url = originalApiUri + _orderParameterUriSuffix; - final response = - await get(url, headers: {'Content-Type': 'application/json'}); + final response = await get(url, headers: _headers); return !(response.statusCode == 403); } @@ -91,9 +94,8 @@ class XMRTOExchangeProvider extends ExchangeProvider { Future createTrade({TradeRequest request}) async { final _request = request as XMRTOTradeRequest; final url = originalApiUri + _orderCreateUriSuffix; - final _amount = _request.isBTCRequest - ? _request.receiveAmount - : _request.amount; + final _amount = + _request.isBTCRequest ? _request.receiveAmount : _request.amount; final _amountCurrency = _request.isBTCRequest ? _request.to.toString() @@ -112,8 +114,8 @@ class XMRTOExchangeProvider extends ExchangeProvider { 'amount_currency': _amountCurrency, 'btc_dest_address': _request.address }; - final response = await post(url, - headers: {'Content-Type': 'application/json'}, body: json.encode(body)); + final response = + await post(url, headers: _headers, body: json.encode(body)); if (response.statusCode != 201) { if (response.statusCode == 400) { @@ -141,13 +143,10 @@ class XMRTOExchangeProvider extends ExchangeProvider { @override Future findTradeById({@required String id}) async { - const headers = { - 'Content-Type': 'application/json', - 'User-Agent': userAgent - }; final url = originalApiUri + _orderStatusUriSuffix; final body = {'uuid': id}; - final response = await post(url, headers: headers, body: json.encode(body)); + final response = + await post(url, headers: _headers, body: json.encode(body)); if (response.statusCode != 200) { if (response.statusCode == 400) { @@ -210,8 +209,7 @@ class XMRTOExchangeProvider extends ExchangeProvider { Future _fetchRates() async { try { final url = originalApiUri + _orderParameterUriSuffix; - final response = - await get(url, headers: {'Content-Type': 'application/json'}); + final response = await get(url, headers: _headers); final responseJSON = json.decode(response.body) as Map; final price = double.parse(responseJSON['price'] as String); From 3ba4a4a367b1e6ee14993d125999004404320288 Mon Sep 17 00:00:00 2001 From: M Date: Tue, 15 Dec 2020 20:41:28 +0200 Subject: [PATCH 2/3] Changed version to 4.0.10 --- ios/Runner.xcodeproj/project.pbxproj | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index ca92f3f09..f377c51a2 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -371,7 +371,7 @@ "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - MARKETING_VERSION = 4.0.9; + MARKETING_VERSION = 4.0.10; PRODUCT_BUNDLE_IDENTIFIER = com.fotolockr.cakewallet; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; @@ -511,7 +511,7 @@ "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - MARKETING_VERSION = 4.0.9; + MARKETING_VERSION = 4.0.10; PRODUCT_BUNDLE_IDENTIFIER = com.fotolockr.cakewallet; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; @@ -545,7 +545,7 @@ "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - MARKETING_VERSION = 4.0.9; + MARKETING_VERSION = 4.0.10; PRODUCT_BUNDLE_IDENTIFIER = com.fotolockr.cakewallet; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; From 96deee0b2de152404879a6425486d021a6e510a9 Mon Sep 17 00:00:00 2001 From: M Date: Tue, 15 Dec 2020 21:04:24 +0200 Subject: [PATCH 3/3] Changed version to 4.0.91 --- ios/Runner.xcodeproj/project.pbxproj | 6 +++--- pubspec.yaml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index f377c51a2..99a1c5f3c 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -371,7 +371,7 @@ "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - MARKETING_VERSION = 4.0.10; + MARKETING_VERSION = 4.0.91; PRODUCT_BUNDLE_IDENTIFIER = com.fotolockr.cakewallet; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; @@ -511,7 +511,7 @@ "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - MARKETING_VERSION = 4.0.10; + MARKETING_VERSION = 4.0.91; PRODUCT_BUNDLE_IDENTIFIER = com.fotolockr.cakewallet; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; @@ -545,7 +545,7 @@ "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - MARKETING_VERSION = 4.0.10; + MARKETING_VERSION = 4.0.91; PRODUCT_BUNDLE_IDENTIFIER = com.fotolockr.cakewallet; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; diff --git a/pubspec.yaml b/pubspec.yaml index c8b1f53c4..656f9b6b2 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -11,7 +11,7 @@ description: Cake Wallet. # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. # Read more about iOS versioning at # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html -version: 4.0.9+21 +version: 4.0.91+22 environment: sdk: ">=2.7.0 <3.0.0"