Skip to content

Commit

Permalink
fix review
Browse files Browse the repository at this point in the history
  • Loading branch information
supermassive committed Nov 18, 2024
1 parent 4328a73 commit 58b7e1e
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions components/brave_wallet/common/eth_sign_typed_data_helper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

#include "brave/components/brave_wallet/common/eth_sign_typed_data_helper.h"

#include <limits>
#include <optional>
#include <string_view>
#include <utility>
Expand Down Expand Up @@ -66,9 +65,9 @@ void EthSignTypedDataHelper::FindAllDependencyTypes(
}
const std::string* type = field.GetDict().FindString("type");
if (type) {
auto type_split = base::SplitStringPiece(
const auto type_split = base::SplitStringPiece(
*type, "[", base::KEEP_WHITESPACE, base::SPLIT_WANT_ALL);
std::string lookup_type = *type;
std::string_view lookup_type = *type;
if (type_split.size() == 2) {
lookup_type = type_split[0];
}
Expand Down Expand Up @@ -204,15 +203,14 @@ EthSignTypedDataHelper::EncodeField(const std::string_view type,
if (!value.is_list()) {
return std::nullopt;
}
auto type_split = base::SplitStringPiece(type, "[", base::KEEP_WHITESPACE,
base::SPLIT_WANT_ALL);
const auto type_split = base::SplitStringPiece(
type, "[", base::KEEP_WHITESPACE, base::SPLIT_WANT_ALL);
if (type_split.size() != 2) {
return std::nullopt;
}
auto array_type = type_split[0];
std::vector<uint8_t> array_result;
for (const auto& item : value.GetList()) {
auto encoded_item = EncodeField(array_type, item);
auto encoded_item = EncodeField(type_split[0], item);
if (!encoded_item) {
return std::nullopt;
}
Expand Down

0 comments on commit 58b7e1e

Please sign in to comment.