On this page

latest contributor to this doc

Last Edit:

@smk762

Komodo DeFi Framework Method: 1inch v6.0 Classic Swap Create

The 1inch_v6_0_classic_swap_create method returns transaction data for classic swap from 1inch API version 6.0.

To use methods which interface with the 1inch API, you need to set the 1inch_api url in your MM2.json file. You'll also need to set your 1inch API key as an environment variable called ONE_INCH_API_TEST_AUTH, e.g. ONE_INCH_API_TEST_AUTH="Bearer YourAPIkey".

As this feature is still experimental, you will need to build KDF from source on the dev branch with a build flag, e.g. cargo build --features test-ext-api.

Refer to the 1inch Classic Swap documentation for more information.

ParameterTypeRequiredDefaultDescription
amountnumeric string or rational-Swap amount (in coins units)
basestring-Base coin name
relstring-Rel coin name (must be from the same EVM chain as the base coin)
slippagefloat-Allowed slippage, min: 0; max: 50
allow_partial_fillbooltrueIf true, the algorithm can cancel part of the route, if the rate has become less attractive. Unswapped tokens will return to 'my address'.
compatibilitybool-Exclude the Unoswap method
complexity_levelnumeric2Maximum number of token-connectors to be used in a transaction, min: 0; max: 3
connector_tokensstring-Token-connectors can be specified via this parameter. If not set, default token-connectors will be used
disable_estimateboolfalseIf true, disable most of the checks
excluded_protocolsstring-Excluded supported liquidity sources. Should be the same for a quote and swap, max: 5
feefloat0Partner fee, percentage of src token amount will be sent to referrer address, min: 0; max: 3. Should be the same for quote and swap rpc.
gas_limitnumeric11500000Maximum amount of gas for a swap. Should be the same for a quote and swap. max: 11500000
gas_pricenumeric string-Network price per gas, in Gwei. 1inch takes in account gas expenses to determine exchange route. Should be the same for a quote and swap
include_gasbooleantrueInclude estimated gas in return value
include_protocolsbooleantrueReturn used swap protocols in response
include_tokens_infobooleantrueReturn fromToken and toToken info in response
main_route_partsnumeric20Limit maximum number of main route parts. Should be the same for a quote and swap. max: 50
partsnumeric20Limit maximum number of parts each main route parts can be split into. Should be the same for a quote and swap. max: 100
permitstring-Used according https://eips.ethereum.org/EIPS/eip-2612
protocolsstring-Specify liquidity sources e.g.: &protocols=WETH,CURVE,BALANCER,...,ZRX (by default - all used)
receiverbool-This address will receive funds after the swap. By default same address as 'my address'
referrerbool-Address to receive the partner fee. Must be set explicitly if fee is also set
use_permit2boolfalseEnable this flag for auto approval by Permit2 contract if you did an approval to Uniswap Permit2 smart contract for this token.

ParameterTypeDescription
dst_amountnumberDestination token amount, in coins units.
src_tokenobjectSource (base) token information. A standard 1inchTokenInfo object.
dst_tokenobjectDestination (rel) token info. A standard 1inchTokenInfo object.
protocolslistOptional. A list of standard 1inchProtocolInfo objects, used as liquidity sources used to route trade.
txobjectA standard 1inchTxFields object.

POST
1inch_v6_0_classic_swap_create
{
  "mmrpc": "2.0",
  "userpass": "RPC_UserP@SSW0RD",
  "method": "1inch_v6_0_classic_swap_create",
  "params": {
    "base": "ETH",
    "rel": "USDC-ERC20",
    "amount": 0.1,
    "slippage": 1,
    "include_tokens_info": true,
    "include_protocols": true,
    "include_gas": true,
    "fee": 0,
    "complexity_level": 3,
    "gas_limit": 11500000,
    "main_route_parts": 50,
    "parts": 100,
    "protocols": ""
  }
}