Show / Hide Table of Contents

Class Currency

Class defining how to encode and decode Currencies

Inheritance
object
Hash
Hash160
Currency
Implements
ISerializedType
Inherited Members
Hash.Buffer
Hash.ToBytes(IBytesSink)
Hash.ToJson()
Hash.Equals(Hash)
Hash.Equals(object)
Hash.GetHashCode()
Namespace: Xrpl.BinaryCodec.Types
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
Type Description
bool
| Edit this page View Source

IsoCode

ISO code of this currency

Declaration
public readonly string IsoCode
Field Value
Type Description
string
| Edit this page View Source

Xrp

Native XRP Currency

Declaration
public static readonly Currency Xrp
Field Value
Type Description
Currency

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
Type Description
byte[]
| 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
Type Description
Currency
| 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
Type Description
Currency

A Blob object

| 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
Type Description
Currency
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
Type Description
string
| Edit this page View Source

ToString()

hash to string value

Declaration
public override string ToString()
Returns
Type Description
string
Overrides
Hash.ToString()

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
Type Description
Currency
| Edit this page View Source

implicit operator Currency(JsonNode)

Declaration
public static implicit operator Currency(JsonNode v)
Parameters
Type Name Description
JsonNode v
Returns
Type Description
Currency
| Edit this page View Source

implicit operator JsonNode(Currency)

Declaration
public static implicit operator JsonNode(Currency v)
Parameters
Type Name Description
Currency v
Returns
Type Description
JsonNode

Implements

ISerializedType

Extension Methods

StExtensions.ToDebuggedHex(ISerializedType)
StExtensions.ToHex(ISerializedType)
  • Edit this page
  • View Source
In this article
Back to top Generated by DocFX