diff --git a/docs/src/api/generated/solve/get-route-v-1.api.mdx b/docs/src/api/generated/solve/get-route-v-1.api.mdx
new file mode 100644
index 0000000..1c9fd0e
--- /dev/null
+++ b/docs/src/api/generated/solve/get-route-v-1.api.mdx
@@ -0,0 +1,71 @@
+---
+id: get-route-v-1
+title: "getRouteV1"
+description: "Calculate the optimal swap route and generate execution parameters for a token exchange"
+sidebar_label: "getRouteV1"
+hide_title: true
+hide_table_of_contents: true
+api: eJztWEtvGzcQ/isEkaJOu5bWrn2obnLitj60DeykF0MFRtyRlskuuSaHilRh/3sx5OplKc4LAVI3N4mcnfnmmwfJWUrboAPS1lwVciCnSNc2EP51IjNZoFdON7wpB/IZVCpUQCioRGEb0jVUwr+FRjj+RIApxBQNq0OBc1SBvxQNOKiR0HkxsU6AIPsGjcC5KsFMUWZyIyEHt0up2dpdQLeQmTRQoxxIqG0wdGX2UL0sUaRNYSdCmyZQMuAF2YTuSJu09L0XvoaqQk8iGE1PZSa9KrEGOVje0ztc6wQjLq+fneYdbvACRIEqeU9Om6k4MlZ4pdGQnmgljKXIKOunRcP4k2D0lQgdW/j7Nj/+efTjExbSVLHUS7aQLMs2kw7vgnZYyAG5gG12mJoI6wAzz6whB4oEFIVD79kXjtwWR5EirKoHeLikEh2GWqj76o5OczFeEPqnAo2yBRbMTYlzWLHzVlMp8rloHE70/GEy8vktHE+Gx78wKcuzvN3mZZhMfiQnfwb6YFJsoB1WxmHx6EjxlW4amOJF4w+W0WpfkK3QgVGcK2IMXnvRWG3IiyPsTXuZOM9jKee98+92a6jzRRvCKTqZyYl1NVBa+ulUZrLWRtehloM8kzXM0++TPM9zhjSBUJEcnOc7Tk2g8tiOeMk31nj0bOs0z/cjcxOUQu8noaoWQq06VrHdpmIANu2pQAJdMSMlQhF70FJe411AT8dXz/dNvDL6LqBwSUToIpV9dHePiXVU10SUOH8oyKdn7RPZtm0mObfQECuDpqm0ij2l/9oziuU7c3OXAYfR/fd43oG149eouGY21N92nTfVUq277pT+Ergp8g8FVfUcCOQok43jE4V0CtLm66+yw+449FUi7Dj+6lvQOgX2kP6G8zUQliqAILYP7rtclx8B4Idt6xfspORSWa10V5frrk1wHbWZPDvUKC6gWJdwEbjnCW1mUOli68LyaJrCpXPWiVX7TAnwYeXPcZOZRFawX95x9x3WeE9oU0SMZhrDzZa4npK67P550a4MvUNljd5DvDLuMrmdA1FyHfmTQ6GCQKV1+h+ujNgs72cAm9LeM2rlMMYSHtER8b/NhrN9VX9YMdMwrnD7ijCxwRTrHjXVMzTfusKjyYPzQ+fBlWGS+ThHN0O3xvIt0v/ZSPP9Dqm03VwjEVzKgezPTvqx0Dk4Mdxp8BBcxbEgavyg3+d+4Hu+cYzO9QhV2a9BG4P7z8rf07q44R4yfHEl+Q32fnVj8Lin6wI8bikaMUYVnKZFBHkBXqthYEduR9u7Nxz7FJYtmXXSMY5VMvJ/ftepyJw2ExsFOwaj7fFCXFRg1B684YsrETwWa4mIVWaSaUwiJ728lx+PkYAj2lhPNcT07B6iUyQRr2pif8y03KT4F5w4dZwQzqnfVKANA43xWnZJcitnjC2lySiTpfXEq8slB+2Vq9qWl9MTm+NSaM/HyOq5+oBbR9ddfT0Vnzu9OujHG1zsTsxmUAUWi1n5STg/bpb0AKrNsOrLgTo8y3kfqPSk/URUnzU+eQDZ7shmA27Ef1y8t8Q2sDqnYiamT4dKYbPt0t55wVrWDfLXy5eybf8FfAyYow==
+sidebar_class_name: "get api-method"
+info_path: ../src/api/generated/solve/swap-by-blanc
+custom_edit_url: null
+---
+
+import MethodEndpoint from "@theme/ApiExplorer/MethodEndpoint";
+import ParamsDetails from "@theme/ParamsDetails";
+import RequestSchema from "@theme/RequestSchema";
+import StatusCodes from "@theme/StatusCodes";
+import OperationTabs from "@theme/OperationTabs";
+import TabItem from "@theme/TabItem";
+import Heading from "@theme/Heading";
+
+
+
+
+
+
+
+
+
+
+Calculate the optimal swap route and generate execution parameters for a token exchange
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/src/api/solve-openapi.yaml b/docs/src/api/solve-openapi.yaml
index 8ea42da..b2fad09 100644
--- a/docs/src/api/solve-openapi.yaml
+++ b/docs/src/api/solve-openapi.yaml
@@ -1,187 +1,94 @@
-openapi: 3.0.3
+openapi: 3.1.0
info:
title: Swap by Blanc
description: API used by Blanc Swap
version: 1.0.0-beta
security:
- - ApiKeyAuth: []
+ - BasicAuth: []
+
+servers:
+ - url: https://swaps.sprinter.tech/mainnet
+ description: Mainnet Swap API
+ - url: https://swaps.sprinter.tech/base
+ description: Base Swap API
paths:
- /quote:
+ /v1/route:
get:
- operationId: getQuote
- description: Get a price estimation quote
+ operationId: getRouteV1
+ description: Calculate the optimal swap route and generate execution parameters for a token exchange
parameters:
- in: query
- name: amount_in
- description: The amount of tokens to sell in decimal notation
+ name: amountIn
+ description: The amount of input tokens to swap (in token's smallest unit)
schema:
$ref: "#/components/schemas/TokenAmount"
required: true
- example: "1000000000000000000"
- in: query
- name: token_in
- description: The token address to sell
+ name: tokenIn
+ description: Contract address of the input token to sell
schema:
$ref: "#/components/schemas/Address"
required: true
- example: "0x6B175474E89094C44Da98b954EedeAC495271d0F"
- in: query
- name: token_out
- description: The token address to buy
+ name: tokenOut
+ description: Contract address of the output token to buy
schema:
$ref: "#/components/schemas/Address"
required: true
- example: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"
- responses:
- 200:
- description: Quote successfully created
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/QuoteResponse"
- 400:
- description: Bad request
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/Error"
- 401:
- description: Unauthorized - Invalid API key
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/Error"
- 500:
- description: Internal server error
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/Error"
-
- /route:
- get:
- operationId: getRoute
- description: Get a route for execution
- parameters:
- in: query
- name: amount_in
- description: The amount of tokens to sell in decimal notation
+ name: slippageBps
+ description: The slippage tolerance in basis points (e.g., 50 for 0.5%)
schema:
- $ref: "#/components/schemas/TokenAmount"
- required: true
- example: "1000000000000000000"
- - in: query
- name: token_in
- description: The token address to sell
- schema:
- $ref: "#/components/schemas/Address"
- required: true
- example: "0x6B175474E89094C44Da98b954EedeAC495271d0F"
- - in: query
- name: min_amount_out
- description: The minimum amount of tokens to receive
- schema:
- $ref: "#/components/schemas/TokenAmount"
- required: true
- example: "990000000000000000"
- - in: query
- name: token_out
- description: The token address to buy
- schema:
- $ref: "#/components/schemas/Address"
- required: true
- example: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"
+ type: integer
+ format: int32
+ minimum: 0
+ maximum: 10000
+ default: 50
+ required: false
responses:
200:
- description: Route successfully generated
+ description: Successfully calculated swap route with execution details
+ headers:
+ Request-ID:
+ $ref: "#/components/headers/RequestID"
content:
application/json:
schema:
- $ref: "#/components/schemas/RouteResponse"
+ $ref: "#/components/schemas/RouteV1Response"
400:
- description: Bad request
+ description: Bad request due to invalid parameters
+ headers:
+ Request-ID:
+ $ref: "#/components/headers/RequestID"
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
401:
- description: Unauthorized - Invalid API key
+ description: Unauthorized access due to invalid or missing credentials
+ headers:
+ Request-ID:
+ $ref: "#/components/headers/RequestID"
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
- 500:
- description: Internal server error
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/Error"
-
- /v2/route:
- get:
- operationId: getRouteV2
- description: Get a route for execution with additional parameters
- parameters:
- - in: query
- name: amount_in
- description: The amount of tokens to sell in decimal notation
- schema:
- $ref: "#/components/schemas/TokenAmount"
- required: true
- example: "1000000000000000000"
- - in: query
- name: token_in
- description: The token address to sell
- schema:
- $ref: "#/components/schemas/Address"
- required: true
- example: "0x6B175474E89094C44Da98b954EedeAC495271d0F"
- - in: query
- name: token_out
- description: The token address to buy
- schema:
- $ref: "#/components/schemas/Address"
- required: true
- example: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"
- - in: query
- name: slippage
- description: The slippage tolerance in percentage (e.g., 0.5 for 0.5%)
- schema:
- type: number
- format: float
- required: false
- example: 0.5
- - in: query
- name: target_duration_ms
- description: The target duration for the route search in milliseconds
- schema:
- type: integer
- format: int64
- required: false
- example: 200
- responses:
- 200:
- description: Route successfully generated
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/RouteResponseV2"
- 400:
- description: Bad request
- content:
- application/json:
- schema:
- $ref: "#/components/schemas/Error"
- 401:
- description: Unauthorized - Invalid API key
+ 404:
+ description: No viable swap route found for the given parameters
+ headers:
+ Request-ID:
+ $ref: "#/components/headers/RequestID"
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
500:
description: Internal server error
+ headers:
+ Request-ID:
+ $ref: "#/components/headers/RequestID"
content:
application/json:
schema:
@@ -189,113 +96,60 @@ paths:
components:
securitySchemes:
- ApiKeyAuth:
- type: apiKey
- in: header
- name: X-API-Key
- description: API key with format sk_live_*
+ BasicAuth:
+ type: http
+ scheme: basic
+
+ headers:
+ RequestID:
+ description: Unique request identifier
+ schema:
+ type: string
+ format: hex
+ pattern: "^0x[a-fA-F0-9]{24}$"
schemas:
Address:
- description: 20 byte Ethereum address encoded as a hex with `0x` prefix
+ description: Ethereum contract address (20 bytes) encoded as hexadecimal with 0x prefix
type: string
pattern: "^0x[a-fA-F0-9]{40}$"
- example: "0x6B175474E89094C44Da98b954EedeAC495271d0F"
+
+ Bytes:
+ description: Arbitrary byte data encoded as hexadecimal with 0x prefix
+ type: string
+ pattern: "^0x[a-fA-F0-9]*$"
TokenAmount:
description: Amount of an ERC20 token as a decimal string (no scientific notation)
type: string
pattern: "^[0-9]+$"
- example: "1000000000000000000"
- QuoteResponse:
- description: Successful quote with the expected output amount
- type: object
- properties:
- amount_out:
- description: The amount of output tokens you would receive
- $ref: "#/components/schemas/TokenAmount"
- required:
- - amount_out
-
- Call:
- description: An EVM call for execution
- type: object
- required:
- - to
- - value
- - data
- properties:
- to:
- description: Target contract address
- $ref: "#/components/schemas/Address"
- value:
- description: Amount of ETH to send with call (in wei)
- $ref: "#/components/schemas/TokenAmount"
- data:
- description: Hex encoded calldata
- type: string
- pattern: "^0x[a-fA-F0-9]*$"
- example: "0x38ed1739"
-
- RouteResponse:
+ RouteV1Response:
description: Successfully created route with execution details
type: object
- required:
- - calls
- - gas
- properties:
- calls:
- description: Array of EVM calls to execute in sequence
- type: array
- items:
- $ref: "#/components/schemas/Call"
- gas:
- description: Estimated gas required for execution
- type: integer
- example: 150000
-
- RouteResponseV2:
- description: Successfully created route with additional details
- type: object
- required:
- - quote_id
- - amount_out
- - min_amount_out
- - target
- - swap_call_data
- - rainbow_input
+ required: [amountOut, minAmountOut, target, callData]
properties:
- quote_id:
- description: Unique identifier for the quote
- type: string
- example: "q_12345678"
- amount_out:
- description: The amount of output tokens you would receive
+ amountOut:
+ description: Amount of tokens to receive
$ref: "#/components/schemas/TokenAmount"
- min_amount_out:
- description: The minimum amount of tokens to receive after slippage
+ minAmountOut:
+ description: Minimum amount of tokens to receive after slippage
$ref: "#/components/schemas/TokenAmount"
target:
description: The target contract address for the swap
$ref: "#/components/schemas/Address"
- swap_call_data:
+ callData:
description: Hex encoded calldata for the swap
- type: string
- pattern: "^0x[a-fA-F0-9]*$"
- example: "0x38ed1739"
- rainbow_input:
- description: Input data for the rainbow swap
- type: string
- example: "0x..."
+ $ref: "#/components/schemas/Bytes"
Error:
description: Error response with details
type: object
- required:
- - error
+ required: [code, error]
properties:
+ code:
+ description: Error code indicating the type of error
+ type: integer
error:
- description: Human readable error message
+ description: Error message
type: string
- example: "insufficient output amount"