From f2c5dccdc7a8fa4f33772411ed873b73038bdb34 Mon Sep 17 00:00:00 2001 From: sergey p Date: Fri, 18 Feb 2022 00:47:54 +0300 Subject: [PATCH] Added comment and using nullopts instead of empty strings --- browser/brave_wallet/brave_wallet_service_unittest.cc | 10 +++++----- components/brave_wallet/common/brave_wallet.mojom | 2 ++ .../brave_wallet/renderer/brave_wallet_js_handler.cc | 1 - 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/browser/brave_wallet/brave_wallet_service_unittest.cc b/browser/brave_wallet/brave_wallet_service_unittest.cc index bef3d01cfa75..93955a3dc162 100644 --- a/browser/brave_wallet/brave_wallet_service_unittest.cc +++ b/browser/brave_wallet/brave_wallet_service_unittest.cc @@ -1317,7 +1317,7 @@ TEST_F(BraveWalletServiceUnitTest, SignMessageHardware) { std::string message = "0xAB"; auto request1 = mojom::SignMessageRequest::New( 1, address, std::string(message.begin(), message.end()), false, - std::string(), std::string()); + absl::nullopt, absl::nullopt); bool callback_is_called = false; service_->AddSignMessageRequest( std::move(request1), base::BindLambdaForTesting( @@ -1340,7 +1340,7 @@ TEST_F(BraveWalletServiceUnitTest, SignMessageHardware) { std::string expected_error = "error"; auto request2 = mojom::SignMessageRequest::New( 2, address, std::string(message.begin(), message.end()), false, - std::string(), std::string()); + absl::nullopt, absl::nullopt); service_->AddSignMessageRequest( std::move(request2), base::BindLambdaForTesting( [&](bool approved, const std::string& signature, @@ -1363,7 +1363,7 @@ TEST_F(BraveWalletServiceUnitTest, SignMessage) { std::string message = "0xAB"; auto request1 = mojom::SignMessageRequest::New( 1, address, std::string(message.begin(), message.end()), false, - std::string(), std::string()); + absl::nullopt, absl::nullopt); bool callback_is_called = false; service_->AddSignMessageRequest( std::move(request1), base::BindLambdaForTesting( @@ -1382,7 +1382,7 @@ TEST_F(BraveWalletServiceUnitTest, SignMessage) { std::string expected_error = "error"; auto request2 = mojom::SignMessageRequest::New( 2, address, std::string(message.begin(), message.end()), false, - std::string(), std::string()); + absl::nullopt, absl::nullopt); service_->AddSignMessageRequest( std::move(request2), base::BindLambdaForTesting( [&](bool approved, const std::string& signature, @@ -1575,7 +1575,7 @@ TEST_F(BraveWalletServiceUnitTest, Reset) { std::string message = "0xAB"; auto request1 = mojom::SignMessageRequest::New( 1, address, std::string(message.begin(), message.end()), false, - std::string(), std::string()); + absl::nullopt, absl::nullopt); service_->AddSignMessageRequest( std::move(request1), base::BindLambdaForTesting( diff --git a/components/brave_wallet/common/brave_wallet.mojom b/components/brave_wallet/common/brave_wallet.mojom index 227dd07c9844..615da446554c 100644 --- a/components/brave_wallet/common/brave_wallet.mojom +++ b/components/brave_wallet/common/brave_wallet.mojom @@ -805,6 +805,8 @@ struct SignMessageRequest { string address; string message; bool is_eip712; + // These fields are for hardware eip712 signing and + // Should be used only if is_eip712 is true string? domain_hash; string? primary_hash; }; diff --git a/components/brave_wallet/renderer/brave_wallet_js_handler.cc b/components/brave_wallet/renderer/brave_wallet_js_handler.cc index da516b6e62c2..9cc0425c30e6 100644 --- a/components/brave_wallet/renderer/brave_wallet_js_handler.cc +++ b/components/brave_wallet/renderer/brave_wallet_js_handler.cc @@ -11,7 +11,6 @@ #include "base/json/json_writer.h" #include "base/no_destructor.h" -#include "base/strings/string_number_conversions.h" #include "base/strings/utf_string_conversions.h" #include "brave/components/brave_wallet/common/eth_request_helper.h" #include "brave/components/brave_wallet/common/hex_utils.h"