Class CurrencyExtensions
Inheritance
object
CurrencyExtensions
Assembly: Xrpl.dll
Syntax
public static class CurrencyExtensions
Methods
|
Edit this page
View Source
CurrencyReadableName(string)
Declaration
public static string CurrencyReadableName(this string currencyCode)
Parameters
| Type |
Name |
Description |
| string |
currencyCode |
token code
|
Returns
| Type |
Description |
| string |
readable token code
|
|
Edit this page
View Source
GetValue(Currency, int?)
Returns the human-readable value of this currency amount.
For XRP, returns the value in XRP (drops / 1,000,000).
For tokens, returns the raw numeric value.
Declaration
public static decimal? GetValue(this Currency currency, int? round = null)
Parameters
| Type |
Name |
Description |
| Currency |
currency |
The currency to get the value from.
|
| int? |
round |
Optional number of decimal places to round to.
|
Returns
| Type |
Description |
| decimal? |
The decimal value, or null if the currency is null.
|
|
Edit this page
View Source
IsLpToken(string)
Declaration
public static bool IsLpToken(this string currencyCode)
Parameters
| Type |
Name |
Description |
| string |
currencyCode |
|
Returns
|
Edit this page
View Source
IsLpToken(Currency)
Declaration
public static bool IsLpToken(this Currency currency)
Parameters
Returns
|
Edit this page
View Source
IsLpToken(TrustLine)
Declaration
public static bool IsLpToken(this TrustLine currency)
Parameters
Returns
|
Edit this page
View Source
IsMPTToken(Currency)
Whether this amount is a multi-purpose token - that is, whether it carries an issuance id.
Declaration
public static bool IsMPTToken(this Currency currency)
Parameters
Returns
|
Edit this page
View Source
IsNFT14D(Currency)
check that currency is NFT XLS14D
Declaration
public static bool IsNFT14D(this Currency cur)
Parameters
Returns
|
Edit this page
View Source
IsXrp(Currency)
Determines whether this currency represents XRP.
A currency is XRP if its code is exactly "XRP" (case-sensitive) and it has no issuer.
Declaration
public static bool IsXrp(this Currency currency)
Parameters
| Type |
Name |
Description |
| Currency |
currency |
The currency to check.
|
Returns
| Type |
Description |
| bool |
true if this currency is XRP; otherwise, false.
|
|
Edit this page
View Source
NormalCurrency(string)
Declaration
public static bool NormalCurrency(this string currencyCode)
Parameters
| Type |
Name |
Description |
| string |
currencyCode |
|
Returns
|
Edit this page
View Source
NormalizeCurrencyCode(string, int)
Declaration
public static string NormalizeCurrencyCode(this string currencyCode, int maxLength = 20)
Parameters
| Type |
Name |
Description |
| string |
currencyCode |
|
| int |
maxLength |
|
Returns
|
Edit this page
View Source
ToDecimalClamped(Currency)
The amount as a decimal (drops for XRP, as ValueAsNumber reads it),
saturating at decimal.MinValue or decimal.MaxValue for an amount the ledger
allows but decimal cannot hold.
Declaration
public static decimal ToDecimalClamped(this Currency amount)
Parameters
| Type |
Name |
Description |
| Currency |
amount |
The amount, or null.
|
Returns
| Type |
Description |
| decimal |
The value; zero for a null amount or a blank Value.
|
Exceptions
| Type |
Condition |
| FormatException |
Value is not a number at all.
|
|
Edit this page
View Source
ToIssued(Currency)
The asset of this amount, without its value: currency code and issuer, or the MPT issuance ID.
Declaration
public static Common.IssuedCurrency ToIssued(this Currency currency)
Parameters
Returns