1inch_v6_0_classic_swap_liquidity_sources
The 1inch_v6_0_classic_swap_liquidity_sources method returns liquidity sources for classic swaps from 1inch API version 6.0.
Refer to the 1inch Classic Swap documentation for more information.
Arguments
| Structure | Type | Description |
|---|---|---|
| chain_id | numeric | Chain id |
Response
| Structure | Type | Description |
|---|---|---|
| dst_amount | rational number | Destination token amount, in coins units. |
| protocols | list | Optional. A list of standard 1inchProtocolImage objects. |
📌 Examples
Command
POST 1inch_v6_0_classic_swap_liquidity_sources
{
"mmrpc": "2.0",
"userpass": "RPC_UserP@SSW0RD",
"method": "1inch_v6_0_classic_swap_liquidity_sources",
"params": {
"chain_id": 1
}
} curl --url "http://127.0.0.1:7783" --data '{
"mmrpc": "2.0",
"userpass": "RPC_UserP@SSW0RD",
"method": "1inch_v6_0_classic_swap_liquidity_sources",
"params": {
"chain_id": 1
}
}' import requests
import json
url = "http://127.0.0.1:7783"
payload = {
"mmrpc": "2.0",
"userpass": "RPC_UserP@SSW0RD",
"method": "1inch_v6_0_classic_swap_liquidity_sources",
"params": {
"chain_id": 1
}
}
response = requests.post(url, json=payload)
print(json.dumps(response.json(), indent=2)) const payload = {
"mmrpc": "2.0",
"userpass": "RPC_UserP@SSW0RD",
"method": "1inch_v6_0_classic_swap_liquidity_sources",
"params": {
"chain_id": 1
}
};
const response = await fetch("http://127.0.0.1:7783", {
method: "POST",
body: JSON.stringify(payload),
});
console.log(await response.json()); <?php
$payload = <<<'JSON'
{
"mmrpc": "2.0",
"userpass": "RPC_UserP@SSW0RD",
"method": "1inch_v6_0_classic_swap_liquidity_sources",
"params": {
"chain_id": 1
}
}
JSON;
$ch = curl_init("http://127.0.0.1:7783");
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
$response = curl_exec($ch);
curl_close($ch);
echo $response; package main
import (
"bytes"
"fmt"
"io"
"net/http"
)
func main() {
payload := []byte(`{"mmrpc":"2.0","userpass":"RPC_UserP@SSW0RD","method":"1inch_v6_0_classic_swap_liquidity_sources","params":{"chain_id":1}}`)
resp, err := http.Post("http://127.0.0.1:7783", "application/json", bytes.NewBuffer(payload))
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
} require 'net/http'
require 'json'
require 'uri'
uri = URI("http://127.0.0.1:7783")
payload = {
"mmrpc": "2.0",
"userpass": "RPC_UserP@SSW0RD",
"method": "1inch_v6_0_classic_swap_liquidity_sources",
"params": {
"chain_id": 1
}
}
response = Net::HTTP.post(uri, payload.to_json, 'Content-Type' => 'application/json')
puts JSON.pretty_generate(JSON.parse(response.body)) Show Response
Response
{
"mmrpc": "2.0",
"result": {
"protocols": [
{
"id": "UNISWAP_V1",
"title": "Uniswap V1",
"img": "https://cdn.1inch.io/liquidity-sources-logo/uniswap.png",
"img_color": "https://cdn.1inch.io/liquidity-sources-logo/uniswap_color.png"
},
{
"id": "UNISWAP_V2",
"title": "Uniswap V2",
"img": "https://cdn.1inch.io/liquidity-sources-logo/uniswap.png",
"img_color": "https://cdn.1inch.io/liquidity-sources-logo/uniswap_color.png"
},
{
"id": "SUSHI",
"title": "SushiSwap",
"img": "https://cdn.1inch.io/liquidity-sources-logo/sushiswap.png",
"img_color": "https://cdn.1inch.io/liquidity-sources-logo/sushiswap_color.png"
}
]
}
} Show Error Responses
Error: Configuration missing
The 1inch_api url not set in your MM2.json file.
{
"mmrpc": "2.0",
"error": "No API config param",
"error_path": "rpcs.client",
"error_trace": "rpcs:137] client:105]",
"error_type": "InvalidParam",
"error_data": "No API config param",
"id": null
}Error: Authentication failure
ONE_INCH_API_TEST_AUTH environment variable not set, or incorrect.
{
"mmrpc": "2.0",
"error": "1inch API error: General API error: Unauthorized description: ",
"error_path": "rpcs.client",
"error_trace": "rpcs:140] client:152]",
"error_type": "OneInchError",
"error_data": {
"GeneralApiError": {
"error_msg": "Unauthorized",
"description": "",
"status_code": 401
}
},
"id": null
}