from compass_api_sdk import CompassAPI, models
with CompassAPI(
api_key_auth="<YOUR_API_KEY_HERE>",
) as compass_api:
res = compass_api.risk_yield.risk_yield_create_account(sender="0xdB035cb494EEE30996fbDD25a7b1Fa38D795bdC6", owner="0xdB035cb494EEE30996fbDD25a7b1Fa38D795bdC6", chain=models.CreateRiskYieldAccountRequestChain.ROBINHOOD, estimate_gas=True)
# 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.riskYield.riskYieldCreateAccount({
sender: "0xdB035cb494EEE30996fbDD25a7b1Fa38D795bdC6",
owner: "0xdB035cb494EEE30996fbDD25a7b1Fa38D795bdC6",
});
console.log(result);
}
run();curl --request POST \
--url https://api.compasslabs.ai/v2/risk_yield/create_account \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"sender": "0xdB035cb494EEE30996fbDD25a7b1Fa38D795bdC6",
"owner": "0xdB035cb494EEE30996fbDD25a7b1Fa38D795bdC6"
}
'const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
sender: '0xdB035cb494EEE30996fbDD25a7b1Fa38D795bdC6',
owner: '0xdB035cb494EEE30996fbDD25a7b1Fa38D795bdC6'
})
};
fetch('https://api.compasslabs.ai/v2/risk_yield/create_account', 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/risk_yield/create_account",
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([
'sender' => '0xdB035cb494EEE30996fbDD25a7b1Fa38D795bdC6',
'owner' => '0xdB035cb494EEE30996fbDD25a7b1Fa38D795bdC6'
]),
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/risk_yield/create_account"
payload := strings.NewReader("{\n \"sender\": \"0xdB035cb494EEE30996fbDD25a7b1Fa38D795bdC6\",\n \"owner\": \"0xdB035cb494EEE30996fbDD25a7b1Fa38D795bdC6\"\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/risk_yield/create_account")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"sender\": \"0xdB035cb494EEE30996fbDD25a7b1Fa38D795bdC6\",\n \"owner\": \"0xdB035cb494EEE30996fbDD25a7b1Fa38D795bdC6\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.compasslabs.ai/v2/risk_yield/create_account")
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 \"sender\": \"0xdB035cb494EEE30996fbDD25a7b1Fa38D795bdC6\",\n \"owner\": \"0xdB035cb494EEE30996fbDD25a7b1Fa38D795bdC6\"\n}"
response = http.request(request)
puts response.read_body{
"transaction": {
"chainId": "0x2105",
"data": "0x1688f0b900000000000000000000000029fcb43b46531bca003ddc8fcb67ffe91900c762000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000675f4a3d",
"from": "0x4A83b4413CF41C3244027e1590E35a0F48403F0c",
"gas": "0x7a120",
"maxFeePerGas": "0x59682f00",
"maxPriorityFeePerGas": "0x3b9aca00",
"nonce": "0x5",
"to": "0x4e1DCf7AD4e460CfD30791CCC4F9c8a4f820ec67",
"value": "0x0"
},
"risk_yield_account_address": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Create account
Create the Risk Yield Account that will hold your LP positions.
Liquidity is provided from an account, not from your wallet, so this comes
first. The address is deterministic from the owner, and it is the same
account as your Earn Account on this chain — if you already have one,
this returns it with transaction: null and nothing needs to be signed.
If the owner pays gas: set sender to the owner’s address.
If someone else pays: set sender to whoever will broadcast.
from compass_api_sdk import CompassAPI, models
with CompassAPI(
api_key_auth="<YOUR_API_KEY_HERE>",
) as compass_api:
res = compass_api.risk_yield.risk_yield_create_account(sender="0xdB035cb494EEE30996fbDD25a7b1Fa38D795bdC6", owner="0xdB035cb494EEE30996fbDD25a7b1Fa38D795bdC6", chain=models.CreateRiskYieldAccountRequestChain.ROBINHOOD, estimate_gas=True)
# 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.riskYield.riskYieldCreateAccount({
sender: "0xdB035cb494EEE30996fbDD25a7b1Fa38D795bdC6",
owner: "0xdB035cb494EEE30996fbDD25a7b1Fa38D795bdC6",
});
console.log(result);
}
run();curl --request POST \
--url https://api.compasslabs.ai/v2/risk_yield/create_account \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"sender": "0xdB035cb494EEE30996fbDD25a7b1Fa38D795bdC6",
"owner": "0xdB035cb494EEE30996fbDD25a7b1Fa38D795bdC6"
}
'const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
sender: '0xdB035cb494EEE30996fbDD25a7b1Fa38D795bdC6',
owner: '0xdB035cb494EEE30996fbDD25a7b1Fa38D795bdC6'
})
};
fetch('https://api.compasslabs.ai/v2/risk_yield/create_account', 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/risk_yield/create_account",
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([
'sender' => '0xdB035cb494EEE30996fbDD25a7b1Fa38D795bdC6',
'owner' => '0xdB035cb494EEE30996fbDD25a7b1Fa38D795bdC6'
]),
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/risk_yield/create_account"
payload := strings.NewReader("{\n \"sender\": \"0xdB035cb494EEE30996fbDD25a7b1Fa38D795bdC6\",\n \"owner\": \"0xdB035cb494EEE30996fbDD25a7b1Fa38D795bdC6\"\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/risk_yield/create_account")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"sender\": \"0xdB035cb494EEE30996fbDD25a7b1Fa38D795bdC6\",\n \"owner\": \"0xdB035cb494EEE30996fbDD25a7b1Fa38D795bdC6\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.compasslabs.ai/v2/risk_yield/create_account")
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 \"sender\": \"0xdB035cb494EEE30996fbDD25a7b1Fa38D795bdC6\",\n \"owner\": \"0xdB035cb494EEE30996fbDD25a7b1Fa38D795bdC6\"\n}"
response = http.request(request)
puts response.read_body{
"transaction": {
"chainId": "0x2105",
"data": "0x1688f0b900000000000000000000000029fcb43b46531bca003ddc8fcb67ffe91900c762000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000675f4a3d",
"from": "0x4A83b4413CF41C3244027e1590E35a0F48403F0c",
"gas": "0x7a120",
"maxFeePerGas": "0x59682f00",
"maxPriorityFeePerGas": "0x3b9aca00",
"nonce": "0x5",
"to": "0x4e1DCf7AD4e460CfD30791CCC4F9c8a4f820ec67",
"value": "0x0"
},
"risk_yield_account_address": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Body
Create the Safe that will hold the owner's LP positions.
The address that signs and broadcasts this transaction.
"0xdB035cb494EEE30996fbDD25a7b1Fa38D795bdC6"
The address that will own and control the Risk Yield Account.
"0xdB035cb494EEE30996fbDD25a7b1Fa38D795bdC6"
Risk Yield is available on Robinhood Chain only.
robinhood Estimate gas, which also proves the transaction can execute.
Response
Successful Response
The transaction that deploys the account, or null when it already exists — calling this twice is safe.
Show child attributes
Show child attributes
{
"chainId": "0x2105",
"data": "0x1688f0b900000000000000000000000029fcb43b46531bca003ddc8fcb67ffe91900c762000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000675f4a3d",
"from": "0x4A83b4413CF41C3244027e1590E35a0F48403F0c",
"gas": "0x7a120",
"maxFeePerGas": "0x59682f00",
"maxPriorityFeePerGas": "0x3b9aca00",
"nonce": "0x5",
"to": "0x4e1DCf7AD4e460CfD30791CCC4F9c8a4f820ec67",
"value": "0x0"
}
Where the account is, or will be. Deterministic from the owner, so it is known before the transaction is sent. This is the same address as the owner's Earn Account on this chain: one Safe holds both, and funds moved in through either product are the same funds.
Was this page helpful?