|
| 1 | +export const title = "Komodo DeFi Framework Method: 1inch v6.0 Classic Swap Create (v2)"; |
| 2 | +export const description = |
| 3 | + "The 1inch_v6_0_classic_swap_create method returns transaction data for classic swap from 1inch API version 6.0."; |
| 4 | + |
| 5 | +# 1inch\_v6\_0\_classic\_swap\_create |
| 6 | + |
| 7 | +The `1inch_v6_0_classic_swap_create` method returns transaction data for classic swap from 1inch API version 6.0. |
| 8 | + |
| 9 | +## Arguments |
| 10 | + |
| 11 | +| Structure | Type | Description | |
| 12 | +| --------------- | ---- | ---------------------------------------------------------------------------- | |
| 13 | +| base | string | Base coin name | |
| 14 | +| rel | string | Rel coin name (must be from the same EVM chain as the base coin) | |
| 15 | +| amount | numeric string or rational | Swap amount (in coins units) | |
| 16 | +| slippage | float | Allowed slippage, min: 0; max: 50 | |
| 17 | +| fee | float | Optional. Partner 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. Default is 0 | |
| 18 | +| protocols | string | Optional. Specify liquidity sources e.g.: &protocols=WETH,CURVE,BALANCER,...,ZRX (by default - all used) | |
| 19 | +| gas_price | numeric string | Optional. 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 | |
| 20 | +| complexity_level | numeric | Optional. Maximum number of token-connectors to be used in a transaction, min: 0; max: 3; default: 2 | |
| 21 | +| parts | numeric | Optional. Limit maximum number of parts each main route parts can be split into. Should be the same for a quote and swap. Default: 20; max: 100 | |
| 22 | +| main_route_parts | numeric | Optional. Limit maximum number of main route parts. Should be the same for a quote and swap. Default: 20; max: 50 | |
| 23 | +| gas_limit | numeric | Optional. Maximum amount of gas for a swap. Should be the same for a quote and swap. Default: 11500000; max: 11500000 | |
| 24 | +| include_tokens_info | boolean | Optional. Return fromToken and toToken info in response (default is true) | |
| 25 | +| include_protocols | boolean | Optional. Return used swap protocols in response (default is true) | |
| 26 | +| include_gas | boolean | Optional. Include estimated gas in return value (default is true) | |
| 27 | +| connector_tokens | string | Optional. Token-connectors can be specified via this parameter. If not set, default token-connectors will be used | |
| 28 | +| excluded_protocols | string | Optional. Excluded supported liquidity sources. Should be the same for a quote and swap, max: 5 | |
| 29 | +| permit | string | Optional. Used according https://eips.ethereum.org/EIPS/eip-2612 | |
| 30 | +| compatibility | bool | Optional. Exclude the Unoswap method | |
| 31 | +| receiver | bool | Optional. This address will receive funds after the swap. By default same address as 'my address' | |
| 32 | +| referrer | bool | Optional. Address to receive the partner fee. Must be set explicitly if fee is also set | |
| 33 | +| disable_estimate | bool | Optional. if true, disable most of the checks, default: false | |
| 34 | +| allow_partial_fill | bool | Optional. if true, the algorithm can cancel part of the route, if the rate has become less attractive. Unswapped tokens will return to 'my address'. Default: true | |
| 35 | +| use_permit2 | bool | Optional. Enable this flag for auto approval by Permit2 contract if you did an approval to Uniswap Permit2 smart contract for this token. Default is false | |
| 36 | + |
| 37 | +## Response |
| 38 | + |
| 39 | +| Structure | Type | Description | |
| 40 | +| --------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | |
| 41 | +| dst_amount | rational number | Destination token amount, in coins units. | |
| 42 | +| src_token | [TokenInfo](/komodo-defi-framework/api/v20/one_inch_v6_0_classic_swap_create/#TokenInfo) | Source (base) token info. | |
| 43 | +| dst_token | [TokenInfo](/komodo-defi-framework/api/v20/one_inch_v6_0_classic_swap_create/#TokenInfo) | Destination (rel) token info. | |
| 44 | +| protocols | list of [ProtocolInfo](/komodo-defi-framework/api/v20/one_inch_v6_0_classic_swap_create/#ProtocolInfo) | Optional. Used liquidity sources to route trade. | |
| 45 | +| tx | [TxFields](/komodo-defi-framework/api/v20/one_inch_v6_0_classic_swap_create/#TxFields) | Swap tx fields (returned only for create swap rpc) | |
| 46 | + |
| 47 | +### TokenInfo |
| 48 | +| Structure | Type | Description | |
| 49 | +| --------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | |
| 50 | +| address | string | Token contract address. | |
| 51 | +| symbol | string | Token symbol. | |
| 52 | +| name | string | Token name. | |
| 53 | +| decimals | numeric | Number of digits after decimal point for the token amount. | |
| 54 | +| eip2612 | boolean | Is Eip-2612 supported. | |
| 55 | +| is_fot | boolean | Is FoT token. | |
| 56 | +| logo_uri | string | Token logo uri. | |
| 57 | +| tags | list of string | Token tags. | |
| 58 | + |
| 59 | +### ProtocolInfo |
| 60 | +| Structure | Type | Description | |
| 61 | +| --------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | |
| 62 | +| name | string | Liquidity source name. | |
| 63 | +| part | numeric | Protocol part. | |
| 64 | +| from_token_address | string | From-token contract address. | |
| 65 | +| to_token_address | numeric | To-token contract address. | |
| 66 | + |
| 67 | +### TxFields |
| 68 | +| Structure | Type | Description | |
| 69 | +| --------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | |
| 70 | +| from | string | From address | |
| 71 | +| to | string | To address | |
| 72 | +| data | string | Transaction data | |
| 73 | +| value | numeric | Transaction value | |
| 74 | +| gas_price | float | Gas price | |
| 75 | +| gas | numeric | Gas | |
| 76 | + |
| 77 | +#### 📌 Examples |
| 78 | + |
| 79 | +#### Command |
| 80 | + |
| 81 | +<CodeGroup title="" tag="POST" label="1inch_v6_0_classic_swap_quote" mm2MethodDecorate="true"> |
| 82 | + ```json |
| 83 | + { |
| 84 | + "mmrpc": "2.0", |
| 85 | + "userpass": "RPC_UserP@SSW0RD", |
| 86 | + "method": "1inch_v6_0_classic_swap_quote", |
| 87 | + "params": { |
| 88 | + "base": "ETH", |
| 89 | + "rel": "USDC-ERC20", |
| 90 | + "amount": 0.1, |
| 91 | + "include_tokens_info": true, |
| 92 | + "include_protocols": true, |
| 93 | + "include_gas": true, |
| 94 | + "fee": 0.0, |
| 95 | + "complexity_level": 3, |
| 96 | + "gas_limit": 11500000, |
| 97 | + "main_route_parts": 50, |
| 98 | + "parts": 100, |
| 99 | + "protocols": "" |
| 100 | + } |
| 101 | + } |
| 102 | + ``` |
| 103 | +</CodeGroup> |
| 104 | + |
| 105 | +<CollapsibleSection expandedText="Hide Response" collapsedText="Show Response"> |
| 106 | + #### Response |
| 107 | + |
| 108 | + ```json |
| 109 | + { |
| 110 | + "mmrpc": "2.0", |
| 111 | + "result": { |
| 112 | + "dst_amount": { |
| 113 | + "amount": "0.000000000035136197", |
| 114 | + "amount_fraction": { |
| 115 | + "numer": "35136197", |
| 116 | + "denom": "1000000000000000000" |
| 117 | + }, |
| 118 | + "amount_rat": [ |
| 119 | + [ |
| 120 | + 1, |
| 121 | + [ |
| 122 | + 35136197 |
| 123 | + ] |
| 124 | + ], |
| 125 | + [ |
| 126 | + 1, |
| 127 | + [ |
| 128 | + 2808348672, |
| 129 | + 232830643 |
| 130 | + ] |
| 131 | + ] |
| 132 | + ] |
| 133 | + }, |
| 134 | + "src_token": { |
| 135 | + "address": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee", |
| 136 | + "symbol": "ETH", |
| 137 | + "name": "Ether", |
| 138 | + "decimals": 18, |
| 139 | + "eip2612": false, |
| 140 | + "isFoT": false, |
| 141 | + "logoURI": "https://tokens.1inch.io/0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee.png", |
| 142 | + "tags": [ |
| 143 | + "crosschain", |
| 144 | + "GROUP:ETH", |
| 145 | + "native", |
| 146 | + "PEG:ETH" |
| 147 | + ] |
| 148 | + }, |
| 149 | + "dst_token": { |
| 150 | + "address": "0xdac17f958d2ee523a2206206994597c13d831ec7", |
| 151 | + "symbol": "USDT", |
| 152 | + "name": "Tether USD", |
| 153 | + "decimals": 6, |
| 154 | + "eip2612": false, |
| 155 | + "isFoT": false, |
| 156 | + "logoURI": "https://tokens-data.1inch.io/images/1/0xdac17f958d2ee523a2206206994597c13d831ec7.webp", |
| 157 | + "tags": [ |
| 158 | + "crosschain", |
| 159 | + "GROUP:USDT", |
| 160 | + "PEG:USD", |
| 161 | + "tokens" |
| 162 | + ] |
| 163 | + }, |
| 164 | + "protocols": [ |
| 165 | + [ |
| 166 | + [ |
| 167 | + { |
| 168 | + "name": "PMM15", |
| 169 | + "part": 100, |
| 170 | + "fromTokenAddress": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee", |
| 171 | + "toTokenAddress": "0xdac17f958d2ee523a2206206994597c13d831ec7" |
| 172 | + } |
| 173 | + ] |
| 174 | + ] |
| 175 | + ], |
| 176 | + "tx": { |
| 177 | + "from": "0x590559f6fb7720f24ff3e2fccf6015b466e9c92c", |
| 178 | + "to": "0x111111125421ca6dc452d289314280a0f8842a65", |
| 179 | + "data": "07ed2379000000000000000000000000f313b370d28760b98a2e935e56be92feb2c4ec04000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec7000000000000000000000000f313b370d28760b98a2e935e56be92feb2c4ec04000000000000000000000000590559f6fb7720f24ff3e2fccf6015b466e9c92c000000000000000000000000000000000000000000000000002386f26fc10000000000000000000000000000000000000000000000000000000000000212c64300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000033c64b2acd3506aded3c1dafdb6fcac91b7a3b6b42a3fe374c25fdd3df2e1f837ca466cb20f8da0c6fa46d937b90bf8a3fc3c68614b3a94c667999d026a40e1de9d0000000000000000000000000000000000000002de00006e00005400004e802026678dcd0000000000000000000000000000000000000000590559f6fb7720f24ff3e2fccf6015b466e9c92c000000000000000000000000000000000000000000000000000000e8d4a5100000206b4be0b94041c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2d0e30db05120111111125421ca6dc452d289314280a0f8842a65c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2012456a75868e8eb936a05227576bce26784ccdc8d75e0db817d687734fcf4c1c3d1d15ee296000000000000000000000000807cf9a772d5a3f9cefbc1192e939d62f0d9bd380000000000000000000000000000000000000000000000000000000000000000000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec7000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000000000000000000000000000000000000002182199000000000000000000000000000000000000000000000000002386099b1bf000000000000000000000000000000001915c00674734b400000000000000000000000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000000002800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000419709bee012bcde5380cd388d52134750a9dd29efd835b9ad7a8792b0da1149e00d9aa573ae0f4b7b6365536e846bc792f8ec1452de4fb7b53a39abfc0e2c901c1b000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000014111111125421ca6dc452d289314280a0f8842a6500000000000000000000000000000000c095c0a2", |
| 180 | + "value": "0.01", |
| 181 | + "gas_price": "22.078218982", |
| 182 | + "gas": 228890 |
| 183 | + }, |
| 184 | + "gas": null |
| 185 | + }, |
| 186 | + "id": null |
| 187 | + } |
| 188 | + ``` |
| 189 | +</CollapsibleSection> |
| 190 | + |
0 commit comments