Swapping
Integrations
Javascript SDK
Introduction

JavaScript SDK

These docs are under active development as we iterate based on our partners' feedback

The Chainflip SDK provides a simple way for JavaScript/TypeScript developers to interact with the Chainflip protocol. In this guide we'll explain how to:

  1. Get chains & assets: Use the getChains and getAssets methods to retrieve information about the available chains and their respective assets.
  2. Get quotes: The getQuote method provides a quote for a proposed swap. This includes the expected exchange rate, expected fees and expected duration.
  3. Swap assets: There are two ways to initiate a swap on Chainflip:
    1. Request a deposit address: The requestDepositAddress method generates a deposit address on the source chain. The user sends funds to this address to initiate a swap.
    2. Trigger a vault swap: The encodeVaultSwapData method returns an unsigned transaction that encodes the details of the swap. The user signs and submits this transaction to initiate the swap.
  4. Get status: The getStatus method provides real-time updates about the status of a swap operation.

If you want to learn more about how Chainflip swaps work, check the Swapping Basics section

Support

If you are experiencing issues with the SDK, visit the #technical-discussion channel in Discord for assistance. Not in Discord yet? Join us (opens in a new tab).