FX (Foreign Exchange)

The FX Anchor service enables currency and token conversions on Keeta. It connects users who want to swap between different assets with liquidity providers who offer exchange services.

Understanding FX Anchors

An FX Anchor operates like a decentralized exchange interface:

  1. Discovery: Clients find FX providers using the Resolver

  2. Quote Request: User requests a price for a conversion

  3. Quote Response: Provider returns a signed quote with rate and fees

  4. Exchange: User submits a block swapping tokens with the provider

  5. Settlement: Provider completes the swap atomically on-chain

The SDK handles the quote signing, verification, and atomic swap construction, ensuring both parties are protected.

Core Concepts

Conversion Input

Every FX operation starts with a ConversionInput specifying:

  • from: The token you have

  • to: The token you want

  • amount: How much to convert

  • affinity: Whether amount refers to 'from' (you have this much) or 'to' (you want this much)

Quotes vs Estimates

  • Estimate: Non-binding price indication, useful for showing users expected rates

  • Quote: Binding commitment from provider with signature, required for execution

Floating vs Fixed Rate

  • Fixed Rate (with quote): Price locked at quote time, guaranteed regardless of market movement

  • Floating Rate (without quote): Price determined at execution time, may be better or worse than estimate

Basic Client FX Flow

https://github.com/KeetaNetwork/keetanet-examples/blob/main/src/anchor/fx-client.ts

Last updated