> ## Documentation Index
> Fetch the complete documentation index at: https://sequence-0fb8d9e6-codex-update-discord-invite.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Unreal Currency Swaps

> Documentation for Unreal SDK overview for the Sequence infrastructure stack for web3 gaming.

Swapping between different ERC20/native token currencies on a given Chain is made easy by Sequence's Smart Swap API.

Please make sure that your token pair has enough liquidity on a supported exchange such as UniSwap.
Checkout this guide on [how to add liquidity on UniSwap.](https://support.uniswap.org/hc/en-us/articles/7423194619661-How-to-add-liquidity-to-Uniswap-v3)

## Get Swap Price

Query the swap price for a given token pair.

<Tabs>
  <Tab title="Blueprint">
    <Frame>
      <img src="https://mintcdn.com/sequence-0fb8d9e6-codex-update-discord-invite/FTpX4UAFpHQ_Qb4p/images/unreal/get_swap_price.png?fit=max&auto=format&n=FTpX4UAFpHQ_Qb4p&q=85&s=7b65d087781065e7a145bf1f6c57fceb" width="2074" height="1104" data-path="images/unreal/get_swap_price.png" />
    </Frame>
  </Tab>

  <Tab title="C++">
    ```cpp theme={null}
    const TSuccessCallback<FSeqSwapPrice> OnApiSuccess = [this, OnSuccess](const FSeqSwapPrice& Response) { };
    const FFailureCallback OnApiFailure = [this, OnFailure](const FSequenceError& Error) { };

    USequencePay* Pay = NewObject<USequencePay>();
    Pay->GetSwapPrice(SequenceSdk::GetChainId(), WalletAddress, SellCurrency, BuyCurrency, BuyAmount, OnApiSuccess, OnApiFailure);
    ```
  </Tab>
</Tabs>

## Get Swap Prices

Query swap prices for the token your user wants to receive.

<Tabs>
  <Tab title="Blueprint">
    <Frame>
      <img src="https://mintcdn.com/sequence-0fb8d9e6-codex-update-discord-invite/FTpX4UAFpHQ_Qb4p/images/unreal/get_swap_prices.png?fit=max&auto=format&n=FTpX4UAFpHQ_Qb4p&q=85&s=d81063e3bed4f6ae6751852bcca49c01" width="2074" height="1104" data-path="images/unreal/get_swap_prices.png" />
    </Frame>
  </Tab>

  <Tab title="C++">
    ```cpp theme={null}
    const TSuccessCallback<TArray<FSeqSwapPrice>> OnApiSuccess = [this, OnSuccess](const TArray<FSeqSwapPrice>& Response) { };
    const FFailureCallback OnApiFailure = [this, OnFailure](const FSequenceError& Error) { };

    USequencePay* Pay = NewObject<USequencePay>();
    Pay->GetSwapPrices(SequenceSdk::GetChainId(), WalletAddress, BuyCurrency, BuyAmount, OnApiSuccess, OnApiFailure);
    ```
  </Tab>
</Tabs>

## Get Swap Quote

After checking the swap price, get your approval and transaction data needed to build your transaction.
Make sure you only define `Sell Amount` or `Buy Amount` and not both.

<Tabs>
  <Tab title="Blueprint">
    <Frame>
      <img src="https://mintcdn.com/sequence-0fb8d9e6-codex-update-discord-invite/FTpX4UAFpHQ_Qb4p/images/unreal/get_swap_quote.png?fit=max&auto=format&n=FTpX4UAFpHQ_Qb4p&q=85&s=7f0678808de4d33f03a8e76b81a12ca1" width="2182" height="1224" data-path="images/unreal/get_swap_quote.png" />
    </Frame>
  </Tab>

  <Tab title="C++">
    ```cpp theme={null}
    const TSuccessCallback<FSeqSwapQuote> OnApiSuccess = [this, OnSuccess](const FSeqSwapQuote& Response) { };
    const FFailureCallback OnApiFailure = [this, OnFailure](const FSequenceError& Error) { };

    USequencePay* Pay = NewObject<USequencePay>();
    Pay->GetSwapQuote(SequenceSdk::GetChainId(), WalletAddress, BuyCurrency, SellCurrency, BuyAmount, SellAmount, IncludeApprove, OnApiSuccess, OnApiFailure);
    ```
  </Tab>
</Tabs>

## Get Supported Swap Chains

Returns the list of chains supported for swapping.

<Tabs>
  <Tab title="Blueprint">
    <Frame>
      <img src="https://mintcdn.com/sequence-0fb8d9e6-codex-update-discord-invite/WI2CxbnlYZro4UIi/images/unreal/supported_swap_chains.png?fit=max&auto=format&n=WI2CxbnlYZro4UIi&q=85&s=808b8d49fd3d769b40d6cd7f5e8b9057" width="1726" height="930" data-path="images/unreal/supported_swap_chains.png" />
    </Frame>
  </Tab>

  <Tab title="C++">
    ```cpp theme={null}
    const TSuccessCallback<FSeqGetLifiChainsResponse> OnApiSuccess = [this, OnSuccess](const FSeqGetLifiChainsResponse& Response) { };
    const FFailureCallback OnApiFailure = [this, OnFailure](const FSequenceError& Error) { };

    USequencePay* Pay = NewObject<USequencePay>();
    Pay->GetSupportedSwapChains(OnApiSuccess, OnApiFailure);
    ```
  </Tab>
</Tabs>

## Get Supported Swap Tokens

Returns the list of tokens supported for swapping.

<Tabs>
  <Tab title="Blueprint">
    <Frame>
      <img src="https://mintcdn.com/sequence-0fb8d9e6-codex-update-discord-invite/WI2CxbnlYZro4UIi/images/unreal/supported_swap_tokens.png?fit=max&auto=format&n=WI2CxbnlYZro4UIi&q=85&s=c928e536c7321ac09e7018ad007a17b1" width="1726" height="930" data-path="images/unreal/supported_swap_tokens.png" />
    </Frame>
  </Tab>

  <Tab title="C++">
    ```cpp theme={null}
    const TSuccessCallback<FSeqGetLifiTokensResponse> OnApiSuccess = [this, OnSuccess](const FSeqGetLifiTokensResponse& Response) { };
    const FFailureCallback OnApiFailure = [this, OnFailure](const FSequenceError& Error) { };

    USequencePay* Pay = NewObject<USequencePay>();
    Pay->GetSupportedSwapTokens(Args, OnApiSuccess, OnApiFailure);
    ```
  </Tab>
</Tabs>
