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.
Install the Fusion SDK and ethers:
Bash
1
npm install @1inch/fusion-sdk ethers dotenv
Create an ethers provider using the 1inch Web3 node and your API key. The provider is used for RPC calls and wallet signing.
TypeScript
1234567
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);
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
1234567891011
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
});
Call getQuote with the native token sentinel address, destination token, amount, and wallet address. For native ETH, use the sentinel address 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE.
TypeScript
1234567891011
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 the order with createOrder, then submit it to the relayer with submitNativeOrder (not submitOrder). Native token orders use a different submission flow.
TypeScript
123456
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);
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
12345678910
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();
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.