Show / Hide Table of Contents

Class X402AmountMapper

Converts a PaymentRequirement amount into an XRPL Currency value, handling both native XRP (drops) and IOU/token assets.

Inheritance
object
X402AmountMapper
Namespace: Xrpl.X402
Assembly: Xrpl.X402.dll
Syntax
public static class X402AmountMapper

Methods

| Edit this page View Source

IsXrp(PaymentRequirement)

Returns true when the requirement's asset is XRP (case-insensitive comparison).

Declaration
public static bool IsXrp(PaymentRequirement req)
Parameters
Type Name Description
PaymentRequirement req

The payment requirement to inspect.

Returns
Type Description
bool

true for XRP; false for IOU/token assets.

| Edit this page View Source

ToCurrency(PaymentRequirement)

Converts the requirement's amount and asset to an XRPL Currency instance. For XRP, the amount is expressed in drops. For IOU assets, extra.issuer must be present.

Declaration
public static Currency ToCurrency(PaymentRequirement req)
Parameters
Type Name Description
PaymentRequirement req

The payment requirement containing asset, amount, and extra fields.

Returns
Type Description
Currency

An XRPL Currency ready to set as the Amount of a Payment transaction.

Exceptions
Type Condition
X402PaymentException

Thrown when an IOU requirement is missing extra.issuer.

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