Call Data API

Generate swap call data for Rooster Protocol

post

Endpoint to generate the necessary call data for executing a token swap on the Rooster Protocol.

Body
inputTokenAddressstringRequired

Address of the input token. Use '0x0000000000000000000000000000000000000000' for the native gas token.

outputTokenAddressstringRequired

Address of the output token.

recipientAddressstringRequired

Address of the recipient of the output tokens.

amountstringRequired

Amount of the input token to swap (in its smallest unit, e.g., Wei).

slippagenumber · floatOptional

Optional. Slippage tolerance percentage (e.g., 3 for 3%). Defaults to a predefined value.

amountOutMinimumstringOptional

Optional. Minimum amount of output tokens expected (in Wei). If not provided, it will be calculated based on the slippage.

Responses
200
Successfully generated swap call data.
application/json
post
POST /api/swap/callData HTTP/1.1
Host: api.rooster-protocol.xyz
Content-Type: application/json
Accept: */*
Content-Length: 263

{
  "inputTokenAddress": "0x0000000000000000000000000000000000000000",
  "outputTokenAddress": "0xdddD73F5Df1F0DC31373357beAC77545dC5A6f3F",
  "recipientAddress": "0xaA923BBe2941EbD52057cAA0ad493BB86d767090",
  "amount": "100000000000000000",
  "slippage": 0.7,
  "amountOutMinimum": ""
}
{
  "callData": "0xac9650d80000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000160000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000c4522ba7eb00000000000000000000000035e44dc4702fd51744001e248b49cbf9fcc51f0c0000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000009184e72a000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000154a14398c5c5b4b7913954cb82521fb7afa676314000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000064f16d7904000000000000000000000000dddd73f5df1f0dc31373357beac77545dc5a6f3f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000008a6f6552ce3fdff3c26d004b255e59b6b5935f06000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000084670ca181000000000000000000000000ea237441c92cae6fc17caaf9a7acb3f953be4bd1000000000000000000000000dddd73f5df1f0dc31373357beac77545dc5a6f3f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000",
  "to": "0x35e44dc4702Fd51744001E248B49CBf9fcc51f0C",
  "value": "10000000000000",
  "expectedOutput": "2",
  "amountOutMinimum": "2",
  "slippage": 0.7,
  "status": 1
}

Last updated