Swap RPC
getQuote
Learn how to use the getQuote JSON-RPC method.
POST
Understanding getQuote
getQuote
calculates and returns the quote price for the swap (the amount oftoTokenAddress
tokens you’ll receive) alongside details about the swap. It takes:address
- string.- Swap information object:
fromTokenAddress
- string.toTokenAddress
- string.amount
- string.
Query example
JSON
Authorizations
Basic authentication header of the form Basic <encoded-value>
, where <encoded-value>
is the base64-encoded string username:password
.
Body
application/json
Request to get a quote for a token swap.
Version of the JSON-RPC protocol, should be 2.0.
Example:
"2.0"
The request identifier.
Example:
1
API method being called.
Available options:
particle_swap_getQuote
Parameters for getting a swap quote.
User address.
The blockchain chain ID.
Example:
1
Response
200 - application/json
Successful response with swap quote.
Version of the JSON-RPC protocol, should be 2.0.
Example:
"2.0"
The request identifier.
Example:
1
Swap quote details.
The blockchain chain ID.
Example:
1
Was this page helpful?