Show / Hide Table of Contents

Class PreviewSugar

Previews transactions through simulate. The node runs the transaction against the current open ledger and discards it, so the numbers are the ones it would apply - rounding, interest and fees included - as long as nothing else changes the ledger in between.

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

Each method autofills the transaction first, the same way Autofill does before a submission, and returns that transaction in Transaction. The transaction must not be signed: simulate refuses signed transactions.

Methods

| Edit this page View Source

PreviewAMMDeposit(IXrplClient, AMMDeposit, CancellationToken)

Previews an AMMDeposit: the assets it would take and the LP tokens it would issue.

Declaration
public static Task<TransactionPreview<AmmOutcome>> PreviewAMMDeposit(this IXrplClient client, AMMDeposit transaction, CancellationToken cancellationToken = default)
Parameters
Type Name Description
IXrplClient client
AMMDeposit transaction
CancellationToken cancellationToken
Returns
Type Description
Task<TransactionPreview<AmmOutcome>>
| Edit this page View Source

PreviewAMMWithdraw(IXrplClient, AMMWithdraw, CancellationToken)

Previews an AMMWithdraw: the assets it would return and the LP tokens it would redeem.

Declaration
public static Task<TransactionPreview<AmmOutcome>> PreviewAMMWithdraw(this IXrplClient client, AMMWithdraw transaction, CancellationToken cancellationToken = default)
Parameters
Type Name Description
IXrplClient client
AMMWithdraw transaction
CancellationToken cancellationToken
Returns
Type Description
Task<TransactionPreview<AmmOutcome>>
| Edit this page View Source

PreviewBalanceChanges(IXrplClient, ITransactionRequest, CancellationToken)

Previews any transaction as the balance changes it would cause, per account.

Declaration
public static Task<TransactionPreview<Dictionary<string, List<Currency>>>> PreviewBalanceChanges(this IXrplClient client, ITransactionRequest transaction, CancellationToken cancellationToken = default)
Parameters
Type Name Description
IXrplClient client
ITransactionRequest transaction
CancellationToken cancellationToken
Returns
Type Description
Task<TransactionPreview<Dictionary<string, List<Currency>>>>
| Edit this page View Source

PreviewLoanBrokerCoverClawback(IXrplClient, LoanBrokerCoverClawback, LedgerRules, CancellationToken)

Previews a LoanBrokerCoverClawback by the asset's issuer: the broker's cover before and after it, and the minimum cover the clawback leaves.

Declaration
public static Task<TransactionPreview<LoanBrokerCoverOutcome>> PreviewLoanBrokerCoverClawback(this IXrplClient client, LoanBrokerCoverClawback transaction, LedgerRules rules = null, CancellationToken cancellationToken = default)
Parameters
Type Name Description
IXrplClient client

The client.

LoanBrokerCoverClawback transaction

The clawback.

LedgerRules rules

The amendments the minimum cover is computed under; read from the node with FromNodeAsync(IXrplClient, CancellationToken) when null.

CancellationToken cancellationToken

Cancels the requests.

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

PreviewLoanBrokerCoverDeposit(IXrplClient, LoanBrokerCoverDeposit, LedgerRules, CancellationToken)

Previews a LoanBrokerCoverDeposit: the broker's cover before and after it, and the minimum cover the broker must keep.

Declaration
public static Task<TransactionPreview<LoanBrokerCoverOutcome>> PreviewLoanBrokerCoverDeposit(this IXrplClient client, LoanBrokerCoverDeposit transaction, LedgerRules rules = null, CancellationToken cancellationToken = default)
Parameters
Type Name Description
IXrplClient client

The client.

LoanBrokerCoverDeposit transaction

The deposit.

LedgerRules rules

The amendments the minimum cover is computed under; read from the node with FromNodeAsync(IXrplClient, CancellationToken) when null.

CancellationToken cancellationToken

Cancels the requests.

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

PreviewLoanBrokerCoverWithdraw(IXrplClient, LoanBrokerCoverWithdraw, LedgerRules, CancellationToken)

