Show / Hide Table of Contents

Class BalanceChanges

Utilities for computing balance changes (XRP, issued currencies and MPTs) from transaction metadata's affected nodes.

Inheritance
object
BalanceChanges
Namespace: Xrpl.Utils
Assembly: Xrpl.dll
Syntax
public static class BalanceChanges

Methods

| Edit this page View Source

GetBalanceChanges(ITransactionMetadata)

Computes balance changes per account from transaction metadata.

Declaration
public static Dictionary<string, List<Currency>> GetBalanceChanges(ITransactionMetadata metadata)
Parameters
Type Name Description
ITransactionMetadata metadata

Transaction metadata including affected nodes.

Returns
Type Description
Dictionary<string, List<Currency>>

Dictionary mapping account addresses to balance changes (XRP string or IssuedCurrencyAmount).

Remarks

This walks every affected node and computes a delta for every account on the payment path, not only the one the caller has in mind, so the amounts it reads are untrusted: a payment can route through an offer in somebody's own token at any value the protocol allows. Issued-currency deltas are computed as XrplAmount, over the ledger's whole range: the difference is exact, then rounded once to sixteen significant digits, to nearest with ties to even, as rippled rounds. Value is written as rippled's STAmount::getText writes it: in scientific notation, a sixteen-digit mantissa and an exponent, when the exponent is above -5 or below -25 - from about 1e11 up and below about 1e-10, e.g. 1234567890120000e-4 for 123456789012. Read the value with ToXrplAmount(), or with ValueAsNumber within the range of decimal, rather than as display text or with System.Globalization.NumberStyles.Number.

  • Edit this page
  • View Source
In this article
Back to top Generated by DocFX