Skip to content
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
8 changes: 0 additions & 8 deletions src/sdk/main/include/impl/EntityIdHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,14 +109,6 @@ template<typename T = uint64_t>
*/
[[nodiscard]] std::string checksum(std::string_view address, const LedgerId& ledgerId);

/**
* Determine if the input byte array could represent a long-zero address.
*
* @param address The byte array to determine if it could be a long-zero address.
* @return \c TRUE if the input byte array could represent a long-zero address, otherwise \c FALSE.
*/
[[nodiscard]] bool isLongZeroAddress(const std::vector<std::byte>& address);

/**
* Decode a Solidity address contained in a string to a byte array.
*
Expand Down
12 changes: 2 additions & 10 deletions src/sdk/main/src/AccountId.cc
Original file line number Diff line number Diff line change
Expand Up @@ -146,15 +146,7 @@ AccountId AccountId::fromEvmAddress(const EvmAddress& evmAddress, uint64_t shard
//-----
AccountId AccountId::fromSolidityAddress(std::string_view address)
{
const std::vector<std::byte> bytes = internal::EntityIdHelper::decodeSolidityAddress(address);
if (internal::EntityIdHelper::isLongZeroAddress(bytes))
{
return internal::EntityIdHelper::fromSolidityAddress<AccountId>(bytes);
}
else
{
return fromEvmAddress(address);
}
return fromEvmAddress(address);
}

//-----
Expand Down Expand Up @@ -262,7 +254,7 @@ AccountId& AccountId::populateAccountEvmAddress(const Client& client)
}

// build url for Mirror Node
std::string url = "https://" + mirrorNetworks.front() + "/api/v1/accounts/0.0." + std::to_string(mAccountNum.value());
std::string url = "https://" + mirrorNetworks.front() + "/api/v1/accounts/" + toString();

// fetch account data for this account from Mirror Node
std::string response = internal::HttpClient::invokeREST(url, "GET");
Expand Down
10 changes: 1 addition & 9 deletions src/sdk/main/src/ContractId.cc
Original file line number Diff line number Diff line change
Expand Up @@ -103,15 +103,7 @@ ContractId ContractId::fromEvmAddress(const EvmAddress& evmAddress, uint64_t sha
//-----
ContractId ContractId::fromSolidityAddress(std::string_view address)
{
const std::vector<std::byte> bytes = internal::EntityIdHelper::decodeSolidityAddress(address);
if (internal::EntityIdHelper::isLongZeroAddress(bytes))
{
return internal::EntityIdHelper::fromSolidityAddress<ContractId>(bytes);
}
else
{
return fromEvmAddress(address);
}
return fromEvmAddress(address);
}

//-----
Expand Down
15 changes: 0 additions & 15 deletions src/sdk/main/src/impl/EntityIdHelper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -160,21 +160,6 @@ std::string checksum(std::string_view address, const LedgerId& ledgerId)
return checksumStr;
}

//-----
bool isLongZeroAddress(const std::vector<std::byte>& address)
{
// The address is a possible long-zero address if the first 12 bytes are zeros.
for (int i = 0; i < 12; ++i)
{
if (address.at(i) != std::byte(0x0))
{
return false;
}
}

return true;
}

//-----
std::vector<std::byte> decodeSolidityAddress(std::string_view address)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,6 @@ using namespace Hiero;

class AccountCreateTransactionIntegrationTests : public BaseIntegrationTest
{
protected:
bool isLongZero(const std::vector<std::byte> address)
{
for (int i = 0; i < 12; i++)
{
if (address[i] != std::byte{ 0 })
{
return false;
}
}
return true;
}
};

//-----
Expand Down Expand Up @@ -656,10 +644,4 @@ TEST_F(AccountCreateTransactionIntegrationTests, CreateTransactionWithAliasAndKe
EXPECT_NO_THROW(txReceipt = txResponse.getReceipt(getTestClient()));

ASSERT_EQ(txReceipt.mAccountId.has_value(), true);
AccountId accountId = txReceipt.mAccountId.value();

AccountInfo accountInfo;
EXPECT_NO_THROW(accountInfo = AccountInfoQuery().setAccountId(accountId).execute(getTestClient()));

EXPECT_FALSE(isLongZero(internal::HexConverter::hexToBytes(accountInfo.mContractAccountId)));
}
Loading