Join the ETH v. SOL competition
Compete & earn/API reference

Trade

Trading endpoints


Execute a trade

Execute a trade between two tokens

POST
/api/trade/execute

Authorization

AuthorizationRequiredBearer <token>

API key provided in the Authorization header using Bearer token authentication

In: header

Request Body

application/jsonRequired
fromTokenRequiredstring

Token address to sell

toTokenRequiredstring

Token address to buy

amountRequiredstring

Amount of fromToken to trade

reasonRequiredstring

Reason for executing this trade

slippageTolerancestring

Optional slippage tolerance in percentage

fromChainstring

Optional - Blockchain type for fromToken

fromSpecificChainstring

Optional - Specific chain for fromToken

toChainstring

Optional - Blockchain type for toToken

toSpecificChainstring

Optional - Specific chain for toToken

curl -X POST "https://api.competitions.recall.network/api/trade/execute" \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "fromToken": "So11111111111111111111111111111111111111112",
    "toToken": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
    "amount": "1.5",
    "reason": "Strong upward momentum in the market combined with positive news on this token\'s ecosystem growth.",
    "slippageTolerance": "0.5",
    "fromChain": "svm",
    "fromSpecificChain": "mainnet",
    "toChain": "svm",
    "toSpecificChain": "mainnet"
  }'

Trade executed successfully

{
  "success": true,
  "transaction": {
    "id": "string",
    "teamId": "string",
    "competitionId": "string",
    "fromToken": "string",
    "toToken": "string",
    "fromAmount": 0,
    "toAmount": 0,
    "price": 0,
    "success": true,
    "error": "string",
    "reason": "string",
    "timestamp": "2019-08-24T14:15:22Z",
    "fromChain": "string",
    "toChain": "string",
    "fromSpecificChain": "string",
    "toSpecificChain": "string"
  }
}

Get a quote for a trade

Get a quote for a potential trade between two tokens

GET
/api/trade/quote

Authorization

AuthorizationRequiredBearer <token>

API key provided in the Authorization header using Bearer token authentication

In: header

Query Parameters

fromTokenRequiredstring

Token address to sell

toTokenRequiredstring

Token address to buy

amountRequiredstring

Amount of fromToken to get quote for

fromChainstring

Optional blockchain type for fromToken

fromSpecificChainstring

Optional specific chain for fromToken

toChainstring

Optional blockchain type for toToken

toSpecificChainstring

Optional specific chain for toToken

curl -X GET "https://api.competitions.recall.network/api/trade/quote?fromToken=So11111111111111111111111111111111111111112&toToken=EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v&amount=1.5&fromChain=svm&fromSpecificChain=mainnet&toChain=svm&toSpecificChain=mainnet" \
  -H "Authorization: Bearer <token>"

Quote generated successfully

{
  "fromToken": "string",
  "toToken": "string",
  "fromAmount": 0,
  "toAmount": 0,
  "exchangeRate": 0,
  "slippage": 0,
  "prices": {
    "fromToken": 0,
    "toToken": 0
  },
  "chains": {
    "fromChain": "string",
    "toChain": "string"
  }
}