Previews a LoanBrokerCoverWithdraw: the broker's cover before and after it, and the minimum cover the broker must keep. A withdrawal that would take the cover below the minimum comes back as tecINSUFFICIENT_FUNDS; MaxWithdrawable(LOLoanBroker, LOVault, LedgerRules) gives the largest one the node accepts.

Declaration
public static Task<TransactionPreview<LoanBrokerCoverOutcome>> PreviewLoanBrokerCoverWithdraw(this IXrplClient client, LoanBrokerCoverWithdraw transaction, LedgerRules rules = null, CancellationToken cancellationToken = default)
Parameters
Type Name Description
IXrplClient client

The client.

LoanBrokerCoverWithdraw transaction

The withdrawal.

LedgerRules rules

The amendments the minimum cover is computed under; read from the node with FromNodeAsync(IXrplClient, CancellationToken) when null.

CancellationToken cancellationToken

Cancels the requests.

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

PreviewLoanManage(IXrplClient, LoanManage, CancellationToken)

Previews a LoanManage: what impairing, unimpairing or defaulting the loan would do to its vault and broker. Compare Outcome with the LoanManageQuote from LoanManagement before signing; a refusal comes back in EngineResult, for example tecTOO_SOON or tecLIMIT_EXCEEDED.

Declaration
public static Task<TransactionPreview<LoanManageOutcome>> PreviewLoanManage(this IXrplClient client, LoanManage transaction, CancellationToken cancellationToken = default)
Parameters
Type Name Description
IXrplClient client

The client.

LoanManage transaction

The loan management transaction, sent by the broker's owner.

CancellationToken cancellationToken

Cancels the requests.

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

PreviewLoanPay(IXrplClient, LoanPay, CancellationToken)

Previews a LoanPay: how the payment would be split, and the loan it would leave.

Declaration
public static Task<TransactionPreview<LoanPaymentOutcome>> PreviewLoanPay(this IXrplClient client, LoanPay transaction, CancellationToken cancellationToken = default)
Parameters
Type Name Description
IXrplClient client
LoanPay transaction
CancellationToken cancellationToken
Returns
Type Description
Task<TransactionPreview<LoanPaymentOutcome>>
| Edit this page View Source

PreviewLoanSet(IXrplClient, LoanSet, CancellationToken)

Previews a LoanSet before the borrower signs it: the exact terms the node would give the loan, and what the borrower would receive.

Declaration
public static Task<TransactionPreview<LoanSetOutcome>> PreviewLoanSet(this IXrplClient client, LoanSet transaction, CancellationToken cancellationToken = default)
Parameters
Type Name Description
IXrplClient client
LoanSet transaction
CancellationToken cancellationToken
Returns
Type Description
Task<TransactionPreview<LoanSetOutcome>>
Remarks

A LoanSet must carry a CounterpartySignature, which the borrower has not provided yet. simulate does not check a signature whose signing key is empty, so the preview sends the transaction with an empty CounterpartySignature as a binary blob. The returned Transaction carries no signature of either party; sign it the usual way.

| Edit this page View Source

PreviewVaultDeposit(IXrplClient, VaultDeposit, CancellationToken)

Previews a VaultDeposit: the shares it would mint.

Declaration
public static Task<TransactionPreview<VaultOutcome>> PreviewVaultDeposit(this IXrplClient client, VaultDeposit transaction, CancellationToken cancellationToken = default)
Parameters
Type Name Description
IXrplClient client
VaultDeposit transaction
CancellationToken cancellationToken
Returns
Type Description
Task<TransactionPreview<VaultOutcome>>
| Edit this page View Source

PreviewVaultWithdraw(IXrplClient, VaultWithdraw, CancellationToken)

Previews a VaultWithdraw: the assets it would pay out and the shares it would burn.

Declaration
public static Task<TransactionPreview<VaultOutcome>> PreviewVaultWithdraw(this IXrplClient client, VaultWithdraw transaction, CancellationToken cancellationToken = default)
Parameters
Type Name Description
IXrplClient client
VaultWithdraw transaction
CancellationToken cancellationToken
Returns
Type Description
Task<TransactionPreview<VaultOutcome>>
  • Edit this page
  • View Source
In this article
Back to top Generated by DocFX