Quotes
Price quotes are the foundation of cross-chain swaps in the Aori protocol. A quote provides real-time pricing information and all necessary parameters to create and execute an order. This page covers everything you need to know about requesting and working with quotes.
Quotes are valid for a limited time and include expiration timestamps to ensure you're working with current market data.
When you request a quote from the Aori API, you're asking for:
- Real-time Pricing: Current market rates for your desired swap
- Order Parameters: All data needed to create a valid order
- Signing Hash: Cryptographic hash for order authorization
Quote Types
QuoteRequest
type
The QuoteRequest
interface defines the parameters needed to request a quote for a cross-chain swap.
- Name
offerer
- Type
- string
- Description
The address requesting the quote
- Name
recipient
- Type
- string
- Description
The address that will receive the output tokens
- Name
inputToken
- Type
- string
- Description
The token address to swap from
- Name
outputToken
- Type
- string
- Description
The token address to swap to
- Name
inputAmount
- Type
- string | number | bigint
- Description
The amount of input tokens to swap
- Name
inputChain
- Type
- string
- Description
The chain where input tokens are located
- Name
outputChain
- Type
- string
- Description
The chain where output tokens will be sent
QuoteRequest Interface
interface QuoteRequest {
offerer: string;
recipient: string;
inputToken: string;
outputToken: string;
inputAmount: string | number | bigint;
inputChain: string;
outputChain: string;
}
Example
const quoteRequest: QuoteRequest = {
offerer: "0x742d35Cc6634C0532925a3b8D4C9db96C4b4d8b",
recipient: "0x742d35Cc6634C0532925a3b8D4C9db96C4b4d8b",
inputToken: "0x4200000000000000000000000000000000000006", // WETH
outputToken: "0xaf88d065e77c8cc2239327c5edb3a432268e5831", // USDC
inputAmount: "1000000000000000000", // 1 ETH
inputChain: "base",
outputChain: "arbitrum"
};
QuoteResponse
type
The QuoteResponse
interface contains the quote details returned by the API, including all necessary data to execute the swap.
- Name
orderHash
- Type
- string
- Description
Unique identifier for the order
- Name
signingHash
- Type
- string
- Description
Hash used for signing the order
- Name
offerer
- Type
- string
- Description
The address initiating the swap
- Name
recipient
- Type
- string
- Description
The address receiving the output tokens
- Name
inputToken
- Type
- string
- Description
The token address being sold
- Name
outputToken
- Type
- string
- Description
The token address being bought
- Name
inputAmount
- Type
- string
- Description
The amount of input tokens (as string)
- Name
outputAmount
- Type
- string
- Description
The amount of output tokens (as string)
- Name
inputChain
- Type
- string
- Description
The source chain identifier
- Name
outputChain
- Type
- string
- Description
The destination chain identifier
- Name
startTime
- Type
- number
- Description
Unix timestamp when the order becomes valid
- Name
endTime
- Type
- number
- Description
Unix timestamp when the order expires
- Name
estimatedTime
- Type
- number
- Description
Estimated execution time in seconds
QuoteResponse Interface
interface QuoteResponse {
orderHash: string;
signingHash: string;
offerer: string;
recipient: string;
inputToken: string;
outputToken: string;
inputAmount: string;
outputAmount: string;
inputChain: string;
outputChain: string;
startTime: number;
endTime: number;
estimatedTime: number;
}
Example
const quoteResponse: QuoteResponse = {
orderHash: "0x1234567890abcdef1234567890abcdef12345678",
signingHash: "0xabcdef1234567890abcdef1234567890abcdef12",
offerer: "0x742d35Cc6634C0532925a3b8D4C9db96C4b4d8b",
recipient: "0x742d35Cc6634C0532925a3b8D4C9db96C4b4d8b",
inputToken: "0x4200000000000000000000000000000000000006",
outputToken: "0xaf88d065e77c8cc2239327c5edb3a432268e5831",
inputAmount: "1000000000000000000", // 1 WETH
outputAmount: "3200000000", // 3200 USDC
inputChain: "base",
outputChain: "arbitrum",
startTime: 1703001600,
endTime: 1703005200,
estimatedTime: 180 // 3 minutes
};
Getting a Quote
getQuote
function
Request a quote for a cross-chain swap with real-time pricing and order parameters.
- Name
request
- Type
- QuoteRequest
- Description
The quote request parameters
- Name
baseUrl
- Type
- string
- Description
API base URL (defaults to
https://api.aori.io
)
- Name
apiKey
- Type
- string
- Description
API key for authentication
Returns: QuoteResponse
Usage
const quote = await getQuote(
{
offerer: '0x742d35Cc6634C0532925a3b8D4C9db96C4b4d8b',
recipient: '0x742d35Cc6634C0532925a3b8D4C9db96C4b4d8b',
inputToken: '0x4200000000000000000000000000000000000006',
outputToken: '0xaf88d065e77c8cc2239327c5edb3a432268e5831',
inputAmount: '1000000000000000000',
inputChain: 'base',
outputChain: 'arbitrum'
},
'https://api.aori.io',
process.env.AORI_API_KEY
);
Response
{
"orderHash": "0x1234567890abcdef1234567890abcdef12345678",
"signingHash": "0xabcdef1234567890abcdef1234567890abcdef12",
"offerer": "0x742d35Cc6634C0532925a3b8D4C9db96C4b4d8b",
"recipient": "0x742d35Cc6634C0532925a3b8D4C9db96C4b4d8b",
"inputToken": "0x4200000000000000000000000000000000000006",
"outputToken": "0xaf88d065e77c8cc2239327c5edb3a432268e5831",
"inputAmount": "1000000000000000000",
"outputAmount": "3200000000",
"inputChain": "base",
"outputChain": "arbitrum",
"startTime": 1703001600,
"endTime": 1703005200,
"estimatedTime": 180
}