Skip to content

Commit 0414518

Browse files
docs: added missing docs (#144)
1 parent 84492ec commit 0414518

315 files changed

Lines changed: 4846 additions & 10 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

StellarDotnetSdk/Accounts/Account.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ public KeyPair KeyPair
6767
}
6868
}
6969

70+
/// <summary>
71+
/// Gets the muxed account identifier associated with this account.
72+
/// </summary>
7073
public IAccountId MuxedAccount { get; }
7174

7275
/// <summary>

StellarDotnetSdk/Accounts/IAccountId.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,21 @@ namespace StellarDotnetSdk.Accounts;
77
/// </summary>
88
public interface IAccountId
99
{
10+
/// <summary>Gets the XDR muxed account representation.</summary>
1011
Xdr.MuxedAccount MuxedAccount { get; }
12+
13+
/// <summary>Gets the <see cref="KeyPair" /> used for signing transactions.</summary>
1114
KeyPair SigningKey { get; }
15+
16+
/// <summary>Gets the raw Ed25519 public key bytes.</summary>
1217
byte[] PublicKey { get; }
18+
19+
/// <summary>Gets the StrKey-encoded address (G... for standard accounts, M... for muxed accounts).</summary>
1320
string Address { get; }
21+
22+
/// <summary>Gets the StrKey-encoded account ID (G... for standard accounts, M... for muxed accounts).</summary>
1423
string AccountId { get; }
24+
25+
/// <summary>Gets a value indicating whether this is a muxed (multiplexed) account.</summary>
1526
bool IsMuxedAccount { get; }
1627
}

StellarDotnetSdk/Accounts/ITransactionBuilderAccount.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,16 @@
77
/// </summary>
88
public interface ITransactionBuilderAccount
99
{
10+
/// <summary>Gets the StrKey-encoded account ID.</summary>
1011
string AccountId { get; }
1112

13+
/// <summary>Gets the <see cref="Accounts.KeyPair" /> of the account.</summary>
1214
KeyPair KeyPair { get; }
15+
16+
/// <summary>Gets the muxed account identifier associated with this account.</summary>
1317
IAccountId MuxedAccount { get; }
18+
19+
/// <summary>Gets the current sequence number of the account on the Stellar ledger.</summary>
1420
long SequenceNumber { get; }
1521

1622
/// <summary>

StellarDotnetSdk/Accounts/KeyPair.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,13 @@ public static KeyPair FromAccountId(string accountId)
287287
return FromPublicKey(decoded);
288288
}
289289

290+
/// <summary>
291+
/// Derives a Stellar <see cref="KeyPair" /> from a BIP-39 mnemonic seed using the
292+
/// standard Stellar derivation path (<c>m/44'/148'/{accountIndex}'</c>).
293+
/// </summary>
294+
/// <param name="seed">The hex-encoded BIP-39 seed.</param>
295+
/// <param name="accountIndex">The account index in the derivation path.</param>
296+
/// <returns>A <see cref="KeyPair" /> derived from the given seed and account index.</returns>
290297
public static KeyPair FromBIP39Seed(string seed, uint accountIndex)
291298
{
292299
var bip32 = new BIP32();
@@ -295,6 +302,13 @@ public static KeyPair FromBIP39Seed(string seed, uint accountIndex)
295302
return FromSecretSeed(bip32.DerivePath(path, seed).Key);
296303
}
297304

