from compass_api_sdk import CompassAPI
with CompassAPI(
api_key_auth="<YOUR_API_KEY_HERE>",
) as compass_api:
res = compass_api.perpetual_trading.perpetual_trading_deposit(owner="0x06A9aF046187895AcFc7258450B15397CAc67400", amount="100.0")
# 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.perpetualTrading.perpetualTradingDeposit({
owner: "0x06A9aF046187895AcFc7258450B15397CAc67400",
amount: "100.0",
});
console.log(result);
}
run();curl --request POST \
--url https://api.compasslabs.ai/v2/perpetual_trading/deposit \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"owner": "0x06A9aF046187895AcFc7258450B15397CAc67400",
"amount": "100.0"
}
'const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({owner: '0x06A9aF046187895AcFc7258450B15397CAc67400', amount: '100.0'})
};
fetch('https://api.compasslabs.ai/v2/perpetual_trading/deposit', 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/perpetual_trading/deposit",
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',
'amount' => '100.0'
]),
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/perpetual_trading/deposit"
payload := strings.NewReader("{\n \"owner\": \"0x06A9aF046187895AcFc7258450B15397CAc67400\",\n \"amount\": \"100.0\"\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/perpetual_trading/deposit")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"owner\": \"0x06A9aF046187895AcFc7258450B15397CAc67400\",\n \"amount\": \"100.0\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.compasslabs.ai/v2/perpetual_trading/deposit")
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 \"amount\": \"100.0\"\n}"
response = http.request(request)
puts response.read_body{
"amount_raw": 1000000000,
"destination": "0x1F31bAad9e2adC1Dc8B0FF8B0c2cF7D0e7d1A8c9",
"permit": {
"domain": {
"chainId": 42161,
"name": "USD Coin",
"verifyingContract": "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
"version": "2"
},
"message": {
"deadline": "1747097383",
"nonce": "5",
"owner": "0x1F31bAad9e2adC1Dc8B0FF8B0c2cF7D0e7d1A8c9",
"spender": "0x2Df1c51E09aECF9cacB7bc98cB1742757f163dF7",
"value": "1000000000"
},
"primaryType": "Permit",
"types": {
"Permit": [
{
"name": "owner",
"type": "address"
},
{
"name": "spender",
"type": "address"
},
{
"name": "value",
"type": "uint256"
},
{
"name": "nonce",
"type": "uint256"
},
{
"name": "deadline",
"type": "uint256"
}
]
}
}
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Deposit USDC to perpetual trading account
Prepare a USDC deposit from Arbitrum via EIP-2612 Permit.
Returns EIP-712 typed data for the user to sign off-chain (no gas needed). Compass does NOT broadcast the bridge tx — the integrator’s own sponsor wallet calls batchedDepositWithPermit on the HL Bridge2 contract on Arbitrum after the user signs. See api_docs/v2/Products/Perpetual-Trading.mdx “Deposit USDC” section for the bridge-broadcast code.
from compass_api_sdk import CompassAPI
with CompassAPI(
api_key_auth="<YOUR_API_KEY_HERE>",
) as compass_api:
res = compass_api.perpetual_trading.perpetual_trading_deposit(owner="0x06A9aF046187895AcFc7258450B15397CAc67400", amount="100.0")
# 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.perpetualTrading.perpetualTradingDeposit({
owner: "0x06A9aF046187895AcFc7258450B15397CAc67400",
amount: "100.0",
});
console.log(result);
}
run();curl --request POST \
--url https://api.compasslabs.ai/v2/perpetual_trading/deposit \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"owner": "0x06A9aF046187895AcFc7258450B15397CAc67400",
"amount": "100.0"
}
'const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({owner: '0x06A9aF046187895AcFc7258450B15397CAc67400', amount: '100.0'})
};
fetch('https://api.compasslabs.ai/v2/perpetual_trading/deposit', 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/perpetual_trading/deposit",
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',
'amount' => '100.0'
]),
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/perpetual_trading/deposit"
payload := strings.NewReader("{\n \"owner\": \"0x06A9aF046187895AcFc7258450B15397CAc67400\",\n \"amount\": \"100.0\"\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/perpetual_trading/deposit")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"owner\": \"0x06A9aF046187895AcFc7258450B15397CAc67400\",\n \"amount\": \"100.0\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.compasslabs.ai/v2/perpetual_trading/deposit")
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 \"amount\": \"100.0\"\n}"
response = http.request(request)
puts response.read_body{
"amount_raw": 1000000000,
"destination": "0x1F31bAad9e2adC1Dc8B0FF8B0c2cF7D0e7d1A8c9",
"permit": {
"domain": {
"chainId": 42161,
"name": "USD Coin",
"verifyingContract": "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
"version": "2"
},
"message": {
"deadline": "1747097383",
"nonce": "5",
"owner": "0x1F31bAad9e2adC1Dc8B0FF8B0c2cF7D0e7d1A8c9",
"spender": "0x2Df1c51E09aECF9cacB7bc98cB1742757f163dF7",
"value": "1000000000"
},
"primaryType": "Permit",
"types": {
"Permit": [
{
"name": "owner",
"type": "address"
},
{
"name": "spender",
"type": "address"
},
{
"name": "value",
"type": "uint256"
},
{
"name": "nonce",
"type": "uint256"
},
{
"name": "deadline",
"type": "uint256"
}
]
}
}
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Body
Request to deposit USDC from Arbitrum into the user's perpetual trading account.
Response
Successful Response
EIP-2612 permit data the user signs to authorize a USDC bridge deposit.
After signing, submit the signature to /v2/perpetual_trading/deposit/sponsor_prepare to get a ready-to-broadcast Arbitrum tx that calls Bridge2.batchedDepositWithPermit. The integrator's sponsor wallet broadcasts that tx — Compass does not broadcast.
EIP-712 typed data for the USDC permit — user signs this off-chain.
Show child attributes
Show child attributes
{
"domain": {
"chainId": 8453,
"name": "USD Coin",
"verifyingContract": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
"version": "2"
},
"message": {
"deadline": "1735689600",
"nonce": "0",
"owner": "0x4A83b4413CF41C3244027e1590E35a0F48403F0c",
"spender": "0x6B90E8B4E3E971E74C1A47a3a20976377E2dB4b1",
"value": "100000000"
},
"primaryType": "Permit",
"types": {
"EIP712Domain": [
{ "name": "name", "type": "string" },
{ "name": "version", "type": "string" },
{ "name": "chainId", "type": "uint256" },
{
"name": "verifyingContract",
"type": "address"
}
],
"Permit": [
{ "name": "owner", "type": "address" },
{ "name": "spender", "type": "address" },
{ "name": "value", "type": "uint256" },
{ "name": "nonce", "type": "uint256" },
{ "name": "deadline", "type": "uint256" }
]
}
}
USDC amount in raw 6-decimal units. Pass this and the signature to /deposit/sponsor_prepare.
Address that will be credited on Hyperliquid (equals the deposit owner EOA — HL keys accounts by EVM address).
Was this page helpful?