diff --git a/docs/aggregation-protocol/api/_category_.json b/docs/aggregation-protocol/api/_category_.json new file mode 100644 index 000000000..a4b6671f1 --- /dev/null +++ b/docs/aggregation-protocol/api/_category_.json @@ -0,0 +1,4 @@ +{ + "label": "API", + "position": 3 +} diff --git a/docs/aggregation-protocol/api/quote-params.mdx b/docs/aggregation-protocol/api/quote-params.mdx new file mode 100644 index 000000000..66f7a4bb1 --- /dev/null +++ b/docs/aggregation-protocol/api/quote-params.mdx @@ -0,0 +1,204 @@ +--- +sidebar_position: 5 +--- + +# Quote params + +## Find the best quote to exchange via 1inch router: [`/api/quote`](./swagger.mdx) + +### Description of query parameters + +
+ Parameter name + | ++ Type + | ++ Description + | +
fromTokenAddress* |
+ string | +
+ contract address of a token to sell + e.g.: 0x6b175474e89094c44da98b954eedeac495271d0f
+ |
+
toTokenAddress* |
+ string | +
+ contract address of a token to buy + e.g.: 0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48
+ |
+
amount* |
+ integer | +
+ amount of a token to sell, set in minimal divisible units + e.g.: + 1.00 DAI set as 1000000000000000000 + 51.03 USDC set as 51030000
+ |
+
fee |
+ number | +
+ this percentage of fromTokenAddress token amount will be sent to referrerAddress ,+ the rest will be used as input for a swap + min: 0; max: 3; default: 0; + example to set a fee to 1.5%: &fee=1.5
+ |
+
protocols |
+ string | +
+ specify liquidity protocols to use. If not set, all liquidity protocols will be used + e.g.: &protocols=WETH,CURVE,BALANCER,...,ZRX + default: all protocols can be used
+ |
+
gasPrice |
+ string | +
+ 1inch takes in account gas expenses to determine exchange route. It is important to use the same gas price + on the quote and swap methods + gas price set in wei: 12.5 GWEI set as 12500000000 + default: "fast" from the network
+ |
+
complexityLevel |
+ string | +
+ maximum number of token-connectors to be used in a transaction. The more is used — the longer route
+ estimation will take, the more complex route might be as a result. If not set, two token-connectors might be
+ used + min: 0; max: 3; default: 2
+ |
+
connectorTokens |
+ string | +
+ token-connectors can be specified via this parameter. The more is set — the longer route estimation will
+ take. If not set, default token-connectors will be used. If token you want to exchange doesn't have a pool
+ with one of the default token-connectors, this parameter will help find the route;
+ should be the same for a quote and swap
+ e.g.: + &connectorTokens=0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE,
+ 0x6b175474e89094c44da98b954eedeac495271d0f + default: list of dafault token-connectors
+ |
+
gasLimit |
+ integer | +
+ maximum amount of gas for a swap; + should be the same for a quote and swap + default: 11500000; max: 11500000;
+ |
+
gasLimit |
+ integer | +
+ maximum amount of gas for a swap; + should be the same for a quote and swap + default: 11500000; max: 11500000;
+ |
+
mainRouteParts |
+ integer | +
+ limit maximum number of main route parts; + should be the same for a quote and swap + default: 20; max: 50;
+ |
+
parts |
+ integer | +
+ limit maximum number of parts each main route part can be split into; should be the same for a quote and swap + default: 20; max: 100;
+ |
+
+ Parameter name + | ++ Type + | ++ Description + | +
fromToken |
+ string | ++ parameters of a token to sell + | +
toToken |
+ string | ++ parameters of a token to buy + | +
fromTokenAmount |
+ string | +
+ input amount of fromToken in minimal divisible units
+ |
+
toTokenAmount |
+ string | +
+ result amount of toToken in minimal divisible units
+ |
+
protocols |
+ string | ++ route of the trade + | +
estimatedGas |
+ string | +
+ rough estimated amount of the gas limit for used protocols; + do not use estimatedGas from the quote method as the gas limit of a transaction
+ |
+
fromTokenAddress*
fromTokenAddress *
0x6b175474e89094c44da98b954eedeac495271d0f
toTokenAddress*
toTokenAddress *
0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48
amount*
amount *
1.00 DAI
set as 1000000000000000000
+ e.g.:1.00 DAI
set as 1000000000000000000
51.03 USDC
set as 51030000
fee
fromAddress *
0x52bc44d5378309ee2abf1539bf71de1b7d7be3b5
+ slippage *
fromTokenAddress
token amount will be sent to referrerAddress
,
- the rest will be used as input for a swap
- min: 0;
max: 3;
default: 0;
- example to set a fee to 1.5%: &fee=1.5
+ limit of price slippage you are willing to accept in percentage, may be set with decimals. &slippage=0.5
+ means 0.5% slippage is acceptable. Low values increase chances that transaction will fail, high values
+ increase chances of front running. Set values in the range from 0 to 50
protocols
&protocols=WETH,CURVE,BALANCER,...,ZRX
+ specify liquidity protocols. If not set, all liquidity protocols will be used; you can disable any protocol
+ by listing all protocols except those you don't need&protocols=WETH,CURVE,BALANCER,...,ZRX
default: all protocols can be used
destReceiver
referrerAddress
fee
min: 0;
max: 3;
default: 0
&fee=1.5
+ gasPrice
12.5 GWEI
set as 12500000000
- default: "fast" from the network
+ on the quote and swap methods.12.5 GWEI
set as 12500000000
default: "fast" from network
+ burnChi
default: false
min: 0;
max: 3;
default: 2
&connectorTokens=0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE,
- 0x6b175474e89094c44da98b954eedeac495271d0f
+ take. If not set, default token-connectors will be used. If a token you want to exchange doesn't have a pool
+ with one of the default token-connectors this parameter will help find the route;
+ should be the same for a quote and swap max: 5;
&connectorTokens=0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE,
+ 0x6b175474e89094c44da98b954eedeac495271d0f
default: list of dafault token-connectors
gasLimit
allowPartialFill
default: true
+ disableEstimate
default: 11500000;
max: 11500000;
+ if true, disable most of the checksdefault: false
gasLimit
default: 11500000;
max: 11500000;
+ maximum amount of gas for a swap;default: 11500000;
max: 11500000
mainRouteParts
default: 20;
max: 50;
+ limit maximum number of main route parts;default: 20;
max: 50
parts
default: 20;
max: 100;
+ limit maximum number of parts each main route parts can be split into; should be the same for a quote and swapdefault: 20;
max: 100
estimatedGas |
- string | -
- rough estimated amount of the gas limit for used protocols;
- do not use estimatedGas from the quote method as the gas limit of a transaction
- |
-
- Parameter name - | -- Type - | -- Description - | -|
fromTokenAddress * | -string | -
- contract address of a token to sell
- e.g.: 0x6b175474e89094c44da98b954eedeac495271d0f
- |
- |
toTokenAddress * | +from |
string |
- contract address of a token to buy
- e.g.: 0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48
+ transactions will be sent from this address
|
amount * | -integer | -
- amount of a token to sell, set in minimal divisible units
- e.g.:
- 1.00 DAI set as 1000000000000000000
- 51.03 USDC set as 51030000
- |
- |
fromAddress * | +to |
string |
- address of a seller, make sure that this address has approved to spend fromTokenAddress in needed
- amount
- e.g.: 0x52bc44d5378309ee2abf1539bf71de1b7d7be3b5
- |
-
slippage * | -number | -- limit of price slippage you are willing to accept in percentage, may be set with decimals. &slippage=0.5 - means 0.5% slippage is acceptable. Low values increase chances that transaction will fail, high values - increase chances of front running. Set values in the range from 0 to 50 + transactions will be sent to our contract address | |
protocols | +data |
string |
- specify liquidity protocols. If not set, all liquidity protocols will be used; you can disable any protocol
- by listing all protocols except those you don't need
- e.g.: &protocols=WETH,CURVE,BALANCER,...,ZRX
- default: all protocols can be used
+ bytes of call data
|
destReceiver | +value |
string | - recipient address of a purchased token - if not set, fromAddress will receive a purchased token - | -
referrerAddress | -string | -referrer's address - | -|
fee | -number | -
- this percentage of fromTokenAddress token amount will be sent to referrerAddress, the rest will be used as
- input for a swap
- min: 0; max: 3; default: 0
- example to set a fee to 1.5%: &fee=1.5
- |
- |
gasPrice | -string | -
- 1inch takes in account gas expenses to determine exchange route. It is important to use the same gas price
- on the quote and swap methods.
- Gas price set in wei: 12.5 GWEI set as 12500000000
- default: "fast" from network
- |
- |
burnChi | -boolean | -
- If true, CHI will be burned from fromAddress to compensate gas. Check CHI balance and allowance before
- turning that on. CHI should be approved for the spender address
- default: false
+ amount of ETH (in wei) will be sent to the contract address
|
|
complexityLevel | +gasPrice |
string |
- maximum number of token-connectors to be used in a transaction. The more is used — the longer route
- estimation will take, the more complex route might be as a result. If not set, two token-connectors may be
- used
- min: 0; max: 3; default: 2
+ gas price in wei
|
connectorTokens | +gas |
string |
- token-connectors can be specified via this parameter. The more is set — the longer route estimation will
- take. If not set, default token-connectors will be used. If a token you want to exchange doesn't have a pool
- with one of the default token-connectors this parameter will help find the route;
- should be the same for a
- quote and swap max: 5;
- e.g.:
- &connectorTokens=0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE,
- 0x6b175474e89094c44da98b954eedeac495271d0f
- default: list of dafault token-connectors
- |
-
allowPartialFill | -boolean | -if true, the algorithm can cancel part of the route, if the rate has become less attractive. Unswapped
- tokens will return to the fromAddress
- default: true
- |
- |
disableEstimate | -boolean | -
- if true, disable most of the checks
- default: false
- |
- |
gasLimit | -integer | -
- maximum amount of gas for a swap;
- should be the same for a quote and swap
- default: 11500000; max: 11500000
- |
- |
mainRouteParts | -integer | -
- limit maximum number of main route parts;
- should be the same for a quote and swap
- default: 20; max: 50
- |
- |
parts | -integer | -
- 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
+ estimated amount of the gas limit, increase this value by 25%
|