YieldCreateExitAction returns unsigned exit-action transaction payloads.
curl --request POST \
--url https://trails-api.sequence.app/rpc/Trails/YieldCreateExitAction \
--header 'Content-Type: application/json' \
--data '
{
"earnMarketId": "<string>",
"userWalletAddress": "<string>",
"args": {
"amount": "<string>",
"amounts": [
"<string>"
],
"validatorAddress": "<string>",
"validatorAddresses": [
"<string>"
],
"providerId": "<string>",
"duration": 123,
"inputToken": "<string>",
"inputTokenNetwork": "<string>",
"outputToken": "<string>",
"outputTokenNetwork": "<string>",
"subnetId": 123,
"tronResource": "<string>",
"feeConfigurationId": "<string>",
"cosmosPubKey": "<string>",
"tezosPubKey": "<string>",
"cAddressBech": "<string>",
"pAddressBech": "<string>",
"executionMode": "<string>",
"ledgerWalletApiCompatible": true,
"useMaxAmount": true,
"useInstantExecution": true,
"skipPrechecks": true,
"useMaxAllowance": true,
"feePayerAddress": "<string>",
"receiverAddress": "<string>",
"rangeMin": "<string>",
"rangeMax": "<string>",
"percentage": 123,
"tokenId": "<string>"
}
}
'import requests
url = "https://trails-api.sequence.app/rpc/Trails/YieldCreateExitAction"
payload = {
"earnMarketId": "<string>",
"userWalletAddress": "<string>",
"args": {
"amount": "<string>",
"amounts": ["<string>"],
"validatorAddress": "<string>",
"validatorAddresses": ["<string>"],
"providerId": "<string>",
"duration": 123,
"inputToken": "<string>",
"inputTokenNetwork": "<string>",
"outputToken": "<string>",
"outputTokenNetwork": "<string>",
"subnetId": 123,
"tronResource": "<string>",
"feeConfigurationId": "<string>",
"cosmosPubKey": "<string>",
"tezosPubKey": "<string>",
"cAddressBech": "<string>",
"pAddressBech": "<string>",
"executionMode": "<string>",
"ledgerWalletApiCompatible": True,
"useMaxAmount": True,
"useInstantExecution": True,
"skipPrechecks": True,
"useMaxAllowance": True,
"feePayerAddress": "<string>",
"receiverAddress": "<string>",
"rangeMin": "<string>",
"rangeMax": "<string>",
"percentage": 123,
"tokenId": "<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({
earnMarketId: '<string>',
userWalletAddress: '<string>',
args: {
amount: '<string>',
amounts: ['<string>'],
validatorAddress: '<string>',
validatorAddresses: ['<string>'],
providerId: '<string>',
duration: 123,
inputToken: '<string>',
inputTokenNetwork: '<string>',
outputToken: '<string>',
outputTokenNetwork: '<string>',
subnetId: 123,
tronResource: '<string>',
feeConfigurationId: '<string>',
cosmosPubKey: '<string>',
tezosPubKey: '<string>',
cAddressBech: '<string>',
pAddressBech: '<string>',
executionMode: '<string>',
ledgerWalletApiCompatible: true,
useMaxAmount: true,
useInstantExecution: true,
skipPrechecks: true,
useMaxAllowance: true,
feePayerAddress: '<string>',
receiverAddress: '<string>',
rangeMin: '<string>',
rangeMax: '<string>',
percentage: 123,
tokenId: '<string>'
}
})
};
fetch('https://trails-api.sequence.app/rpc/Trails/YieldCreateExitAction', 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://trails-api.sequence.app/rpc/Trails/YieldCreateExitAction",
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([
'earnMarketId' => '<string>',
'userWalletAddress' => '<string>',
'args' => [
'amount' => '<string>',
'amounts' => [
'<string>'
],
'validatorAddress' => '<string>',
'validatorAddresses' => [
'<string>'
],
'providerId' => '<string>',
'duration' => 123,
'inputToken' => '<string>',
'inputTokenNetwork' => '<string>',
'outputToken' => '<string>',
'outputTokenNetwork' => '<string>',
'subnetId' => 123,
'tronResource' => '<string>',
'feeConfigurationId' => '<string>',
'cosmosPubKey' => '<string>',
'tezosPubKey' => '<string>',
'cAddressBech' => '<string>',
'pAddressBech' => '<string>',
'executionMode' => '<string>',
'ledgerWalletApiCompatible' => true,
'useMaxAmount' => true,
'useInstantExecution' => true,
'skipPrechecks' => true,
'useMaxAllowance' => true,
'feePayerAddress' => '<string>',
'receiverAddress' => '<string>',
'rangeMin' => '<string>',
'rangeMax' => '<string>',
'percentage' => 123,
'tokenId' => '<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://trails-api.sequence.app/rpc/Trails/YieldCreateExitAction"
payload := strings.NewReader("{\n \"earnMarketId\": \"<string>\",\n \"userWalletAddress\": \"<string>\",\n \"args\": {\n \"amount\": \"<string>\",\n \"amounts\": [\n \"<string>\"\n ],\n \"validatorAddress\": \"<string>\",\n \"validatorAddresses\": [\n \"<string>\"\n ],\n \"providerId\": \"<string>\",\n \"duration\": 123,\n \"inputToken\": \"<string>\",\n \"inputTokenNetwork\": \"<string>\",\n \"outputToken\": \"<string>\",\n \"outputTokenNetwork\": \"<string>\",\n \"subnetId\": 123,\n \"tronResource\": \"<string>\",\n \"feeConfigurationId\": \"<string>\",\n \"cosmosPubKey\": \"<string>\",\n \"tezosPubKey\": \"<string>\",\n \"cAddressBech\": \"<string>\",\n \"pAddressBech\": \"<string>\",\n \"executionMode\": \"<string>\",\n \"ledgerWalletApiCompatible\": true,\n \"useMaxAmount\": true,\n \"useInstantExecution\": true,\n \"skipPrechecks\": true,\n \"useMaxAllowance\": true,\n \"feePayerAddress\": \"<string>\",\n \"receiverAddress\": \"<string>\",\n \"rangeMin\": \"<string>\",\n \"rangeMax\": \"<string>\",\n \"percentage\": 123,\n \"tokenId\": \"<string>\"\n }\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://trails-api.sequence.app/rpc/Trails/YieldCreateExitAction")
.header("Content-Type", "application/json")
.body("{\n \"earnMarketId\": \"<string>\",\n \"userWalletAddress\": \"<string>\",\n \"args\": {\n \"amount\": \"<string>\",\n \"amounts\": [\n \"<string>\"\n ],\n \"validatorAddress\": \"<string>\",\n \"validatorAddresses\": [\n \"<string>\"\n ],\n \"providerId\": \"<string>\",\n \"duration\": 123,\n \"inputToken\": \"<string>\",\n \"inputTokenNetwork\": \"<string>\",\n \"outputToken\": \"<string>\",\n \"outputTokenNetwork\": \"<string>\",\n \"subnetId\": 123,\n \"tronResource\": \"<string>\",\n \"feeConfigurationId\": \"<string>\",\n \"cosmosPubKey\": \"<string>\",\n \"tezosPubKey\": \"<string>\",\n \"cAddressBech\": \"<string>\",\n \"pAddressBech\": \"<string>\",\n \"executionMode\": \"<string>\",\n \"ledgerWalletApiCompatible\": true,\n \"useMaxAmount\": true,\n \"useInstantExecution\": true,\n \"skipPrechecks\": true,\n \"useMaxAllowance\": true,\n \"feePayerAddress\": \"<string>\",\n \"receiverAddress\": \"<string>\",\n \"rangeMin\": \"<string>\",\n \"rangeMax\": \"<string>\",\n \"percentage\": 123,\n \"tokenId\": \"<string>\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://trails-api.sequence.app/rpc/Trails/YieldCreateExitAction")
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 \"earnMarketId\": \"<string>\",\n \"userWalletAddress\": \"<string>\",\n \"args\": {\n \"amount\": \"<string>\",\n \"amounts\": [\n \"<string>\"\n ],\n \"validatorAddress\": \"<string>\",\n \"validatorAddresses\": [\n \"<string>\"\n ],\n \"providerId\": \"<string>\",\n \"duration\": 123,\n \"inputToken\": \"<string>\",\n \"inputTokenNetwork\": \"<string>\",\n \"outputToken\": \"<string>\",\n \"outputTokenNetwork\": \"<string>\",\n \"subnetId\": 123,\n \"tronResource\": \"<string>\",\n \"feeConfigurationId\": \"<string>\",\n \"cosmosPubKey\": \"<string>\",\n \"tezosPubKey\": \"<string>\",\n \"cAddressBech\": \"<string>\",\n \"pAddressBech\": \"<string>\",\n \"executionMode\": \"<string>\",\n \"ledgerWalletApiCompatible\": true,\n \"useMaxAmount\": true,\n \"useInstantExecution\": true,\n \"skipPrechecks\": true,\n \"useMaxAllowance\": true,\n \"feePayerAddress\": \"<string>\",\n \"receiverAddress\": \"<string>\",\n \"rangeMin\": \"<string>\",\n \"rangeMax\": \"<string>\",\n \"percentage\": 123,\n \"tokenId\": \"<string>\"\n }\n}"
response = http.request(request)
puts response.read_body{
"action": {
"id": "<string>",
"intent": "<string>",
"type": "<string>",
"yieldId": "<string>",
"address": "<string>",
"transactions": [
{
"id": "<string>",
"title": "<string>",
"network": "<string>",
"status": "<string>",
"type": "<string>",
"createdAt": "<string>",
"hash": "<string>",
"broadcastedAt": "<string>",
"signedTransaction": "<string>",
"unsignedTransaction": {},
"annotatedTransaction": {},
"structuredTransaction": {},
"stepIndex": 123,
"description": "<string>",
"error": "<string>",
"gasEstimate": "<string>",
"explorerUrl": "<string>",
"isMessage": true
}
],
"executionPattern": "<string>",
"createdAt": "<string>",
"status": "<string>",
"amount": "<string>",
"amountRaw": "<string>",
"amountUsd": "<string>",
"rawArguments": {
"amount": "<string>",
"amounts": [
"<string>"
],
"validatorAddress": "<string>",
"validatorAddresses": [
"<string>"
],
"providerId": "<string>",
"duration": 123,
"inputToken": "<string>",
"inputTokenNetwork": "<string>",
"outputToken": "<string>",
"outputTokenNetwork": "<string>",
"subnetId": 123,
"tronResource": "<string>",
"feeConfigurationId": "<string>",
"cosmosPubKey": "<string>",
"tezosPubKey": "<string>",
"cAddressBech": "<string>",
"pAddressBech": "<string>",
"executionMode": "<string>",
"ledgerWalletApiCompatible": true,
"useMaxAmount": true,
"useInstantExecution": true,
"skipPrechecks": true,
"useMaxAllowance": true,
"feePayerAddress": "<string>",
"receiverAddress": "<string>",
"rangeMin": "<string>",
"rangeMax": "<string>",
"percentage": 123,
"tokenId": "<string>"
},
"completedAt": "<string>"
}
}{
"error": "WebrpcEndpoint",
"code": 0,
"msg": "endpoint error",
"status": 400,
"cause": "<string>"
}{
"error": "WebrpcBadResponse",
"code": -5,
"msg": "bad response",
"status": 500,
"cause": "<string>"
}Earn
YieldCreateExitAction
Generate unsigned withdrawal transaction calldata for a DeFi yield position
POST
/
rpc
/
Trails
/
YieldCreateExitAction
YieldCreateExitAction returns unsigned exit-action transaction payloads.
curl --request POST \
--url https://trails-api.sequence.app/rpc/Trails/YieldCreateExitAction \
--header 'Content-Type: application/json' \
--data '
{
"earnMarketId": "<string>",
"userWalletAddress": "<string>",
"args": {
"amount": "<string>",
"amounts": [
"<string>"
],
"validatorAddress": "<string>",
"validatorAddresses": [
"<string>"
],
"providerId": "<string>",
"duration": 123,
"inputToken": "<string>",
"inputTokenNetwork": "<string>",
"outputToken": "<string>",
"outputTokenNetwork": "<string>",
"subnetId": 123,
"tronResource": "<string>",
"feeConfigurationId": "<string>",
"cosmosPubKey": "<string>",
"tezosPubKey": "<string>",
"cAddressBech": "<string>",
"pAddressBech": "<string>",
"executionMode": "<string>",
"ledgerWalletApiCompatible": true,
"useMaxAmount": true,
"useInstantExecution": true,
"skipPrechecks": true,
"useMaxAllowance": true,
"feePayerAddress": "<string>",
"receiverAddress": "<string>",
"rangeMin": "<string>",
"rangeMax": "<string>",
"percentage": 123,
"tokenId": "<string>"
}
}
'import requests
url = "https://trails-api.sequence.app/rpc/Trails/YieldCreateExitAction"
payload = {
"earnMarketId": "<string>",
"userWalletAddress": "<string>",
"args": {
"amount": "<string>",
"amounts": ["<string>"],
"validatorAddress": "<string>",
"validatorAddresses": ["<string>"],
"providerId": "<string>",
"duration": 123,
"inputToken": "<string>",
"inputTokenNetwork": "<string>",
"outputToken": "<string>",
"outputTokenNetwork": "<string>",
"subnetId": 123,
"tronResource": "<string>",
"feeConfigurationId": "<string>",
"cosmosPubKey": "<string>",
"tezosPubKey": "<string>",
"cAddressBech": "<string>",
"pAddressBech": "<string>",
"executionMode": "<string>",
"ledgerWalletApiCompatible": True,
"useMaxAmount": True,
"useInstantExecution": True,
"skipPrechecks": True,
"useMaxAllowance": True,
"feePayerAddress": "<string>",
"receiverAddress": "<string>",
"rangeMin": "<string>",
"rangeMax": "<string>",
"percentage": 123,
"tokenId": "<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({
earnMarketId: '<string>',
userWalletAddress: '<string>',
args: {
amount: '<string>',
amounts: ['<string>'],
validatorAddress: '<string>',
validatorAddresses: ['<string>'],
providerId: '<string>',
duration: 123,
inputToken: '<string>',
inputTokenNetwork: '<string>',
outputToken: '<string>',
outputTokenNetwork: '<string>',
subnetId: 123,
tronResource: '<string>',
feeConfigurationId: '<string>',
cosmosPubKey: '<string>',
tezosPubKey: '<string>',
cAddressBech: '<string>',
pAddressBech: '<string>',
executionMode: '<string>',
ledgerWalletApiCompatible: true,
useMaxAmount: true,
useInstantExecution: true,
skipPrechecks: true,
useMaxAllowance: true,
feePayerAddress: '<string>',
receiverAddress: '<string>',
rangeMin: '<string>',
rangeMax: '<string>',
percentage: 123,
tokenId: '<string>'
}
})
};
fetch('https://trails-api.sequence.app/rpc/Trails/YieldCreateExitAction', 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://trails-api.sequence.app/rpc/Trails/YieldCreateExitAction",
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([
'earnMarketId' => '<string>',
'userWalletAddress' => '<string>',
'args' => [
'amount' => '<string>',
'amounts' => [
'<string>'
],
'validatorAddress' => '<string>',
'validatorAddresses' => [
'<string>'
],
'providerId' => '<string>',
'duration' => 123,
'inputToken' => '<string>',
'inputTokenNetwork' => '<string>',
'outputToken' => '<string>',
'outputTokenNetwork' => '<string>',
'subnetId' => 123,
'tronResource' => '<string>',
'feeConfigurationId' => '<string>',
'cosmosPubKey' => '<string>',
'tezosPubKey' => '<string>',
'cAddressBech' => '<string>',
'pAddressBech' => '<string>',
'executionMode' => '<string>',
'ledgerWalletApiCompatible' => true,
'useMaxAmount' => true,
'useInstantExecution' => true,
'skipPrechecks' => true,
'useMaxAllowance' => true,
'feePayerAddress' => '<string>',
'receiverAddress' => '<string>',
'rangeMin' => '<string>',
'rangeMax' => '<string>',
'percentage' => 123,
'tokenId' => '<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://trails-api.sequence.app/rpc/Trails/YieldCreateExitAction"
payload := strings.NewReader("{\n \"earnMarketId\": \"<string>\",\n \"userWalletAddress\": \"<string>\",\n \"args\": {\n \"amount\": \"<string>\",\n \"amounts\": [\n \"<string>\"\n ],\n \"validatorAddress\": \"<string>\",\n \"validatorAddresses\": [\n \"<string>\"\n ],\n \"providerId\": \"<string>\",\n \"duration\": 123,\n \"inputToken\": \"<string>\",\n \"inputTokenNetwork\": \"<string>\",\n \"outputToken\": \"<string>\",\n \"outputTokenNetwork\": \"<string>\",\n \"subnetId\": 123,\n \"tronResource\": \"<string>\",\n \"feeConfigurationId\": \"<string>\",\n \"cosmosPubKey\": \"<string>\",\n \"tezosPubKey\": \"<string>\",\n \"cAddressBech\": \"<string>\",\n \"pAddressBech\": \"<string>\",\n \"executionMode\": \"<string>\",\n \"ledgerWalletApiCompatible\": true,\n \"useMaxAmount\": true,\n \"useInstantExecution\": true,\n \"skipPrechecks\": true,\n \"useMaxAllowance\": true,\n \"feePayerAddress\": \"<string>\",\n \"receiverAddress\": \"<string>\",\n \"rangeMin\": \"<string>\",\n \"rangeMax\": \"<string>\",\n \"percentage\": 123,\n \"tokenId\": \"<string>\"\n }\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://trails-api.sequence.app/rpc/Trails/YieldCreateExitAction")
.header("Content-Type", "application/json")
.body("{\n \"earnMarketId\": \"<string>\",\n \"userWalletAddress\": \"<string>\",\n \"args\": {\n \"amount\": \"<string>\",\n \"amounts\": [\n \"<string>\"\n ],\n \"validatorAddress\": \"<string>\",\n \"validatorAddresses\": [\n \"<string>\"\n ],\n \"providerId\": \"<string>\",\n \"duration\": 123,\n \"inputToken\": \"<string>\",\n \"inputTokenNetwork\": \"<string>\",\n \"outputToken\": \"<string>\",\n \"outputTokenNetwork\": \"<string>\",\n \"subnetId\": 123,\n \"tronResource\": \"<string>\",\n \"feeConfigurationId\": \"<string>\",\n \"cosmosPubKey\": \"<string>\",\n \"tezosPubKey\": \"<string>\",\n \"cAddressBech\": \"<string>\",\n \"pAddressBech\": \"<string>\",\n \"executionMode\": \"<string>\",\n \"ledgerWalletApiCompatible\": true,\n \"useMaxAmount\": true,\n \"useInstantExecution\": true,\n \"skipPrechecks\": true,\n \"useMaxAllowance\": true,\n \"feePayerAddress\": \"<string>\",\n \"receiverAddress\": \"<string>\",\n \"rangeMin\": \"<string>\",\n \"rangeMax\": \"<string>\",\n \"percentage\": 123,\n \"tokenId\": \"<string>\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://trails-api.sequence.app/rpc/Trails/YieldCreateExitAction")
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 \"earnMarketId\": \"<string>\",\n \"userWalletAddress\": \"<string>\",\n \"args\": {\n \"amount\": \"<string>\",\n \"amounts\": [\n \"<string>\"\n ],\n \"validatorAddress\": \"<string>\",\n \"validatorAddresses\": [\n \"<string>\"\n ],\n \"providerId\": \"<string>\",\n \"duration\": 123,\n \"inputToken\": \"<string>\",\n \"inputTokenNetwork\": \"<string>\",\n \"outputToken\": \"<string>\",\n \"outputTokenNetwork\": \"<string>\",\n \"subnetId\": 123,\n \"tronResource\": \"<string>\",\n \"feeConfigurationId\": \"<string>\",\n \"cosmosPubKey\": \"<string>\",\n \"tezosPubKey\": \"<string>\",\n \"cAddressBech\": \"<string>\",\n \"pAddressBech\": \"<string>\",\n \"executionMode\": \"<string>\",\n \"ledgerWalletApiCompatible\": true,\n \"useMaxAmount\": true,\n \"useInstantExecution\": true,\n \"skipPrechecks\": true,\n \"useMaxAllowance\": true,\n \"feePayerAddress\": \"<string>\",\n \"receiverAddress\": \"<string>\",\n \"rangeMin\": \"<string>\",\n \"rangeMax\": \"<string>\",\n \"percentage\": 123,\n \"tokenId\": \"<string>\"\n }\n}"
response = http.request(request)
puts response.read_body{
"action": {
"id": "<string>",
"intent": "<string>",
"type": "<string>",
"yieldId": "<string>",
"address": "<string>",
"transactions": [
{
"id": "<string>",
"title": "<string>",
"network": "<string>",
"status": "<string>",
"type": "<string>",
"createdAt": "<string>",
"hash": "<string>",
"broadcastedAt": "<string>",
"signedTransaction": "<string>",
"unsignedTransaction": {},
"annotatedTransaction": {},
"structuredTransaction": {},
"stepIndex": 123,
"description": "<string>",
"error": "<string>",
"gasEstimate": "<string>",
"explorerUrl": "<string>",
"isMessage": true
}
],
"executionPattern": "<string>",
"createdAt": "<string>",
"status": "<string>",
"amount": "<string>",
"amountRaw": "<string>",
"amountUsd": "<string>",
"rawArguments": {
"amount": "<string>",
"amounts": [
"<string>"
],
"validatorAddress": "<string>",
"validatorAddresses": [
"<string>"
],
"providerId": "<string>",
"duration": 123,
"inputToken": "<string>",
"inputTokenNetwork": "<string>",
"outputToken": "<string>",
"outputTokenNetwork": "<string>",
"subnetId": 123,
"tronResource": "<string>",
"feeConfigurationId": "<string>",
"cosmosPubKey": "<string>",
"tezosPubKey": "<string>",
"cAddressBech": "<string>",
"pAddressBech": "<string>",
"executionMode": "<string>",
"ledgerWalletApiCompatible": true,
"useMaxAmount": true,
"useInstantExecution": true,
"skipPrechecks": true,
"useMaxAllowance": true,
"feePayerAddress": "<string>",
"receiverAddress": "<string>",
"rangeMin": "<string>",
"rangeMax": "<string>",
"percentage": 123,
"tokenId": "<string>"
},
"completedAt": "<string>"
}
}{
"error": "WebrpcEndpoint",
"code": 0,
"msg": "endpoint error",
"status": 400,
"cause": "<string>"
}{
"error": "WebrpcBadResponse",
"code": -5,
"msg": "bad response",
"status": 500,
"cause": "<string>"
}Overview
YieldCreateExitAction returns the unsigned transaction payload needed to withdraw from a DeFi yield position. It is the counterpart to YieldCreateEnterAction.
Use this endpoint to build withdrawal UIs or construct exit calldata for Trails routes. For React apps, the composable action builders handle this automatically.
Request Parameters
| Field | Type | Required | Description |
|---|---|---|---|
earnMarketId | string | Yes | Market ID from YieldGetMarkets |
userWalletAddress | string | Yes | Address of the withdrawing wallet |
args | object | No | Market-specific arguments (e.g. amount, shares) |
Response
Returnspayload containing unsigned transaction data:
| Field | Description |
|---|---|
transactions | Array of transaction objects to execute |
transactions[].to | Contract address |
transactions[].data | ABI-encoded calldata |
transactions[].value | ETH value (for native token withdrawals) |
Examples
Withdraw from an Aave lending position
const response = await fetch('https://trails-api.sequence.app/rpc/Trails/YieldCreateExitAction', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-Access-Key': 'YOUR_ACCESS_KEY',
},
body: JSON.stringify({
earnMarketId: 'base-usdc-aave-v3-lending',
userWalletAddress: '0xYourWalletAddress',
}),
})
const { payload } = await response.json()
const action = JSON.parse(payload)
Withdraw a specific amount
Useargs to pass withdrawal parameters for markets that require them (e.g. partial withdrawals):
const response = await fetch('https://trails-api.sequence.app/rpc/Trails/YieldCreateExitAction', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-Access-Key': 'YOUR_ACCESS_KEY',
},
body: JSON.stringify({
earnMarketId: 'ethereum-usdc-morpho-0x...',
userWalletAddress: '0xYourWalletAddress',
args: {
amount: '1000000', // 1 USDC in wei
},
}),
})
Common pattern: check balance then exit
// 1. Check what positions the wallet holds
const balancesRes = await fetch('https://trails-api.sequence.app/rpc/Trails/YieldGetAggregateBalances', {
method: 'POST',
headers: { 'Content-Type': 'application/json', 'X-Access-Key': 'YOUR_ACCESS_KEY' },
body: JSON.stringify({ queries: [{ address: '0xYourWallet', network: 'base' }] }),
})
const { payload: balPayload } = await balancesRes.json()
const balances = JSON.parse(balPayload)
// 2. Build exit calldata for each position
for (const position of balances) {
const exitRes = await fetch('https://trails-api.sequence.app/rpc/Trails/YieldCreateExitAction', {
method: 'POST',
headers: { 'Content-Type': 'application/json', 'X-Access-Key': 'YOUR_ACCESS_KEY' },
body: JSON.stringify({
earnMarketId: position.yieldId,
userWalletAddress: '0xYourWallet',
}),
})
const { payload: exitPayload } = await exitRes.json()
const exitAction = JSON.parse(exitPayload)
// Use exitAction.transactions to build and submit the withdrawal
}
See also
- YieldCreateEnterAction — Deposit into a position
- YieldGetAggregateBalances — Check existing positions before exiting
- YieldGetMarkets — Discover market IDs
Was this page helpful?
⌘I