-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(net): add some extension methods to Substrate.Gear.Client (#609)
- Loading branch information
1 parent
418c351
commit 0e0c513
Showing
3 changed files
with
117 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
net/src/Substrate.Gear.Client/Model/Types/AccountExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
using EnsureThat; | ||
using Substrate.NET.Schnorrkel; | ||
using Substrate.NetApi.Model.Types; | ||
|
||
namespace Substrate.Gear.Client.Model.Types; | ||
|
||
public static class AccountExtensions | ||
{ | ||
/// <summary> | ||
/// Returns a public key of the account. | ||
/// </summary> | ||
/// <param name="account"></param> | ||
/// <returns></returns> | ||
public static PublicKey GetPublicKey(this Account account) | ||
{ | ||
EnsureArg.IsNotNull(account, nameof(account)); | ||
EnsureArg.HasItems(account.Bytes, nameof(account.Bytes)); | ||
|
||
return new PublicKey(account.Bytes); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters