Class Currency
Class defining how to encode and decode Currencies
Inheritance
object
Currency
Assembly: Xrpl.BinaryCodec.dll
Syntax
public class Currency : Hash160, ISerializedType
Constructors
|
Edit this page
View Source
Currency(byte[])
Constructs a Currency object
Declaration
public Currency(byte[] buffer)
Parameters
| Type |
Name |
Description |
| byte[] |
buffer |
bytes buffer
|
Fields
|
Edit this page
View Source
IsNative
Test if this amount is in units of Native Currency(XRP)
Declaration
public readonly bool IsNative
Field Value
|
Edit this page
View Source
IsoCode
ISO code of this currency
Declaration
public readonly string IsoCode
Field Value
|
Edit this page
View Source
Xrp
Declaration
public static readonly Currency Xrp
Field Value
Methods
|
Edit this page
View Source
EncodeCurrency(string)
Encode a standard three-character currency code (bytes 12-14), as rippled and xrpl.js do
for every Currency field: issued currencies and Oracle BaseAsset / QuoteAsset alike.
Declaration
public static byte[] EncodeCurrency(string currencyCode)
Parameters
| Type |
Name |
Description |
| string |
currencyCode |
currency code
|
Returns
|
Edit this page
View Source
FromJson(JsonNode)
decode currency from json field
Declaration
public static Currency FromJson(JsonNode token)
Parameters
| Type |
Name |
Description |
| JsonNode |
token |
json field
|
Returns
|
Edit this page
View Source
FromParser(BinaryParser, int?)
Defines how to read a Currency from a BinaryParser
Declaration
public static Currency FromParser(BinaryParser parser, int? hint = null)
Parameters
| Type |
Name |
Description |
| BinaryParser |
parser |
The binary parser to read Currency
|
| int? |
hint |
|
Returns
|
Edit this page
View Source
FromString(string)
decode currency from string
Declaration
public static Currency FromString(string str)
Parameters
| Type |
Name |
Description |
| string |
str |
string currency code
|
Returns
Exceptions
| Type |
Condition |
| InvalidOperationException |
|
|
Edit this page
View Source
GetCurrencyCodeFromTlcBytes(byte[], out bool)
get currency code from bytes: XRP for the zero currency, the three characters of a
standard code (bytes 12-14, every other byte zero), and null for anything else, which
is then shown as hex. A code whose text starts at byte 0 is a nonstandard code, not the
standard code with the same letters, so it is not read as one.
Declaration
public static string GetCurrencyCodeFromTlcBytes(byte[] bytes, out bool isNative)
Parameters
| Type |
Name |
Description |
| byte[] |
bytes |
bytes
|
| bool |
isNative |
will true if currency is XRP
|
Returns
|
Edit this page
View Source
ToString()
Declaration
public override string ToString()
Returns
Overrides
Operators
|
Edit this page
View Source
implicit operator Currency(string)
Declaration
public static implicit operator Currency(string v)
Parameters
| Type |
Name |
Description |
| string |
v |
|
Returns
|
Edit this page
View Source
implicit operator Currency(JsonNode)
Declaration
public static implicit operator Currency(JsonNode v)
Parameters
| Type |
Name |
Description |
| JsonNode |
v |
|
Returns
|
Edit this page
View Source
implicit operator JsonNode(Currency)
Declaration
public static implicit operator JsonNode(Currency v)
Parameters
Returns
| Type |
Description |
| JsonNode |
|
Implements
Extension Methods