Skip to content
docs

QuoteValue

Defined in: protocol-swap2-router/src/value.ts:61

A quote’s value in USD: what the user pays, what arrives, the loss, and a better alternative when one exists. Use it to warn before a bad-value swap.

optional betterAlternative?: object

Defined in: protocol-swap2-router/src/value.ts:71

Another provider in the same set that delivers more than betterByPct more. Every quote of a request pays out the same destination token, so the comparison is by delivered USD when priced and by raw destAmount otherwise.

byPct: number

destAmount: string

provider: string

valueUsdOut: number | null


lossPct: number | null

Defined in: protocol-swap2-router/src/value.ts:68

(in − out) / in × 100. Positive = the user receives less value than they pay. null when either side is unpriced.


optional priceImpactBps?: number

Defined in: protocol-swap2-router/src/value.ts:73

The venue’s own price impact in basis points (providerData.priceImpactBps), when it measures one.


provider: string

Defined in: protocol-swap2-router/src/value.ts:62


valueUsdIn: number | null

Defined in: protocol-swap2-router/src/value.ts:64

USD the user pays: the source amount at the current price. null when unpriced.


valueUsdOut: number | null

Defined in: protocol-swap2-router/src/value.ts:66

USD the quote delivers: the expected destAmount at the current price, minus a native fee paid on top. null when unpriced.