Skip to content

v0.2.0

Choose a tag to compare

@dillu24 dillu24 released this 14 Oct 14:12
· 7 commits to main since this release
c6adbd5

Quote routes now have one standard fee measure, priced at reference prices, instead of the per-provider fee fields. This follows Pegaroute's new fee API and is a breaking change.

npm install @pegaroute/sdk@0.2.0

Breaking changes

Before Now
QuoteRoute.fees: QuoteFees QuoteRouteFees | NoQuoteRouteFees: total in USD and bps, split into affiliate, route and gas. {} means no fee data, not a zero fee
QuoteRoute.resolvedFee removed
(none) QuoteRoute.additionalFee: AdditionalFee | null: a fee the wallet pays on top, in the source chain's native coin
RouteInfo.fees, GetSwapResponse.fees, Transaction.fees, TransactionWebhookData.fees removed
QuoteFees type removed; new QuoteRouteFees, NoQuoteRouteFees, FeeAmount, AdditionalFee

Routes are now ranked by expectedOutput minus additionalFee, then by speed.

Added

  • hasQuoteRouteFees(fees) tells full fees from {}. It's exported from @pegaroute/sdk and @pegaroute/sdk/types.

Upgrading

if (hasQuoteRouteFees(route.fees)) show(`$${route.fees.totalUsd} (${route.fees.totalBps} bps)`);
if (route.additionalFee) show(`+ ${route.additionalFee.amount} ${route.additionalFee.token}`);

fees.totalUsd is never negative, so compare routes by expectedOutput. See the README.

Full changelog: v0.1.0...v0.2.0