Learn how to use the getSwap JSON-RPC method.
getSwapgetSwap 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.fromTokenAddress - string.toTokenAddress - string.amount - string.slippage - integer.Basic authentication header of the form Basic <encoded-value>, where <encoded-value> is the base64-encoded string username:password.
Request to execute a token swap.
Version of the JSON-RPC protocol, should be 2.0.
"2.0"
The request identifier.
1
API method being called.
particle_swap_getSwap Parameters for the API method call. Parameters for executing a swap.
User address.
"0x369aa8a7a7BE683E1a46d9A056806B2B3FD778C8"
The blockchain chain ID.
1
Successful response with swap transaction details.