curl --request POST \
--url https://api.defindex.io/migration/defindex-to-defindex \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"from": "GDR4KOVET27WYMB4H7UOBHKKOKXXER7ULHFIS7EMRISJUTKTS6BKQZWG",
"fromVault": "CCA2ZJP5BVRXYTQH4FAGHCAUMRYCXVC4CRYC2NXHWMR7TIVX36U7F5HR",
"toVault": "CBJSNWFJ4DKVIB6MJIPNEO77RX3FK7Y46XKHU2WONOPU5MUSO4VKK55W",
"slippageBps": 10
}
'import requests
url = "https://api.defindex.io/migration/defindex-to-defindex"
payload = {
"from": "GDR4KOVET27WYMB4H7UOBHKKOKXXER7ULHFIS7EMRISJUTKTS6BKQZWG",
"fromVault": "CCA2ZJP5BVRXYTQH4FAGHCAUMRYCXVC4CRYC2NXHWMR7TIVX36U7F5HR",
"toVault": "CBJSNWFJ4DKVIB6MJIPNEO77RX3FK7Y46XKHU2WONOPU5MUSO4VKK55W",
"slippageBps": 10
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
from: 'GDR4KOVET27WYMB4H7UOBHKKOKXXER7ULHFIS7EMRISJUTKTS6BKQZWG',
fromVault: 'CCA2ZJP5BVRXYTQH4FAGHCAUMRYCXVC4CRYC2NXHWMR7TIVX36U7F5HR',
toVault: 'CBJSNWFJ4DKVIB6MJIPNEO77RX3FK7Y46XKHU2WONOPU5MUSO4VKK55W',
slippageBps: 10
})
};
fetch('https://api.defindex.io/migration/defindex-to-defindex', 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.defindex.io/migration/defindex-to-defindex",
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([
'from' => 'GDR4KOVET27WYMB4H7UOBHKKOKXXER7ULHFIS7EMRISJUTKTS6BKQZWG',
'fromVault' => 'CCA2ZJP5BVRXYTQH4FAGHCAUMRYCXVC4CRYC2NXHWMR7TIVX36U7F5HR',
'toVault' => 'CBJSNWFJ4DKVIB6MJIPNEO77RX3FK7Y46XKHU2WONOPU5MUSO4VKK55W',
'slippageBps' => 10
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.defindex.io/migration/defindex-to-defindex"
payload := strings.NewReader("{\n \"from\": \"GDR4KOVET27WYMB4H7UOBHKKOKXXER7ULHFIS7EMRISJUTKTS6BKQZWG\",\n \"fromVault\": \"CCA2ZJP5BVRXYTQH4FAGHCAUMRYCXVC4CRYC2NXHWMR7TIVX36U7F5HR\",\n \"toVault\": \"CBJSNWFJ4DKVIB6MJIPNEO77RX3FK7Y46XKHU2WONOPU5MUSO4VKK55W\",\n \"slippageBps\": 10\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.defindex.io/migration/defindex-to-defindex")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"from\": \"GDR4KOVET27WYMB4H7UOBHKKOKXXER7ULHFIS7EMRISJUTKTS6BKQZWG\",\n \"fromVault\": \"CCA2ZJP5BVRXYTQH4FAGHCAUMRYCXVC4CRYC2NXHWMR7TIVX36U7F5HR\",\n \"toVault\": \"CBJSNWFJ4DKVIB6MJIPNEO77RX3FK7Y46XKHU2WONOPU5MUSO4VKK55W\",\n \"slippageBps\": 10\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.defindex.io/migration/defindex-to-defindex")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"from\": \"GDR4KOVET27WYMB4H7UOBHKKOKXXER7ULHFIS7EMRISJUTKTS6BKQZWG\",\n \"fromVault\": \"CCA2ZJP5BVRXYTQH4FAGHCAUMRYCXVC4CRYC2NXHWMR7TIVX36U7F5HR\",\n \"toVault\": \"CBJSNWFJ4DKVIB6MJIPNEO77RX3FK7Y46XKHU2WONOPU5MUSO4VKK55W\",\n \"slippageBps\": 10\n}"
response = http.request(request)
puts response.read_body{
"xdr": "<string>",
"simulationResponse": "<unknown>",
"functionName": "exec",
"operationXDR": "<string>",
"isSmartWallet": false
}Migrate a full position between two DeFindex vaults
Builds an unsigned, atomic Stellar Router transaction that withdraws the caller’s entire share balance from fromVault and deposits the proceeds into toVault. Both legs live in one transaction, so the migration either fully succeeds or fully reverts. The deposited amount is a floor derived from slippageBps; any surplus is left in the caller’s wallet.
curl --request POST \
--url https://api.defindex.io/migration/defindex-to-defindex \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"from": "GDR4KOVET27WYMB4H7UOBHKKOKXXER7ULHFIS7EMRISJUTKTS6BKQZWG",
"fromVault": "CCA2ZJP5BVRXYTQH4FAGHCAUMRYCXVC4CRYC2NXHWMR7TIVX36U7F5HR",
"toVault": "CBJSNWFJ4DKVIB6MJIPNEO77RX3FK7Y46XKHU2WONOPU5MUSO4VKK55W",
"slippageBps": 10
}
'import requests
url = "https://api.defindex.io/migration/defindex-to-defindex"
payload = {
"from": "GDR4KOVET27WYMB4H7UOBHKKOKXXER7ULHFIS7EMRISJUTKTS6BKQZWG",
"fromVault": "CCA2ZJP5BVRXYTQH4FAGHCAUMRYCXVC4CRYC2NXHWMR7TIVX36U7F5HR",
"toVault": "CBJSNWFJ4DKVIB6MJIPNEO77RX3FK7Y46XKHU2WONOPU5MUSO4VKK55W",
"slippageBps": 10
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
from: 'GDR4KOVET27WYMB4H7UOBHKKOKXXER7ULHFIS7EMRISJUTKTS6BKQZWG',
fromVault: 'CCA2ZJP5BVRXYTQH4FAGHCAUMRYCXVC4CRYC2NXHWMR7TIVX36U7F5HR',
toVault: 'CBJSNWFJ4DKVIB6MJIPNEO77RX3FK7Y46XKHU2WONOPU5MUSO4VKK55W',
slippageBps: 10
})
};
fetch('https://api.defindex.io/migration/defindex-to-defindex', 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.defindex.io/migration/defindex-to-defindex",
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([
'from' => 'GDR4KOVET27WYMB4H7UOBHKKOKXXER7ULHFIS7EMRISJUTKTS6BKQZWG',
'fromVault' => 'CCA2ZJP5BVRXYTQH4FAGHCAUMRYCXVC4CRYC2NXHWMR7TIVX36U7F5HR',
'toVault' => 'CBJSNWFJ4DKVIB6MJIPNEO77RX3FK7Y46XKHU2WONOPU5MUSO4VKK55W',
'slippageBps' => 10
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.defindex.io/migration/defindex-to-defindex"
payload := strings.NewReader("{\n \"from\": \"GDR4KOVET27WYMB4H7UOBHKKOKXXER7ULHFIS7EMRISJUTKTS6BKQZWG\",\n \"fromVault\": \"CCA2ZJP5BVRXYTQH4FAGHCAUMRYCXVC4CRYC2NXHWMR7TIVX36U7F5HR\",\n \"toVault\": \"CBJSNWFJ4DKVIB6MJIPNEO77RX3FK7Y46XKHU2WONOPU5MUSO4VKK55W\",\n \"slippageBps\": 10\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.defindex.io/migration/defindex-to-defindex")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"from\": \"GDR4KOVET27WYMB4H7UOBHKKOKXXER7ULHFIS7EMRISJUTKTS6BKQZWG\",\n \"fromVault\": \"CCA2ZJP5BVRXYTQH4FAGHCAUMRYCXVC4CRYC2NXHWMR7TIVX36U7F5HR\",\n \"toVault\": \"CBJSNWFJ4DKVIB6MJIPNEO77RX3FK7Y46XKHU2WONOPU5MUSO4VKK55W\",\n \"slippageBps\": 10\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.defindex.io/migration/defindex-to-defindex")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"from\": \"GDR4KOVET27WYMB4H7UOBHKKOKXXER7ULHFIS7EMRISJUTKTS6BKQZWG\",\n \"fromVault\": \"CCA2ZJP5BVRXYTQH4FAGHCAUMRYCXVC4CRYC2NXHWMR7TIVX36U7F5HR\",\n \"toVault\": \"CBJSNWFJ4DKVIB6MJIPNEO77RX3FK7Y46XKHU2WONOPU5MUSO4VKK55W\",\n \"slippageBps\": 10\n}"
response = http.request(request)
puts response.read_body{
"xdr": "<string>",
"simulationResponse": "<unknown>",
"functionName": "exec",
"operationXDR": "<string>",
"isSmartWallet": false
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Query Parameters
Stellar network to use (testnet or mainnet)
testnet, mainnet Body
User's Stellar public key (G-address). This account holds the source vault shares and must sign the returned XDR.
"GDR4KOVET27WYMB4H7UOBHKKOKXXER7ULHFIS7EMRISJUTKTS6BKQZWG"
Source DeFindex vault contract address. The full share balance held by from is withdrawn from this vault.
"CCA2ZJP5BVRXYTQH4FAGHCAUMRYCXVC4CRYC2NXHWMR7TIVX36U7F5HR"
Target DeFindex vault contract address. Must expose the same assets, in the same order, as fromVault.
"CBJSNWFJ4DKVIB6MJIPNEO77RX3FK7Y46XKHU2WONOPU5MUSO4VKK55W"
Buffer in basis points applied to the simulated withdrawal proceeds before they are deposited into the target vault. 10000 = 100%, 100 = 1%. Defaults to 10 bps (0.1%). The buffer is left behind in the wallet as dust; raising it makes the transaction more resilient to price-per-share movement between simulation and submission.
0 <= x <= 1000010
Was this page helpful?