Skip to main content

Simulate Swap

Simulates a swap given the swap parameters.

Related Queries
  • All Tokens: Use this query to fetch valid token IDs for asset_in, asset_out, and the entries in swaps.
  • Router Config: Use this query to fetch the router contract address for contract.

Request URL

Method: POST

https://api.euclidprotocol.com/api/v1/simulate-swap

Curl

curl -X 'POST' \
  'https://api.euclidprotocol.com/api/v1/simulate-swap' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "amount_in": "100000000",
  "asset_in": "usdc",
  "asset_out": "eth",
  "contract": "euclid1yvgh8xeju5dyr0zxlkvq09htvhjj20fncp5g58np4u25g8rkpgjsy5hngy",
  "min_amount_out": "1",
  "swaps": ["usdc","eth"]
}'

Parameters

Swap Transaction Details

FieldTypeDescription
amount_inStringThe amount of the asset being swapped in, in micro denoms.
asset_inStringThe Id of the input asset.
asset_outStringThe Id of the output asset.
contractStringThe address of the router contract.
min_amount_outStringThe minimum amount of the output asset for the swap to be considered a success, in micro denoms.
swapsArrayA list of swaps to execute to get from asset_in to asset_out. This is derived from the Routes query.

Example Response

{"id":"","amount_out":"45377330596656764","asset_out":"eth"}