Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uplift 1.41.x Enable Solana dApps by default on desktop (BUNDLE) #14000

Merged
merged 11 commits into from
Jul 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
262 changes: 238 additions & 24 deletions browser/brave_wallet/solana_provider_browsertest.cc

Large diffs are not rendered by default.

33 changes: 14 additions & 19 deletions browser/brave_wallet/solana_provider_impl_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,10 @@ class SolanaProviderImplUnitTest : public testing::Test {
base::Value result_out(base::Value::Type::DICTIONARY);
base::RunLoop run_loop;
provider_->SignAndSendTransaction(
encoded_serialized_message, absl::nullopt,
mojom::SolanaSignTransactionParam::New(
encoded_serialized_message,
std::vector<mojom::SignaturePubkeyPairPtr>()),
absl::nullopt,
base::BindLambdaForTesting([&](mojom::SolanaProviderError error,
const std::string& error_message,
base::Value result) {
Expand All @@ -277,7 +280,9 @@ class SolanaProviderImplUnitTest : public testing::Test {
std::vector<uint8_t> result_out;
base::RunLoop run_loop;
provider_->SignTransaction(
encoded_serialized_message,
mojom::SolanaSignTransactionParam::New(
encoded_serialized_message,
std::vector<mojom::SignaturePubkeyPairPtr>()),
base::BindLambdaForTesting([&](mojom::SolanaProviderError error,
const std::string& error_message,
const std::vector<uint8_t>& result) {
Expand All @@ -296,8 +301,14 @@ class SolanaProviderImplUnitTest : public testing::Test {
const std::string& expected_error_message) {
std::vector<std::vector<uint8_t>> result_out;
base::RunLoop run_loop;
std::vector<mojom::SolanaSignTransactionParamPtr> params;
for (const auto& encoded_serialized_message : encoded_serialized_messages) {
params.push_back(mojom::SolanaSignTransactionParam::New(
encoded_serialized_message,
std::vector<mojom::SignaturePubkeyPairPtr>()));
}
provider_->SignAllTransactions(
encoded_serialized_messages,
std::move(params),
base::BindLambdaForTesting(
[&](mojom::SolanaProviderError error,
const std::string& error_message,
Expand Down Expand Up @@ -634,22 +645,6 @@ TEST_F(SolanaProviderImplUnitTest, GetDeserializedMessage) {
Base58Encode(*serialized_msg),
"3Lu176FQzbQJCc8iL9PnmALbpMPhZeknoturApnXRDJw");
EXPECT_FALSE(deserialized_msg);

// Mutiple signers should return absl::nullopt.
SolanaInstruction instruction2(
kSolanaSystemProgramId,
{SolanaAccountMeta(address, true, true),
SolanaAccountMeta("3Lu176FQzbQJCc8iL9PnmALbpMPhZeknoturApnXRDJw", true,
true)},
{2, 0, 0, 0, 128, 150, 152, 0, 0, 0, 0, 0});
SolanaMessage msg2("9sHcv6xwn9YkB8nxTUGKDwPwNnmqVp5oAXxU8Fdkm4J6", 0, address,
{instruction2});
serialized_msg = msg2.Serialize(nullptr);
ASSERT_TRUE(serialized_msg);

deserialized_msg =
provider_->GetDeserializedMessage(Base58Encode(*serialized_msg), address);
EXPECT_FALSE(deserialized_msg);
}

TEST_F(SolanaProviderImplUnitTest, SignTransactionAPIs) {
Expand Down
Loading