305+
/// <summary>
306+
/// Derives a Stellar <see cref="KeyPair" /> from a BIP-39 mnemonic seed using the
307+
/// standard Stellar derivation path (<c>m/44'/148'/{accountIndex}'</c>).
308+
/// </summary>
309+
/// <param name="seedBytes">The raw BIP-39 seed bytes.</param>
310+
/// <param name="accountIndex">The account index in the derivation path.</param>
311+
/// <returns>A <see cref="KeyPair" /> derived from the given seed and account index.</returns>
298312
public static KeyPair FromBIP39Seed(byte[] seedBytes, uint accountIndex)
299313
{
300314
var seed = seedBytes.ToStringHex();

StellarDotnetSdk/Accounts/MuxedAccount.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,18 @@
33

44
namespace StellarDotnetSdk.Accounts;
55

6+
/// <summary>
7+
/// Provides factory methods for creating account identifiers from XDR muxed account representations.
8+
/// </summary>
69
public static class MuxedAccount
710
{
11+
/// <summary>
12+
/// Creates an <see cref="IAccountId" /> from an XDR <see cref="Xdr.MuxedAccount" />.
13+
/// Returns a <see cref="KeyPair" /> for standard Ed25519 accounts, or a
14+
/// <see cref="MuxedAccountMed25519" /> for multiplexed accounts.
15+
/// </summary>
16+
/// <param name="muxedAccount">The XDR muxed account to convert.</param>
17+
/// <returns>An <see cref="IAccountId" /> representing the account.</returns>
818
public static IAccountId FromXdrMuxedAccount(Xdr.MuxedAccount muxedAccount)
919
{
1020
return muxedAccount.Discriminant.InnerValue switch

StellarDotnetSdk/Accounts/MuxedAccountMed25519.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,13 @@ public MuxedAccountMed25519(KeyPair key, ulong id)
2222
Key = key ?? throw new ArgumentNullException(nameof(key));
2323
}
2424

25+
/// <summary>Gets the 64-bit numeric identifier that distinguishes this muxed account.</summary>
2526
public ulong Id { get; }
27+
28+
/// <summary>Gets the underlying Ed25519 <see cref="KeyPair" /> of the muxed account.</summary>
2629
public KeyPair Key { get; }
30+
31+
/// <summary>Gets the raw Ed25519 public key bytes of the underlying account.</summary>
2732
public byte[] PublicKey => Key.PublicKey;
2833

2934
/// <summary>

StellarDotnetSdk/Amount.cs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,41 @@
33

44
namespace StellarDotnetSdk;
55

6+
/// <summary>
7+
/// Utility class for converting between Stellar amount representations. Stellar stores amounts as
8+
/// 64-bit integers with 7 decimal places of precision (1 XLM = 10,000,000 stroops).
9+
/// </summary>
610
public static class Amount
711
{
812
private static readonly decimal One = new(10000000);
913

1014

15+
/// <summary>
16+
/// Converts a decimal value to its culture-invariant string representation.
17+
/// </summary>
18+
/// <param name="d">The decimal value to convert.</param>
19+
/// <returns>A culture-invariant string representation of the decimal.</returns>
1120
public static string DecimalToString(decimal d)
1221
{
1322
return d.ToString(CultureInfo.InvariantCulture);
1423
}
1524

25+
/// <summary>
26+
/// Converts an XDR amount (in stroops) to a human-readable decimal string.
27+
/// </summary>
28+
/// <param name="value">The XDR amount in stroops (1 unit = 10,000,000 stroops).</param>
29+
/// <returns>A decimal string representation of the amount.</returns>
1630
public static string FromXdr(long value)
1731
{
1832
var amount = decimal.Divide(new decimal(value), One);
1933
return DecimalToString(amount);
2034
}
2135

36+
/// <summary>
37+
/// Converts a human-readable decimal string to an XDR amount (in stroops).
38+
/// </summary>
39+
/// <param name="value">The decimal string to convert (e.g., "10.5").</param>
40+
/// <returns>The amount in stroops as a 64-bit integer.</returns>
2241
public static long ToXdr(string value)
2342
{
2443
if (string.IsNullOrEmpty(value))

StellarDotnetSdk/Assets/Asset.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,13 @@ public abstract class Asset
2626
/// </summary>
2727
public abstract string Type { get; }
2828

29+
/// <summary>
30+
/// Creates an <see cref="Asset" /> from its canonical string form.
31+
/// Native assets use <c>"native"</c>; credit assets use <c>"CODE:ISSUER"</c>.
32+
/// </summary>
33+
/// <param name="canonicalForm">The canonical asset string (e.g., <c>"native"</c> or <c>"USD:GABC..."</c>).</param>
34+
/// <returns>The corresponding <see cref="Asset" /> instance.</returns>
35+
/// <exception cref="ArgumentException">Thrown when the canonical form is invalid.</exception>
2936
public static Asset Create(string canonicalForm)
3037
{
3138
if (canonicalForm == "native")
@@ -119,5 +126,11 @@ public static Asset FromXdr(Xdr.Asset thisXdr)
119126
/// </summary>
120127
public abstract string CanonicalName();
121128

129+
/// <summary>
130+
/// Compares this asset to another <see cref="Asset" /> for ordering.
131+
/// Assets are ordered: native &lt; credit_alphanum4 &lt; credit_alphanum12.
132+
/// </summary>
133+
/// <param name="asset">The asset to compare with.</param>
134+
/// <returns>A negative value, zero, or positive value if this asset is less than, equal to, or greater than <paramref name="asset" />.</returns>
122135
public abstract int CompareTo(Asset asset);
123136
}

StellarDotnetSdk/Assets/AssetAmount.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,23 @@ public class AssetAmount(
77
Asset Asset,
88
string Amount)
99
{
10+
/// <summary>
11+
/// Gets the Stellar asset.
12+
/// </summary>
1013
public Asset Asset { get; } = Asset;
14+
15+
/// <summary>
16+
/// Gets the amount of the asset as a string (in stroops-compatible decimal format).
17+
/// </summary>
1118
public string Amount { get; } = Amount;
1219

20+
/// <inheritdoc />
1321
public override int GetHashCode()
1422
{
1523
return Asset.GetHashCode().Hash(Amount);
1624
}
1725

26+
/// <inheritdoc />
1827
public override bool Equals(object? obj)
1928
{
2029
if (obj is not AssetAmount other)

StellarDotnetSdk/Assets/AssetExtensions.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
namespace StellarDotnetSdk.Assets;
22

3+
/// <summary>
4+
/// Provides extension methods for the <see cref="Asset" /> class.
5+
/// </summary>
36
public static class AssetExtensions
47
{
58
/// <summary>

0 commit comments

Comments
 (0)