Uniswap’s new widget allows developers to integrate token swaps with a single line of code.
Uniswap is now accessible from anywhere across web3.
On April 14, Uniswap launched Swap Widget, allowing developers to integrate access to the exchange “with just one line of code.”
Swap Widget leverages Uniswap’s Auto Router to source the best pricing across the exchange’s v2 and v3 pools. It is also available on Uniswap’s Layer 2 deployments, allowing developers building on Optimism, Arbitrum, and Polygon to integrate the widget to facilitate low-fee swaps.
Dapps that embed the widget can choose to receive a commission on trades executed through their platform.
“We envision a world in which everyone is able to access fair, open, and transparent markets,” Uniswap wrote in a blog post. “The Swap Widget brings this vision closer to reality by allowing developers to easily embed Uniswap swapping functionality.”
“Embedding a customized Uniswap trading experience into any UI in a single line of code has been a dream of mine for over 3 years now,” Uniswap creator, Hayden Adams, tweeted.
The widget has already been integrated on several leading web3 dapps on the Ethereum mainnet.
Traders on top NFT marketplace, OpenSea, can use the widget to wrap their Ether or swap ERC-20 tokens for WETH to fund purchases without leaving the platform.
The Oasis dapp, which spun out of MakerDAO, has deployed the widget to allow users to quickly swap tokens for supported collateral to back self-managed DAI loans within a single interface.
The widget is also live on the web3 social platform, Friends With Benefits, where users can exchange assets for the FWB token to access DAO membership.
While the widget has generally received positive feedback on social media, Twitter user ‘elyx0’ questioned how users can ensure they are using the correct widget and not fall prey to a malicious copy made by scammers.
Uniswap’s Will Hennessy responded that users need to be diligent when connecting their wallets to web3 sites. “The Swap Widget is an open-source React component that lives inside a web app, so it’s critical that you trust the enclosing web app,” he said.
Simon Schmidsi of The Graph chimed in, stating “even on the Uniswap website and others I trust I doublecheck the contract address that I am about to interact with.”
Uniswap is currently the seventh-largest DeFi protocol with $7.27B in total value locked. It is the top decentralized exchange by volume with $1.2B worth of trades executed over the past 24 hours, beating out its closest rival by more than triple.