## Introduction

This guide shows how to use Intent Swap (Fusion mode) to perform a gasless swap from native ETH to USDC on Ethereum. You will use the 1inch Fusion SDK to fetch quotes, create orders, and submit them to the relayer network. Native token swaps require no approval—just deploy an escrow contract to lock your ETH.

## Before You Start

- You must have a valid **1inch API Key**. You can get one from the [1inch Business](https://business.1inch.com/portal).
- Your wallet must have:
  - ETH on Ethereum

## Install Dependencies

Install the Fusion SDK and ethers:

```bash
npm install @1inch/fusion-sdk ethers dotenv
```

## Set Up the Provider

Create an ethers provider using the 1inch Web3 node and your API key. The provider is used for RPC calls and wallet signing.

```typescript
import { ethers } from "ethers";

const rpcUrl = "https://api.1inch.com/web3/1";
const fetchReq = new ethers.FetchRequest(rpcUrl);
fetchReq.setHeader("Authorization", `Bearer ${API_KEY}`);
const provider = new ethers.JsonRpcProvider(fetchReq, 1, { staticNetwork: true });
const wallet = new ethers.Wallet(PRIVATE_KEY, provider);
```

## Initialize the Fusion SDK

Create a Fusion SDK instance with your API key and a blockchain provider connector. The connector bridges ethers to the SDK's expected interface.

```typescript
import { FusionSDK, NetworkEnum, PrivateKeyProviderConnector } from "@1inch/fusion-sdk";

const sdk = new FusionSDK({
  url: "https://api.1inch.com/fusion",
  network: NetworkEnum.ETHEREUM,
  blockchainProvider: new PrivateKeyProviderConnector(PRIVATE_KEY, {
    eth: { call: (tx) => provider.call(tx) },
    extend() {}
  }),
  authKey: API_KEY
});
```

## Get a Swap Quote

Call `getQuote` with the native token sentinel address, destination token, amount, and wallet address. For native ETH, use the sentinel address `0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE`.

```typescript
const NATIVE = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE";
const USDC = "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48";

const params = {
  fromTokenAddress: NATIVE,
  toTokenAddress: USDC,
  amount: "1000000000000000", // 0.001 ETH (18 decimals)
  walletAddress: wallet.address
};

const quote = await sdk.getQuote(params);
```

## Create and Submit the Order

Create the order with `createOrder`, then submit it to the relayer with `submitNativeOrder` (not `submitOrder`). Native token orders use a different submission flow.

```typescript
import { Address } from "@1inch/fusion-sdk";

const order = await sdk.createOrder(params);
const makerAddress = new Address(wallet.address);
const result = await sdk.submitNativeOrder(order.order, makerAddress, order.quoteId);
console.log("Order submitted:", result.orderHash);
```

## Deploy the Escrow Contract

Native token swaps require an on-chain escrow to hold your ETH. Use `NativeOrdersFactory` to build the deployment transaction, then send it with your wallet. The escrow wraps ETH to WETH and locks it until the order is filled.

```typescript
import { NativeOrdersFactory, NetworkEnum } from "@1inch/fusion-sdk";

const factory = NativeOrdersFactory.default(NetworkEnum.ETHEREUM);
const call = factory.create(makerAddress, result.order);
const tx = await wallet.sendTransaction({
  to: call.to.toString(),
  data: call.data,
  value: call.value
});
await tx.wait();
```

## Full Code Example

Explore the complete quick-start implementation (~85 lines) in StackBlitz:

<stackblitz example="intent-swap" file="src/evm/quick-start.ts" />

For a more comprehensive example with order tracking and error handling, see `src/evm/swap-native.ts` in the same project.
