Show / Hide Table of Contents

Class LoanSigningHelper

Helper for LoanSet multi-party signing (XLS-66d). LoanSet requires two signatures: the broker (Account) signs as the submitter (TxnSignature), and the borrower (Counterparty) provides a CounterpartySignature (inner STObject with SigningPubKey + TxnSignature).

Three signing patterns (analogous to Batch V1/V2/V3):

V1 — Automatic (both keys available):

var result = LoanSigningHelper.SignLoanSet(loanTx, brokerWallet, borrowerWallet);
await client.SubmitRequest(result.TxBlob);

V2 — Parallel (keys on separate devices, sign independently):

// Device A (borrower):
var counterpartySig = borrowerWallet.SignAsLoanCounterparty(preparedTxJson);
// Device B (broker):
var brokerSig = brokerWallet.Sign(preparedTxJson);
// Combiner:
var combined = LoanSigningHelper.CombineLoanSignatures(brokerSig.TxBlob, counterpartySig.TxBlob);
await client.SubmitRequest(combined);

V3 — Sequential (borrower signs first, passes to broker):

// Borrower signs, adds CounterpartySignature:
var withCounterparty = borrowerWallet.SignAsLoanCounterparty(preparedTxJson);
// Broker receives the partially signed blob, adds TxnSignature:
var final = LoanSigningHelper.BrokerSign(withCounterparty.TxBlob, brokerWallet);
await client.SubmitRequest(final.TxBlob);
Inheritance
object
LoanSigningHelper
Namespace: Xrpl.Wallet
Assembly: Xrpl.dll
Syntax
public static class LoanSigningHelper

Methods

| Edit this page View Source

BrokerSign(string, XrplWallet)

V3 — Broker signs a partially signed LoanSet blob (one that already has CounterpartySignature). Decodes the blob, strips CounterpartySignature to compute the correct preimage, adds the broker's TxnSignature, then restores CounterpartySignature for encoding.

Declaration
public static SignatureResult BrokerSign(string partiallySignedBlob, XrplWallet brokerWallet)
Parameters
Type Name Description
string partiallySignedBlob

Hex blob from borrower's SignAsLoanCounterparty (has CounterpartySignature, no TxnSignature).

XrplWallet brokerWallet

The broker's wallet (submitting account).

Returns
Type Description
SignatureResult

Fully signed transaction blob and hash.

| Edit this page View Source

CombineLoanSignatures(string, string)

V2 — Combine independently signed broker and counterparty blobs. The broker blob has TxnSignature but no CounterpartySignature. The counterparty blob has CounterpartySignature but no TxnSignature.

Declaration
public static SignatureResult CombineLoanSignatures(string brokerSignedBlob, string counterpartySignedBlob)
Parameters
Type Name Description
string brokerSignedBlob

Hex blob signed by the broker (has TxnSignature).

string counterpartySignedBlob

Hex blob signed by the borrower (has CounterpartySignature).

Returns
Type Description
SignatureResult

Combined fully signed blob.

| Edit this page View Source

PrepareForSigning(JsonObject, XrplWallet)

Prepares a LoanSet JSON object for signing.

Declaration
public static JsonObject PrepareForSigning(JsonObject txJson, XrplWallet brokerWallet)
Parameters
Type Name Description
JsonObject txJson
XrplWallet brokerWallet
Returns
Type Description
JsonObject
| Edit this page View Source

PrepareForSigning(ITransactionRequest, XrplWallet)

Prepares a LoanSet transaction JSON for signing. Sets SigningPubKey to the broker's public key and removes signature fields. Returns a JsonObject ready for both parties to sign.

Declaration
public static JsonObject PrepareForSigning(ITransactionRequest loanSetTx, XrplWallet brokerWallet)
Parameters
Type Name Description
ITransactionRequest loanSetTx

The LoanSet transaction (autofilled with Sequence, Fee, LastLedgerSequence).

XrplWallet brokerWallet

The broker's wallet (submitting account).

Returns
Type Description
JsonObject

JsonObject ready for signing by both parties.

Remarks

Fee for CounterpartySignature overhead is handled by Autofill (see CalculateBaseFeeForType in Autofill.cs).

| Edit this page View Source

SignLoanSet(JsonObject, XrplWallet, XrplWallet)

V1 — Automatic signing: both broker and borrower wallets available locally. Computes the signing preimage, has both parties sign, and returns the fully signed tx blob.

Declaration
public static SignatureResult SignLoanSet(JsonObject preparedTx, XrplWallet brokerWallet, XrplWallet borrowerWallet)
Parameters
Type Name Description
JsonObject preparedTx

Prepared LoanSet JSON (from PrepareForSigning or already prepared).

XrplWallet brokerWallet

The broker's wallet (submitting account).

XrplWallet borrowerWallet

The borrower's wallet (counterparty).

Returns
Type Description
SignatureResult

Fully signed transaction blob and hash.

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