1inchXNear

Atomic cross-chain ETH ↔ NEAR swaps via HTLC using a 1inch Fusion+ post-interaction extension.

1inchXNear

Created At

Unite Defi

Project Description

1inch Fusion+ Near Extension is a cross-chain swap system that allows users to securely and trustlessly exchange ETH and NEAR without relying on centralized bridges or custodians. It brings true atomic swap functionality to 1inch Fusion+ by enabling interoperability between Ethereum and Near Protocol.

This project solves a major challenge in DeFi: how to let users move value between two entirely different blockchain ecosystems — one EVM-based and the other WASM-based — in a way that’s decentralized, reliable, and user-friendly. Instead of using traditional bridges or wrapped assets, this system uses Hashed Timelock Contracts (HTLCs) to make sure that both sides of a swap either complete successfully or are refunded, automatically.

The system integrates directly with 1inch’s Fusion+ limit order protocol, not as a standalone tool but as an extension that plugs into the existing order lifecycle. This approach lets users access cross-chain functionality without needing to leave the 1inch environment or learn an entirely new interface.

From a user perspective, the flow is simple:

Connect both MetaMask and Near Wallet Choose swap direction (ETH → NEAR or NEAR → ETH) Enter the amount to swap Click one button to initiate the swap The system handles locking, secret generation, matching, and claiming

The entire process is non-custodial and bidirectional, meaning users can go both ways between Ethereum and Near. It also includes safety features like refundability and secret-based validation, making it secure even in cases of incomplete or delayed swaps.

Beyond just the backend mechanics, the project includes a polished user interface that guides the user through each step of the process and intelligently handles wallet behavior depending on the chosen swap direction.

This project is not just a proof of concept. It's a working, complete, and production-ready extension that demonstrates how decentralized infrastructure can scale beyond single-chain boundaries — and how trustless execution can be maintained even across entirely different blockchain architectures.

How it's Made

The 1inch Fusion+ Near Extension was built as a cross-chain, production-ready atomic swap system by combining multiple technologies across Ethereum and Near ecosystems. It integrates tightly with 1inch Fusion+, utilizes Hashed Timelock Contracts (HTLCs) for trustless execution, and features a complete front-end dApp for end-user interaction.

Below is a breakdown of the system's components and how they are integrated:

Core Technologies Used

Smart Contracts

  • Solidity (Ethereum contracts) ---Built using Hardhat for development and testing ---Deployed on the Sepolia testnet ---Contracts: -----SimpleLimitOrderProtocol: Used from 1inch as the base limit order system -----FusionNearExtension: Custom post-interaction extension implementing HTLCs, secret validation, and event emission

  • Rust (Near contracts) ---Built using the Near SDK with AssemblyScript and compiled to WASM ---Contract: -----FusionEscrow: Handles NEAR locking, hash validation, refund logic, and secret reveal mechanism

Frontend --React and Next.js for the application UI --Wagmi + Ethers.js for Ethereum wallet integration (MetaMask) --Near Wallet Selector SDK for NEAR wallet integration --Tailwind CSS for styling --Vercel-ready codebase for easy deployment

DevOps / Tooling --dotenv for environment variable configuration --npm for dependency management --Hardhat and Near CLI for contract deployment --Typescript across both frontend and backend for type safety

Architecture Overview -Ethereum Side: ---When a user initiates a swap (e.g., ETH → NEAR), they submit a signed limit order through 1inch Fusion+. ---The FusionNearExtension listens to post-interaction calls and locks ETH in an HTLC using a hash of a secret and a timelock. ---This contract emits an event that signals to the resolver (off-chain relayer or bot) that an order is active.

-Near Side: ---The resolver sees the Ethereum event and calls the Near contract FusionEscrow, locking NEAR using the same hash. ---Once NEAR is claimed by the swap initiator using the secret, the revealed secret is used by the resolver to complete the Ethereum side of the transaction.

-Off-Chain Resolver Logic: ---A lightweight service or user script watches for new orders on Ethereum via event logs. ---Upon detecting a valid order, it verifies conditions and creates the corresponding escrow transaction on Near. ---It also monitors Near for secret reveal transactions to finalize swaps on Ethereum.

-Frontend Logic: ---Detects connected wallets and swap direction ---Dynamically chooses the correct wallet and contract flow ---Manages order creation, confirmation prompts, transaction tracking, and feedback ---React hooks and local state manage user flow and form validation

background image mobile

Join the mailing list

Get the latest news and updates