> For the complete documentation index, see [llms.txt](https://jungle-toolkit.gitbook.io/evm-xcm-jungle-toolkit/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://jungle-toolkit.gitbook.io/evm-xcm-jungle-toolkit/build-a-cross-chain-transaction-from-any-evm-chain-to-a-substrate-based-chain-using-ibc-and-xcm/transfer-tokens-to-moonbeam-parachain-using-squid-sdk-from-any-evm-chain.md).

# Transfer tokens to Moonbeam Parachain using Squid SDK from any EVM chain

As explained in the previous sections, the flow will start on the source chain. For instance, let's say we'll do a cross-chain transaction from MATIC to Moonbeam. The flow will be handled by Squid router, using their SDK v2 leveraging IBC across chains.&#x20;

A signer, aka the user, will start the process by signing a transaction, in our example he'll call the `CALL_BRIDGE_CALL` function of the Squid router adress on the Source chain.

The router can change its address so it's important to check the Squid documentation to get the latest address available.

As of December 23, you'll find these smart contracts at the following addresses:

* **Mainnet**
  * SquidRouter
    * [0xce16F69375520ab01377ce7B88f5BA8C48F8D666](https://blockscan.com/address/0xce16F69375520ab01377ce7B88f5BA8C48F8D666)
  * SquidMulticall
    * [0x4fd39C9E151e50580779bd04B1f7eCc310079fd3](https://blockscan.com/address/0x4fd39C9E151e50580779bd04B1f7eCc310079fd3)
* **Testnet**
  * SquidRouter
    * 0xC3468a191Fe51815b26535ED1F82C1f79e6Ec37D
  * SquidMulticall
    * 0x7a4F2BCdDf68C98202cbad13c4f3a04FF2405681

In order to execute the cross-chain transaction, Axelar General Message Passing protocol need a call properly forged containing all the required data. This is what we call a route in Squid API/SDK. To get a route that suits us, in our example a MATIC to GLMR swap, we can leverage both the Squid API and SDK. Let's see how both solutions are working.

## Obtain an integrator-id to build with Squid

To get an integrator-id, you'll need to fill a quick form about yourself and your project. It literally takes 5mn and it's mandatory to make the calls work, so everything starts with[ this link.](https://form.typeform.com/to/cqFtqSvX?typeform-source=docs.squidrouter.com)

## Get a route using the Squid SDK

### Initiate the SDK

```javascript
import { Squid } from "@0xsquid/sdk";

(async () => {
  // instantiate the SDK with config
   const squid = new Squid({
    baseUrl: "https://v2.api.squidrouter.com",
    integratorId: "your-integrator-id"
  });

  // init the SDK
  await squid.init();
  console.log("Squid inited");
})();
```

### Forge the route request parameters

```javascript
// Set up parameters for swapping tokens and depositing into Radiant lending pool
const params = {
  fromAddress: signerAddress,
  fromChain: polygonId,
  fromToken: nativeToken,
  fromAmount: amount,
  toChain: moonbeamId,
  toToken: nativeToken,
  toAddress: signerAddress,
  slippage: 1,
  slippageConfig: {
    autoMode: 1,
  },
  quoteOnly: false,
};

// Get the swap route using Squid SDK
const { route, requestId } = await squid!.getRoute(params);
```

fromAddress should be equal to msg.sender later in the transaction

fromChain and toChain should be chain IDs a String

fromAmount and toAmount should be formatted numbers with the appropriate decimals as String

## Get a route using the Squid API

### Initiate the API

```javascript
const baseUrl = "https://v2.api.squidrouter.com/v2"

// get an integrator-id https://form.typeform.com/to/cqFtqSvX
const integratorId = "<you-integrator-id>"

// Set up JSON RPC provider and signer
const provider = new ethers.providers.JsonRpcProvider(<source-chain-rpc-endpoint>);
const signer = new ethers.Wallet(<privateKey>, provider);
```

### Forge the route request

```javascript
const getRoute = async (params: any) => {
  try {
    const result = await axios.post(
      "https://v2.api.squidrouter.com/v2/route",
      params,
      {
        headers: {
          "x-integrator-id": integratorId,
          "Content-Type": "application/json",
        },
      }
    );
    const requestId = result.headers["x-request-id"];
    return { data: result.data, requestId: requestId };
  } catch (error) {
    // Log the error response if it's available.
    if (error.response) {
      console.error("API error:", error.response.data);
    }
    console.error("Error with parameters:", params);
    throw error;
  }
};

// Get the swap route using Squid API
const routeResult = await getRoute(params);
const route = routeResult.data.route;
const requestId = routeResult.requestId;
console.log("Calculated route:", route);
console.log("requestId:", requestId);
```

## Example Route Request parameters (from 1 MATIC to GLMR)

```json
{
    "fromChain": "137",
    "fromAmount": "1000000000000000000",
    "fromToken": "0xEEeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
    "toChain": "1284",
    "toToken": "0xEEeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
    "fromAddress": signerAddress,
    "toAddress": signerAddress,
    "slippageConfig": {
        "autoMode": 1
    }
}
```

Note: `0xEEeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee` is used for native tokens

### Currently available tokens on Moonbeam as destination chain

* GLMR
* xcDOT
* Wormhole assets
  * USDC
  * BTC
  * ETH
