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) AaveMarkets(ctx context.Context, request *operations.V2CreditAaveMarketsRequest, ...) (*operations.V2CreditAaveMarketsResponse, error)
- 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) Swap(ctx context.Context, request components.CreditSwapRequest, ...) (*operations.V2CreditSwapResponse, 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) EarnMaplePools(ctx context.Context, request operations.V2EarnMaplePoolsRequest, ...) (*operations.V2EarnMaplePoolsResponse, 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 HTTPClient
- type PerpetualTrading
- func (s *PerpetualTrading) Activity(ctx context.Context, request operations.V2PerpetualTradingActivityRequest, ...) (*operations.V2PerpetualTradingActivityResponse, error)
- func (s *PerpetualTrading) ApproveBuilderFee(ctx context.Context, ...) (*operations.V2PerpetualTradingApproveBuilderFeeResponse, error)
- func (s *PerpetualTrading) CancelOrder(ctx context.Context, request components.PerpetualTradingCancelOrderRequest, ...) (*operations.V2PerpetualTradingCancelOrderResponse, error)
- func (s *PerpetualTrading) Candles(ctx context.Context, request operations.V2PerpetualTradingCandlesRequest, ...) (*operations.V2PerpetualTradingCandlesResponse, error)
- func (s *PerpetualTrading) Deposit(ctx context.Context, request components.PerpetualTradingDepositRequest, ...) (*operations.V2PerpetualTradingDepositResponse, error)
- func (s *PerpetualTrading) DepositSponsorPrepare(ctx context.Context, ...) (*operations.V2PerpetualTradingDepositSponsorPrepareResponse, error)
- func (s *PerpetualTrading) EnableUnifiedAccount(ctx context.Context, ...) (*operations.V2PerpetualTradingEnableUnifiedAccountResponse, error)
- func (s *PerpetualTrading) EnsureLeverage(ctx context.Context, request components.PerpetualTradingEnsureLeverageRequest, ...) (*operations.V2PerpetualTradingEnsureLeverageResponse, error)
- func (s *PerpetualTrading) Execute(ctx context.Context, request components.PerpetualTradingExecuteRequest, ...) (*operations.V2PerpetualTradingExecuteResponse, error)
- func (s *PerpetualTrading) LimitOrder(ctx context.Context, request components.PerpetualTradingLimitOrderRequest, ...) (*operations.V2PerpetualTradingLimitOrderResponse, error)
- func (s *PerpetualTrading) MarketOrder(ctx context.Context, request components.PerpetualTradingMarketOrderRequest, ...) (*operations.V2PerpetualTradingMarketOrderResponse, error)
- func (s *PerpetualTrading) Opportunities(ctx context.Context, ...) (*operations.V2PerpetualTradingOpportunitiesResponse, error)
- func (s *PerpetualTrading) Positions(ctx context.Context, request operations.V2PerpetualTradingPositionsRequest, ...) (*operations.V2PerpetualTradingPositionsResponse, error)
- func (s *PerpetualTrading) SetLeverage(ctx context.Context, request components.PerpetualTradingSetLeverageRequest, ...) (*operations.V2PerpetualTradingSetLeverageResponse, error)
- func (s *PerpetualTrading) Withdraw(ctx context.Context, request components.PerpetualTradingWithdrawRequest, ...) (*operations.V2PerpetualTradingWithdrawResponse, 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
PerpetualTrading *PerpetualTrading
TokenizedAssets *TokenizedAssets
// 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) AaveMarkets ¶ added in v0.1.78
func (s *Credit) AaveMarkets(ctx context.Context, request *operations.V2CreditAaveMarketsRequest, opts ...operations.Option) (*operations.V2CreditAaveMarketsResponse, 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.
Same data as `/v2/earn/aave_markets`. To borrow from an Aave market, use the [borrow endpoint](https://docs.compasslabs.ai/v2/api-reference/credit/borrow-against-collateral) (`protocol` defaults to `AAVE`).
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 market swap is performed first.
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 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 position in ONE atomic transaction.
Supply collateral, borrow against it, swap the borrowed token back to collateral, repeat — until total collateral reaches multiplier x initial_collateral_amount. If any step fails the whole transaction reverts, so a position is never left half-built.
See the [Leveraged Looping guide](https://docs.compasslabs.ai/v2/Products/Looping) for chain coverage, market discovery, vault-share collateral, HyperEVM specifics and the full error list.
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 the leveraged positions held by an owner's Credit Account.
Positions are reconstructed from on-chain history rather than from API calls, so a loop assembled by hand through /v2/credit/bundle is recognised the same way as one opened through /v2/credit/loop. Only activity inside the Credit Account is visible — leverage the owner holds directly in their wallet is not.
See the [Leveraged Looping guide](https://docs.compasslabs.ai/v2/Products/Looping) for protocol coverage and how to read leverage, health factor and net APY.
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 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 Move one or more leveraged positions to the state you want, in ONE atomic transaction.
List the positions to change and the end state you want for each. The API works out whether that means opening, growing, shrinking, delevering or closing, and does them all together.
Money freed by shrinking or closing one position pays for growing or opening another, so shifting funds between positions needs no new deposit. Any shortfall is taken from the Credit Account's idle balance, and the call returns 422 if that does not cover it either.
See the [Leveraged Looping guide](https://docs.compasslabs.ai/v2/Products/Looping) for protocol and chain coverage, capital routing and the full error list.
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 market swap is performed after withdrawal.
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) Swap ¶ added in v0.1.68
func (s *Credit) Swap(ctx context.Context, request components.CreditSwapRequest, opts ...operations.Option) (*operations.V2CreditSwapResponse, error)
Swap tokens Swap one token for another inside a Credit Account.
Exchanges tokens the Credit Account already holds in a single atomic transaction, so idle or borrowed balances can be converted without moving funds out first. Returns an unsigned transaction to sign, the expected output amount, and which route priced the swap.
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 a leveraged position in ONE atomic transaction.
Withdraw collateral, swap it back to the borrow token, repay, repeat — until the position reaches target_multiplier, or until the debt is cleared exactly if you omit it. If any step fails the whole transaction reverts.
See the [Leveraged Looping guide](https://docs.compasslabs.ai/v2/Products/Looping) for chain coverage, vault-share collateral, shared Aave reserves and the full error list.
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) EarnMaplePools ¶ added in v0.1.77
func (s *Earn) EarnMaplePools(ctx context.Context, request operations.V2EarnMaplePoolsRequest, opts ...operations.Option) (*operations.V2EarnMaplePoolsResponse, error)
EarnMaplePools - List maple pools List the Maple syrup pools (syrupUSDC, syrupUSDT) available through the `MAPLE` venue, with exchange rate, TVL, 7-day APY and withdrawal-queue state.
Deposit with the [manage endpoint](https://docs.compasslabs.ai/v2/api-reference/earn/manage-earn-position) using `{"type": "MAPLE", "pool_address": ...}`: shares are minted directly from Maple at the pool exchange rate, and the Earn Account is authorized with Maple automatically on its first deposit. Withdrawals are asynchronous (Maple's withdrawal queue, typically minutes, at most 30 days); to exit immediately at market price, use the [swap endpoint](https://docs.compasslabs.ai/v2/api-reference/earn/swap-tokens).
Maple pools are on Ethereum; other chains return an empty list.
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, Pendle PT position, or Maple syrup pool. 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) - `MAPLE`: Maple syrup pools on Ethereum, syrupUSDC and syrupUSDT (see [/maple_pools](https://docs.compasslabs.ai/v2/api-reference/earn/list-maple-pools)). Deposits mint shares directly from Maple at the pool exchange rate; the Earn Account is authorized with Maple automatically on its first deposit. Withdrawals are **asynchronous**: the response has `settlement: "async"`, and the asset arrives in the Earn Account when Maple processes its withdrawal queue (typically within minutes, at most 30 days). Fees are not supported on MAPLE withdrawals. To exit immediately at market price, use [/swap](https://docs.compasslabs.ai/v2/api-reference/earn/swap-tokens).
**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 Swap one token for another inside an Earn Account.
Exchanges tokens the Earn Account already holds in a single atomic transaction, so funds never leave it, and can be chained with other actions through the [bundle endpoint](https://docs.compasslabs.ai/v2/api-reference/earn/execute-multiple-earn-actions) (for example, swap ETH to USDC and deposit the USDC into a vault at once). Returns an unsigned transaction to sign and the expected output amount.
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`. On chains with a market route this is the market rate; on HyperEVM, where swaps are firm-priced, it is an indicative price from the firm provider's live levels (`swap_provider` tells you which). 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 HTTPClient ¶
HTTPClient provides an interface for supplying the SDK with a custom HTTP client
type PerpetualTrading ¶ added in v0.1.51
type PerpetualTrading struct {
// contains filtered or unexported fields
}
func (*PerpetualTrading) Activity ¶ added in v0.1.51
func (s *PerpetualTrading) Activity(ctx context.Context, request operations.V2PerpetualTradingActivityRequest, opts ...operations.Option) (*operations.V2PerpetualTradingActivityResponse, 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 (*PerpetualTrading) ApproveBuilderFee ¶ added in v0.1.51
func (s *PerpetualTrading) ApproveBuilderFee(ctx context.Context, request components.PerpetualTradingApproveBuilderFeeRequest, opts ...operations.Option) (*operations.V2PerpetualTradingApproveBuilderFeeResponse, error)
ApproveBuilderFee - Approve builder fee Prepare builder fee approval for the perpetual trading 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 (*PerpetualTrading) CancelOrder ¶ added in v0.1.51
func (s *PerpetualTrading) CancelOrder(ctx context.Context, request components.PerpetualTradingCancelOrderRequest, opts ...operations.Option) (*operations.V2PerpetualTradingCancelOrderResponse, 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 (*PerpetualTrading) Candles ¶ added in v0.1.51
func (s *PerpetualTrading) Candles(ctx context.Context, request operations.V2PerpetualTradingCandlesRequest, opts ...operations.Option) (*operations.V2PerpetualTradingCandlesResponse, 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 (*PerpetualTrading) Deposit ¶ added in v0.1.51
func (s *PerpetualTrading) Deposit(ctx context.Context, request components.PerpetualTradingDepositRequest, opts ...operations.Option) (*operations.V2PerpetualTradingDepositResponse, error)
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.
func (*PerpetualTrading) DepositSponsorPrepare ¶ added in v0.1.51
func (s *PerpetualTrading) DepositSponsorPrepare(ctx context.Context, request components.PerpetualTradingDepositSponsorPrepareRequest, opts ...operations.Option) (*operations.V2PerpetualTradingDepositSponsorPrepareResponse, 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 (*PerpetualTrading) EnableUnifiedAccount ¶ added in v0.1.51
func (s *PerpetualTrading) EnableUnifiedAccount(ctx context.Context, request components.PerpetualTradingEnableUnifiedAccountRequest, opts ...operations.Option) (*operations.V2PerpetualTradingEnableUnifiedAccountResponse, 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 (*PerpetualTrading) EnsureLeverage ¶ added in v0.1.51
func (s *PerpetualTrading) EnsureLeverage(ctx context.Context, request components.PerpetualTradingEnsureLeverageRequest, opts ...operations.Option) (*operations.V2PerpetualTradingEnsureLeverageResponse, 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 (*PerpetualTrading) Execute ¶ added in v0.1.51
func (s *PerpetualTrading) Execute(ctx context.Context, request components.PerpetualTradingExecuteRequest, opts ...operations.Option) (*operations.V2PerpetualTradingExecuteResponse, 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 (*PerpetualTrading) LimitOrder ¶ added in v0.1.51
func (s *PerpetualTrading) LimitOrder(ctx context.Context, request components.PerpetualTradingLimitOrderRequest, opts ...operations.Option) (*operations.V2PerpetualTradingLimitOrderResponse, error)
LimitOrder - Place limit order Prepare a limit order on a perpetual trading 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 (*PerpetualTrading) MarketOrder ¶ added in v0.1.51
func (s *PerpetualTrading) MarketOrder(ctx context.Context, request components.PerpetualTradingMarketOrderRequest, opts ...operations.Option) (*operations.V2PerpetualTradingMarketOrderResponse, error)
MarketOrder - Place market order Prepare a market order on a perpetual trading 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 (*PerpetualTrading) Opportunities ¶ added in v0.1.51
func (s *PerpetualTrading) Opportunities(ctx context.Context, request *operations.V2PerpetualTradingOpportunitiesRequest, opts ...operations.Option) (*operations.V2PerpetualTradingOpportunitiesResponse, error)
Opportunities - List perpetual trading markets List available perpetual trading 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 perpetual trading assets are returned — crypto perps are excluded.
func (*PerpetualTrading) Positions ¶ added in v0.1.51
func (s *PerpetualTrading) Positions(ctx context.Context, request operations.V2PerpetualTradingPositionsRequest, opts ...operations.Option) (*operations.V2PerpetualTradingPositionsResponse, error)
Positions - List perpetual trading 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 (*PerpetualTrading) SetLeverage ¶ added in v0.1.51
func (s *PerpetualTrading) SetLeverage(ctx context.Context, request components.PerpetualTradingSetLeverageRequest, opts ...operations.Option) (*operations.V2PerpetualTradingSetLeverageResponse, 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 (*PerpetualTrading) Withdraw ¶ added in v0.1.51
func (s *PerpetualTrading) Withdraw(ctx context.Context, request components.PerpetualTradingWithdrawRequest, opts ...operations.Option) (*operations.V2PerpetualTradingWithdrawResponse, error)
Withdraw USDC from perpetual trading 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 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, deposit into an IXS managed vault, or buy a Centrifuge deRWA token, with a stablecoin in one transaction.
Set `token_out` to a Midas symbol (`mTBILL`, `mBASIS`, `mBTC`), a Centrifuge deRWA symbol (e.g. `deSPXA`), or 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`. All three settle instantly. 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 four providers — Ondo (tokenized US equities), Midas (RWA yield tokens), IXS (managed vaults), and Centrifuge (deRWA wrappers) — 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, redeem from an IXS managed vault, or sell a Centrifuge deRWA token, back to a stablecoin.
Set `token_in` to a Midas symbol (`mTBILL`, `mBASIS`, `mBTC`), a Centrifuge deRWA symbol (e.g. `deSPXA`), or an IXS **vault address**. Midas redemptions and Centrifuge deRWA swaps are instant and settle 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.