For the complete documentation index, see llms.txt. This page is also available as Markdown.

Fiat Conversions With Anchor Chaining

This example shows how to use the Anchor Chaining SDK to perform fiat conversions. FX via an external fiat anchor may require additional steps than just a simple FX Anchor. The Anchor Chaining library helps facilitate the steps required (eg. CAD to EUR may require CAD to USD then USD to EUR). This example assumes KYC has been completed and onboarded wtih a fiat anchor that supports USD and EUR and that the account has existing USD balance.

To run the example on the main network, the following changes are needed.

  • Change network from test to main

  • Use the main network Keeta USD Token - keeta_amnkge74xitii5dsobstldatv3irmyimujfjotftx7plaaaseam4bntb7wnna

  • Use the main network Keeta EUR Token - keeta_anutgo4o3yp5tvc6wjt4vzsehjbn7t2wylpxmam4d4ojtdkjj2yca2qoinfcs

1

Setup Account and Anchor Client

2

Initialize Anchor Chaining

3

Construct the Conversion Request

This example performs a conversion between USD and EUR for $2.00

4

Search Available Paths

Searching the available anchor paths uses the Anchor Resolver metadata to determine what anchor's currently support the desired request and what paths can be used to get from source to destination.

5

Compute Plans

Getting the plans involves contacting each Anchor required to perform the request and obtaining the instructions for each step of the plan.

6

Execute the Plan

The Anchor Chaining library automatically generates the necessary blocks required to send from the users account to the anchor to perform the swaps.

7

Confirm Balance Updates

Once the conversion is completed balance changes can be viewed directly from the network

Full Code Example

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

Last updated