from compass_api_sdk import CompassAPI, models
with CompassAPI(
api_key_auth="<YOUR_API_KEY_HERE>",
) as compass_api:
res = compass_api.earn.earn_manage(venue={
"type": "VAULT",
"vault_address": "0x7BfA7C4f149E7415b73bdeDfe609237e29CBF34A",
}, action=models.EarnManageRequestAction.DEPOSIT, amount="0.01", owner="0x06A9aF046187895AcFc7258450B15397CAc67400", chain=models.EarnManageRequestChain.BASE, fee={
"recipient": "<value>",
"amount": "263.30",
"denomination": models.FeeDenomination.PERCENTAGE,
}, gas_sponsorship=False)
# Handle response
print(res)import { CompassApiSDK } from "@compass-labs/api-sdk";
const compassApiSDK = new CompassApiSDK({
apiKeyAuth: "<YOUR_API_KEY_HERE>",
});
async function run() {
const result = await compassApiSDK.earn.earnManage({
venue: {
type: "VAULT",
vaultAddress: "0x7BfA7C4f149E7415b73bdeDfe609237e29CBF34A",
},
action: "DEPOSIT",
amount: "0.01",
owner: "0x06A9aF046187895AcFc7258450B15397CAc67400",
chain: "base",
gasSponsorship: false,
});
console.log(result);
}
run();curl --request POST \
--url https://api.compasslabs.ai/v2/earn/manage \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"owner": "0x06A9aF046187895AcFc7258450B15397CAc67400",
"chain": "base",
"venue": {
"type": "VAULT",
"vault_address": "0x7BfA7C4f149E7415b73bdeDfe609237e29CBF34A"
},
"action": "DEPOSIT",
"amount": "0.01",
"gas_sponsorship": false
}
'const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
owner: '0x06A9aF046187895AcFc7258450B15397CAc67400',
chain: 'base',
venue: {type: 'VAULT', vault_address: '0x7BfA7C4f149E7415b73bdeDfe609237e29CBF34A'},
action: 'DEPOSIT',
amount: '0.01',
gas_sponsorship: false
})
};
fetch('https://api.compasslabs.ai/v2/earn/manage', 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.compasslabs.ai/v2/earn/manage",
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([
'owner' => '0x06A9aF046187895AcFc7258450B15397CAc67400',
'chain' => 'base',
'venue' => [
'type' => 'VAULT',
'vault_address' => '0x7BfA7C4f149E7415b73bdeDfe609237e29CBF34A'
],
'action' => 'DEPOSIT',
'amount' => '0.01',
'gas_sponsorship' => false
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$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.compasslabs.ai/v2/earn/manage"
payload := strings.NewReader("{\n \"owner\": \"0x06A9aF046187895AcFc7258450B15397CAc67400\",\n \"chain\": \"base\",\n \"venue\": {\n \"type\": \"VAULT\",\n \"vault_address\": \"0x7BfA7C4f149E7415b73bdeDfe609237e29CBF34A\"\n },\n \"action\": \"DEPOSIT\",\n \"amount\": \"0.01\",\n \"gas_sponsorship\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
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.compasslabs.ai/v2/earn/manage")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"owner\": \"0x06A9aF046187895AcFc7258450B15397CAc67400\",\n \"chain\": \"base\",\n \"venue\": {\n \"type\": \"VAULT\",\n \"vault_address\": \"0x7BfA7C4f149E7415b73bdeDfe609237e29CBF34A\"\n },\n \"action\": \"DEPOSIT\",\n \"amount\": \"0.01\",\n \"gas_sponsorship\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.compasslabs.ai/v2/earn/manage")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"owner\": \"0x06A9aF046187895AcFc7258450B15397CAc67400\",\n \"chain\": \"base\",\n \"venue\": {\n \"type\": \"VAULT\",\n \"vault_address\": \"0x7BfA7C4f149E7415b73bdeDfe609237e29CBF34A\"\n },\n \"action\": \"DEPOSIT\",\n \"amount\": \"0.01\",\n \"gas_sponsorship\": false\n}"
response = http.request(request)
puts response.read_body{
"transaction": {
"chainId": "0x2105",
"data": "0x8d80ff0a0000000000000000000000000000000000000000000000000000000000000020",
"from": "0x4A83b4413CF41C3244027e1590E35a0F48403F0c",
"gas": "0x7a120",
"maxFeePerGas": "0x59682f00",
"maxPriorityFeePerGas": "0x3b9aca00",
"nonce": "0x5",
"to": "0x6B90E8B4E3E971E74C1A47a3a20976377E2dB4b1",
"value": "0x0"
}
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Manage earn position
Deposit into or withdraw from a yield venue.
Use DEPOSIT to move tokens from the Earn Account into a vault, Aave market, or Pendle PT position. Use WITHDRAW to move tokens back from a venue into the Earn Account.
Venue types:
VAULT: ERC-4626 vaults (see /vaults for available options)AAVE: Aave lending pools (see /aave_markets for available options)PENDLE_PT: Pendle Principal Tokens (see /pendle_markets for available options)
Fees: A fee can be configured and deducted from the transaction amount (not supported for PENDLE_PT):
FIXED: A fixed token amount (e.g., 0.1 means 0.1 tokens)PERCENTAGE: A percentage of the amount (e.g., 1.5 means 1.5%)PERFORMANCE: A percentage of realized profit (withdrawals only)
Gas sponsorship: Set gas_sponsorship=true to receive EIP-712 typed data. Owner signs the typed data, then submit to /gas_sponsorship/prepare.
from compass_api_sdk import CompassAPI, models
with CompassAPI(
api_key_auth="<YOUR_API_KEY_HERE>",
) as compass_api:
res = compass_api.earn.earn_manage(venue={
"type": "VAULT",
"vault_address": "0x7BfA7C4f149E7415b73bdeDfe609237e29CBF34A",
}, action=models.EarnManageRequestAction.DEPOSIT, amount="0.01", owner="0x06A9aF046187895AcFc7258450B15397CAc67400", chain=models.EarnManageRequestChain.BASE, fee={
"recipient": "<value>",
"amount": "263.30",
"denomination": models.FeeDenomination.PERCENTAGE,
}, gas_sponsorship=False)
# Handle response
print(res)import { CompassApiSDK } from "@compass-labs/api-sdk";
const compassApiSDK = new CompassApiSDK({
apiKeyAuth: "<YOUR_API_KEY_HERE>",
});
async function run() {
const result = await compassApiSDK.earn.earnManage({
venue: {
type: "VAULT",
vaultAddress: "0x7BfA7C4f149E7415b73bdeDfe609237e29CBF34A",
},
action: "DEPOSIT",
amount: "0.01",
owner: "0x06A9aF046187895AcFc7258450B15397CAc67400",
chain: "base",
gasSponsorship: false,
});
console.log(result);
}
run();curl --request POST \
--url https://api.compasslabs.ai/v2/earn/manage \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"owner": "0x06A9aF046187895AcFc7258450B15397CAc67400",
"chain": "base",
"venue": {
"type": "VAULT",
"vault_address": "0x7BfA7C4f149E7415b73bdeDfe609237e29CBF34A"
},
"action": "DEPOSIT",
"amount": "0.01",
"gas_sponsorship": false
}
'const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
owner: '0x06A9aF046187895AcFc7258450B15397CAc67400',
chain: 'base',
venue: {type: 'VAULT', vault_address: '0x7BfA7C4f149E7415b73bdeDfe609237e29CBF34A'},
action: 'DEPOSIT',
amount: '0.01',
gas_sponsorship: false
})
};
fetch('https://api.compasslabs.ai/v2/earn/manage', 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.compasslabs.ai/v2/earn/manage",
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([
'owner' => '0x06A9aF046187895AcFc7258450B15397CAc67400',
'chain' => 'base',
'venue' => [
'type' => 'VAULT',
'vault_address' => '0x7BfA7C4f149E7415b73bdeDfe609237e29CBF34A'
],
'action' => 'DEPOSIT',
'amount' => '0.01',
'gas_sponsorship' => false
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$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.compasslabs.ai/v2/earn/manage"
payload := strings.NewReader("{\n \"owner\": \"0x06A9aF046187895AcFc7258450B15397CAc67400\",\n \"chain\": \"base\",\n \"venue\": {\n \"type\": \"VAULT\",\n \"vault_address\": \"0x7BfA7C4f149E7415b73bdeDfe609237e29CBF34A\"\n },\n \"action\": \"DEPOSIT\",\n \"amount\": \"0.01\",\n \"gas_sponsorship\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
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.compasslabs.ai/v2/earn/manage")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"owner\": \"0x06A9aF046187895AcFc7258450B15397CAc67400\",\n \"chain\": \"base\",\n \"venue\": {\n \"type\": \"VAULT\",\n \"vault_address\": \"0x7BfA7C4f149E7415b73bdeDfe609237e29CBF34A\"\n },\n \"action\": \"DEPOSIT\",\n \"amount\": \"0.01\",\n \"gas_sponsorship\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.compasslabs.ai/v2/earn/manage")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"owner\": \"0x06A9aF046187895AcFc7258450B15397CAc67400\",\n \"chain\": \"base\",\n \"venue\": {\n \"type\": \"VAULT\",\n \"vault_address\": \"0x7BfA7C4f149E7415b73bdeDfe609237e29CBF34A\"\n },\n \"action\": \"DEPOSIT\",\n \"amount\": \"0.01\",\n \"gas_sponsorship\": false\n}"
response = http.request(request)
puts response.read_body{
"transaction": {
"chainId": "0x2105",
"data": "0x8d80ff0a0000000000000000000000000000000000000000000000000000000000000020",
"from": "0x4A83b4413CF41C3244027e1590E35a0F48403F0c",
"gas": "0x7a120",
"maxFeePerGas": "0x59682f00",
"maxPriorityFeePerGas": "0x3b9aca00",
"nonce": "0x5",
"to": "0x6B90E8B4E3E971E74C1A47a3a20976377E2dB4b1",
"value": "0x0"
}
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Body
Request model for the unified manage endpoint.
Inherits from EarnManageParams and adds context fields (owner, chain, etc).
The earn venue.
- VaultVenue
- AaveVenue
- PendlePTVenue
Show child attributes
Show child attributes
{
"type": "VAULT",
"vault_address": "0x7BfA7C4f149E7415b73bdeDfe609237e29CBF34A"
}
Whether you are depositing into or withdrawing from the given Earn venue.
DEPOSIT, WITHDRAW "DEPOSIT"
Amount of the underlying asset to act on (deposit or withdraw). For VAULT, this is the vault's underlying token; for AAVE, this is the Aave reserve asset; for PENDLE_PT, this is the amount of token to spend (DEPOSIT) or PT to sell (WITHDRAW). Provide as a decimal in token units (not wei); must be > 0.
x > 00.1
The primary wallet address that owns and controls the Earn Account.
"0x06A9aF046187895AcFc7258450B15397CAc67400"
Blockchain network
arbitrum, base, bsc, ethereum, hyperevm, tempo "base"
Action type identifier for manage operations.
"V2_MANAGE"Optional fee configuration. If provided, a fee will be applied to the transaction amount and sent to the specified recipient address. The fee can be specified as a percentage of the transaction amount, as a fixed token amount, or as a percentage of realized profit (PERFORMANCE).
Show child attributes
Show child attributes
Optionally request gas sponsorship. If set to true, EIP-712 typed data will be returned that must be signed by the owner and submitted to the 'Prepare gas-sponsored transaction' endpoint (/gas_sponsorship/prepare).
false
Response
Successful Response
Unsigned transaction for direct execution. Present when gas_sponsorship=false.
Show child attributes
Show child attributes
{
"chainId": "0x2105",
"data": "0x1688f0b900000000000000000000000029fcb43b46531bca003ddc8fcb67ffe91900c762000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000675f4a3d",
"from": "0x4A83b4413CF41C3244027e1590E35a0F48403F0c",
"gas": "0x7a120",
"maxFeePerGas": "0x59682f00",
"maxPriorityFeePerGas": "0x3b9aca00",
"nonce": "0x5",
"to": "0x4e1DCf7AD4e460CfD30791CCC4F9c8a4f820ec67",
"value": "0x0"
}
EIP-712 typed data for gas-sponsored execution. Present when gas_sponsorship=true.
Show child attributes
Show child attributes
{
"domain": {
"chainId": 8453,
"verifyingContract": "0x6B90E8B4E3E971E74C1A47a3a20976377E2dB4b1"
},
"message": {
"baseGas": "0",
"data": "0x8d80ff0a0000000000000000000000000000000000000000000000000000000000000020",
"gasPrice": "0",
"gasToken": "0x0000000000000000000000000000000000000000",
"nonce": "7",
"operation": 1,
"refundReceiver": "0x0000000000000000000000000000000000000000",
"safeTxGas": "0",
"to": "0x93C23AAE4793C14D6DF35D2A2A2234204e1559dA",
"value": "0"
},
"primaryType": "SafeTx",
"types": {
"EIP712Domain": [
{ "name": "chainId", "type": "uint256" },
{
"name": "verifyingContract",
"type": "address"
}
],
"SafeTx": [
{ "name": "to", "type": "address" },
{ "name": "value", "type": "uint256" },
{ "name": "data", "type": "bytes" },
{ "name": "operation", "type": "uint8" },
{ "name": "safeTxGas", "type": "uint256" },
{ "name": "baseGas", "type": "uint256" },
{ "name": "gasPrice", "type": "uint256" },
{ "name": "gasToken", "type": "address" },
{
"name": "refundReceiver",
"type": "address"
},
{ "name": "nonce", "type": "uint256" }
]
}
}
Was this page helpful?