> ## Documentation Index
> Fetch the complete documentation index at: https://developers.particle.network/llms.txt
> Use this file to discover all available pages before exploring further.

# getSwap

> Learn how to use the getSwap JSON-RPC method.

## Understanding `getSwap`

* `getSwap` returns a detailed object containing swap information, a price quote, and a complete transaction object to have the user sign for swap execution. It takes:
  * `address` - string.
  * Swap information object:
    * `fromTokenAddress` - string.
    * `toTokenAddress` - string.
    * `amount` - string.
    * `slippage` - integer.

***

## Query example

```json JSON theme={null}
{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "particle_swap_getSwap",
  "params": [
    "0x369aa8a7a7BE683E1a46d9A056806B2B3FD778C8",
    {
      "fromTokenAddress": "0x111111111117dc0aa78b770fa6a738034120c302",
      "toTokenAddress": "0x6B175474E89094C44Da98b954EedeAC495271d0F",
      "amount": "1000000000",
      "slippage": 1
    }
  ]
}
```


## OpenAPI

````yaml openapi-swap POST /#particle_swap_getSwap
openapi: 3.0.0
info:
  title: Particle Network Enhanced RPC Swap
  version: 1.0.0
servers:
  - url: https://rpc.particle.network/evm-chain
security:
  - basicAuth: []
paths:
  /#particle_swap_getSwap:
    post:
      summary: getSwap
      operationId: getSwap
      requestBody:
        description: Request to execute a token swap.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GetSwapRequest'
      responses:
        '200':
          description: Successful response with swap transaction details.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetSwapResponse'
      security:
        - basicAuth: []
components:
  schemas:
    GetSwapRequest:
      allOf:
        - $ref: '#/components/schemas/RPCRequest'
        - type: object
          properties:
            method:
              enum:
                - particle_swap_getSwap
            params:
              type: array
              description: Parameters for executing a swap.
              items:
                oneOf:
                  - type: string
                    description: User address.
                    example: '0x369aa8a7a7BE683E1a46d9A056806B2B3FD778C8'
                  - type: object
                    description: Swap execution details.
                    properties:
                      fromTokenAddress:
                        type: string
                        description: Address of the token to be swapped.
                        example: '0x111111111117dc0aa78b770fa6a738034120c302'
                      toTokenAddress:
                        type: string
                        description: Address of the token to receive.
                        example: '0x6B175474E89094C44Da98b954EedeAC495271d0F'
                      amount:
                        type: string
                        description: Amount to be swapped.
                        example: '1000000000'
                      slippage:
                        type: integer
                        description: Slippage tolerance in percentage.
                        example: 1
    GetSwapResponse:
      allOf:
        - $ref: '#/components/schemas/RPCResponse'
        - type: object
          properties:
            result:
              type: object
              description: Swap transaction details.
              properties:
                fromToken:
                  $ref: '#/components/schemas/TokenInfo'
                  description: Details of the token being swapped.
                toToken:
                  $ref: '#/components/schemas/TokenInfo'
                  description: Details of the token to be received.
                toTokenAmount:
                  type: string
                  description: Amount of the token to be received.
                  example: '781970036'
                fromTokenAmount:
                  type: string
                  description: Amount of the token being swapped.
                  example: '1000000000'
                tx:
                  type: object
                  description: Transaction details.
                  properties:
                    to:
                      type: string
                      description: Recipient address.
                      example: '0x1111111254fb6c44bAC0beD2854e76F90643097d'
                    data:
                      type: string
                      description: Transaction data.
                      example: '0x000'
                    value:
                      type: string
                      description: Transaction value.
                      example: '0x0'
    RPCRequest:
      type: object
      required:
        - jsonrpc
        - id
        - method
        - params
      properties:
        jsonrpc:
          type: string
          default: '2.0'
          description: Version of the JSON-RPC protocol, should be 2.0.
          example: '2.0'
        id:
          type: integer
          default: 1
          description: The request identifier.
          example: 1
        method:
          type: string
          description: API method being called.
        params:
          type: array
          description: Parameters for the API method call.
        chainId:
          type: integer
          description: The blockchain chain ID.
          example: 1
    RPCResponse:
      type: object
      required:
        - jsonrpc
        - id
        - result
      properties:
        jsonrpc:
          type: string
          default: '2.0'
          description: Version of the JSON-RPC protocol, should be 2.0.
          example: '2.0'
        id:
          type: integer
          default: 1
          description: The request identifier.
          example: 1
        result:
          anyOf:
            - $ref: '#/components/schemas/AnyValue'
        chainId:
          type: integer
          description: The blockchain chain ID.
          example: 1
    TokenInfo:
      type: object
      properties:
        chainId:
          type: integer
          description: Blockchain chain ID.
          example: 1
        address:
          type: string
          description: Token contract address.
          example: '0x6B175474E89094C44Da98b954EedeAC495271d0F'
        symbol:
          type: string
          description: Token symbol.
          example: DAI
        name:
          type: string
          description: Token name.
          example: Dai Stablecoin
        decimals:
          type: integer
          description: Token decimals.
          example: 18
        logoURI:
          type: string
          description: URI of the token logo.
          example: >-
            https://static.particle.network/token-list/ethereum/0x6B175474E89094C44Da98b954EedeAC495271d0F.png
    AnyValue:
      anyOf:
        - type: string
        - type: number
        - type: integer
        - type: boolean
        - type: object
        - type: array
          items: {}
  securitySchemes:
    basicAuth:
      type: http
      scheme: basic

````