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

# Quickstart Guide

> This guide walks you through the process of setting up and using the Skip Go Client to perform a cross-chain from USDC on Noble to TIA on Celestia.

<Info>
  For a more in-depth guide, check out our [detailed walkthrough](../client/getting-started), which covers both Solana and EVM transactions. You can also explore more about [EVM Transactions](/skip-go/advanced-transfer/evm-transactions) or dive into the specifics of [SVM Transactions](/skip-go/advanced-transfer/svm-transaction-details).
</Info>

## Prerequisites

* Browser environment setup with **Keplr** installed (`create-next-app` is recommended)
* **Node.js** and **npm**

<Steps>
  <Step title="Install Library">
    Install the library using npm or yarn:

    <CodeGroup>
      ```Shell npm theme={"theme":{"light":"github-light-high-contrast","dark":"github-dark-high-contrast"}}
      npm install @skip-go/client
      ```

      ```Shell yarn theme={"theme":{"light":"github-light-high-contrast","dark":"github-dark-high-contrast"}}
      yarn add @skip-go/client
      ```
    </CodeGroup>
  </Step>

  <Step title="Initialize Client">
    To start integrating with the Skip Go API, configure the library once using `setClientOptions` or `setApiOptions`. After configuration, you import and call functions like `route` and `executeRoute` directly.

    ```ts theme={"theme":{"light":"github-light-high-contrast","dark":"github-dark-high-contrast"}}
    import {
      setClientOptions,
      setApiOptions,
      route,
      executeRoute,
      // ...other helpers you might use
    } from "@skip-go/client";

    // Example initialization for executeRoute usage
    setClientOptions({
      apiUrl: "YOUR_API_URL", // optional: defaults to Skip API
      apiKey: "YOUR_API_KEY", // optional: required for some features
      // endpointOptions, aminoTypes, registryTypes, etc.
    });

    // If only calling API functions directly, you can instead use:
    setApiOptions({ apiUrl: "YOUR_API_URL", apiKey: "YOUR_API_KEY" });
    ```
  </Step>

  <Step title="Get a Route">
    Now, we can use the `route` function to request a quote and route to swap USDC on Noble to TIA on Celestia.

    ```ts theme={"theme":{"light":"github-light-high-contrast","dark":"github-dark-high-contrast"}}
    const routeResult = await route({
      sourceAssetDenom: 'uusdc',
      sourceAssetChainID: 'noble-1',
      destAssetDenom: 'utia',
      destAssetChainID: 'celestia',
      amountIn: '1000000', // 1 uusdc
      smartRelay: true
    });
    ```

    <Info>
      **Understanding the Route Response**

      The route response contains important information about the swap process:

      * **`amountOut`**: The estimated amount the user will receive after the swap, net of all fees and price impact
      * **`requiredChainAddresses`**: Chain IDs where you need to provide user addresses when generating the transaction
      * **`operations`**: Steps involved in moving from the source to the destination token

      For more details, see the [/route](/skip-go/api-reference/prod/fungible/post-v2fungibleroute) endpoint reference.
    </Info>
  </Step>

  <Step title="Get Required Addresses">
    After generating a route, you need to provide user addresses for the required chains. The `routeResult.requiredChainAddresses` array lists the chain IDs for which addresses are needed.

    <Warning>
      **Only use addresses your user can sign for.**
      Funds could get stuck in any address you provide, including intermediate chains in certain failure conditions. Ensure your user can sign for each address you provide.
      See [Cross-chain Failure Cases](../advanced-transfer/handling-cross-chain-failure-cases) for more details.
    </Warning>

    We recommend storing the user's addresses and creating a function like `getAddress` that retrieves the address based on the chain ID (see an example [here](https://github.com/skip-mev/skip-go-example/blob/c55d9208bb46fbf1a4934000e7ec4196d8ccdca4/pages/index.tsx#L99)).

    ```ts theme={"theme":{"light":"github-light-high-contrast","dark":"github-dark-high-contrast"}}
    // get user addresses for each requiredChainAddress to execute the route
    const userAddresses = await Promise.all(
      routeResult.requiredChainAddresses.map(async (chainID) => ({
        chainID,
        address: await getAddress(chainID),
      }))
    );
    ```

    <Warning>
      **Never attempt to derive an address on one chain from an address on another chain**

      Whenever you need a user address, please request it from the corresponding wallet or signer. Do not attempt to use bech32 cross-chain derivation.

      If you attempt to derive an address on one chain from an address on another chain, you may derive an address that the user cannot actually sign for if the two chains have different address-derivation processes. For example, if you derive a Cosmos address from an Ethereum address, you will get an address that the user cannot sign for and thus risk lost tokens.
    </Warning>
  </Step>

  <Step title="Execute the Route">
    Once you have a route, you can execute it in a single function call by passing in the route, the user addresses for at least the chains the route includes, and optional callback functions. This also registers the transaction for tracking.

    ```ts theme={"theme":{"light":"github-light-high-contrast","dark":"github-dark-high-contrast"}}
    await executeRoute({
      route: routeResult,
      userAddresses,
      getCosmosSigner: (chainId) => {},
      getEvmSigner: (chainId) => {},
      getSvmSigner: () => {},
      // Executes after all of the operations triggered by a user's signature complete.
      onTransactionCompleted: async (chainID, txHash, status) => {
        console.log(
          `Route completed with tx hash: ${txHash} & status: ${status.state}`
        );
      },
      onTransactionBroadcast: async ({ txHash, chainID }) => {
        console.log(`Transaction broadcasted with tx hash: ${txHash}`);
      },
      onTransactionTracked: async ({ txHash, chainID }) => {
        console.log(`Transaction tracked with tx hash: ${txHash}`);
      },
    });
    ```

    Once the transaction is complete, you'll have new TIA in your Celestia address!
  </Step>
</Steps>
