Swap Quotes
getUniswapV2Quote
Gets a swap quote from the Uniswap V2 Router02 contract using getAmountsOut (constant-product x*y=k AMM). On-chain read - no transaction needed. Router02 only deployed on Ethereum.
curl -X POST https://your-endpoint.simplystaking.xyz/v1 \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "getUniswapV2Quote",
"params": {
"chain": "ethereum",
"tokenIn": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
"tokenOut": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
"amount": "1.0"
},
"id": 1
}'import { Spectrum } from '@spectrumnodes/sdk';
const spectrum = new Spectrum({ api: 'https://your-endpoint.simplystaking.xyz/YOUR_API_KEY/' });
const result = await spectrum.defi.getUniswapV2Quote('ethereum', {
tokenIn: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2',
tokenOut: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
amount: '1.0'
});
console.log(result);{
"jsonrpc": "2.0",
"result": {
"data": {
"chain": "ethereum",
"tokenIn": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
"tokenOut": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
"amountIn": "1.0",
"amountOut": "2075.234"
}
},
"id": 1
}Parameters
| Name | Required | Description |
|---|---|---|
| chain | yes | Network slug |
| tokenIn | yes | Input token contract address e.g. 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2 |
| tokenOut | yes | Output token contract address e.g. 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48 |
| amount | yes | Input amount (human-readable, e.g. "1.0") e.g. 1.0 |
Response Fields
| Field | Type |
|---|---|
data | object |
chain | string |
tokenIn | string |
tokenOut | string |
amountIn | string |
amountOut | string |
Supported Networks
Ethereum
getUniswapV3Quote
Gets an exact-input swap quote from the Uniswap V3 QuoterV2 contract. On-chain read - no transaction needed.
curl -X POST https://your-endpoint.simplystaking.xyz/v1 \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "getUniswapV3Quote",
"params": {
"chain": "ethereum",
"tokenIn": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
"tokenOut": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
"amount": "1.0",
"fee": 3000,
"blockHeight": 19834521
},
"id": 1
}'import { Spectrum } from '@spectrumnodes/sdk';
const spectrum = new Spectrum({ api: 'https://your-endpoint.simplystaking.xyz/YOUR_API_KEY/' });
const result = await spectrum.defi.getUniswapV3Quote('ethereum', {
tokenIn: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2',
tokenOut: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
amount: '1.0',
fee: 3000
});
console.log(result);{
"jsonrpc": "2.0",
"result": {
"data": {
"chain": "ethereum",
"tokenIn": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
"tokenOut": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
"amountIn": "1.0",
"amountOut": "2075.234",
"fee": 3000,
"blockHeight": 19834521,
"gasEstimate": "165000"
}
},
"id": 1
}Parameters
| Name | Required | Description |
|---|---|---|
| chain | yes | Network slug |
| tokenIn | yes | Input token contract address e.g. 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2 |
| tokenOut | yes | Output token contract address e.g. 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48 |
| amount | yes | Input amount (human-readable, e.g. "1.0") e.g. 1.0 |
| fee | no | Pool fee tier in bps Options: 500, 3000, 10000 |
| blockHeight | no | Historical EVM block number (archive nodes only) e.g. 19834521 |
Response Fields
| Field | Type |
|---|---|
data | object |
chain | string |
tokenIn | string |
tokenOut | string |
amountIn | string |
amountOut | string |
fee | integer |
blockHeight | integer |
gasEstimate | string |
Supported Networks
EthereumPolygonArbitrumOptimismBaseBNB ChainAvalanche
getUniswapV4Quote
Gets a swap quote from the Uniswap V4 Quoter contract (singleton PoolManager architecture with hooks). On-chain read via staticCall.
curl -X POST https://your-endpoint.simplystaking.xyz/v1 \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "getUniswapV4Quote",
"params": {
"chain": "ethereum",
"tokenIn": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
"tokenOut": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
"amount": "1.0",
"fee": 3000,
"tickSpacing": 60,
"blockHeight": 19834521
},
"id": 1
}'import { Spectrum } from '@spectrumnodes/sdk';
const spectrum = new Spectrum({ api: 'https://your-endpoint.simplystaking.xyz/YOUR_API_KEY/' });
const result = await spectrum.defi.getUniswapV4Quote('ethereum', {
tokenIn: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2',
tokenOut: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
amount: '1.0'
});
console.log(result);{
"jsonrpc": "2.0",
"result": {
"data": {
"chain": "ethereum",
"tokenIn": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
"tokenOut": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
"amountIn": "1.0",
"amountOut": "2080.15",
"fee": 3000,
"tickSpacing": 60,
"blockHeight": 19834521,
"gasEstimate": "180000"
}
},
"id": 1
}Parameters
| Name | Required | Description |
|---|---|---|
| chain | yes | Network slug |
| tokenIn | yes | Input token contract address e.g. 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2 |
| tokenOut | yes | Output token contract address e.g. 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48 |
| amount | yes | Input amount (human-readable, e.g. "1.0") e.g. 1.0 |
| fee | no | Pool fee in bps (default 3000) e.g. 3000 |
| tickSpacing | no | Tick spacing (default 60) e.g. 60 |
| blockHeight | no | Historical EVM block number (archive nodes only) e.g. 19834521 |
Response Fields
| Field | Type |
|---|---|
data | object |
chain | string |
tokenIn | string |
tokenOut | string |
amountIn | string |
amountOut | string |
fee | integer |
tickSpacing | integer |
blockHeight | integer |
gasEstimate | string |
Supported Networks
EthereumOptimismBaseArbitrumPolygonBNB ChainAvalanche
Endpoint "defi-uniswap-v3-token" not found
getJupiterQuote
Gets a swap quote from the Jupiter aggregator for Solana SPL tokens. Returns route plan, price impact, and output amount. Chain is fixed to Solana.
curl -X POST https://your-endpoint.simplystaking.xyz/v1 \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "getJupiterQuote",
"params": {
"inputMint": "So11111111111111111111111111111111111111112",
"outputMint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
"amount": "1000000000",
"slippageBps": 50
},
"id": 1
}'import { Spectrum } from '@spectrumnodes/sdk';
const spectrum = new Spectrum({ api: 'https://your-endpoint.simplystaking.xyz/YOUR_API_KEY/' });
const result = await spectrum.defi.getJupiterQuote({
inputMint: 'So11111111111111111111111111111111111111112',
outputMint: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v',
amount: '1000000000'
});
console.log(result);{
"jsonrpc": "2.0",
"result": {
"data": {
"inputMint": "So11111111111111111111111111111111111111112",
"outputMint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
"amountIn": "1000000000",
"amountOut": "152340000",
"priceImpactPct": "0.01",
"routePlan": [
{
"swapInfo": {
"ammKey": "ABC...",
"label": "Raydium",
"inputMint": "So1...",
"outputMint": "EPj..."
},
"percent": 100
}
]
}
},
"id": 1
}Parameters
| Name | Required | Description |
|---|---|---|
| inputMint | yes | Input SPL token mint address e.g. So11111111111111111111111111111111111111112 |
| outputMint | yes | Output SPL token mint address e.g. EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v |
| amount | yes | Input amount in raw units (lamports) e.g. 1000000000 |
| slippageBps | no | Slippage tolerance in bps (default 50) e.g. 50 |
Response Fields
| Field | Type |
|---|---|
data | object |
inputMint | string |
outputMint | string |
amountIn | string |
amountOut | string |
priceImpactPct | string |
routePlan | object[] |
swapInfo | object |
ammKey | string |
label | string |
inputMint | string |
outputMint | string |
percent | integer |
Supported Networks
Solana
getJupiterPrice
Gets the current price of a Solana token by quoting 1 unit against a reference token (e.g. USDC). Derived from Jupiter quote API. Chain is fixed to Solana.
curl -X POST https://your-endpoint.simplystaking.xyz/v1 \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "getJupiterPrice",
"params": {
"inputMint": "So11111111111111111111111111111111111111112",
"outputMint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"
},
"id": 1
}'import { Spectrum } from '@spectrumnodes/sdk';
const spectrum = new Spectrum({ api: 'https://your-endpoint.simplystaking.xyz/YOUR_API_KEY/' });
const result = await spectrum.defi.getJupiterPrice({
inputMint: 'So11111111111111111111111111111111111111112',
outputMint: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v'
});
console.log(result);{
"jsonrpc": "2.0",
"result": {
"data": {
"price": 152.34
}
},
"id": 1
}Parameters
| Name | Required | Description |
|---|---|---|
| inputMint | yes | Token mint to price e.g. So11111111111111111111111111111111111111112 |
| outputMint | yes | Reference token mint (e.g. USDC) e.g. EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v |
Response Fields
| Field | Type |
|---|---|
data | object |
price | number |
Supported Networks
Solana