Integrate the Universal API
Integrate just-in-time mint/redeems of 80+ uAssets directly in your app or protocol.
The Universal API allows developers to seamlessly integrate uAssets into their applications and optionally earn fees. The API acts as an intermediary, connecting users with Merchants to facilitate buying, selling, and cross-chain transactions.
What is the Universal API?
DeFi typically relies on liquidity pools (LPs) to provide assets for swaps. However, LPs are capital inefficient because liquidity sits unused until needed.
Universal solves this with JIT (just-in-time) Liquidity via the Universal API meaning:
Instead of pre-depositing liquidity, Merchants mint and fulfill orders dynamically when demand arises.
Liquidity is provided on an as-needed basis, optimizing capital efficiency.
To obtain API access with higher rate limits, please reach out to the Universal Partnerships team for an API key.
On EVM, the user will need to approve the Permit2 contract address 0x000000000022D473030F116dDEE9F6B43aC78BA3 to spend USDC or token address to be used for purchase, and the uAsset address for selling.
On Solana, the user will need to create a token account for the uAsset they're acquiring and approve the Universal Solana program id: 3UcHkqbtMGtRZmWNGGfC6wwi9f7uGBacTBbuRgrGyoLG
Monetization
Developers are able to add referrer_address and referrer_bps to the quote request to monetize their app. referrer_bps charge will be added on to every order, and the fees will be settled periodically (currently, at the end of every month) to referrer_address.
Typescript SDK Reference
The viem compatible Typescript SDK is the simplest way to integrate with the Universal API.
Environment
For signing orders, you’ll need your private key. We strongly recommend storing private keys securely using environment variables. For example, create a .env file in your project root:
Load the .env file in your code by installing the dotenv package:
Then, in your project:
Quick Start Example
Below is a complete TypeScript example that shows you how to use the SDK to request a quote, generate EIP‑712 typed data, sign the data, and submit an order:
API Reference
Types
TokenName:BTC, SOL, XRP, DOGE, DOT, NEAR, LTC, ADA, BCH, ALGO, ...PairTokenName:USDCBlockchainName:BASE | ARBITRUM | POLYGON | WORLD | SOLANAQuote
Requesting a Quote
Send a Quote Request
To retrieve a price quote for a uAsset transaction, make a POST request to the following endpoint:
Request Body Parameters
type: Specifies if the user wants toBUYorSELL.token: The uAsset being bought or sold.token_amount: (Optional) The amount of the asset being transacted.pair_token: The stable asset used for the trade (e.g., USDC).pair_token_amount: (Optional) The amount of the paired asset.slippage_bips: Slippage tolerance in basis points (0-100).blockchain: The blockchain network where the transaction is executed.user_address: The wallet address initiating the trade.referrer_address: (Optional) The address to send referrer fees to.referrer_bps: (Optional) Basis points to charge the user as a referrer.
Response (200 OK)
Upon success, the API returns a quote containing:
Quoted amounts
Gas fees
Merchant details
A unique quote
IDfor later use
Submitting an Order
Submit a Signed Order
Once the quote is signed, submit it using the /order endpoint:
Request Body Parameters
This request includes the signed quote along with the necessary parameters from the previous steps.
Response (200 OK)
Upon success, the API will return the transaction hash confirming the execution of the trade.Response
To be compatible with Lighthouse on Solana, you will need to provide signedTransaction in the request body as well.
Last updated