Execute
curl --request POST \
--url https://api.example.com/citrea/execute \
--header 'Content-Type: application/json' \
--data '
{
"route": {},
"slippageTolerance": 123,
"deadline": 123,
"recipient": "<string>"
}
'import requests
url = "https://api.example.com/citrea/execute"
payload = {
"route": {},
"slippageTolerance": 123,
"deadline": 123,
"recipient": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({route: {}, slippageTolerance: 123, deadline: 123, recipient: '<string>'})
};
fetch('https://api.example.com/citrea/execute', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/citrea/execute",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'route' => [
],
'slippageTolerance' => 123,
'deadline' => 123,
'recipient' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/citrea/execute"
payload := strings.NewReader("{\n \"route\": {},\n \"slippageTolerance\": 123,\n \"deadline\": 123,\n \"recipient\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/citrea/execute")
.header("Content-Type", "application/json")
.body("{\n \"route\": {},\n \"slippageTolerance\": 123,\n \"deadline\": 123,\n \"recipient\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/citrea/execute")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"route\": {},\n \"slippageTolerance\": 123,\n \"deadline\": 123,\n \"recipient\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"transactionHash": "<string>",
"route": {
"protocol": "<string>",
"path": [
{}
],
"pools": [
{}
]
}
}Execute
Execute a swap using the optimal route found through Fibrous on Citrea
POST
/
citrea
/
execute
Execute
curl --request POST \
--url https://api.example.com/citrea/execute \
--header 'Content-Type: application/json' \
--data '
{
"route": {},
"slippageTolerance": 123,
"deadline": 123,
"recipient": "<string>"
}
'import requests
url = "https://api.example.com/citrea/execute"
payload = {
"route": {},
"slippageTolerance": 123,
"deadline": 123,
"recipient": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({route: {}, slippageTolerance: 123, deadline: 123, recipient: '<string>'})
};
fetch('https://api.example.com/citrea/execute', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/citrea/execute",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'route' => [
],
'slippageTolerance' => 123,
'deadline' => 123,
'recipient' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/citrea/execute"
payload := strings.NewReader("{\n \"route\": {},\n \"slippageTolerance\": 123,\n \"deadline\": 123,\n \"recipient\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/citrea/execute")
.header("Content-Type", "application/json")
.body("{\n \"route\": {},\n \"slippageTolerance\": 123,\n \"deadline\": 123,\n \"recipient\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/citrea/execute")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"route\": {},\n \"slippageTolerance\": 123,\n \"deadline\": 123,\n \"recipient\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"transactionHash": "<string>",
"route": {
"protocol": "<string>",
"path": [
{}
],
"pools": [
{}
]
}
}https://api.fibrous.finance/citrea/execute
Request Body Parameters
object
required
The route object returned from the
/citrea/route endpoint.
This contains all necessary information about the swap path and expected outcomes.number
default:"0.5"
Maximum acceptable slippage in percentage (0.1 to 100).
Example:
0.5 for 0.5% slippage tolerancenumber
Unix timestamp (in seconds) after which the transaction will revert.
Defaults to 20 minutes from the current time if not specified.
string
The address that will receive the output tokens.
If not specified, tokens will be sent to the transaction sender.
Response
boolean
Indicates if the execution request was successful.
string
The hash of the executed transaction.