> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sequence.xyz/llms.txt
> Use this file to discover all available pages before exploring further.

# Intercambio de Monedas en Unreal

> Documentación general del SDK de Unreal para la infraestructura Sequence orientada a juegos web3.

Cambiar entre diferentes monedas ERC20 o tokens nativos en una cadena determinada es sencillo gracias al Smart Swap API de Sequence.

Por favor, asegúrese de que su par de tokens tenga suficiente liquidez en un exchange compatible como UniSwap.
Consulte esta guía sobre [cómo agregar liquidez en UniSwap.](https://support.uniswap.org/hc/en-us/articles/7423194619661-How-to-add-liquidity-to-Uniswap-v3)

## Obtener el precio de swap

Obtenga el precio de swap para un par de tokens específico.

<Tabs>
  <Tab title="Blueprint">
    <Frame>
      <img src="https://mintcdn.com/sequence-0fb8d9e6/AFzdYwHtaLpVA9X3/images/unreal/get_swap_price.png?fit=max&auto=format&n=AFzdYwHtaLpVA9X3&q=85&s=a4dd2c35234ec951291b866aeefc204f" 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>

## Obtener precios de swap

Obtenga los precios de swap para el token que su usuario desea recibir.

<Tabs>
  <Tab title="Blueprint">
    <Frame>
      <img src="https://mintcdn.com/sequence-0fb8d9e6/AFzdYwHtaLpVA9X3/images/unreal/get_swap_prices.png?fit=max&auto=format&n=AFzdYwHtaLpVA9X3&q=85&s=71de33044d5ddb0cae1c06053abbdeb0" 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>

## Obtener la cotización de swap

Después de consultar el precio del swap, obtenga la aprobación y los datos de transacción necesarios para construir su transacción.
Asegúrese de definir solo el `Sell Amount` o el `Buy Amount`, pero no ambos.

<Tabs>
  <Tab title="Blueprint">
    <Frame>
      <img src="https://mintcdn.com/sequence-0fb8d9e6/AFzdYwHtaLpVA9X3/images/unreal/get_swap_quote.png?fit=max&auto=format&n=AFzdYwHtaLpVA9X3&q=85&s=1356ef65fe2fadd871f200123509d41d" 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>

## Obtener las cadenas compatibles para swaps

Devuelve la lista de cadenas compatibles para swaps.

<Tabs>
  <Tab title="Blueprint">
    <Frame>
      <img src="https://mintcdn.com/sequence-0fb8d9e6/jCmUvzGpoEMBvubT/images/unreal/supported_swap_chains.png?fit=max&auto=format&n=jCmUvzGpoEMBvubT&q=85&s=ee3aecf18e7e6d47065eb8a791775850" 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>

## Obtener los tokens compatibles para swaps

Devuelve la lista de tokens compatibles para swaps.

<Tabs>
  <Tab title="Blueprint">
    <Frame>
      <img src="https://mintcdn.com/sequence-0fb8d9e6/jCmUvzGpoEMBvubT/images/unreal/supported_swap_tokens.png?fit=max&auto=format&n=jCmUvzGpoEMBvubT&q=85&s=0422653edbf7c85655aba23cdbe3827b" 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>
