Table of Contents

Class RfqProtocol

Namespace
NArk.ArkadeIntents.Rfq
Assembly
NArk.ArkadeIntents.dll

RFQ v1 — the request-for-quote negotiation layer shared by every Arkade swap corridor (Lightning, cross-chain and arkade-to-arkade alike).

public static class RfqProtocol
Inheritance
RfqProtocol
Inherited Members

Remarks

The envelope and the message family are corridor-agnostic; everything corridor-specific lives in the profile object each message carries, which is why the messages are generic over it. A transport maps these payloads to its own framing but never reshapes them, so the same bytes go over HTTP or a relay.

Two asymmetric rules are load-bearing and are encoded rather than described. Requests are strict: a solver rejects unknown fields with UnsupportedPayload, so a request serializes exactly its declared fields. Responses are tolerant: unknown members are ignored, which is what lets solvers extend responses without a version bump.

Fields

Json

Serializer settings for the whole family: snake_case names, and unknown members ignored on the way in — the "responses are tolerant" rule.

public static readonly JsonSerializerOptions Json

Field Value

JsonSerializerOptions

Version

The protocol version this client speaks.

public const int Version = 1

Field Value

int

Methods

ExpectQuote<TQuoteProfile>(JsonNode, string, string?)

Validate a reply and narrow it to the quote we asked for. A refusal throws; so does a quote for a different negotiation, or for a different market.

public static RfqQuote<TQuoteProfile> ExpectQuote<TQuoteProfile>(JsonNode payload, string rfqId, string? requestedPair = null)

Parameters

payload JsonNode

The reply payload.

rfqId string

The correlation id of the request.

requestedPair string

The pair that was asked for, or null to accept whatever the quote names.

Returns

RfqQuote<TQuoteProfile>

The quote.

Type Parameters

TQuoteProfile

The corridor's quote-profile shape.

Remarks

Matching the correlation id is what stops a stale or misrouted reply being funded: on a shared relay every one of the solver's events arrives on the same subscription.

The pair is compared byte for byte, the way the solver compares it, because a solver that normalises case or quotes a market other than the one asked for is otherwise undetectable from here. A quote's pair is a constant the solver restates rather than the request's echoed back, so this binds every solver to the exact spellings the profiles build.

Exceptions

RfqRefusedException

The reply was a refusal.

InvalidOperationException

The reply was not a quote for this negotiation.

NewRfqId()

A fresh client-chosen negotiation id: 32 random bytes, lowercase hex. It is the idempotency and correlation key for the whole negotiation, so it must be unpredictable per swap.

public static string NewRfqId()

Returns

string

64 lowercase hex characters.

ReadStatus<TProfile>(JsonNode, string)

Reads a correlated status or throws a structured refusal; unknown response types return null.

public static RfqStatus<TProfile>? ReadStatus<TProfile>(JsonNode payload, string rfqId)

Parameters

payload JsonNode
rfqId string

Returns

RfqStatus<TProfile>

Type Parameters

TProfile