Swap RPC
getQuote
Learn how to use the getQuote JSON-RPC method.
POST
/
#particle_swap_getQuote
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
Authorization
string
headerrequiredBasic authentication header of the form Basic <encoded-value>
, where <encoded-value>
is the base64-encoded string username:password
.
Body
application/json
jsonrpc
string
default: 2.0requiredVersion of the JSON-RPC protocol, should be 2.0.
id
integer
default: 1requiredThe request identifier.
method
enum<string>
requiredAPI method being called.
Available options:
particle_swap_getQuote
params
array
requiredParameters for getting a swap quote.
chainId
integer
The blockchain chain ID.
Response
200 - application/json
jsonrpc
string
default: 2.0requiredVersion of the JSON-RPC protocol, should be 2.0.
id
integer
default: 1requiredThe request identifier.
result
object
requiredSwap quote details.
chainId
integer
The blockchain chain ID.
Was this page helpful?