Search
⌘K
Intent Swap (Fusion)
API version: All versions
Introduction
Quick start
Quick Start - Ethereum
Quick Start - Solana
Orders
Get gasless swap active orders GET
Get settlement contract address GET
Get order status by hash GET
Get multiple orders by hashes POST
Get orders by maker address GET
Get cancelable orders GET
Quoter
Get quote for token swap GET
Get quote with custom auction presets POST
Build Fusion order from quote POST
Relayer
Submit a signed Fusion order POST
Submit multiple signed Fusion orders POST
Migration
Migration from v1.0 to v2.0
SDK
Solana
Overview
Filling and canceling Solana Fusion order
WebSocket API
EVMs
Overview
Swapping a Native Token to ERC-20
Swapping with Permit2
WebSocket API
Docs·APIs·Swap API·Intent Swap (Fusion)·Quick start·Quick Start - Ethereum

Quick Start - Ethereum

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.
  • Your wallet must have:
    • ETH on Ethereum

Install Dependencies

Install the Fusion SDK and ethers:

Bash
1
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
1
2
3
4
5
6
7
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
1
2
3
4
5
6
7
8
9
10
11
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
1
2
3
4
5
6
7
8
9
10
11
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
1
2
3
4
5
6
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
1
2
3
4
5
6
7
8
9
10
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:

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

Did you find what you need?