Skip to content

Commit

Permalink
feat(accounts): add MinBalance constructor that takes an `AlgoSdk.I…
Browse files Browse the repository at this point in the history
…ndexer.Account` result
  • Loading branch information
jasonboukheir committed Jun 13, 2022
1 parent 8b6d577 commit 03dc71a
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion Runtime/CareBoo.AlgoSdk/Accounts/MinBalance.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using AlgodAccount = AlgoSdk.Algod.Account;
using IndexerAccount = AlgoSdk.Indexer.Account;

namespace AlgoSdk
{
Expand Down Expand Up @@ -71,7 +72,7 @@ namespace AlgoSdk
/// <summary>
/// Get the minimum balance of an account.
/// </summary>
/// <param name="accountInfo">The <see cref="AccountInfo"/> to obtain the minimum balance.</param>
/// <param name="accountInfo">The <see cref="AlgoSdk.Algod.Account"/> to obtain the minimum balance.</param>
public MinBalance(AlgodAccount accountInfo)
{
Assets = (ulong)(accountInfo.Assets?.LongLength ?? 0L);
Expand All @@ -82,6 +83,20 @@ public MinBalance(AlgodAccount accountInfo)
ApplicationSchemaByteSlices = accountInfo.AppsTotalSchema.NumByteSlice;
}

/// <summary>
/// Get the minimum balance of an account.
/// </summary>
/// <param name="accountInfo">The <see cref="AlgoSdk.Indexer.Account"/> to obtain the minimum balance.</param>
public MinBalance(IndexerAccount accountInfo)
{
Assets = (ulong)(accountInfo.Assets?.LongLength ?? 0L);
ApplicationsOptedIn = (ulong)(accountInfo.AppsLocalState?.LongLength ?? 0L);
ApplicationsCreated = (ulong)(accountInfo.CreatedApps?.LongLength ?? 0L);
ApplicationExtraPages = accountInfo.AppsTotalExtraPages;
ApplicationSchemaUints = accountInfo.AppsTotalSchema.NumUint;
ApplicationSchemaByteSlices = accountInfo.AppsTotalSchema.NumByteSlice;
}

/// <summary>
/// Get the minimum balance from explicit data.
/// </summary>
Expand Down

0 comments on commit 03dc71a

Please sign in to comment.