Documentation
¶
Index ¶
- Variables
- func Bool(b bool) *bool
- func Float32(f float32) *float32
- func Float64(f float64) *float64
- func Int(i int) *int
- func Int64(i int64) *int64
- func Pointer[T any](v T) *T
- func String(s string) *string
- type CompassCLI
- type Credit
- func (s *Credit) Balances(ctx context.Context, request operations.V2CreditBalancesRequest, ...) (*operations.V2CreditBalancesResponse, error)
- func (s *Credit) Borrow(ctx context.Context, request components.CreditBorrowRequest, ...) (*operations.V2CreditBorrowResponse, error)
- func (s *Credit) Bundle(ctx context.Context, request components.CreditBundleRequest, ...) (*operations.V2CreditBundleResponse, error)
- func (s *Credit) CreateAccount(ctx context.Context, request components.CreateCreditAccountRequest, ...) (*operations.V2CreditCreateAccountResponse, error)
- func (s *Credit) EulerMarkets(ctx context.Context, request operations.V2CreditEulerMarketsRequest, ...) (*operations.V2CreditEulerMarketsResponse, error)
- func (s *Credit) Loop(ctx context.Context, request components.CreditLoopRequest, ...) (*operations.V2CreditLoopResponse, error)
- func (s *Credit) LoopedPositions(ctx context.Context, request operations.V2CreditLoopedPositionsRequest, ...) (*operations.V2CreditLoopedPositionsResponse, error)
- func (s *Credit) MorphoMarkets(ctx context.Context, request operations.V2CreditMorphoMarketsRequest, ...) (*operations.V2CreditMorphoMarketsResponse, error)
- func (s *Credit) Positions(ctx context.Context, request operations.V2CreditPositionsRequest, ...) (*operations.V2CreditPositionsResponse, error)
- func (s *Credit) Rebalance(ctx context.Context, request components.CreditRebalanceRequest, ...) (*operations.V2CreditRebalanceResponse, error)
- func (s *Credit) Repay(ctx context.Context, request components.CreditRepayRequest, ...) (*operations.V2CreditRepayResponse, error)
- func (s *Credit) Transfer(ctx context.Context, request components.CreditTransferRequest, ...) (*operations.V2CreditTransferResponse, error)
- func (s *Credit) Unloop(ctx context.Context, request components.CreditUnloopRequest, ...) (*operations.V2CreditUnloopResponse, error)
- type Earn
- func (s *Earn) AaveMarkets(ctx context.Context, request *operations.V2EarnAaveMarketsRequest, ...) (*operations.V2EarnAaveMarketsResponse, error)
- func (s *Earn) Balances(ctx context.Context, request operations.V2EarnBalancesRequest, ...) (*operations.V2EarnBalancesResponse, error)
- func (s *Earn) Bundle(ctx context.Context, request components.V2BundleRequest, ...) (*operations.V2EarnBundleResponse, error)
- func (s *Earn) CreateAccount(ctx context.Context, request components.CreateAccountRequest, ...) (*operations.V2EarnCreateAccountResponse, error)
- func (s *Earn) Manage(ctx context.Context, request components.EarnManageRequest, ...) (*operations.V2EarnManageResponse, error)
- func (s *Earn) PendleMarkets(ctx context.Context, request operations.V2EarnPendleMarketsRequest, ...) (*operations.V2EarnPendleMarketsResponse, error)
- func (s *Earn) Positions(ctx context.Context, request operations.V2EarnPositionsRequest, ...) (*operations.V2EarnPositionsResponse, error)
- func (s *Earn) PositionsAll(ctx context.Context, request operations.V2EarnPositionsAllRequest, ...) (*operations.V2EarnPositionsAllResponse, error)
- func (s *Earn) Swap(ctx context.Context, request components.EarnSwapRequest, ...) (*operations.V2EarnSwapResponse, error)
- func (s *Earn) SwapQuote(ctx context.Context, request operations.V2EarnSwapQuoteRequest, ...) (*operations.V2EarnSwapQuoteResponse, error)
- func (s *Earn) Transfer(ctx context.Context, request components.EarnTransferRequest, ...) (*operations.V2EarnTransferResponse, error)
- func (s *Earn) Vaults(ctx context.Context, request operations.V2EarnVaultsRequest, ...) (*operations.V2EarnVaultsResponse, error)
- type GasSponsorship
- func (s *GasSponsorship) ApproveTransfer(ctx context.Context, request components.ApproveTransferRequest, ...) (*operations.V2GasSponsorshipApproveTransferResponse, error)
- func (s *GasSponsorship) Prepare(ctx context.Context, request components.SponsorGasRequest, ...) (*operations.V2GasSponsorshipPrepareResponse, error)
- type GlobalMarketsPerps
- func (s *GlobalMarketsPerps) Activity(ctx context.Context, request operations.V2GlobalMarketsPerpsActivityRequest, ...) (*operations.V2GlobalMarketsPerpsActivityResponse, error)
- func (s *GlobalMarketsPerps) ApproveBuilderFee(ctx context.Context, ...) (*operations.V2GlobalMarketsPerpsApproveBuilderFeeResponse, error)
- func (s *GlobalMarketsPerps) CancelOrder(ctx context.Context, request components.GlobalMarketsPerpsCancelOrderRequest, ...) (*operations.V2GlobalMarketsPerpsCancelOrderResponse, error)
- func (s *GlobalMarketsPerps) Candles(ctx context.Context, request operations.V2GlobalMarketsPerpsCandlesRequest, ...) (*operations.V2GlobalMarketsPerpsCandlesResponse, error)
- func (s *GlobalMarketsPerps) Deposit(ctx context.Context, request components.GlobalMarketsPerpsDepositRequest, ...) (*operations.V2GlobalMarketsPerpsDepositResponse, error)
- func (s *GlobalMarketsPerps) DepositSponsorPrepare(ctx context.Context, ...) (*operations.V2GlobalMarketsPerpsDepositSponsorPrepareResponse, error)
- func (s *GlobalMarketsPerps) EnableUnifiedAccount(ctx context.Context, ...) (*operations.V2GlobalMarketsPerpsEnableUnifiedAccountResponse, error)
- func (s *GlobalMarketsPerps) EnsureLeverage(ctx context.Context, ...) (*operations.V2GlobalMarketsPerpsEnsureLeverageResponse, error)
- func (s *GlobalMarketsPerps) Execute(ctx context.Context, request components.GlobalMarketsPerpsExecuteRequest, ...) (*operations.V2GlobalMarketsPerpsExecuteResponse, error)
- func (s *GlobalMarketsPerps) LimitOrder(ctx context.Context, request components.GlobalMarketsPerpsLimitOrderRequest, ...) (*operations.V2GlobalMarketsPerpsLimitOrderResponse, error)
- func (s *GlobalMarketsPerps) MarketOrder(ctx context.Context, request components.GlobalMarketsPerpsMarketOrderRequest, ...) (*operations.V2GlobalMarketsPerpsMarketOrderResponse, error)
- func (s *GlobalMarketsPerps) Opportunities(ctx context.Context, ...) (*operations.V2GlobalMarketsPerpsOpportunitiesResponse, error)
- func (s *GlobalMarketsPerps) Positions(ctx context.Context, request operations.V2GlobalMarketsPerpsPositionsRequest, ...) (*operations.V2GlobalMarketsPerpsPositionsResponse, error)
- func (s *GlobalMarketsPerps) SetLeverage(ctx context.Context, request components.GlobalMarketsPerpsSetLeverageRequest, ...) (*operations.V2GlobalMarketsPerpsSetLeverageResponse, error)
- func (s *GlobalMarketsPerps) Withdraw(ctx context.Context, request components.GlobalMarketsPerpsWithdrawRequest, ...) (*operations.V2GlobalMarketsPerpsWithdrawResponse, error)
- type HTTPClient
- type Onramp
- func (s *Onramp) Create(ctx context.Context, request components.OnrampCreateRequest, ...) (*operations.V2OnrampCreateResponse, error)
- func (s *Onramp) Quote(ctx context.Context, request components.OnrampQuoteRequest, ...) (*operations.V2OnrampQuoteResponse, error)
- func (s *Onramp) Status(ctx context.Context, request operations.V2OnrampStatusRequest, ...) (*operations.V2OnrampStatusResponse, error)
- type SDKOption
- func WithClient(client HTTPClient) SDKOption
- func WithRetryConfig(retryConfig retry.Config) SDKOption
- func WithSecurity(security components.Security) SDKOption
- func WithSecuritySource(security func(context.Context) (components.Security, error)) SDKOption
- func WithServerIndex(serverIndex int) SDKOption
- func WithServerURL(serverURL string) SDKOption
- func WithTemplatedServerURL(serverURL string, params map[string]string) SDKOption
- func WithTimeout(timeout time.Duration) SDKOption
- type TokenizedAssets
- func (s *TokenizedAssets) Balances(ctx context.Context, request operations.V2TokenizedAssetsBalancesRequest, ...) (*operations.V2TokenizedAssetsBalancesResponse, error)
- func (s *TokenizedAssets) Buy(ctx context.Context, request components.TokenizedAssetsTradeRequest, ...) (*operations.V2TokenizedAssetsTransactBuyResponse, error)
- func (s *TokenizedAssets) CreateAccount(ctx context.Context, request components.CreateTokenizedAssetsAccountRequest, ...) (*operations.V2TokenizedAssetsCreateAccountResponse, error)
- func (s *TokenizedAssets) Market(ctx context.Context, request operations.V2TokenizedAssetsMarketsSymbolRequest, ...) (*operations.V2TokenizedAssetsMarketsSymbolResponse, error)
- func (s *TokenizedAssets) Markets(ctx context.Context, request *operations.V2TokenizedAssetsMarketsRequest, ...) (*operations.V2TokenizedAssetsMarketsResponse, error)
- func (s *TokenizedAssets) Order(ctx context.Context, request components.TokenizedAssetsBuildOrderRequest, ...) (*operations.V2TokenizedAssetsOrderResponse, error)
- func (s *TokenizedAssets) OrderCancel(ctx context.Context, ...) (*operations.V2TokenizedAssetsOrderOrderHashCancelResponse, error)
- func (s *TokenizedAssets) OrderChargeFee(ctx context.Context, ...) (*operations.V2TokenizedAssetsOrderOrderHashChargeFeeResponse, error)
- func (s *TokenizedAssets) OrderStatus(ctx context.Context, request operations.V2TokenizedAssetsOrderOrderHashRequest, ...) (*operations.V2TokenizedAssetsOrderOrderHashResponse, error)
- func (s *TokenizedAssets) OrderSubmit(ctx context.Context, request components.TokenizedAssetsSubmitOrderRequest, ...) (*operations.V2TokenizedAssetsOrderSubmitResponse, error)
- func (s *TokenizedAssets) Positions(ctx context.Context, request operations.V2TokenizedAssetsPositionsRequest, ...) (*operations.V2TokenizedAssetsPositionsResponse, error)
- func (s *TokenizedAssets) Quote(ctx context.Context, request components.TokenizedAssetsQuoteRequest, ...) (*operations.V2TokenizedAssetsQuoteResponse, error)
- func (s *TokenizedAssets) Redemptions(ctx context.Context, request operations.V2TokenizedAssetsRedemptionsRequest, ...) (*operations.V2TokenizedAssetsRedemptionsResponse, error)
- func (s *TokenizedAssets) Sell(ctx context.Context, request components.TokenizedAssetsTradeRequest, ...) (*operations.V2TokenizedAssetsTransactSellResponse, error)
- func (s *TokenizedAssets) Transfer(ctx context.Context, request components.TokenizedAssetsTransferRequest, ...) (*operations.V2TokenizedAssetsTransferResponse, error)
Constants ¶
This section is empty.
Variables ¶
var ServerList = []string{
"https://api.compasslabs.ai",
}
ServerList contains the list of servers available to the SDK
Functions ¶
Types ¶
type CompassCLI ¶
type CompassCLI struct {
SDKVersion string
GasSponsorship *GasSponsorship
Earn *Earn
Credit *Credit
GlobalMarketsPerps *GlobalMarketsPerps
TokenizedAssets *TokenizedAssets
Onramp *Onramp
// contains filtered or unexported fields
}
CompassCLI - Compass API: Compass Labs DeFi API
func New ¶
func New(opts ...SDKOption) *CompassCLI
New creates a new instance of the SDK with the provided options
type Credit ¶
type Credit struct {
// contains filtered or unexported fields
}
func (*Credit) Balances ¶ added in v0.1.10
func (s *Credit) Balances(ctx context.Context, request operations.V2CreditBalancesRequest, opts ...operations.Option) (*operations.V2CreditBalancesResponse, error)
Balances - Get credit account token balances Get token balances and transfer history for a credit account.
Returns all token balances held by the credit account derived from the owner address, along with complete transfer history and USD valuations.
func (*Credit) Borrow ¶ added in v0.1.10
func (s *Credit) Borrow(ctx context.Context, request components.CreditBorrowRequest, opts ...operations.Option) (*operations.V2CreditBorrowResponse, error)
Borrow against collateral Borrow an asset from Aave using a Credit Account.
Bundles an optional swap, collateral supply, and borrow into a single atomic Safe transaction.
- If `token_in` equals `collateral_token`, the tokens are supplied directly as collateral. - If `token_in` differs from `collateral_token`, a swap is performed first via 1inch.
The Credit Account must already be created via `/v2/credit/create_account` and funded with `token_in`.
func (*Credit) Bundle ¶ added in v0.1.10
func (s *Credit) Bundle(ctx context.Context, request components.CreditBundleRequest, opts ...operations.Option) (*operations.V2CreditBundleResponse, error)
Bundle - Execute multiple credit actions Compose individual credit operations (supply, withdraw, borrow, repay, swap, transfer) into a single atomic Safe transaction.
The Credit Account must already be created via `/v2/credit/create_account`.
func (*Credit) CreateAccount ¶ added in v0.1.10
func (s *Credit) CreateAccount(ctx context.Context, request components.CreateCreditAccountRequest, opts ...operations.Option) (*operations.V2CreditCreateAccountResponse, error)
CreateAccount - Create credit account Create a Credit Account for a wallet address.
Before using credit features, the owner must create a Credit Account. Each wallet address has one Credit Account per chain.
Returns an unsigned transaction to create the account. The `sender` signs and broadcasts this transaction.
**If owner pays gas:** Set `sender` to the owner's address.
**If someone else pays gas:** Set `sender` to the wallet that will sign and broadcast the transaction on behalf of the owner.
func (*Credit) EulerMarkets ¶ added in v0.1.30
func (s *Credit) EulerMarkets(ctx context.Context, request operations.V2CreditEulerMarketsRequest, opts ...operations.Option) (*operations.V2CreditEulerMarketsResponse, error)
EulerMarkets - List curated Euler markets List curated Euler V2 credit markets for a chain.
Euler is permissionless, so credit borrow/repay identify a market by EVK vault address. This returns the borrow markets from Euler's Governed Perspective (the DAO-vetted vault set) -- each with the collateral vaults it accepts and their LTVs -- so callers know which borrow_vault / collateral_vault to use.
func (*Credit) Loop ¶ added in v0.1.46
func (s *Credit) Loop(ctx context.Context, request components.CreditLoopRequest, opts ...operations.Option) (*operations.V2CreditLoopResponse, error)
Loop - Open a leveraged loop Open a leveraged loop into an Aave or Morpho market in ONE atomic transaction.
Repeatedly supplies collateral, borrows at the requested loan-to-value, and swaps the borrow back to collateral. Each iteration's supply uses the swap's GUARANTEED minimum output (enforced on-chain), so a fill anywhere within the slippage tolerance can never break a later step; any positive surplus stays in the Credit Account (the preview reports the bound as estimated_max_dust). Very large loops relative to pool depth can still exceed the slippage tolerance through their own cumulative price impact — size accordingly or raise max_slippage_percent. Conversely, the geometric tail can shrink below the swap router's minimum routable size; when it does the loop simply ends early on that supply — the achieved multiplier is still guaranteed within 0.5% of the request or the call returns a clean 400.
The Credit Account must already hold initial_collateral_amount of collateral_token. For protocol=MORPHO pass a market_id from /v2/credit/morpho_markets.
func (*Credit) LoopedPositions ¶ added in v0.1.46
func (s *Credit) LoopedPositions(ctx context.Context, request operations.V2CreditLoopedPositionsRequest, opts ...operations.Option) (*operations.V2CreditLoopedPositionsResponse, error)
LoopedPositions - List looped (leveraged) credit positions List looped (leveraged) positions for a credit account owner.
Detects loops from the account's on-chain history: a transaction containing lending + borrowing + swap legs is a loop transaction. Returns one position per Morpho market / Aave collateral+debt reserve pair, each with its complete per-transaction history, lifetime totals, and live on-chain state (health factor, USD values, leverage) for open positions. Covers Aave V3 and Morpho Blue.
func (*Credit) MorphoMarkets ¶ added in v0.1.46
func (s *Credit) MorphoMarkets(ctx context.Context, request operations.V2CreditMorphoMarketsRequest, opts ...operations.Option) (*operations.V2CreditMorphoMarketsResponse, error)
MorphoMarkets - List curated Morpho markets List curated Morpho Blue lending markets for a chain.
Morpho Blue is permissionless, so credit actions identify a market by its bytes32 market id. This returns the curated market set with live LLTV, supply/borrow APY, utilization, and available liquidity -- read on-chain per request -- so callers know which market_id to use and what it currently costs.
func (*Credit) Positions ¶ added in v0.1.10
func (s *Credit) Positions(ctx context.Context, request operations.V2CreditPositionsRequest, opts ...operations.Option) (*operations.V2CreditPositionsResponse, error)
Positions - List credit positions List all Credit positions for a given owner.
Returns a unified list of positions (collateral and debt) and an account summary with health factor and LTV. Each position includes event history.
func (*Credit) Rebalance ¶ added in v0.1.46
func (s *Credit) Rebalance(ctx context.Context, request components.CreditRebalanceRequest, opts ...operations.Option) (*operations.V2CreditRebalanceResponse, error)
Rebalance the leveraged credit book Rebalance the leveraged credit book in ONE atomic transaction.
List only the positions to change — anything not named is left untouched; remove a position with close=true. Each target states an end state: target_equity_usd (net USD committed) × target_multiplier.
Releasing targets run first (each unwind/delever frees tokens into the Credit Account), the freed tokens are then routed by swaps at a GUARANTEED minimum output (enforced on-chain), and consuming targets run last — so moving a levered position between markets, token pairs, or protocols (Aave ↔ Morpho) is simply a close plus an open in the same transaction.
Net book growth is funded from the Credit Account's existing idle balance — fund it first via /v2/credit/transfer; a net release stays in the Credit Account as idle balance. Any swap surplus above the guaranteed floors also stays in the Credit Account (preview.estimated_max_dust) — recoverable, never lost.
A book already at its target returns transaction: null with the preview — the call is idempotent and safe to drive from a converge-to-target loop.
A rebalance too large for one transaction is rejected with a 422 — split it into two calls. Every deleveraging step keeps the health factor ≥ 1.02 and every leveraging step respects the protocol's borrow limits; Aave targets share one account-level health factor, which the preview reports.
Dust tails and routing swaps below the swap router's minimum routable size do not fail the call: a releasing target that cannot fully unwind returns its honest residual in the preview, and an unroutable routing swap is skipped (its uncovered amount only 422s the rebalance if it breaches the funding tolerance).
For protocol=MORPHO pass a market_id from /v2/credit/morpho_markets; inspect the current book via /v2/credit/looped_positions.
func (*Credit) Repay ¶ added in v0.1.10
func (s *Credit) Repay(ctx context.Context, request components.CreditRepayRequest, opts ...operations.Option) (*operations.V2CreditRepayResponse, error)
Repay debt and withdraw collateral Repay an Aave debt and withdraw collateral from a Credit Account.
Bundles repayment, collateral withdrawal, and an optional swap into a single atomic Safe transaction.
- If `token_out` is None or equals `withdraw_token`, the withdrawn collateral is kept as-is. - If `token_out` differs from `withdraw_token`, a swap is performed after withdrawal via 1inch.
The Credit Account must already have a borrow position created via `/v2/credit/borrow`. The repay_token must be available in the Credit Account (or pulled from EOA via Permit2).
func (*Credit) Transfer ¶ added in v0.1.10
func (s *Credit) Transfer(ctx context.Context, request components.CreditTransferRequest, opts ...operations.Option) (*operations.V2CreditTransferResponse, error)
Transfer tokens to/from Credit Account Transfer tokens between the owner's EOA and their Credit Account.
**DEPOSIT** (EOA → Credit Account):
- With `gas_sponsorship=true`: returns Permit2 EIP-712 typed data to sign. The gas sponsor calls `permitTransferFrom` to pull tokens (1 signature).
- With `gas_sponsorship=false`: returns an unsigned ERC-20 transfer transaction.
**WITHDRAW** (Credit Account → EOA):
- With `gas_sponsorship=true`: returns SafeTx EIP-712 typed data to sign. The gas sponsor broadcasts the `execTransaction` (1 signature).
- With `gas_sponsorship=false`: returns an unsigned `execTransaction`.
func (*Credit) Unloop ¶ added in v0.1.46
func (s *Credit) Unloop(ctx context.Context, request components.CreditUnloopRequest, opts ...operations.Option) (*operations.V2CreditUnloopResponse, error)
Unloop - Unwind a leveraged loop Unwind an Aave or Morpho loop in ONE atomic transaction.
Repeatedly withdraws collateral, swaps it to the borrow token at a GUARANTEED minimum output (enforced on-chain), and repays. The floor discipline means a swap filling anywhere within the slippage tolerance can never break a later step; any positive surplus stays in the Credit Account as borrow-token dust (the preview reports the bound as estimated_max_dust).
Omit target_multiplier for a full close: the debt is cleared exactly — accrued interest included — and the pair collateral is returned to the Credit Account. Pass 1 to clear the debt but keep the collateral supplied, or a value above 1 to delever to that multiplier (it must be below the position's current multiplier).
Each withdrawal is sized to keep the position's health factor ≥ 1.02 at that step, so a position opened very close to the liquidation threshold may need more than one transaction to fully close — set allow_partial=true to return the maximum single-transaction progress (preview.fully_unwound=false), then call unloop again to finish. Very large unwinds relative to pool depth can still exceed the slippage tolerance through their own cumulative price impact.
Positions are unwound as far as the swap router can route; on a router-minimum stop the engine still withdraws all collateral not needed to back the residual, and completes a true full close whenever the unwind's own guaranteed swap surpluses (or the Credit Account's idle balance) cover the remainder — a residual below the router's minimum routable size never fails the call, it is reported honestly in the preview (fully_unwound=false).
When other open Aave loops share this position's collateral reserve, a full close withdraws only this position's attributed share of the pooled collateral (event-ledger bookkeeping), leaving the rest supplied for the other positions.
For protocol=MORPHO pass a market_id from /v2/credit/morpho_markets; inspect open loops via /v2/credit/looped_positions.
type Earn ¶
type Earn struct {
// contains filtered or unexported fields
}
func (*Earn) AaveMarkets ¶ added in v0.1.10
func (s *Earn) AaveMarkets(ctx context.Context, request *operations.V2EarnAaveMarketsRequest, opts ...operations.Option) (*operations.V2EarnAaveMarketsResponse, error)
AaveMarkets - List aave markets List Aave lending markets with supply and borrow rates.
Returns rates organized by token symbol, with chain-specific data for each token. Each token includes rates for all chains where it's available, plus information about which chain offers the highest supply APY.
APY values are returned in percentage format (e.g., 4.5 means 4.5%). Tokens with zero APY on both supply and borrow are excluded.
To deposit into an Aave market, use the [manage endpoint](https://docs.compasslabs.ai/v2/api-reference/earn/manage-earn-position) with `venue_type=AAVE`.
func (*Earn) Balances ¶ added in v0.1.10
func (s *Earn) Balances(ctx context.Context, request operations.V2EarnBalancesRequest, opts ...operations.Option) (*operations.V2EarnBalancesResponse, error)
Balances - Get token balances Get token balances and transfer history for an earn account.
Returns on-chain token balances for all tokens the earn account has interacted with, along with the complete transfer history for each token. Balances are keyed by token symbol for easy access.
Use this endpoint to display account balances, track token movements, or build transaction history interfaces.
func (*Earn) Bundle ¶ added in v0.1.10
func (s *Earn) Bundle(ctx context.Context, request components.V2BundleRequest, opts ...operations.Option) (*operations.V2EarnBundleResponse, error)
Bundle - Execute multiple earn actions Combine multiple actions into a single atomic transaction.
Bundle swaps and venue deposits/withdrawals into one transaction executed through the Earn Account. This saves gas compared to executing actions separately and ensures all actions succeed or fail together.
**Example:** Swap AUSD to USDC, then deposit USDC into a vault - all in one transaction.
**Fees:** Manage actions (deposits/withdrawals) support optional fee configuration, same as the standalone manage endpoint.
**Gas sponsorship:** Set `gas_sponsorship=true` to receive EIP-712 typed data. Owner signs the typed data, then submit to [/gas_sponsorship/prepare](https://docs.compasslabs.ai/v2/api-reference/gas-sponsorship/prepare-gas-sponsored-transaction).
func (*Earn) CreateAccount ¶ added in v0.1.10
func (s *Earn) CreateAccount(ctx context.Context, request components.CreateAccountRequest, opts ...operations.Option) (*operations.V2EarnCreateAccountResponse, error)
CreateAccount - Create earn account Create an Earn Account for a wallet address.
Before depositing into venues or managing positions, the owner must create an Earn Account. Each wallet address has one Earn Account per chain.
Returns an unsigned transaction to create the account. The `sender` signs and broadcasts this transaction.
**If owner pays gas:** Set `sender` to the owner's address.
**If someone else pays gas:** Set `sender` to the wallet that will sign and broadcast the transaction on behalf of the owner.
func (*Earn) Manage ¶ added in v0.1.10
func (s *Earn) Manage(ctx context.Context, request components.EarnManageRequest, opts ...operations.Option) (*operations.V2EarnManageResponse, error)
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](https://docs.compasslabs.ai/v2/api-reference/earn/list-vaults) for available options) - `AAVE`: Aave lending pools (see [/aave_markets](https://docs.compasslabs.ai/v2/api-reference/earn/list-aave-markets) for available options) - `PENDLE_PT`: Pendle Principal Tokens (see [/pendle_markets](https://docs.compasslabs.ai/v2/api-reference/earn/list-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](https://docs.compasslabs.ai/v2/api-reference/gas-sponsorship/prepare-gas-sponsored-transaction).
func (*Earn) PendleMarkets ¶ added in v0.1.10
func (s *Earn) PendleMarkets(ctx context.Context, request operations.V2EarnPendleMarketsRequest, opts ...operations.Option) (*operations.V2EarnPendleMarketsResponse, error)
PendleMarkets - List pendle markets List Pendle yield trading markets with TVL and implied APY.
Returns Pendle market data including Principal Token (PT), Standardized Yield (SY), and Yield Token (YT) addresses, along with market expiry, TVL, and implied APY.
Use this endpoint to discover yield trading opportunities, compare rates across Pendle markets, or build market selection interfaces.
APY values are returned in percentage format (e.g., 5.25 means 5.25%). Markets without complete metadata or statistics are excluded.
func (*Earn) Positions ¶ added in v0.1.10
func (s *Earn) Positions(ctx context.Context, request operations.V2EarnPositionsRequest, opts ...operations.Option) (*operations.V2EarnPositionsResponse, error)
Positions - List earn positions List all Earn positions for a given owner with PnL tracking.
Returns position data including current balance, cost basis, and profit and loss. Use this endpoint to display portfolio performance, track yields over time, or build position management interfaces.
Positions are tracked across all venue types (vaults and Aave markets). Each position includes the venue address, deposited amount, and performance metrics.
func (*Earn) PositionsAll ¶ added in v0.1.10
func (s *Earn) PositionsAll(ctx context.Context, request operations.V2EarnPositionsAllRequest, opts ...operations.Option) (*operations.V2EarnPositionsAllResponse, error)
PositionsAll - List earn positions across all chains List all Earn positions across all supported chains (Ethereum, Base, Arbitrum).
Returns positions grouped by chain, with per-chain and total USD values. Each chain includes Aave, vault, and Pendle PT positions. Chains where the user has no earn account return empty position lists.
Use this endpoint for a cross-chain portfolio overview instead of making separate calls per chain to /positions.
func (*Earn) Swap ¶ added in v0.1.10
func (s *Earn) Swap(ctx context.Context, request components.EarnSwapRequest, opts ...operations.Option) (*operations.V2EarnSwapResponse, error)
Swap tokens within Earn Account Swap tokens within an Earn Account.
Use this endpoint to exchange one token for another without transferring funds out of the Earn Account.
The swap executes atomically within the Earn Account and can be combined with other actions using the [bundle endpoint](https://docs.compasslabs.ai/v2/api-reference/earn/execute-multiple-earn-actions). For example, swap ETH to USDC, then deposit USDC into a vault—all in one transaction.
Returns either an unsigned transaction (when `gas_sponsorship=false`) or EIP-712 typed data for off-chain signing (when `gas_sponsorship=true`). For gas-sponsored swaps, submit the signed typed data to `/gas_sponsorship/prepare`.
func (*Earn) SwapQuote ¶ added in v0.1.30
func (s *Earn) SwapQuote(ctx context.Context, request operations.V2EarnSwapQuoteRequest, opts ...operations.Option) (*operations.V2EarnSwapQuoteResponse, error)
SwapQuote - Quote a swap Estimate the output of a swap without building a transaction.
Returns the expected amount of `token_out` received for selling `amount_in` of `token_in`, routed via 1inch. This is read-only: it does not build a transaction, require an account, or check balances.
Use it to gauge exit liquidity and price impact for a token before entering a position — for example, to warn when a market's underlying asset cannot be swapped back to a stablecoin without large slippage.
func (*Earn) Transfer ¶ added in v0.1.10
func (s *Earn) Transfer(ctx context.Context, request components.EarnTransferRequest, opts ...operations.Option) (*operations.V2EarnTransferResponse, error)
Transfer tokens to/from account Transfer tokens between an owner's wallet and their Earn Account.
Use `DEPOSIT` to move tokens from the owner's wallet into their Earn Account. Use `WITHDRAW` to move tokens from the Earn Account back to the owner's wallet.
**Gas-sponsored deposits** require two steps:
**Step 1 (once per token):** Set up Permit2 allowance 1. Call [/gas_sponsorship/approve_transfer](https://docs.compasslabs.ai/v2/api-reference/gas-sponsorship/approve-token-transfer) to get EIP-712 typed data 2. Owner signs the typed data 3. Submit signature + typed data to [/gas_sponsorship/prepare](https://docs.compasslabs.ai/v2/api-reference/gas-sponsorship/prepare-gas-sponsored-transaction)
**Step 2 (each transfer):** Execute the gas-sponsored transfer 1. Call this endpoint with `gas_sponsorship=true` to get EIP-712 typed data 2. Owner signs the typed data 3. Submit signature + typed data to [/gas_sponsorship/prepare](https://docs.compasslabs.ai/v2/api-reference/gas-sponsorship/prepare-gas-sponsored-transaction)
**Note:** This endpoint moves tokens to/from the Earn Account itself—not into yield venues. To deposit into a vault or Aave market, use the [manage endpoint](https://docs.compasslabs.ai/v2/api-reference/earn/manage-earn-position).
func (*Earn) Vaults ¶ added in v0.1.10
func (s *Earn) Vaults(ctx context.Context, request operations.V2EarnVaultsRequest, opts ...operations.Option) (*operations.V2EarnVaultsResponse, error)
Vaults - List vaults List ERC-4626 yield vaults across DeFi venues.
Returns vault data including APY, TVL, and underlying asset information. Use this endpoint to discover yield opportunities, compare rates across venues, or build vault selection interfaces.
Supports dozens of vaults and markets like Morpho and other ERC-4626 compatible yield venues.
To deposit into a vault, use the [manage endpoint](https://docs.compasslabs.ai/v2/api-reference/earn/manage-earn-position) with `venue_type=VAULTS`.
type GasSponsorship ¶
type GasSponsorship struct {
// contains filtered or unexported fields
}
func (*GasSponsorship) ApproveTransfer ¶ added in v0.1.10
func (s *GasSponsorship) ApproveTransfer(ctx context.Context, request components.ApproveTransferRequest, opts ...operations.Option) (*operations.V2GasSponsorshipApproveTransferResponse, error)
ApproveTransfer - Approve token transfer Set up a one-time Permit2 allowance for gas-sponsored token transfers.
Required when using [/earn/transfer](https://docs.compasslabs.ai/v2/api-reference/earn/transfer-tokens-tofrom-account) or [/credit/transfer](https://docs.compasslabs.ai/v2/api-reference/credit/transfer-tokens-tofrom-account) with `gas_sponsorship=true`. This allowance only needs to be set up once per token.
**With gas sponsorship (`gas_sponsorship=true`):** - Returns EIP-712 typed data for the owner to sign off-chain - Submit signature + typed data to [/prepare](https://docs.compasslabs.ai/v2/api-reference/gas-sponsorship/prepare-gas-sponsored-transaction) - Only works for tokens that support EIP-2612 permit (e.g., USDC)
Some tokens, like USDT and WETH, do not support EIP-2612 permit. For these tokens, set `gas_sponsorship=false` to receive an unsigned transaction that the owner must sign, submit, and pay gas for.
func (*GasSponsorship) Prepare ¶ added in v0.1.10
func (s *GasSponsorship) Prepare(ctx context.Context, request components.SponsorGasRequest, opts ...operations.Option) (*operations.V2GasSponsorshipPrepareResponse, error)
Prepare gas-sponsored transaction Prepare a gas-sponsored transaction from signed EIP-712 typed data.
Submit the `owner`'s off-chain signature along with the EIP-712 typed data that was signed. Returns an unsigned transaction for the `sender` to sign and broadcast.
**How gas sponsorship works:** 1. Call an endpoint with `gas_sponsorship=true` (e.g., [/earn/transfer](https://docs.compasslabs.ai/v2/api-reference/earn/transfer-tokens-tofrom-account), [/earn/manage](https://docs.compasslabs.ai/v2/api-reference/earn/manage-earn-position), [/credit/transfer](https://docs.compasslabs.ai/v2/api-reference/credit/transfer-tokens-tofrom-account)) to get EIP-712 typed data 2. Owner signs the typed data off-chain 3. Submit signature + typed data to this endpoint 4. Sender signs and broadcasts the returned transaction, paying gas on behalf of the owner
**Note:** For gas-sponsored deposits via [/earn/transfer](https://docs.compasslabs.ai/v2/api-reference/earn/transfer-tokens-tofrom-account) or [/credit/transfer](https://docs.compasslabs.ai/v2/api-reference/credit/transfer-tokens-tofrom-account), the owner must first set up a Permit2 allowance using [/approve_transfer](https://docs.compasslabs.ai/v2/api-reference/gas-sponsorship/approve-token-transfer) (once per token).
type GlobalMarketsPerps ¶ added in v0.1.1
type GlobalMarketsPerps struct {
// contains filtered or unexported fields
}
func (*GlobalMarketsPerps) Activity ¶ added in v0.1.10
func (s *GlobalMarketsPerps) Activity(ctx context.Context, request operations.V2GlobalMarketsPerpsActivityRequest, opts ...operations.Option) (*operations.V2GlobalMarketsPerpsActivityResponse, error)
Activity - Aggregated Hyperliquid activity for a user Return positions, fills, open orders, and (optionally) builder approval state for an end-user in one normalized payload.
Each section is fetched in parallel from the Hyperliquid `info` API. If a single upstream call fails the corresponding section returns “null“ and an entry is added to “partial_errors“; if every section fails the endpoint responds with 502.
Pass “builder“ to additionally include the user's current approved max fee rate for that builder (used by dashboards to decide whether to prompt the user to sign an `approveBuilderFee` action).
func (*GlobalMarketsPerps) ApproveBuilderFee ¶ added in v0.1.10
func (s *GlobalMarketsPerps) ApproveBuilderFee(ctx context.Context, request components.GlobalMarketsPerpsApproveBuilderFeeRequest, opts ...operations.Option) (*operations.V2GlobalMarketsPerpsApproveBuilderFeeResponse, error)
ApproveBuilderFee - Approve builder fee Prepare builder fee approval for the global markets perps DEX.
This is a one-time action required before placing the first trade. Returns EIP-712 typed data for the user to sign. After signing, submit the signature via the /execute endpoint.
func (*GlobalMarketsPerps) CancelOrder ¶ added in v0.1.10
func (s *GlobalMarketsPerps) CancelOrder(ctx context.Context, request components.GlobalMarketsPerpsCancelOrderRequest, opts ...operations.Option) (*operations.V2GlobalMarketsPerpsCancelOrderResponse, error)
CancelOrder - Cancel order Prepare an order cancellation.
Returns EIP-712 typed data for the user to sign. After signing, submit the signature via the /execute endpoint.
func (*GlobalMarketsPerps) Candles ¶ added in v0.1.10
func (s *GlobalMarketsPerps) Candles(ctx context.Context, request operations.V2GlobalMarketsPerpsCandlesRequest, opts ...operations.Option) (*operations.V2GlobalMarketsPerpsCandlesResponse, error)
Candles - Get OHLCV candles Return OHLCV candles for a single asset and interval.
Wraps Hyperliquid's “candleSnapshot“ info type and adds the xyz: HIP-3 DEX prefix server-side so the SDK only needs the bare ticker (e.g. “AAPL“). Candle “time“ is returned in unix seconds, ready for TradingView lightweight-charts. Cached for 15 seconds per (symbol, interval, window).
func (*GlobalMarketsPerps) Deposit ¶ added in v0.1.10
func (s *GlobalMarketsPerps) Deposit(ctx context.Context, request components.GlobalMarketsPerpsDepositRequest, opts ...operations.Option) (*operations.V2GlobalMarketsPerpsDepositResponse, error)
Deposit USDC to global markets perps 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/Global-Markets.mdx "Deposit USDC" section for the bridge-broadcast code.
func (*GlobalMarketsPerps) DepositSponsorPrepare ¶ added in v0.1.10
func (s *GlobalMarketsPerps) DepositSponsorPrepare(ctx context.Context, request components.GlobalMarketsPerpsDepositSponsorPrepareRequest, opts ...operations.Option) (*operations.V2GlobalMarketsPerpsDepositSponsorPrepareResponse, error)
DepositSponsorPrepare - Build the Bridge2 deposit tx from a signed permit Build the Arbitrum tx that completes a USDC deposit to HL.
Takes the EIP-2612 permit signature returned by /deposit and returns a fully-encoded `Bridge2.batchedDepositWithPermit` call. The integrator's sponsor wallet (`sender`) broadcasts the returned tx — Compass does not broadcast and does not hold gas keys.
func (*GlobalMarketsPerps) EnableUnifiedAccount ¶ added in v0.1.10
func (s *GlobalMarketsPerps) EnableUnifiedAccount(ctx context.Context, request components.GlobalMarketsPerpsEnableUnifiedAccountRequest, opts ...operations.Option) (*operations.V2GlobalMarketsPerpsEnableUnifiedAccountResponse, error)
EnableUnifiedAccount - Enable unified account mode Check account mode and prepare the enable-unified-account action if needed.
If the account is already in unified mode (or portfolio margin), returns the current mode with null typed_data — no signing needed. Otherwise, returns EIP-712 typed data for the user to sign. After signing, submit the signature via the /execute endpoint.
func (*GlobalMarketsPerps) EnsureLeverage ¶ added in v0.1.10
func (s *GlobalMarketsPerps) EnsureLeverage(ctx context.Context, request components.GlobalMarketsPerpsEnsureLeverageRequest, opts ...operations.Option) (*operations.V2GlobalMarketsPerpsEnsureLeverageResponse, error)
EnsureLeverage - Ensure 1x cross leverage Check leverage and prepare an updateLeverage action if not 1x cross.
If the asset is already at 1x cross leverage, returns leverage_ok=true with null typed_data — no signing needed. Otherwise, returns EIP-712 typed data for the user to sign. After signing, submit the signature via the /execute endpoint.
func (*GlobalMarketsPerps) Execute ¶ added in v0.1.10
func (s *GlobalMarketsPerps) Execute(ctx context.Context, request components.GlobalMarketsPerpsExecuteRequest, opts ...operations.Option) (*operations.V2GlobalMarketsPerpsExecuteResponse, error)
Execute signed action Submit a signed Hyperliquid action for execution.
Accepts the signature from any prepare endpoint (market_order, limit_order, cancel_order, withdraw, approve_builder_fee) and POSTs it to the Hyperliquid exchange API.
The caller must have already hit a prepare endpoint, so no compass_account registration is performed here.
func (*GlobalMarketsPerps) LimitOrder ¶ added in v0.1.10
func (s *GlobalMarketsPerps) LimitOrder(ctx context.Context, request components.GlobalMarketsPerpsLimitOrderRequest, opts ...operations.Option) (*operations.V2GlobalMarketsPerpsLimitOrderResponse, error)
LimitOrder - Place limit order Prepare a limit order on a global markets perps market.
Returns EIP-712 typed data for the user to sign. After signing, submit the signature via the /execute endpoint. Supports GTC and ALO time-in-force.
func (*GlobalMarketsPerps) MarketOrder ¶ added in v0.1.10
func (s *GlobalMarketsPerps) MarketOrder(ctx context.Context, request components.GlobalMarketsPerpsMarketOrderRequest, opts ...operations.Option) (*operations.V2GlobalMarketsPerpsMarketOrderResponse, error)
MarketOrder - Place market order Prepare a market order on a global markets perps market.
Returns EIP-712 typed data for the user to sign. After signing, submit the signature via the /execute endpoint. Executes as an IOC order at the current mark price with slippage protection.
func (*GlobalMarketsPerps) Opportunities ¶ added in v0.1.10
func (s *GlobalMarketsPerps) Opportunities(ctx context.Context, request *operations.V2GlobalMarketsPerpsOpportunitiesRequest, opts ...operations.Option) (*operations.V2GlobalMarketsPerpsOpportunitiesResponse, error)
Opportunities - List global markets perps markets List available global markets perps markets with key metrics.
Returns perp markets (stocks, commodities, forex) with open interest, 24h volume, funding rate, and max leverage. Supports filtering by category, minimum OI/volume, and sorting.
Only global markets perps assets are returned — crypto perps are excluded.
func (*GlobalMarketsPerps) Positions ¶ added in v0.1.10
func (s *GlobalMarketsPerps) Positions(ctx context.Context, request operations.V2GlobalMarketsPerpsPositionsRequest, opts ...operations.Option) (*operations.V2GlobalMarketsPerpsPositionsResponse, error)
Positions - List global markets perps positions List open perpetual futures positions for a user.
Returns position data including size, entry price, mark price, PnL, liquidation price, leverage, and cumulative funding. Optionally filter by asset ticker. Returns an empty list if no positions are open.
func (*GlobalMarketsPerps) SetLeverage ¶ added in v0.1.30
func (s *GlobalMarketsPerps) SetLeverage(ctx context.Context, request components.GlobalMarketsPerpsSetLeverageRequest, opts ...operations.Option) (*operations.V2GlobalMarketsPerpsSetLeverageResponse, error)
SetLeverage - Set leverage (defaults to market maximum) Check leverage and prepare an updateLeverage action to the requested value.
If `leverage` is omitted, targets the asset's maximum leverage for that market. If the asset is already at the requested leverage, returns leverage_ok=true with null typed_data — no signing needed. Otherwise, returns EIP-712 typed data for the user to sign. After signing, submit the signature via the /execute endpoint.
func (*GlobalMarketsPerps) Withdraw ¶ added in v0.1.10
func (s *GlobalMarketsPerps) Withdraw(ctx context.Context, request components.GlobalMarketsPerpsWithdrawRequest, opts ...operations.Option) (*operations.V2GlobalMarketsPerpsWithdrawResponse, error)
Withdraw USDC from global markets perps account Prepare a USDC withdrawal from Hyperliquid to Arbitrum.
Returns EIP-712 typed data for the user to sign. After signing, submit the signature via the /execute endpoint. Withdrawal processing takes minutes to hours depending on bridge conditions.
type HTTPClient ¶
HTTPClient provides an interface for supplying the SDK with a custom HTTP client
type Onramp ¶ added in v0.1.26
type Onramp struct {
// contains filtered or unexported fields
}
func (*Onramp) Create ¶ added in v0.1.26
func (s *Onramp) Create(ctx context.Context, request components.OnrampCreateRequest, opts ...operations.Option) (*operations.V2OnrampCreateResponse, error)
Create a fiat on-ramp payment + get the checkout link Create a fiat on-ramp payment and return the browser-checkout handoff.
A fiat card + identity-verification flow can only render in a browser, so this endpoint returns a **`checkout_url`** (a Compass-hosted page) together with `payment_id`, the one-time-wallet `deposit_address`, an initial `status`, and a `user_instructions` string.
**How to drive this (CLI / MCP agent / UI):**
- **Present `checkout_url` to the user and open it in a browser.** It renders the card payment + identity verification and delivers USDC on Ethereum to the destination wallet. (An MCP agent cannot open a browser itself — show the link and ask the user to open it.)
- **Poll `GET /v2/onramp/status?payment_id=...`** until `status` becomes `delivered` (or `failed`). `pending` = awaiting payment, `processing` = payment received and bridging/swapping to USDC.
- Once `delivered`, the USDC is in the user's own wallet — continue with the tokenized buy.
Funds are never held by Compass: the `deposit_address` is a one-time wallet owned solely by the user's wallet.
func (*Onramp) Quote ¶ added in v0.1.26
func (s *Onramp) Quote(ctx context.Context, request components.OnrampQuoteRequest, opts ...operations.Option) (*operations.V2OnrampQuoteResponse, error)
Quote - Get a fiat on-ramp quote (card -> USDC on Ethereum) Get an indicative quote for buying USDC on Ethereum with a card.
Returns the estimated USDC the user will receive for a given fiat amount, the exchange rate, fee breakdown (`business_fees` is `0`), and the provider min/max limits. The output is always **USDC on Ethereum** delivered to the `destination_address` — this is a non-custodial on-ramp, so Compass never holds the funds.
This quote is indicative and may expire (`expires_at`). To actually start a payment, call `POST /v2/onramp/create`.
func (*Onramp) Status ¶ added in v0.1.26
func (s *Onramp) Status(ctx context.Context, request operations.V2OnrampStatusRequest, opts ...operations.Option) (*operations.V2OnrampStatusResponse, error)
Status - Get the status of a fiat on-ramp payment Get the current status of a fiat on-ramp payment.
Poll this after `create` until `status` is `delivered`. The `status` field is one of:
- `pending` — awaiting the card payment in the hosted checkout.
- `processing` — payment received; bridging/swapping the proceeds to USDC.
- `delivered` — USDC has been delivered to the destination wallet (`delivery_tx_hash` and `output_amount_delivered` are populated).
- `failed` — the payment failed, expired, or was refunded.
State is re-read live from the on-ramp provider on every call — Compass stores nothing of its own.
type SDKOption ¶
type SDKOption func(*CompassCLI)
func WithClient ¶
func WithClient(client HTTPClient) SDKOption
WithClient allows the overriding of the default HTTP client used by the SDK
func WithRetryConfig ¶
func WithSecurity ¶
func WithSecurity(security components.Security) SDKOption
WithSecurity configures the SDK to use the provided security details
func WithSecuritySource ¶
WithSecuritySource configures the SDK to invoke the Security Source function on each method call to determine authentication
func WithServerIndex ¶
WithServerIndex allows the overriding of the default server by index
func WithServerURL ¶
WithServerURL allows providing an alternative server URL
func WithTemplatedServerURL ¶
WithTemplatedServerURL allows the overriding of the default server URL with a templated URL populated with the provided parameters
func WithTimeout ¶
WithTimeout Optional request timeout applied to each operation
type TokenizedAssets ¶
type TokenizedAssets struct {
// contains filtered or unexported fields
}
func (*TokenizedAssets) Balances ¶ added in v0.1.30
func (s *TokenizedAssets) Balances(ctx context.Context, request operations.V2TokenizedAssetsBalancesRequest, opts ...operations.Option) (*operations.V2TokenizedAssetsBalancesResponse, error)
Balances - Get token balances Get a Tokenized Assets Account's full token ledger.
Returns every token the account has held — including zero balances from fully-exited positions and USDC funding — each with its USD value and transfer history (a superset of `/positions`). Pass `chain=base` or `chain=bsc` for Base or BNB Smart Chain holdings.
func (*TokenizedAssets) Buy ¶ added in v0.1.19
func (s *TokenizedAssets) Buy(ctx context.Context, request components.TokenizedAssetsTradeRequest, opts ...operations.Option) (*operations.V2TokenizedAssetsTransactBuyResponse, error)
Buy an RWA yield token Buy an RWA yield token, or deposit into an IXS managed vault, with a stablecoin in one transaction.
Set `token_out` to a Midas symbol (`mTBILL`, `mBASIS`, `mBTC`) or to an IXS **vault address** (its shares aren't a registered symbol). The account spends a stablecoin it already holds (fund it with a plain transfer first) and settles inside the product account — an unsigned transaction the owner signs, or EIP-712 with `gas_sponsorship`. Both paths are instant. Equities use the order flow (`/quote`, `/order`).
func (*TokenizedAssets) CreateAccount ¶ added in v0.1.19
func (s *TokenizedAssets) CreateAccount(ctx context.Context, request components.CreateTokenizedAssetsAccountRequest, opts ...operations.Option) (*operations.V2TokenizedAssetsCreateAccountResponse, error)
CreateAccount - Create account Create a Tokenized Assets Account for a wallet address.
Before trading tokenized assets, the owner must create a Tokenized Assets Account. Each wallet address has one Tokenized Assets Account per chain.
Returns an unsigned transaction to create the account. The `sender` signs and broadcasts this transaction.
**If owner pays gas:** Set `sender` to the owner's address.
**If someone else pays gas:** Set `sender` to the wallet that will sign and broadcast the transaction on behalf of the owner.
func (*TokenizedAssets) Market ¶ added in v0.1.19
func (s *TokenizedAssets) Market(ctx context.Context, request operations.V2TokenizedAssetsMarketsSymbolRequest, opts ...operations.Option) (*operations.V2TokenizedAssetsMarketsSymbolResponse, error)
Market - Get a market Get extended detail for a single market — an Ondo **equity** (e.g. `TSLAon`), a Midas **RWA yield token** (e.g. `mTBILL`), or an IXS **managed vault** (e.g. `ixv1`).
Adds richer market data on top of the `/markets` listing, plus an optional OHLC candle series: pass matching `interval` and `range` query params to include `candles` (available for equities, Midas tokens except `mBTC`, and IXS vaults; omit both for detail without candles).
func (*TokenizedAssets) Markets ¶ added in v0.1.19
func (s *TokenizedAssets) Markets(ctx context.Context, request *operations.V2TokenizedAssetsMarketsRequest, opts ...operations.Option) (*operations.V2TokenizedAssetsMarketsResponse, error)
Markets - List markets List the tradable tokenized-asset catalog.
Aggregates all three providers — Ondo (tokenized US equities), Midas (RWA yield tokens), and IXS (managed vaults) — into a single list with live USD pricing, plus APY and TVL for yield assets. Filter by provider, asset class, or chain, and narrow the results with a sector `category` or free-text `search`.
func (*TokenizedAssets) Order ¶ added in v0.1.19
func (s *TokenizedAssets) Order(ctx context.Context, request components.TokenizedAssetsBuildOrderRequest, opts ...operations.Option) (*operations.V2TokenizedAssetsOrderResponse, error)
Order - Build an order Build a tokenized-**equity** (Ondo) buy/sell order; the product account is the maker.
Returns everything needed to place the order in one round-trip: a price quote, a one-time token approval to sign (only until the settlement contract is approved), and the order payload the owner signs off-chain. Only the approval ever touches the chain — the signed order is relayed to market makers, never broadcast. Equities only; RWA yield tokens use `/transact/buy` and `/transact/sell`.
func (*TokenizedAssets) OrderCancel ¶ added in v0.1.19
func (s *TokenizedAssets) OrderCancel(ctx context.Context, request operations.V2TokenizedAssetsOrderOrderHashCancelRequest, opts ...operations.Option) (*operations.V2TokenizedAssetsOrderOrderHashCancelResponse, error)
OrderCancel - Cancel an order Cancel an unfilled equity order on-chain.
Returns an EIP-712 payload the owner signs; a sponsor relays it, or the owner broadcasts it directly. Works only on `pending` or `expired` orders, and only the account that placed the order can cancel it.
func (*TokenizedAssets) OrderChargeFee ¶ added in v0.1.30
func (s *TokenizedAssets) OrderChargeFee(ctx context.Context, request operations.V2TokenizedAssetsOrderOrderHashChargeFeeRequest, opts ...operations.Option) (*operations.V2TokenizedAssetsOrderOrderHashChargeFeeResponse, error)
OrderChargeFee - Charge a partner fee Charge a partner fee on a filled equity sell order's USDC proceeds.
Equity orders settle off-chain, so fees can't be bundled into the trade — call this after a sell fills and it builds a USDC transfer of your `fee` from the actual proceeds, executed by the product account (owner signs, or EIP-712 with `gas_sponsorship`).
func (*TokenizedAssets) OrderStatus ¶ added in v0.1.19
func (s *TokenizedAssets) OrderStatus(ctx context.Context, request operations.V2TokenizedAssetsOrderOrderHashRequest, opts ...operations.Option) (*operations.V2TokenizedAssetsOrderOrderHashResponse, error)
OrderStatus - Get order status Poll the lifecycle state of a submitted equity order (Ondo).
Reports `pending`, `filled`, `expired`, or `cancelled`, with fill details as they arrive. Equity orders only — RWA yield swaps settle in one transaction and have no lifecycle to poll.
func (*TokenizedAssets) OrderSubmit ¶ added in v0.1.19
func (s *TokenizedAssets) OrderSubmit(ctx context.Context, request components.TokenizedAssetsSubmitOrderRequest, opts ...operations.Option) (*operations.V2TokenizedAssetsOrderSubmitResponse, error)
OrderSubmit - Submit a signed order Submit a signed equity order to the market-maker network for settlement.
Relays the payload from `/order` plus the owner's signature, and returns the order hash. Poll `GET /order/{order_hash}` to track its lifecycle (`pending` → `filled` / `expired` / `cancelled`).
func (*TokenizedAssets) Positions ¶ added in v0.1.19
func (s *TokenizedAssets) Positions(ctx context.Context, request operations.V2TokenizedAssetsPositionsRequest, opts ...operations.Option) (*operations.V2TokenizedAssetsPositionsResponse, error)
Positions - List positions Get an owner's tokenized-asset holdings, priced and aggregated.
Returns positions across every asset family the account holds — Ondo equities, Midas RWA yield tokens, and IXS managed vaults — each valued in USD (equities from the Ondo feed, RWA at the latest indexed NAV) with a `total_usd` total. The account is derived from `owner`; pass `chain` for Base (Midas) or BNB Smart Chain (IXS) holdings.
func (*TokenizedAssets) Quote ¶ added in v0.1.19
func (s *TokenizedAssets) Quote(ctx context.Context, request components.TokenizedAssetsQuoteRequest, opts ...operations.Option) (*operations.V2TokenizedAssetsQuoteResponse, error)
Quote an order Preview a buy/sell quote for a tokenized **equity** (Ondo, e.g. `TSLAon`).
Read-only price preview: returns the expected input/output amounts and a system-recommended slippage tolerance to carry into `/order`. Equities only — RWA yield tokens (Midas) have no quote step and are rejected with `422 Wrong trade flow`; trade them via `/transact/buy` and `/transact/sell`.
func (*TokenizedAssets) Redemptions ¶ added in v0.1.33
func (s *TokenizedAssets) Redemptions(ctx context.Context, request operations.V2TokenizedAssetsRedemptionsRequest, opts ...operations.Option) (*operations.V2TokenizedAssetsRedemptionsResponse, error)
Redemptions - List redemption requests Get an owner's IXS managed-vault redemption requests and their status.
IXS vault sells are asynchronous — `/transact/sell` files a `requestRedeem` that the vault operator settles off-chain later. This reconstructs the owner's requests live from the vault (Compass stores no async state), reporting each as `pending`, `finalized`, or `rejected`. IXS vaults live on BNB Smart Chain (`chain=bsc`, vault `ixv1`).
func (*TokenizedAssets) Sell ¶ added in v0.1.19
func (s *TokenizedAssets) Sell(ctx context.Context, request components.TokenizedAssetsTradeRequest, opts ...operations.Option) (*operations.V2TokenizedAssetsTransactSellResponse, error)
Sell an RWA yield token Sell an RWA yield token, or redeem from an IXS managed vault, back to a stablecoin.
Set `token_in` to a Midas symbol (`mTBILL`, `mBASIS`, `mBTC`) or to an IXS **vault address**. A Midas redemption is instant and settles in the same transaction; an IXS redemption is **asynchronous** — it files a `requestRedeem` (`settlement: async`) the vault operator settles off-chain later, so poll `GET /v2/tokenized_assets/redemptions` for status. The transaction executes inside the product account (owner signs, or EIP-712 with `gas_sponsorship`).
func (*TokenizedAssets) Transfer ¶ added in v0.1.19
func (s *TokenizedAssets) Transfer(ctx context.Context, request components.TokenizedAssetsTransferRequest, opts ...operations.Option) (*operations.V2TokenizedAssetsTransferResponse, error)
Transfer tokens to/from account Move tokens between the owner's wallet and their Tokenized Assets Account.
`DEPOSIT` funds the account from the owner's wallet; `WITHDRAW` sends tokens back. Supports gas sponsorship: with `gas_sponsorship=true` the owner signs EIP-712 typed data (a Permit2 permit on deposit, a product-account transaction on withdrawal) and a sponsor broadcasts; otherwise the owner broadcasts the transaction directly.