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 +
feenumber + 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 +
protocolsstring + 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 +
gasPricestring + 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 +
complexityLevelstring + 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 +
connectorTokensstring + 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 +
gasLimitinteger + maximum amount of gas for a swap;
+ should be the same for a quote and swap
+ default: 11500000; max: 11500000; +
gasLimitinteger + maximum amount of gas for a swap;
+ should be the same for a quote and swap
+ default: 11500000; max: 11500000; +
mainRoutePartsinteger + limit maximum number of main route parts;
+ should be the same for a quote and swap
+ default: 20; max: 50; +
partsinteger + 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; +
+ +### Description of response parameters + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Parameter name + + Type + + Description +
fromTokenstring + parameters of a token to sell +
toTokenstring + parameters of a token to buy +
fromTokenAmountstring + input amount of fromToken in minimal divisible units +
toTokenAmountstring + result amount of toToken in minimal divisible units +
protocolsstring + route of the trade +
estimatedGasstring + 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 +
diff --git a/docs/aggregation-protocol/swagger.mdx b/docs/aggregation-protocol/api/swagger.mdx similarity index 90% rename from docs/aggregation-protocol/swagger.mdx rename to docs/aggregation-protocol/api/swagger.mdx index 99cef366d..73343f001 100644 --- a/docs/aggregation-protocol/swagger.mdx +++ b/docs/aggregation-protocol/api/swagger.mdx @@ -1,12 +1,12 @@ --- -sidebar_position: 2 +sidebar_position: 1 --- import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; -import {SwaggerDoc} from '../../src/components/swagger-doc/SwaggerDoc'; +import {SwaggerDoc} from '../../../src/components/swagger-doc/SwaggerDoc'; -# API +# Swagger diff --git a/docs/aggregation-protocol/swap-builder-params.mdx b/docs/aggregation-protocol/api/swap-params.mdx similarity index 52% rename from docs/aggregation-protocol/swap-builder-params.mdx rename to docs/aggregation-protocol/api/swap-params.mdx index d1c78382b..e53424311 100644 --- a/docs/aggregation-protocol/swap-builder-params.mdx +++ b/docs/aggregation-protocol/api/swap-params.mdx @@ -2,9 +2,9 @@ sidebar_position: 4 --- -# Swap builder params +# Swap params -## /api/quote +## Generate data for calling the 1inch router for exchange: [`/api/swap`](./swagger.mdx) ### Description of query parameters @@ -24,58 +24,99 @@ sidebar_position: 4 - fromTokenAddress* + fromTokenAddress * string - contract address of a token to sell + contract address of a token to sell
e.g.: 0x6b175474e89094c44da98b954eedeac495271d0f - toTokenAddress* + toTokenAddress * string - contract address of a token to buy + contract address of a token to buy
e.g.: 0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48 - amount* + amount * integer amount of a token to sell, set in minimal divisible units - e.g.: - 1.00 DAI set as 1000000000000000000 + e.g.:
+ 1.00 DAI set as 1000000000000000000
51.03 USDC set as 51030000 - fee + fromAddress * + string + + address of a seller, make sure that this address has approved to spend fromTokenAddress in needed amount
+ e.g.: 0x52bc44d5378309ee2abf1539bf71de1b7d7be3b5 + + + + slippage * 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 + 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 string - specify liquidity protocols to use. If not set, all liquidity protocols will be used - e.g.: &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
+ e.g.: &protocols=WETH,CURVE,BALANCER,...,ZRX
default: all protocols can be used + + destReceiver + 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 the network + 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 @@ -83,8 +124,7 @@ sidebar_position: 4 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 + 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 @@ -93,55 +133,60 @@ sidebar_position: 4 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 + 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 - gasLimit - integer + 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 - maximum amount of gas for a swap; - should be the same for a quote and swap - default: 11500000; max: 11500000; + 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; + 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; + 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; + 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 -## Description of response parameters +### Description of response parameters + @@ -194,202 +239,46 @@ sidebar_position: 4 - - - - - -
estimatedGasstring - 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 -
- - -## /api/swap - -### Description of query parameters - - - - - - - - - - - - - - - - - + - - - - - - + - - - - - - + - + - - - - - - - - - - - - - - - - - - - - - + - + - - - - - - - - - - - - - - - - - - - - - - - - -
- 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
protocolsdata 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
destReceivervalue string - recipient address of a purchased token - if not set, fromAddress will receive a purchased token -
referrerAddressstringreferrer's address -
feenumber - 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 -
gasPricestring - 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 -
burnChiboolean - 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
complexityLevelgasPrice 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
connectorTokensgas 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 -
allowPartialFillbooleanif 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 -
disableEstimateboolean - if true, disable most of the checks - default: false -
gasLimitinteger - maximum amount of gas for a swap; - should be the same for a quote and swap - default: 11500000; max: 11500000 -
mainRoutePartsinteger - limit maximum number of main route parts; - should be the same for a quote and swap - default: 20; max: 50 -
partsinteger - 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%
- -### Description of response parameters diff --git a/docs/aggregation-protocol/guide/quick-start.mdx b/docs/aggregation-protocol/guide/quick-start.mdx index 9012d2d16..83dbbc034 100644 --- a/docs/aggregation-protocol/guide/quick-start.mdx +++ b/docs/aggregation-protocol/guide/quick-start.mdx @@ -34,7 +34,7 @@ TODO: explaining of decimals :::info -About `slippage`, `disableEstimate`, `allowPartialFill` and other params, please, read [Swap builder params](../swap-builder-params.md) +About `slippage`, `disableEstimate`, `allowPartialFill` and other params, please, read [Swap params](../api/swap-params) ::: diff --git a/docs/limit-order-protocol/smart-contract/_category_.json b/docs/limit-order-protocol/smart-contract/_category_.json index fbfd39631..c246a63bb 100644 --- a/docs/limit-order-protocol/smart-contract/_category_.json +++ b/docs/limit-order-protocol/smart-contract/_category_.json @@ -1,4 +1 @@ -{ - "label": "Smart contracts", - "position": 2 -} +{"label": "Smart contracts","position": 2} diff --git a/git-submodules/limit-order-protocol b/git-submodules/limit-order-protocol index f110eaa97..bf1909826 160000 --- a/git-submodules/limit-order-protocol +++ b/git-submodules/limit-order-protocol @@ -1 +1 @@ -Subproject commit f110eaa97e5f0dd5a026ad0e6e334e551547702c +Subproject commit bf190982639e0408d0f8b1bbf4a874ff0810096c diff --git a/package.json b/package.json index b1dfec970..161897560 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "write-translations": "docusaurus write-translations", "write-heading-ids": "docusaurus write-heading-ids", "postinstall": "yarn run copy:lo-smartcontract-docs", - "copy:lo-smartcontract-docs": "git submodule update --remote --merge && rimraf docs/limit-order-protocol/smart-contract/* && cp -R git-submodules/limit-order-protocol/docgen/docs/* docs/limit-order-protocol/smart-contract/" + "copy:lo-smartcontract-docs": "git submodule update --remote --merge && rimraf docs/limit-order-protocol/smart-contract/* && cp -R git-submodules/limit-order-protocol/docgen/docs/* docs/limit-order-protocol/smart-contract/ && touch docs/limit-order-protocol/smart-contract/_category_.json && echo '{\"label\": \"Smart contracts\",\"position\": 2}' > docs/limit-order-protocol/smart-contract/_category_.json" }, "dependencies": { "@docusaurus/core": "2.0.0-beta.6",