Show / Hide Table of Contents

Class DexQuoteSugar

Quotes for payments and offers, computed by the local payment engine against the node's last validated ledger: a DexSnapshot read from the node, then PaymentFlow or OfferCreateCrossing run on it.

Inheritance
object
DexQuoteSugar
Namespace: Xrpl.Sugar
Assembly: Xrpl.dll
Syntax
public static class DexQuoteSugar
Remarks

A quote is exact against the ledger it was read from; the transaction lands in a later one. Each book is first read one book_offers page deep; when the engine walks past what was read, the snapshot is read again, deeper, until the result no longer depends on unread offers or the deepest read is reached.

Methods

| Edit this page View Source

FindPathsAsync(IXrplClient, PathFindRequest, IBookIndex, LedgerRules, CancellationToken)

Finds the paths of request locally over the node's ledger, reading the books from books - or, when null, those between the assets the source's and the destination's trust lines hold (FromAccountsAsync(IXrplClient, IEnumerable<string>, string, LedgerIndex, CancellationToken)).

Declaration
public static Task<PathFindResult> FindPathsAsync(this IXrplClient client, PathFindRequest request, IBookIndex books = null, LedgerRules rules = null, CancellationToken cancellationToken = default)
Parameters
Type Name Description
IXrplClient client

The node to read from.

PathFindRequest request

What to find paths for.

IBookIndex books

The order books; see BookIndex.

LedgerRules rules

The amendments in force; read from the node when null.

CancellationToken cancellationToken

Cancels the search and the reads.

Returns
Type Description
Task<PathFindResult>
| Edit this page View Source

QuoteDeliverAsync(IXrplClient, string, string, XrplAmount, IssuedCurrency, uint?, IBookIndex, LedgerRules, CancellationToken)

What delivering exactly deliver to destination costs source in sourceAsset, along the paths ripple_path_find finds - or, given books, the local path finder (PathFinding).

Declaration
public static Task<PaymentQuote> QuoteDeliverAsync(this IXrplClient client, string source, string destination, XrplAmount deliver, Common.IssuedCurrency sourceAsset, uint? destinationTag = null, IBookIndex books = null, LedgerRules rules = null, CancellationToken cancellationToken = default)
Parameters
Type Name Description
IXrplClient client

The node to read from.

string source

The paying account.

string destination

The receiving account.

XrplAmount deliver

The amount to deliver.

Common.IssuedCurrency sourceAsset

The asset to pay with; an issued currency's issuer may be source itself for any issuer it holds.

uint? destinationTag

The payment's destination tag, for a destination that requires one.

IBookIndex books

The order books for a local path search; null to ask the node's ripple_path_find.

LedgerRules rules

The amendments in force; read from the node when null.

CancellationToken cancellationToken

Cancels the reads.

Returns
Type Description
Task<PaymentQuote>
Remarks

The quote's Payment carries those paths and a SendMax of the quoted cost, so against an unchanged ledger it delivers exactly; raise SendMax to leave room for the market to move.

| Edit this page View Source

QuoteOfferCreateAsync(IXrplClient, OfferCreate, LedgerRules, CancellationToken)

What offer would do if it were applied now.

Declaration
public static Task<OfferCrossingResult> QuoteOfferCreateAsync(this IXrplClient client, OfferCreate offer, LedgerRules rules = null, CancellationToken cancellationToken = default)
Parameters
Type Name Description
IXrplClient client

The node to read from.

OfferCreate offer

The offer; its Fee is charged when set.

LedgerRules rules

The amendments in force; read from the node when null.

CancellationToken cancellationToken

Cancels the reads.

Returns
Type Description
Task<OfferCrossingResult>
| Edit this page View Source

QuotePaymentAsync(IXrplClient, Payment, LedgerRules, CancellationToken)

What payment would do if it were applied now.

Declaration
public static Task<PaymentFlowResult> QuotePaymentAsync(this IXrplClient client, Payment payment, LedgerRules rules = null, CancellationToken cancellationToken = default)
Parameters
Type Name Description
IXrplClient client

The node to read from.

Payment payment

The payment, with its paths; its Fee is charged when set.

LedgerRules rules

The amendments in force; read from the node when null.

CancellationToken cancellationToken

Cancels the reads.

Returns
Type Description
Task<PaymentFlowResult>
| Edit this page View Source

QuoteSpendAsync(IXrplClient, string, string, XrplAmount, IssuedCurrency, uint?, IBookIndex, LedgerRules, CancellationToken)

What spending exactly spend delivers to destination in deliverAsset, along the paths ripple_path_find finds - or, given books, the local path finder (PathFinding).

Declaration
public static Task<PaymentQuote> QuoteSpendAsync(this IXrplClient client, string source, string destination, XrplAmount spend, Common.IssuedCurrency deliverAsset, uint? destinationTag = null, IBookIndex books = null, LedgerRules rules = null, CancellationToken cancellationToken = default)
Parameters
Type Name Description
IXrplClient client

The node to read from.

string source

The paying account.

string destination

The receiving account.

XrplAmount spend

The amount to spend, transfer fees included.

Common.IssuedCurrency deliverAsset

The asset to deliver.

uint? destinationTag

The payment's destination tag, for a destination that requires one.

IBookIndex books

The order books for a local path search; null to ask the node's ripple_path_find.

LedgerRules rules

The amendments in force; read from the node when null.

CancellationToken cancellationToken

Cancels the reads.

Returns
Type Description
Task<PaymentQuote>
Remarks

The quote's Payment carries those paths, the quoted delivery as its Amount and spend as its SendMax, so against an unchanged ledger it delivers exactly that; add tfPartialPayment with a DeliverMin to accept less.

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