Skip to content

Commit

Permalink
introduce AddressValidator
Browse files Browse the repository at this point in the history
  • Loading branch information
boscohyun committed May 21, 2024
1 parent 4fbfa1b commit 38f2564
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions Mimir/Validators/AddressValidator.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using Libplanet.Crypto;

namespace Mimir.Validators;

public static class AddressValidator
{
public static bool TryValidate(
string addressString,
out Address address,
out string? errorMessage)
{
try
{
address = new Address(addressString);
errorMessage = null;
return true;
}
catch (ArgumentException e)
{
address = default;
errorMessage = e.Message;
return false;
}
}
}

0 comments on commit 38f2564

Please sign in to comment.