Requesting a Quote
Once you've gathered the transaction information, the next step is to obtain a possible route from the Swing API. The route information contains the fees and total amount that a wallet holder will have to pay for the transaction to be processed by Swing.
The full API reference for our /quote endpoint can be found in the API reference section.
Making a Request
URL: https://swap.prod.swing.xyz/v0/transfer/quote
Query Parameters:
Property | Example | Description |
---|---|---|
tokenAmount | 1000000000000000000 | Amount of the source token being sent (in wei for ETH). |
fromChain | ethereum | Source Chain slug |
fromUserAddress | 0x018c15DA1239B84b08283799B89045CD476BBbBb | Sender's wallet address |
fromTokenAddress | 0x0000000000000000000000000000000000000000 | Source Token Address |
tokenSymbol | ETH | Source Token slug |
toTokenAddress | 0x0000000000000000000000000000000000000000 | Destination Token Address. |
toTokenSymbol | MATIC | Destination Token slug |
toChain | polygon | Destination Chain slug |
toUserAddress | 0x018c15DA1239B84b08283799B89045CD476BBbBb | Receiver's wallet address |
projectId | replug | Your project's ID |
contractCall | false | Return only contract-call enabled routes |
Sample Request
Sample Response
Request a Contract Call Quote
When executing a contract call, you need to ensure that the routes/integrations being returned from the /quote
endpoint supports contract calls.
To return only contract call enabled routes from the /qoute
endpoint, set the contractCall
parameter to true: