Show / Hide Table of Contents

Class NumberType

XRPL Number type (serialized type code 9). Serialized as 12 bytes big-endian: 8 bytes — mantissa (signed int64, big-endian) 4 bytes — exponent (signed int32, big-endian) The value itself, its parsing and its text form are XrplNumber; this type keeps the wire pair as it was read or produced. Used by Vault (XLS-65) and Loan/LoanBroker (XLS-66) fields such as PrincipalRequested and DebtMaximum. Encoding matches rippled Number class (include/xrpl/basics/Number.h).

Inheritance
object
NumberType
Implements
ISerializedType
Namespace: Xrpl.BinaryCodec.Types
Assembly: Xrpl.BinaryCodec.dll
Syntax
public class NumberType : ISerializedType

Constructors

| Edit this page View Source

NumberType(long, int)

Creates the wire pair as given.

Declaration
public NumberType(long mantissa, int exponent)
Parameters
Type Name Description
long mantissa
int exponent
Exceptions
Type Condition
ArgumentOutOfRangeException

The mantissa is zero and the exponent is neither int.MinValue nor 0, the two zero encodings.

OverflowException

The pair is not a value rippled can hold; see XrplNumber(long, int).

| Edit this page View Source

NumberType(XrplNumber)

Creates the canonical wire pair of value.

Declaration
public NumberType(XrplNumber value)
Parameters
Type Name Description
XrplNumber value

Fields

| Edit this page View Source

Exponent

Exponent of the wire pair: int.MinValue (or 0) for zero.

Declaration
public readonly int Exponent
Field Value
Type Description
int
| Edit this page View Source

Mantissa

Mantissa of the wire pair: signed, 0 for zero.

Declaration
public readonly long Mantissa
Field Value
Type Description
long

Properties

| Edit this page View Source

Value

The value the wire pair holds.

Declaration
public XrplNumber Value { get; }
Property Value
Type Description
XrplNumber

Methods

| Edit this page View Source

FromJson(JsonNode)

Reads a JSON string or number into the canonical wire pair.

Declaration
public static NumberType FromJson(JsonNode token)
Parameters
Type Name Description
JsonNode token
Returns
Type Description
NumberType
Exceptions
Type Condition
FormatException

The token is neither a string nor a number, is not a number, or the ledger cannot hold it exactly.

| Edit this page View Source

FromParser(BinaryParser, int?)

Reads the 12-byte wire pair and keeps it as read.

Declaration
public static NumberType FromParser(BinaryParser parser, int? hint = null)
Parameters
Type Name Description
BinaryParser parser
int? hint
Returns
Type Description
NumberType
Exceptions
Type Condition
FormatException

The bytes are not a value rippled can hold.

| Edit this page View Source

FromString(string)

Parses a decimal or scientific string (e.g. "10000000000000", "0", "-500", "1e-32000") into the canonical wire pair. See Parse(string).

Declaration
public static NumberType FromString(string str)
Parameters
Type Name Description
string str
Returns
Type Description
NumberType
Exceptions
Type Condition
FormatException

The string is not a number, or the ledger cannot hold it exactly.

| Edit this page View Source

ToBytes(IBytesSink)

Writes the wire pair: 8-byte mantissa, then 4-byte exponent, both big-endian.

Declaration
public void ToBytes(IBytesSink sink)
Parameters
Type Name Description
IBytesSink sink
| Edit this page View Source

ToJson()

The value as rippled writes it: decimal, or scientific notation (1e13) for very large and very small values.

Declaration
public JsonNode ToJson()
Returns
Type Description
JsonNode
| Edit this page View Source

ToString()

The value as rippled writes it in JSON (to_string(Number)).

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

Implements

ISerializedType

Extension Methods

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