components

package
v0.1.72-rc.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 24, 2026 License: MIT Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AavePosition

type AavePosition struct {

	// The reserve (underlying token) address.
	ReserveAddress string `json:"reserve_address"`
	// Symbol of the reserve asset (e.g., USDC).
	ReserveSymbol string `json:"reserve_symbol"`
	// The user's position value (aToken balance).
	Balance *string `json:"balance"`
	// Position value in USD (null if price unavailable).
	UsdValue optionalnullable.OptionalNullable[string] `json:"usd_value,omitzero"`
	// PnL metrics for this position.
	Pnl optionalnullable.OptionalNullable[PositionPnL] `json:"pnl,omitzero"`
	// All deposit events for this position.
	Deposits []DepositEvent `json:"deposits,omitzero"`
	// All withdrawal events for this position.
	Withdrawals []WithdrawalEvent `json:"withdrawals,omitzero"`
	// Current supply APY (percentage).
	Apy optionalnullable.OptionalNullable[string] `json:"apy,omitzero"`
	// contains filtered or unexported fields
}

AavePosition - Aave V3 lending position.

Note: Unlike the old model, this no longer has vault_address/vault_name fields as they were nonsensical for Aave positions.

func (*AavePosition) GetApy

func (*AavePosition) GetBalance

func (a *AavePosition) GetBalance() *string

func (*AavePosition) GetDeposits

func (a *AavePosition) GetDeposits() []DepositEvent

func (*AavePosition) GetPnl

func (*AavePosition) GetReserveAddress

func (a *AavePosition) GetReserveAddress() string

func (*AavePosition) GetReserveSymbol

func (a *AavePosition) GetReserveSymbol() string

func (*AavePosition) GetType

func (a *AavePosition) GetType() string

func (*AavePosition) GetUsdValue

func (*AavePosition) GetWithdrawals

func (a *AavePosition) GetWithdrawals() []WithdrawalEvent

func (AavePosition) MarshalJSON

func (a AavePosition) MarshalJSON() ([]byte, error)

func (*AavePosition) UnmarshalJSON

func (a *AavePosition) UnmarshalJSON(data []byte) error

type AaveVenue

type AaveVenue struct {

	// The reserve token for the Aave pool you are interacting with.
	Token string `json:"token"`
	// contains filtered or unexported fields
}

func (*AaveVenue) GetToken

func (a *AaveVenue) GetToken() string

func (*AaveVenue) GetType

func (a *AaveVenue) GetType() string

func (AaveVenue) MarshalJSON

func (a AaveVenue) MarshalJSON() ([]byte, error)

func (*AaveVenue) UnmarshalJSON

func (a *AaveVenue) UnmarshalJSON(data []byte) error

type AccountSummary

type AccountSummary struct {
	// Which lending protocol a credit action targets.
	//
	// “AAVE“ is the default so existing callers (which never send a “protocol“
	// field) keep hitting the unchanged Aave code path; markets are named by token
	// symbol. “MORPHO“ identifies Morpho Blue lending markets by their bytes32
	// “market_id“. “EULER“ identifies Euler V2 markets by their EVK
	// “collateral_vault“ + “borrow_vault“ addresses and supports isolated
	// per-sub-account positions (“sub_account_id“).
	//
	// Deployment is per chain, so a valid protocol can still 422 on a given chain:
	// AAVE on Ethereum, Base, Arbitrum, BSC and HyperEVM (where it is Hyperlend, the
	// chain's Aave V3 deployment); MORPHO on Ethereum, Base, Arbitrum and HyperEVM
	// (where it is Felix); EULER on Ethereum, Base, Arbitrum and BSC.
	//
	// All three support “/v2/credit/loop“, “/v2/credit/unloop“,
	// “/v2/credit/looped_positions“ and “/v2/credit/rebalance“.
	Protocol *CreditProtocol `json:"protocol,omitzero"`
	// Euler only: the EVC sub-account (0–255) this summary describes. Euler health is per-sub-account. Null for Aave/Morpho.
	SubAccountID optionalnullable.OptionalNullable[int64] `json:"sub_account_id,omitzero"`
	// Health factor. Above 1 is safe; below 1 risks liquidation.
	HealthFactor string `json:"health_factor"`
	// Total collateral value in USD.
	TotalCollateralUsd string `json:"total_collateral_usd"`
	// Total debt value in USD.
	TotalDebtUsd string `json:"total_debt_usd"`
	// Available borrow capacity in USD.
	AvailableBorrowsUsd string `json:"available_borrows_usd"`
	// Current loan-to-value ratio.
	Ltv string `json:"ltv"`
	// E-Mode category ID. 0 = disabled. E-Mode gives higher LTV when collateral and debt are price-correlated (e.g. stablecoin-to-stablecoin or ETH-to-ETH-derivative).
	EmodeCategoryID *int64 `json:"emode_category_id,omitzero"`
	// Human-readable E-Mode category name (e.g. 'Stablecoins', 'ETH correlated'). Null when E-Mode is disabled (category 0).
	EmodeLabel optionalnullable.OptionalNullable[string] `json:"emode_label,omitzero"`
}

AccountSummary - Account-level summary for one lending protocol.

Populated from Aave “getUserAccountData()“ or, for Euler, from the controller vault's risk engine (“accountLiquidity“). The E-Mode fields are Aave-only and stay at their defaults for Euler.

func (*AccountSummary) GetAvailableBorrowsUsd

func (a *AccountSummary) GetAvailableBorrowsUsd() string

func (*AccountSummary) GetEmodeCategoryID

func (a *AccountSummary) GetEmodeCategoryID() *int64

func (*AccountSummary) GetEmodeLabel

func (*AccountSummary) GetHealthFactor

func (a *AccountSummary) GetHealthFactor() string

func (*AccountSummary) GetLtv

func (a *AccountSummary) GetLtv() string

func (*AccountSummary) GetProtocol added in v0.1.27

func (a *AccountSummary) GetProtocol() *CreditProtocol

func (*AccountSummary) GetSubAccountID added in v0.1.41

func (a *AccountSummary) GetSubAccountID() optionalnullable.OptionalNullable[int64]

func (*AccountSummary) GetTotalCollateralUsd

func (a *AccountSummary) GetTotalCollateralUsd() string

func (*AccountSummary) GetTotalDebtUsd

func (a *AccountSummary) GetTotalDebtUsd() string

type ApproveTransferRequest

type ApproveTransferRequest struct {
	// The wallet address that owns the Earn Account.
	Owner string `json:"owner"`
	// The chain to use.
	Chain Chain `json:"chain"`
	// The token you would like to transfer with gas sponsorship.
	Token string `json:"token"`
	// Optionally request gas sponsorship. If set to `true`, EIP-712 signature data will be returned that must be signed by the `owner` and submitted to the `/gas_sponsorship/prepare` endpoint.
	GasSponsorship *bool `json:"gas_sponsorship,omitzero"`
}

func (*ApproveTransferRequest) GetChain

func (a *ApproveTransferRequest) GetChain() Chain

func (*ApproveTransferRequest) GetGasSponsorship

func (a *ApproveTransferRequest) GetGasSponsorship() *bool

func (*ApproveTransferRequest) GetOwner

func (a *ApproveTransferRequest) GetOwner() string

func (*ApproveTransferRequest) GetToken

func (a *ApproveTransferRequest) GetToken() string

type ApproveTransferResponse

type ApproveTransferResponse struct {
	// Unsigned approval transaction. Present when gas_sponsorship=false.
	Transaction optionalnullable.OptionalNullable[UnsignedTransaction] `json:"transaction,omitzero"`
	// EIP-712 typed data for off-chain permit signing. Present when gas_sponsorship=true.
	Eip712 optionalnullable.OptionalNullable[PermitTypedDataResponseOutput] `json:"eip_712,omitzero"`
}

func (*ApproveTransferResponse) GetTransaction

func (ApproveTransferResponse) MarshalJSON

func (a ApproveTransferResponse) MarshalJSON() ([]byte, error)

func (*ApproveTransferResponse) UnmarshalJSON

func (a *ApproveTransferResponse) UnmarshalJSON(data []byte) error

type BatchedSafeOperationsResponseInput

type BatchedSafeOperationsResponseInput struct {
	// The EIP-712 domain separator.
	Domain CompassAPIBackendV2ModelsSafeTransactResponseBatchedSafeOperationsEip712Domain `json:"domain"`
	// The type definitions for EIP-712 structured data.
	Types CompassAPIBackendV2ModelsSafeTransactResponseBatchedSafeOperationsEip712Types `json:"types"`

	// The message data for the transaction.
	Message SafeTxMessage `json:"message"`
	// contains filtered or unexported fields
}

BatchedSafeOperationsResponseInput - Response containing EIP-712 typed data for Safe transaction signing.

func (*BatchedSafeOperationsResponseInput) GetMessage

func (*BatchedSafeOperationsResponseInput) GetPrimaryType

func (b *BatchedSafeOperationsResponseInput) GetPrimaryType() string

func (BatchedSafeOperationsResponseInput) MarshalJSON

func (b BatchedSafeOperationsResponseInput) MarshalJSON() ([]byte, error)

func (*BatchedSafeOperationsResponseInput) UnmarshalJSON

func (b *BatchedSafeOperationsResponseInput) UnmarshalJSON(data []byte) error

type BatchedSafeOperationsResponseOutput

type BatchedSafeOperationsResponseOutput struct {
	// The EIP-712 domain separator.
	Domain CompassAPIBackendV2ModelsSafeTransactResponseBatchedSafeOperationsEip712Domain `json:"domain"`
	// The type definitions for EIP-712 structured data.
	Types CompassAPIBackendV2ModelsSafeTransactResponseBatchedSafeOperationsEip712Types `json:"types"`

	// The message data for the transaction.
	Message SafeTxMessage `json:"message"`
	// contains filtered or unexported fields
}

BatchedSafeOperationsResponseOutput - Response containing EIP-712 typed data for Safe transaction signing.

func (*BatchedSafeOperationsResponseOutput) GetMessage

func (*BatchedSafeOperationsResponseOutput) GetPrimaryType

func (b *BatchedSafeOperationsResponseOutput) GetPrimaryType() string

func (BatchedSafeOperationsResponseOutput) MarshalJSON

func (b BatchedSafeOperationsResponseOutput) MarshalJSON() ([]byte, error)

func (*BatchedSafeOperationsResponseOutput) UnmarshalJSON

func (b *BatchedSafeOperationsResponseOutput) UnmarshalJSON(data []byte) error

type BorrowAmount

type BorrowAmount struct {
	Number *float64 `queryParam:"inline" union:"member"`
	Str    *string  `queryParam:"inline" union:"member"`

	Type BorrowAmountType
}

BorrowAmount - Amount to borrow (in token units, not wei).

func CreateBorrowAmountNumber

func CreateBorrowAmountNumber(number float64) BorrowAmount

func CreateBorrowAmountStr

func CreateBorrowAmountStr(str string) BorrowAmount

func (BorrowAmount) MarshalJSON

func (u BorrowAmount) MarshalJSON() ([]byte, error)

func (*BorrowAmount) UnmarshalJSON

func (u *BorrowAmount) UnmarshalJSON(data []byte) (err error)

type BorrowAmountType

type BorrowAmountType string
const (
	BorrowAmountTypeNumber BorrowAmountType = "number"
	BorrowAmountTypeStr    BorrowAmountType = "str"
)

type BorrowableToken

type BorrowableToken struct {
	// Address of the borrowable token.
	Token string `json:"token"`
	// Symbol of the borrowable token (e.g. WETH).
	Symbol string `json:"symbol"`
	// Euler only: the EVK borrow vault to borrow this token from (pass as borrow_vault).
	Vault optionalnullable.OptionalNullable[string] `json:"vault,omitzero"`
	// Maximum amount that can be borrowed based on available borrow capacity and token price.
	MaxBorrowableAmount string `json:"max_borrowable_amount"`
	// Current variable borrow APY in percentage (e.g. 4.5 means 4.5%). Null if the rate is unavailable.
	BorrowApy optionalnullable.OptionalNullable[string] `json:"borrow_apy,omitzero"`
}

BorrowableToken - A token available for borrowing with the maximum borrowable amount.

func (*BorrowableToken) GetBorrowApy

func (*BorrowableToken) GetMaxBorrowableAmount

func (b *BorrowableToken) GetMaxBorrowableAmount() string

func (*BorrowableToken) GetSymbol

func (b *BorrowableToken) GetSymbol() string

func (*BorrowableToken) GetToken

func (b *BorrowableToken) GetToken() string

func (*BorrowableToken) GetVault added in v0.1.29

type Builder added in v0.1.3

type Builder struct {
	// Builder address that receives the fee. The address must hold ≥100 USDC on Hyperliquid perps and must not be the zero address.
	Address string `json:"address"`
	// Maximum fee rate the end-user authorizes for this builder, in Hyperliquid grammar (e.g. '0.01%'). Must end with '%', use at most 0.001% precision (one tenth of a basis point) and be at most 0.1%, Hyperliquid's cap on perps builder fees. The fee is charged on top of Hyperliquid's own trading fee.
	MaxFeeRate string `json:"max_fee_rate"`
}

Builder address + max fee rate the end-user authorizes.

func (*Builder) GetAddress added in v0.1.3

func (b *Builder) GetAddress() string

func (*Builder) GetMaxFeeRate added in v0.1.3

func (b *Builder) GetMaxFeeRate() string

type Candle added in v0.1.5

type Candle struct {
	// Candle open time as unix seconds (already converted from Hyperliquid's milliseconds — drop-in compatible with TradingView lightweight-charts).
	Time int64 `json:"time"`
	// Open price
	Open string `json:"open"`
	// High price
	High string `json:"high"`
	// Low price
	Low string `json:"low"`
	// Close price
	Close string `json:"close"`
	// Volume in base asset units
	Volume string `json:"volume"`
	// Number of trades in this candle
	Trades int64 `json:"trades"`
}

Candle - A single OHLCV candle.

func (*Candle) GetClose added in v0.1.5

func (c *Candle) GetClose() string

func (*Candle) GetHigh added in v0.1.5

func (c *Candle) GetHigh() string

func (*Candle) GetLow added in v0.1.5

func (c *Candle) GetLow() string

func (*Candle) GetOpen added in v0.1.5

func (c *Candle) GetOpen() string

func (*Candle) GetTime added in v0.1.5

func (c *Candle) GetTime() int64

func (*Candle) GetTrades added in v0.1.5

func (c *Candle) GetTrades() int64

func (*Candle) GetVolume added in v0.1.5

func (c *Candle) GetVolume() string

type Chain

type Chain string

Chain - The chain to use.

const (
	ChainBase            Chain = "base"
	ChainEthereum        Chain = "ethereum"
	ChainArbitrum        Chain = "arbitrum"
	ChainHyperevm        Chain = "hyperevm"
	ChainTempo           Chain = "tempo"
	ChainBsc             Chain = "bsc"
	ChainRobinhood       Chain = "robinhood"
	ChainEthereumSepolia Chain = "ethereum_sepolia"
)

func (*Chain) IsExact added in v0.1.17

func (e *Chain) IsExact() bool

IsExact returns true if the value matches a known enum value, false otherwise.

func (Chain) ToPointer

func (e Chain) ToPointer() *Chain

type ChainMarketInfo

type ChainMarketInfo struct {
	// Underlying token (reserve) contract address on this chain. This is Aave's canonical per-reserve identifier.
	Address string `json:"address"`
	// Aave aToken contract address on this chain. This is the interest-bearing token that represents the supply position.
	ATokenAddress string `json:"a_token_address"`
	// Variable rate APY for deposits, in percentage (e.g., 4.5 means 4.5%). This is LENDING interest only — what borrowers pay. For a staked or wrapped asset it is not the whole yield; add `intrinsic_apy`.
	SupplyApy string `json:"supply_apy"`
	// What holding this asset earns OUTSIDE the lending pool, in percentage: staking rewards or vault yield accruing inside the token's own exchange rate, which the pool neither pays nor observes. A trailing 7-day measurement. ABSENT when no measurement is available (the route omits null fields) — absent does not mean zero. For an asset that plainly earns beyond lending (wstETH, sUSDe, wstHYPE) `supply_apy` alone understates what it earns by percentage points, since almost nobody borrows these and their supply rate rounds to nothing: Hyperlend's wstHYPE reserve pays 0.00006% against a ~2.5% staking yield. Treat an absent value as unknown rather than as the asset earning nothing beyond `supply_apy`.
	IntrinsicApy optionalnullable.OptionalNullable[string] `json:"intrinsic_apy,omitzero"`
	// Variable rate APY for loans, in percentage (e.g., 6.2 means 6.2%).
	BorrowApy string `json:"borrow_apy"`
	// Variable rate APY for deposits averaged over the `days` window in the request (default 30 days), in percentage. Computed the same way as the v1 `/v1/aave/avg_rate` endpoint.
	SupplyApyAvg string `json:"supply_apy_avg"`
	// Variable rate APY for loans averaged over the `days` window in the request (default 30 days), in percentage. Computed the same way as the v1 `/v1/aave/avg_rate` endpoint.
	BorrowApyAvg string `json:"borrow_apy_avg"`
	// Total amount currently borrowed from this market, in token units (e.g., 1234567.89 USDC).
	TotalBorrowed string `json:"total_borrowed"`
	// Amount of tokens available to borrow, in token units. Equals total supplied minus total borrowed.
	AvailableLiquidity string `json:"available_liquidity"`
	// Percentage of supplied tokens that are currently borrowed (e.g., 85.0 means 85%).
	UtilizationRate string `json:"utilization_rate"`
	// Maximum loan-to-value when this reserve is used as collateral, in percentage (e.g., 80.0 means 80%). This is the highest LTV you can borrow at against this asset; 0 means it cannot be used as collateral.
	Ltv string `json:"ltv"`
	// Liquidation threshold when this reserve is used as collateral, in percentage (e.g., 82.5 means 82.5%). A position whose LTV crosses this can be liquidated; 0 means the asset cannot be used as collateral.
	LiquidationThreshold string `json:"liquidation_threshold"`
	// Every Aave reserve for this token on this chain, ordered by liquidity (highest first). Identified by underlying `address`. For most tokens this has a single entry equal to the canonical reserve above; where a chain has multiple reserves for one symbol (e.g. Arbitrum native USDC and bridged USDC.e), all are listed with their individual rates.
	Reserves []ReserveInfo `json:"reserves,omitzero"`
}

ChainMarketInfo - Rate information for a token on a specific chain.

The top-level fields describe the canonical (highest-liquidity) reserve for this token on this chain, preserving the original single-reserve shape. `reserves` lists every reserve for the token on this chain so clients can disambiguate cases like native USDC vs bridged USDC.e on Arbitrum.

func (*ChainMarketInfo) GetATokenAddress

func (c *ChainMarketInfo) GetATokenAddress() string

func (*ChainMarketInfo) GetAddress

func (c *ChainMarketInfo) GetAddress() string

func (*ChainMarketInfo) GetAvailableLiquidity

func (c *ChainMarketInfo) GetAvailableLiquidity() string

func (*ChainMarketInfo) GetBorrowApy

func (c *ChainMarketInfo) GetBorrowApy() string

func (*ChainMarketInfo) GetBorrowApyAvg added in v0.1.6

func (c *ChainMarketInfo) GetBorrowApyAvg() string

func (*ChainMarketInfo) GetIntrinsicApy added in v0.1.54

func (*ChainMarketInfo) GetLiquidationThreshold added in v0.1.43

func (c *ChainMarketInfo) GetLiquidationThreshold() string

func (*ChainMarketInfo) GetLtv added in v0.1.43

func (c *ChainMarketInfo) GetLtv() string

func (*ChainMarketInfo) GetReserves added in v0.1.16

func (c *ChainMarketInfo) GetReserves() []ReserveInfo

func (*ChainMarketInfo) GetSupplyApy

func (c *ChainMarketInfo) GetSupplyApy() string

func (*ChainMarketInfo) GetSupplyApyAvg added in v0.1.6

func (c *ChainMarketInfo) GetSupplyApyAvg() string

func (*ChainMarketInfo) GetTotalBorrowed

func (c *ChainMarketInfo) GetTotalBorrowed() string

func (*ChainMarketInfo) GetUtilizationRate

func (c *ChainMarketInfo) GetUtilizationRate() string

func (ChainMarketInfo) MarshalJSON added in v0.1.16

func (c ChainMarketInfo) MarshalJSON() ([]byte, error)

func (*ChainMarketInfo) UnmarshalJSON added in v0.1.16

func (c *ChainMarketInfo) UnmarshalJSON(data []byte) error

type Classification added in v0.1.34

type Classification string

Classification - What this transaction did to the position: loop_open / loop_increase (lever up with a swap), unwind (delever), single-sided supply/withdraw/borrow/repay, liquidation, or mixed.

const (
	ClassificationLoopOpen     Classification = "loop_open"
	ClassificationLoopIncrease Classification = "loop_increase"
	ClassificationUnwind       Classification = "unwind"
	ClassificationSupply       Classification = "supply"
	ClassificationWithdraw     Classification = "withdraw"
	ClassificationBorrow       Classification = "borrow"
	ClassificationRepay        Classification = "repay"
	ClassificationLiquidation  Classification = "liquidation"
	ClassificationMixed        Classification = "mixed"
)

func (*Classification) IsExact added in v0.1.34

func (e *Classification) IsExact() bool

IsExact returns true if the value matches a known enum value, false otherwise.

func (Classification) ToPointer added in v0.1.34

func (e Classification) ToPointer() *Classification

type CollateralPosition

type CollateralPosition struct {
	// Address of the collateral token.
	Token string `json:"token"`
	// Symbol of the collateral token (e.g. USDC).
	Symbol string `json:"symbol"`
	// Which lending protocol a credit action targets.
	//
	// “AAVE“ is the default so existing callers (which never send a “protocol“
	// field) keep hitting the unchanged Aave code path; markets are named by token
	// symbol. “MORPHO“ identifies Morpho Blue lending markets by their bytes32
	// “market_id“. “EULER“ identifies Euler V2 markets by their EVK
	// “collateral_vault“ + “borrow_vault“ addresses and supports isolated
	// per-sub-account positions (“sub_account_id“).
	//
	// Deployment is per chain, so a valid protocol can still 422 on a given chain:
	// AAVE on Ethereum, Base, Arbitrum, BSC and HyperEVM (where it is Hyperlend, the
	// chain's Aave V3 deployment); MORPHO on Ethereum, Base, Arbitrum and HyperEVM
	// (where it is Felix); EULER on Ethereum, Base, Arbitrum and BSC.
	//
	// All three support “/v2/credit/loop“, “/v2/credit/unloop“,
	// “/v2/credit/looped_positions“ and “/v2/credit/rebalance“.
	Protocol *CreditProtocol `json:"protocol,omitzero"`
	// Euler only: the EVK collateral vault holding this position.
	Vault optionalnullable.OptionalNullable[string] `json:"vault,omitzero"`
	// Euler only: the EVC sub-account (0–255) this position belongs to. Each sub-account is an independent Euler position with its own health. Null for Aave/Morpho.
	SubAccountID optionalnullable.OptionalNullable[int64] `json:"sub_account_id,omitzero"`
	// Morpho only: the bytes32 id of the isolated market holding this position.
	MarketID optionalnullable.OptionalNullable[string] `json:"market_id,omitzero"`
	// Morpho only: true when this is a loan-asset supply position (earning supply APY) rather than collateral backing borrows.
	IsPureSupply optionalnullable.OptionalNullable[bool] `json:"is_pure_supply,omitzero"`
	// Current on-chain collateral balance (the vault's underlying asset for Euler).
	AmountSupplied *string `json:"amount_supplied"`
	// Collateral value in USD.
	UsdValue optionalnullable.OptionalNullable[string] `json:"usd_value,omitzero"`
	// Current supply APY in percentage (e.g. 4.5 means 4.5%).
	SupplyApy optionalnullable.OptionalNullable[string] `json:"supply_apy,omitzero"`
	// Total collateral deposited over all time.
	TotalDeposited optionalnullable.OptionalNullable[string] `json:"total_deposited,omitzero"`
	// Total collateral withdrawn over all time.
	TotalWithdrawn optionalnullable.OptionalNullable[string] `json:"total_withdrawn,omitzero"`
	// Interest earned on collateral: on_chain_balance + total_withdrawn - total_deposited.
	InterestEarned optionalnullable.OptionalNullable[string] `json:"interest_earned,omitzero"`
	// Maximum loan-to-value ratio for this collateral in percentage (e.g. 80 means 80%).
	MaxLtv optionalnullable.OptionalNullable[string] `json:"max_ltv,omitzero"`
	// All historical events for this collateral reserve.
	Events []CreditEvent `json:"events,omitzero"`
}

CollateralPosition - A per-reserve collateral position.

func (*CollateralPosition) GetAmountSupplied

func (c *CollateralPosition) GetAmountSupplied() *string

func (*CollateralPosition) GetEvents

func (c *CollateralPosition) GetEvents() []CreditEvent

func (*CollateralPosition) GetInterestEarned

func (*CollateralPosition) GetIsPureSupply added in v0.1.34

func (*CollateralPosition) GetMarketID added in v0.1.34

func (*CollateralPosition) GetMaxLtv

func (*CollateralPosition) GetProtocol added in v0.1.27

func (c *CollateralPosition) GetProtocol() *CreditProtocol

func (*CollateralPosition) GetSubAccountID added in v0.1.41

func (*CollateralPosition) GetSupplyApy

func (*CollateralPosition) GetSymbol

func (c *CollateralPosition) GetSymbol() string

func (*CollateralPosition) GetToken

func (c *CollateralPosition) GetToken() string

func (*CollateralPosition) GetTotalDeposited

func (*CollateralPosition) GetTotalWithdrawn

func (*CollateralPosition) GetUsdValue

func (*CollateralPosition) GetVault added in v0.1.27

func (CollateralPosition) MarshalJSON

func (c CollateralPosition) MarshalJSON() ([]byte, error)

func (*CollateralPosition) UnmarshalJSON

func (c *CollateralPosition) UnmarshalJSON(data []byte) error

type CompassAPIBackendV2ModelsBalancesTokenBalance

type CompassAPIBackendV2ModelsBalancesTokenBalance struct {
	// The token contract address.
	TokenAddress string `json:"token_address"`
	// The token symbol (e.g., 'USDC').
	TokenSymbol string `json:"token_symbol"`
	// The token's decimal places.
	TokenDecimals int64 `json:"token_decimals"`
	// The current on-chain balance (raw).
	Balance string `json:"balance"`
	// The human-readable balance.
	BalanceFormatted string `json:"balance_formatted"`
	// Balance value in USD (null if price unavailable).
	UsdValue optionalnullable.OptionalNullable[string] `json:"usd_value,omitzero"`
	// List of all transfers involving this token.
	Transfers []TokenTransfer `json:"transfers,omitzero"`
}

CompassAPIBackendV2ModelsBalancesTokenBalance - Balance and transfer history for a single token.

func (*CompassAPIBackendV2ModelsBalancesTokenBalance) GetBalance

func (*CompassAPIBackendV2ModelsBalancesTokenBalance) GetBalanceFormatted

func (c *CompassAPIBackendV2ModelsBalancesTokenBalance) GetBalanceFormatted() string

func (*CompassAPIBackendV2ModelsBalancesTokenBalance) GetTokenAddress

func (*CompassAPIBackendV2ModelsBalancesTokenBalance) GetTokenDecimals

func (*CompassAPIBackendV2ModelsBalancesTokenBalance) GetTokenSymbol

func (*CompassAPIBackendV2ModelsBalancesTokenBalance) GetTransfers

func (*CompassAPIBackendV2ModelsBalancesTokenBalance) GetUsdValue

func (CompassAPIBackendV2ModelsBalancesTokenBalance) MarshalJSON

func (*CompassAPIBackendV2ModelsBalancesTokenBalance) UnmarshalJSON

func (c *CompassAPIBackendV2ModelsBalancesTokenBalance) UnmarshalJSON(data []byte) error

type CompassAPIBackendV2ModelsEarnReadResponsePositionsVaultPosition

type CompassAPIBackendV2ModelsEarnReadResponsePositionsVaultPosition struct {

	// The vault address.
	VaultAddress string `json:"vault_address"`
	// Name of the vault token (share token).
	VaultName string `json:"vault_name"`
	// Symbol of the underlying token (e.g., USDC).
	UnderlyingSymbol string `json:"underlying_symbol"`
	// Address of the underlying token.
	UnderlyingAddress string `json:"underlying_address"`
	// The user's position value in underlying token.
	Balance *string `json:"balance"`
	// Position value in USD (null if price unavailable).
	UsdValue optionalnullable.OptionalNullable[string] `json:"usd_value,omitzero"`
	// PnL metrics for this position.
	Pnl optionalnullable.OptionalNullable[PositionPnL] `json:"pnl,omitzero"`
	// All deposit events for this position.
	Deposits []DepositEvent `json:"deposits,omitzero"`
	// All withdrawal events for this position.
	Withdrawals []WithdrawalEvent `json:"withdrawals,omitzero"`
	// 7-day annualized APY (percentage).
	Apy7d optionalnullable.OptionalNullable[string] `json:"apy_7d,omitzero"`
	// 30-day annualized APY (percentage).
	Apy30d optionalnullable.OptionalNullable[string] `json:"apy_30d,omitzero"`
	// 90-day annualized APY (percentage).
	Apy90d optionalnullable.OptionalNullable[string] `json:"apy_90d,omitzero"`
	// contains filtered or unexported fields
}

CompassAPIBackendV2ModelsEarnReadResponsePositionsVaultPosition - ERC-4626 vault position.

func (*CompassAPIBackendV2ModelsEarnReadResponsePositionsVaultPosition) GetApy7d

func (*CompassAPIBackendV2ModelsEarnReadResponsePositionsVaultPosition) GetApy30d

func (*CompassAPIBackendV2ModelsEarnReadResponsePositionsVaultPosition) GetApy90d

func (*CompassAPIBackendV2ModelsEarnReadResponsePositionsVaultPosition) GetBalance

func (*CompassAPIBackendV2ModelsEarnReadResponsePositionsVaultPosition) GetDeposits

func (*CompassAPIBackendV2ModelsEarnReadResponsePositionsVaultPosition) GetPnl

func (*CompassAPIBackendV2ModelsEarnReadResponsePositionsVaultPosition) GetType

func (*CompassAPIBackendV2ModelsEarnReadResponsePositionsVaultPosition) GetUnderlyingAddress

func (*CompassAPIBackendV2ModelsEarnReadResponsePositionsVaultPosition) GetUnderlyingSymbol

func (*CompassAPIBackendV2ModelsEarnReadResponsePositionsVaultPosition) GetUsdValue

func (*CompassAPIBackendV2ModelsEarnReadResponsePositionsVaultPosition) GetVaultAddress

func (*CompassAPIBackendV2ModelsEarnReadResponsePositionsVaultPosition) GetVaultName

func (*CompassAPIBackendV2ModelsEarnReadResponsePositionsVaultPosition) GetWithdrawals

func (CompassAPIBackendV2ModelsEarnReadResponsePositionsVaultPosition) MarshalJSON

func (*CompassAPIBackendV2ModelsEarnReadResponsePositionsVaultPosition) UnmarshalJSON

type CompassAPIBackendV2ModelsGasSponsorshipPermit2TypedDataEip712Domain

type CompassAPIBackendV2ModelsGasSponsorshipPermit2TypedDataEip712Domain struct {

	// EVM chain ID
	ChainID int64 `json:"chainId"`
	// Permit2 contract address
	VerifyingContract string `json:"verifyingContract"`
	// contains filtered or unexported fields
}

func (*CompassAPIBackendV2ModelsGasSponsorshipPermit2TypedDataEip712Domain) GetChainID

func (*CompassAPIBackendV2ModelsGasSponsorshipPermit2TypedDataEip712Domain) GetName

func (*CompassAPIBackendV2ModelsGasSponsorshipPermit2TypedDataEip712Domain) GetVerifyingContract

func (CompassAPIBackendV2ModelsGasSponsorshipPermit2TypedDataEip712Domain) MarshalJSON

func (*CompassAPIBackendV2ModelsGasSponsorshipPermit2TypedDataEip712Domain) UnmarshalJSON

type CompassAPIBackendV2ModelsGasSponsorshipPermit2TypedDataEip712Types

type CompassAPIBackendV2ModelsGasSponsorshipPermit2TypedDataEip712Types struct {
	// Standard EIP-712 domain type
	Eip712Domain []Eip712Field `json:"EIP712Domain,omitzero"`
	// TokenPermissions struct
	TokenPermissions []Eip712Field `json:"TokenPermissions,omitzero"`
	// Main permit message type
	PermitTransferFrom []Eip712Field `json:"PermitTransferFrom,omitzero"`
}

func (*CompassAPIBackendV2ModelsGasSponsorshipPermit2TypedDataEip712Types) GetEip712Domain

func (*CompassAPIBackendV2ModelsGasSponsorshipPermit2TypedDataEip712Types) GetPermitTransferFrom

func (*CompassAPIBackendV2ModelsGasSponsorshipPermit2TypedDataEip712Types) GetTokenPermissions

func (CompassAPIBackendV2ModelsGasSponsorshipPermit2TypedDataEip712Types) MarshalJSON

func (*CompassAPIBackendV2ModelsGasSponsorshipPermit2TypedDataEip712Types) UnmarshalJSON

type CompassAPIBackendV2ModelsGasSponsorshipPermitTypedDataEip712Domain

type CompassAPIBackendV2ModelsGasSponsorshipPermitTypedDataEip712Domain struct {
	// Token name
	Name string `json:"name"`
	// Token version (usually '1' or '2')
	Version string `json:"version"`
	// Chain ID
	ChainID int64 `json:"chainId"`
	// Token contract address
	VerifyingContract string `json:"verifyingContract"`
}

CompassAPIBackendV2ModelsGasSponsorshipPermitTypedDataEip712Domain - The EIP-712 domain separator for ERC-20 Permit.

func (*CompassAPIBackendV2ModelsGasSponsorshipPermitTypedDataEip712Domain) GetChainID

func (*CompassAPIBackendV2ModelsGasSponsorshipPermitTypedDataEip712Domain) GetName

func (*CompassAPIBackendV2ModelsGasSponsorshipPermitTypedDataEip712Domain) GetVerifyingContract

func (*CompassAPIBackendV2ModelsGasSponsorshipPermitTypedDataEip712Domain) GetVersion

func (CompassAPIBackendV2ModelsGasSponsorshipPermitTypedDataEip712Domain) MarshalJSON

func (*CompassAPIBackendV2ModelsGasSponsorshipPermitTypedDataEip712Domain) UnmarshalJSON

type CompassAPIBackendV2ModelsGasSponsorshipPermitTypedDataEip712Types

type CompassAPIBackendV2ModelsGasSponsorshipPermitTypedDataEip712Types struct {
	// EIP712Domain type definition
	Eip712Domain []Eip712DomainField `json:"EIP712Domain"`
	// Permit type definition
	Permit []PermitField `json:"Permit"`
}

CompassAPIBackendV2ModelsGasSponsorshipPermitTypedDataEip712Types - The type definitions for EIP-712 structured data (ERC-20 Permit).

func (*CompassAPIBackendV2ModelsGasSponsorshipPermitTypedDataEip712Types) GetEip712Domain

func (*CompassAPIBackendV2ModelsGasSponsorshipPermitTypedDataEip712Types) GetPermit

func (CompassAPIBackendV2ModelsGasSponsorshipPermitTypedDataEip712Types) MarshalJSON

func (*CompassAPIBackendV2ModelsGasSponsorshipPermitTypedDataEip712Types) UnmarshalJSON

type CompassAPIBackendV2ModelsSafeTransactResponseBatchedSafeOperationsEip712Domain

type CompassAPIBackendV2ModelsSafeTransactResponseBatchedSafeOperationsEip712Domain struct {
	// Chain ID
	ChainID int64 `json:"chainId"`
	// Address of the Product Account
	VerifyingContract string `json:"verifyingContract"`
}

CompassAPIBackendV2ModelsSafeTransactResponseBatchedSafeOperationsEip712Domain - The EIP-712 domain separator.

func (*CompassAPIBackendV2ModelsSafeTransactResponseBatchedSafeOperationsEip712Domain) GetChainID

func (*CompassAPIBackendV2ModelsSafeTransactResponseBatchedSafeOperationsEip712Domain) GetVerifyingContract

func (CompassAPIBackendV2ModelsSafeTransactResponseBatchedSafeOperationsEip712Domain) MarshalJSON

func (*CompassAPIBackendV2ModelsSafeTransactResponseBatchedSafeOperationsEip712Domain) UnmarshalJSON

type CompassAPIBackendV2ModelsSafeTransactResponseBatchedSafeOperationsEip712Types

type CompassAPIBackendV2ModelsSafeTransactResponseBatchedSafeOperationsEip712Types struct {
	// EIP712Domain type definition
	Eip712Domain []Eip712DomainField `json:"EIP712Domain"`
	// SafeTx type definition
	SafeTx []SafeTxField `json:"SafeTx"`
}

CompassAPIBackendV2ModelsSafeTransactResponseBatchedSafeOperationsEip712Types - The type definitions for EIP-712 structured data.

func (*CompassAPIBackendV2ModelsSafeTransactResponseBatchedSafeOperationsEip712Types) GetEip712Domain

func (*CompassAPIBackendV2ModelsSafeTransactResponseBatchedSafeOperationsEip712Types) GetSafeTx

func (CompassAPIBackendV2ModelsSafeTransactResponseBatchedSafeOperationsEip712Types) MarshalJSON

func (*CompassAPIBackendV2ModelsSafeTransactResponseBatchedSafeOperationsEip712Types) UnmarshalJSON

type CompassAPIBackendV2ModelsTokenizedAssetsMarketMarket

type CompassAPIBackendV2ModelsTokenizedAssetsMarketMarket struct {
	// On-chain token symbol (e.g. 'TSLAon').
	Symbol string `json:"symbol"`
	// Underlying equity ticker (e.g. 'TSLA').
	UnderlyingTicker string `json:"underlying_ticker"`
	// Underlying equity full name (e.g. 'Tesla, Inc. Common Stock').
	Name string `json:"name"`
	// On-chain ERC-20 address for this token, on the network given by `chain`.
	ContractAddress string `json:"contract_address"`
	// ERC-20 decimals for this token.
	Decimals int64 `json:"decimals"`
	// Latest price in USD as a decimal string.
	CurrentPriceUsd string `json:"current_price_usd"`
	// Absolute USD price change vs 24h ago (decimal string).
	Change24hUsd optionalnullable.OptionalNullable[string] `json:"change_24h_usd,omitzero"`
	// Percent price change vs 24h ago (decimal string).
	Change24hPct optionalnullable.OptionalNullable[string] `json:"change_24h_pct,omitzero"`
	// Sector / industry tags from the issuer (e.g. ['Technology']).
	Sectors []string `json:"sectors,omitzero"`
	// Regional market exposure tags (e.g. ['US']).
	RegionExposure []string `json:"region_exposure,omitzero"`
	// Issuer/provider of a tokenized asset.
	Provider TokenizedAssetProvider `json:"provider"`
	// Asset class of a tokenized asset.
	//
	// `EQUITY` trades via the order endpoints (build/submit/cancel); the RWA
	// yield classes (`T_BILLS`, `BASIS_TRADE`, `BTC_YIELD`), `MANAGED_VAULT`, and
	// `DERWA` trade via the swap-based `transact/buy` and `transact/sell`
	// endpoints. `MANAGED_VAULT` (IXS ERC-4626 vaults) is special in that a sell
	// is an *asynchronous* redemption request settled off-chain by the vault
	// operator. `DERWA` (Centrifuge freely-transferable RWA wrappers) settles
	// each buy/sell as a single instant DEX swap.
	//
	// `MONEY_MARKET` (WisdomTree Connect digital funds) also uses `transact/buy`
	// and `transact/sell`, but neither swaps nor mints: a buy transfers the
	// settlement stablecoin to the issuer's deposit address and the issuer mints
	// fund shares back at the next NAV cycle, so settlement is *asynchronous*.
	AssetClass TokenizedAssetClass `json:"asset_class"`
	// The chain to use.
	Chain Chain `json:"chain"`
	// Trailing 7-day annualized NAV growth (decimal fraction string, e.g. '0.0512' = 5.12%). RWA yield assets only; null until enough NAV history exists.
	Apy7d optionalnullable.OptionalNullable[string] `json:"apy_7d,omitzero"`
	// Trailing 30-day annualized NAV growth (decimal fraction string). RWA yield assets only; null until enough NAV history exists.
	Apy30d optionalnullable.OptionalNullable[string] `json:"apy_30d,omitzero"`
	// Total value locked in USD (RWA yield assets only).
	TvlUsd optionalnullable.OptionalNullable[string] `json:"tvl_usd,omitzero"`
	// Live tradability: whether this market can be traded right now, and if not, why (and when it reopens). Equities follow US market sessions (some are 24-7 via an off-hours track); RWA yield / vault assets trade continuously unless the issuer pauses. Null if status is unavailable.
	Status optionalnullable.OptionalNullable[TradingStatus] `json:"status,omitzero"`
	// ISO country codes where this asset must not be offered (e.g. ['US']). Regulation-S instruments (Centrifuge deRWA) restrict US persons; the API surfaces the restriction for integrators to enforce — it does not itself geo-gate. Empty for unrestricted assets (Ondo/Midas/IXS).
	RestrictedJurisdictions []string `json:"restricted_jurisdictions,omitzero"`
}

CompassAPIBackendV2ModelsTokenizedAssetsMarketMarket - Compact market entry returned in list responses.

func (*CompassAPIBackendV2ModelsTokenizedAssetsMarketMarket) GetApy7d added in v0.1.17

func (*CompassAPIBackendV2ModelsTokenizedAssetsMarketMarket) GetApy30d added in v0.1.17

func (*CompassAPIBackendV2ModelsTokenizedAssetsMarketMarket) GetAssetClass added in v0.1.17

func (*CompassAPIBackendV2ModelsTokenizedAssetsMarketMarket) GetChain

func (*CompassAPIBackendV2ModelsTokenizedAssetsMarketMarket) GetChange24hPct

func (*CompassAPIBackendV2ModelsTokenizedAssetsMarketMarket) GetChange24hUsd

func (*CompassAPIBackendV2ModelsTokenizedAssetsMarketMarket) GetContractAddress

func (*CompassAPIBackendV2ModelsTokenizedAssetsMarketMarket) GetCurrentPriceUsd

func (*CompassAPIBackendV2ModelsTokenizedAssetsMarketMarket) GetDecimals

func (*CompassAPIBackendV2ModelsTokenizedAssetsMarketMarket) GetName

func (*CompassAPIBackendV2ModelsTokenizedAssetsMarketMarket) GetProvider added in v0.1.17

func (*CompassAPIBackendV2ModelsTokenizedAssetsMarketMarket) GetRegionExposure

func (*CompassAPIBackendV2ModelsTokenizedAssetsMarketMarket) GetRestrictedJurisdictions added in v0.1.47

func (c *CompassAPIBackendV2ModelsTokenizedAssetsMarketMarket) GetRestrictedJurisdictions() []string

func (*CompassAPIBackendV2ModelsTokenizedAssetsMarketMarket) GetSectors

func (*CompassAPIBackendV2ModelsTokenizedAssetsMarketMarket) GetStatus added in v0.1.36

func (*CompassAPIBackendV2ModelsTokenizedAssetsMarketMarket) GetSymbol

func (*CompassAPIBackendV2ModelsTokenizedAssetsMarketMarket) GetTvlUsd added in v0.1.17

func (*CompassAPIBackendV2ModelsTokenizedAssetsMarketMarket) GetUnderlyingTicker

func (CompassAPIBackendV2ModelsTokenizedAssetsMarketMarket) MarshalJSON

func (*CompassAPIBackendV2ModelsTokenizedAssetsMarketMarket) UnmarshalJSON

type CompassAPIBackendV2ModelsTokenizedAssetsReadResponsePositionsPosition

type CompassAPIBackendV2ModelsTokenizedAssetsReadResponsePositionsPosition struct {
	// On-chain Ondo symbol (e.g. `TSLAon`).
	Symbol string `json:"symbol"`
	// Underlying equity ticker.
	UnderlyingTicker string `json:"underlying_ticker"`
	// Underlying equity name (or ticker fallback).
	Name string `json:"name"`
	// Ethereum mainnet ERC-20 address.
	ContractAddress string `json:"contract_address"`
	// ERC-20 decimals.
	Decimals int64 `json:"decimals"`
	// Human-readable balance (already scaled by `decimals`).
	Balance string `json:"balance"`
	// USD spot price at read time (decimal string).
	CurrentPriceUsd optionalnullable.OptionalNullable[string] `json:"current_price_usd,omitzero"`
	// `balance * current_price_usd` when the price is available.
	BalanceUsd optionalnullable.OptionalNullable[string] `json:"balance_usd,omitzero"`
	// Issuer/provider of a tokenized asset.
	Provider *TokenizedAssetProvider `json:"provider,omitzero"`
	// Asset class of a tokenized asset.
	//
	// `EQUITY` trades via the order endpoints (build/submit/cancel); the RWA
	// yield classes (`T_BILLS`, `BASIS_TRADE`, `BTC_YIELD`), `MANAGED_VAULT`, and
	// `DERWA` trade via the swap-based `transact/buy` and `transact/sell`
	// endpoints. `MANAGED_VAULT` (IXS ERC-4626 vaults) is special in that a sell
	// is an *asynchronous* redemption request settled off-chain by the vault
	// operator. `DERWA` (Centrifuge freely-transferable RWA wrappers) settles
	// each buy/sell as a single instant DEX swap.
	//
	// `MONEY_MARKET` (WisdomTree Connect digital funds) also uses `transact/buy`
	// and `transact/sell`, but neither swaps nor mints: a buy transfers the
	// settlement stablecoin to the issuer's deposit address and the issuer mints
	// fund shares back at the next NAV cycle, so settlement is *asynchronous*.
	AssetClass *TokenizedAssetClass `json:"asset_class,omitzero"`
	// The chain to use.
	Chain *Chain `json:"chain,omitzero"`
	// Realized + unrealized PnL for this position, or `null` when it cannot be priced (no current price, or externally-funded inventory with no on-chain cost basis).
	Pnl optionalnullable.OptionalNullable[TokenizedAssetsPnl] `json:"pnl,omitzero"`
	// Chronological activity for this position (buy / sell / transfer_in / transfer_out). Pure-USDC funding is excluded — it appears on the balances endpoint.
	Events []TokenizedAssetsActivityEvent `json:"events,omitzero"`
}

CompassAPIBackendV2ModelsTokenizedAssetsReadResponsePositionsPosition - One non-zero on-chain position in a tokenized equity.

func (*CompassAPIBackendV2ModelsTokenizedAssetsReadResponsePositionsPosition) GetAssetClass added in v0.1.17

func (*CompassAPIBackendV2ModelsTokenizedAssetsReadResponsePositionsPosition) GetBalance

func (*CompassAPIBackendV2ModelsTokenizedAssetsReadResponsePositionsPosition) GetBalanceUsd

func (*CompassAPIBackendV2ModelsTokenizedAssetsReadResponsePositionsPosition) GetChain added in v0.1.17

func (*CompassAPIBackendV2ModelsTokenizedAssetsReadResponsePositionsPosition) GetContractAddress

func (*CompassAPIBackendV2ModelsTokenizedAssetsReadResponsePositionsPosition) GetCurrentPriceUsd

func (*CompassAPIBackendV2ModelsTokenizedAssetsReadResponsePositionsPosition) GetDecimals

func (*CompassAPIBackendV2ModelsTokenizedAssetsReadResponsePositionsPosition) GetEvents added in v0.1.23

func (*CompassAPIBackendV2ModelsTokenizedAssetsReadResponsePositionsPosition) GetName

func (*CompassAPIBackendV2ModelsTokenizedAssetsReadResponsePositionsPosition) GetPnl added in v0.1.21

func (*CompassAPIBackendV2ModelsTokenizedAssetsReadResponsePositionsPosition) GetProvider added in v0.1.17

func (*CompassAPIBackendV2ModelsTokenizedAssetsReadResponsePositionsPosition) GetSymbol

func (*CompassAPIBackendV2ModelsTokenizedAssetsReadResponsePositionsPosition) GetUnderlyingTicker

func (CompassAPIBackendV2ModelsTokenizedAssetsReadResponsePositionsPosition) MarshalJSON added in v0.1.21

func (*CompassAPIBackendV2ModelsTokenizedAssetsReadResponsePositionsPosition) UnmarshalJSON added in v0.1.21

type CreateAccountRequest

type CreateAccountRequest struct {
	Chain CreateAccountRequestChain `json:"chain"`
	// The address of the transaction sender.
	Sender string `json:"sender"`
	// Determines whether to estimate gas costs for transactions, also verifying that the transaction can be successfully executed.
	EstimateGas *bool `json:"estimate_gas,omitzero"`
	// The address that will own and control the compass account
	Owner string `json:"owner"`
}

CreateAccountRequest - Request to create a compass account.

func (*CreateAccountRequest) GetChain

func (*CreateAccountRequest) GetEstimateGas

func (c *CreateAccountRequest) GetEstimateGas() *bool

func (*CreateAccountRequest) GetOwner

func (c *CreateAccountRequest) GetOwner() string

func (*CreateAccountRequest) GetSender

func (c *CreateAccountRequest) GetSender() string

type CreateAccountRequestChain

type CreateAccountRequestChain string
const (
	CreateAccountRequestChainArbitrum CreateAccountRequestChain = "arbitrum"
	CreateAccountRequestChainBase     CreateAccountRequestChain = "base"
	CreateAccountRequestChainBsc      CreateAccountRequestChain = "bsc"
	CreateAccountRequestChainEthereum CreateAccountRequestChain = "ethereum"
	CreateAccountRequestChainHyperevm CreateAccountRequestChain = "hyperevm"
	CreateAccountRequestChainTempo    CreateAccountRequestChain = "tempo"
)

func (CreateAccountRequestChain) ToPointer

func (*CreateAccountRequestChain) UnmarshalJSON

func (e *CreateAccountRequestChain) UnmarshalJSON(data []byte) error

type CreateAccountResponse

type CreateAccountResponse struct {
	// Transaction to create compass account
	Transaction *UnsignedTransaction `json:"transaction"`
	// Predicted address of the compass earn account that will be deployed
	EarnAccountAddress string `json:"earn_account_address"`
}

CreateAccountResponse - Response containing unsigned transaction to create compass Earn account.

func (*CreateAccountResponse) GetEarnAccountAddress

func (c *CreateAccountResponse) GetEarnAccountAddress() string

func (*CreateAccountResponse) GetTransaction

func (c *CreateAccountResponse) GetTransaction() *UnsignedTransaction

type CreateCreditAccountRequest

type CreateCreditAccountRequest struct {
	Chain CreateCreditAccountRequestChain `json:"chain"`
	// The address of the transaction sender.
	Sender string `json:"sender"`
	// Determines whether to estimate gas costs for transactions, also verifying that the transaction can be successfully executed.
	EstimateGas *bool `json:"estimate_gas,omitzero"`
	// The address that will own and control the compass credit account
	Owner string `json:"owner"`
}

CreateCreditAccountRequest - Request to create a compass credit account.

func (*CreateCreditAccountRequest) GetChain

func (*CreateCreditAccountRequest) GetEstimateGas

func (c *CreateCreditAccountRequest) GetEstimateGas() *bool

func (*CreateCreditAccountRequest) GetOwner

func (c *CreateCreditAccountRequest) GetOwner() string

func (*CreateCreditAccountRequest) GetSender

func (c *CreateCreditAccountRequest) GetSender() string

type CreateCreditAccountRequestChain

type CreateCreditAccountRequestChain string
const (
	CreateCreditAccountRequestChainArbitrum CreateCreditAccountRequestChain = "arbitrum"
	CreateCreditAccountRequestChainBase     CreateCreditAccountRequestChain = "base"
	CreateCreditAccountRequestChainBsc      CreateCreditAccountRequestChain = "bsc"
	CreateCreditAccountRequestChainEthereum CreateCreditAccountRequestChain = "ethereum"
	CreateCreditAccountRequestChainHyperevm CreateCreditAccountRequestChain = "hyperevm"
	CreateCreditAccountRequestChainTempo    CreateCreditAccountRequestChain = "tempo"
)

func (CreateCreditAccountRequestChain) ToPointer

func (*CreateCreditAccountRequestChain) UnmarshalJSON

func (e *CreateCreditAccountRequestChain) UnmarshalJSON(data []byte) error

type CreateCreditAccountResponse

type CreateCreditAccountResponse struct {
	// Transaction to create compass credit account
	Transaction *UnsignedTransaction `json:"transaction"`
	// Predicted address of the compass credit account that will be deployed
	CreditAccountAddress string `json:"credit_account_address"`
}

CreateCreditAccountResponse - Response containing unsigned transaction to create compass Credit account.

func (*CreateCreditAccountResponse) GetCreditAccountAddress

func (c *CreateCreditAccountResponse) GetCreditAccountAddress() string

func (*CreateCreditAccountResponse) GetTransaction

func (c *CreateCreditAccountResponse) GetTransaction() *UnsignedTransaction

type CreateTokenizedAssetsAccountRequest

type CreateTokenizedAssetsAccountRequest struct {
	// The address of the transaction sender.
	Sender string `json:"sender"`
	// The address that will own and control the compass Tokenized Assets Account
	Owner string `json:"owner"`
	// Determines whether to estimate gas costs for transactions, also verifying that the transaction can be successfully executed.
	EstimateGas *bool `json:"estimate_gas,omitzero"`
	// The chain to use.
	Chain *Chain `json:"chain,omitzero"`
}

CreateTokenizedAssetsAccountRequest - Request to create a compass Tokenized Assets Account.

func (*CreateTokenizedAssetsAccountRequest) GetChain

func (*CreateTokenizedAssetsAccountRequest) GetEstimateGas

func (c *CreateTokenizedAssetsAccountRequest) GetEstimateGas() *bool

func (*CreateTokenizedAssetsAccountRequest) GetOwner

func (*CreateTokenizedAssetsAccountRequest) GetSender

type CreateTokenizedAssetsAccountResponse

type CreateTokenizedAssetsAccountResponse struct {
	// Transaction to create compass Tokenized Assets Account
	Transaction *UnsignedTransaction `json:"transaction"`
	// Predicted address of the compass Tokenized Assets Account that will be deployed
	TokenizedAssetsAccountAddress string `json:"tokenized_assets_account_address"`
}

CreateTokenizedAssetsAccountResponse - Response containing unsigned transaction to create compass Tokenized Assets Account.

func (*CreateTokenizedAssetsAccountResponse) GetTokenizedAssetsAccountAddress

func (c *CreateTokenizedAssetsAccountResponse) GetTokenizedAssetsAccountAddress() string

func (*CreateTokenizedAssetsAccountResponse) GetTransaction

type CreditBalancesResponse

type CreditBalancesResponse struct {
	// The derived credit account address.
	CreditAccountAddress string `json:"credit_account_address"`
	// Token balances keyed by token symbol. Symbols are not unique on-chain: when two tokens collide, each key becomes 'SYMBOL (0xAddress)' — match on token_address for exactness.
	Balances map[string]CompassAPIBackendV2ModelsBalancesTokenBalance `json:"balances,omitzero"`
	// Total USD value of all balances (sum of available values).
	TotalUsdValue optionalnullable.OptionalNullable[string] `json:"total_usd_value,omitzero"`
}

CreditBalancesResponse - Response containing credit account balances and transfer history.

func (*CreditBalancesResponse) GetBalances

func (*CreditBalancesResponse) GetCreditAccountAddress

func (c *CreditBalancesResponse) GetCreditAccountAddress() string

func (*CreditBalancesResponse) GetTotalUsdValue

func (CreditBalancesResponse) MarshalJSON

func (c CreditBalancesResponse) MarshalJSON() ([]byte, error)

func (*CreditBalancesResponse) UnmarshalJSON

func (c *CreditBalancesResponse) UnmarshalJSON(data []byte) error

type CreditBorrowParams

type CreditBorrowParams struct {

	// Token to borrow from Aave.
	Token string `json:"token"`
	// Amount in token units to borrow.
	Amount CreditBorrowParamsAmount `json:"amount"`
	// On AAVE there are 2 different interest modes.
	//
	// A stable (but typically higher rate), or a variable rate.
	InterestRateMode *InterestRateMode `json:"interest_rate_mode,omitzero"`
	// Optional fee on the borrowed amount.
	Fee optionalnullable.OptionalNullable[CreditFee] `json:"fee,omitzero"`
	// Which lending protocol a credit action targets.
	//
	// “AAVE“ is the default so existing callers (which never send a “protocol“
	// field) keep hitting the unchanged Aave code path; markets are named by token
	// symbol. “MORPHO“ identifies Morpho Blue lending markets by their bytes32
	// “market_id“. “EULER“ identifies Euler V2 markets by their EVK
	// “collateral_vault“ + “borrow_vault“ addresses and supports isolated
	// per-sub-account positions (“sub_account_id“).
	//
	// Deployment is per chain, so a valid protocol can still 422 on a given chain:
	// AAVE on Ethereum, Base, Arbitrum, BSC and HyperEVM (where it is Hyperlend, the
	// chain's Aave V3 deployment); MORPHO on Ethereum, Base, Arbitrum and HyperEVM
	// (where it is Felix); EULER on Ethereum, Base, Arbitrum and BSC.
	//
	// All three support “/v2/credit/loop“, “/v2/credit/unloop“,
	// “/v2/credit/looped_positions“ and “/v2/credit/rebalance“.
	Protocol *CreditProtocol `json:"protocol,omitzero"`
	// Euler only: the EVK vault to borrow from. Required when protocol=EULER.
	BorrowVault optionalnullable.OptionalNullable[string] `json:"borrow_vault,omitzero"`
	// Euler only: EVC sub-account (0–255) to borrow against. Each sub-account is an independent Euler position with its own collateral, borrow controller, and health. Defaults to 0. Ignored for Aave/Morpho.
	SubAccountID *int64 `json:"sub_account_id,omitzero"`
	// Morpho only: the bytes32 market id (from /v2/credit/morpho_markets). Required when protocol=MORPHO.
	MarketID optionalnullable.OptionalNullable[string] `json:"market_id,omitzero"`
	// contains filtered or unexported fields
}

CreditBorrowParams - Borrow from Aave via Credit Account.

func (*CreditBorrowParams) GetActionType

func (c *CreditBorrowParams) GetActionType() *string

func (*CreditBorrowParams) GetAmount

func (*CreditBorrowParams) GetBorrowVault added in v0.1.27

func (*CreditBorrowParams) GetFee

func (*CreditBorrowParams) GetInterestRateMode

func (c *CreditBorrowParams) GetInterestRateMode() *InterestRateMode

func (*CreditBorrowParams) GetMarketID added in v0.1.34

func (*CreditBorrowParams) GetProtocol added in v0.1.27

func (c *CreditBorrowParams) GetProtocol() *CreditProtocol

func (*CreditBorrowParams) GetSubAccountID added in v0.1.41

func (c *CreditBorrowParams) GetSubAccountID() *int64

func (*CreditBorrowParams) GetToken

func (c *CreditBorrowParams) GetToken() string

func (CreditBorrowParams) MarshalJSON

func (c CreditBorrowParams) MarshalJSON() ([]byte, error)

func (*CreditBorrowParams) UnmarshalJSON

func (c *CreditBorrowParams) UnmarshalJSON(data []byte) error

type CreditBorrowParamsAmount

type CreditBorrowParamsAmount struct {
	Number *float64 `queryParam:"inline" union:"member"`
	Str    *string  `queryParam:"inline" union:"member"`

	Type CreditBorrowParamsAmountType
}

CreditBorrowParamsAmount - Amount in token units to borrow.

func CreateCreditBorrowParamsAmountNumber

func CreateCreditBorrowParamsAmountNumber(number float64) CreditBorrowParamsAmount

func CreateCreditBorrowParamsAmountStr

func CreateCreditBorrowParamsAmountStr(str string) CreditBorrowParamsAmount

func (CreditBorrowParamsAmount) MarshalJSON

func (u CreditBorrowParamsAmount) MarshalJSON() ([]byte, error)

func (*CreditBorrowParamsAmount) UnmarshalJSON

func (u *CreditBorrowParamsAmount) UnmarshalJSON(data []byte) (err error)

type CreditBorrowParamsAmountType

type CreditBorrowParamsAmountType string
const (
	CreditBorrowParamsAmountTypeNumber CreditBorrowParamsAmountType = "number"
	CreditBorrowParamsAmountTypeStr    CreditBorrowParamsAmountType = "str"
)

type CreditBorrowRequest

type CreditBorrowRequest struct {
	// The address that owns the Credit Account.
	Owner string `json:"owner"`
	// Blockchain network.
	Chain CreditBorrowRequestChain `json:"chain"`
	// Which lending protocol a credit action targets.
	//
	// “AAVE“ is the default so existing callers (which never send a “protocol“
	// field) keep hitting the unchanged Aave code path; markets are named by token
	// symbol. “MORPHO“ identifies Morpho Blue lending markets by their bytes32
	// “market_id“. “EULER“ identifies Euler V2 markets by their EVK
	// “collateral_vault“ + “borrow_vault“ addresses and supports isolated
	// per-sub-account positions (“sub_account_id“).
	//
	// Deployment is per chain, so a valid protocol can still 422 on a given chain:
	// AAVE on Ethereum, Base, Arbitrum, BSC and HyperEVM (where it is Hyperlend, the
	// chain's Aave V3 deployment); MORPHO on Ethereum, Base, Arbitrum and HyperEVM
	// (where it is Felix); EULER on Ethereum, Base, Arbitrum and BSC.
	//
	// All three support “/v2/credit/loop“, “/v2/credit/unloop“,
	// “/v2/credit/looped_positions“ and “/v2/credit/rebalance“.
	Protocol *CreditProtocol `json:"protocol,omitzero"`
	// Euler only: the EVK collateral vault to supply into. Required when protocol=EULER and supplying collateral.
	CollateralVault optionalnullable.OptionalNullable[string] `json:"collateral_vault,omitzero"`
	// Euler only: the EVK vault to borrow from. Required when protocol=EULER.
	BorrowVault optionalnullable.OptionalNullable[string] `json:"borrow_vault,omitzero"`
	// Morpho only: the bytes32 market id (from /v2/credit/morpho_markets). Required when protocol=MORPHO.
	MarketID optionalnullable.OptionalNullable[string] `json:"market_id,omitzero"`
	// Euler only: EVC sub-account (0–255) to isolate this position. Each sub-account is an independent Euler position with its own collateral, borrow controller, and health, letting one Credit Account hold multiple isolated Euler positions. Defaults to 0. Ignored for Aave/Morpho.
	SubAccountID *int64 `json:"sub_account_id,omitzero"`
	// Token currently held in the Credit Account to use as input. If the same as collateral_token, no swap is performed. Omit together with amount_in and collateral_token to borrow against existing collateral.
	TokenIn optionalnullable.OptionalNullable[string] `json:"token_in,omitzero"`
	// Amount of token_in to use (in token units, not wei). Omit together with token_in and collateral_token for borrow-only mode.
	AmountIn optionalnullable.OptionalNullable[CreditBorrowRequestAmountIn] `json:"amount_in,omitzero"`
	// Aave reserve token to supply as collateral. Omit together with token_in and amount_in for borrow-only mode.
	CollateralToken optionalnullable.OptionalNullable[string] `json:"collateral_token,omitzero"`
	// Asset to borrow from Aave.
	BorrowToken string `json:"borrow_token"`
	// Amount to borrow (in token units, not wei).
	BorrowAmount BorrowAmount `json:"borrow_amount"`
	// On AAVE there are 2 different interest modes.
	//
	// A stable (but typically higher rate), or a variable rate.
	InterestRateMode *InterestRateMode `json:"interest_rate_mode,omitzero"`
	// Maximum slippage tolerance as a percentage (e.g., 0.5 = 0.5%). Only used when a swap is needed.
	Slippage *CreditBorrowRequestSlippage `json:"slippage,omitzero"`
	// If true, returns EIP-712 signature data instead of an unsigned transaction.
	GasSponsorship *bool `json:"gas_sponsorship,omitzero"`
	// Optional fee configuration. If provided, a fee will be deducted from the borrowed amount and sent to the specified recipient address.
	Fee optionalnullable.OptionalNullable[CreditFee] `json:"fee,omitzero"`
	// The EOA owner's signature of the Permit2 PermitTransferFrom typed data. When provided, the borrow bundle will first pull token_in from the owner's EOA into the Credit Account via Permit2. Obtain by calling /v2/credit/transfer and signing the returned EIP-712 data.
	Permit2Signature optionalnullable.OptionalNullable[string] `json:"permit2_signature,omitzero"`
	// The nonce used in the Permit2 signature (from the signed typed data).
	Permit2Nonce optionalnullable.OptionalNullable[int64] `json:"permit2_nonce,omitzero"`
	// The deadline timestamp used in the Permit2 signature (from the signed typed data).
	Permit2Deadline optionalnullable.OptionalNullable[int64] `json:"permit2_deadline,omitzero"`
}

func (*CreditBorrowRequest) GetBorrowAmount

func (c *CreditBorrowRequest) GetBorrowAmount() BorrowAmount

func (*CreditBorrowRequest) GetBorrowToken

func (c *CreditBorrowRequest) GetBorrowToken() string

func (*CreditBorrowRequest) GetBorrowVault added in v0.1.27

func (*CreditBorrowRequest) GetChain

func (*CreditBorrowRequest) GetCollateralToken

func (*CreditBorrowRequest) GetCollateralVault added in v0.1.27

func (*CreditBorrowRequest) GetFee

func (*CreditBorrowRequest) GetGasSponsorship

func (c *CreditBorrowRequest) GetGasSponsorship() *bool

func (*CreditBorrowRequest) GetInterestRateMode

func (c *CreditBorrowRequest) GetInterestRateMode() *InterestRateMode

func (*CreditBorrowRequest) GetMarketID added in v0.1.34

func (*CreditBorrowRequest) GetOwner

func (c *CreditBorrowRequest) GetOwner() string

func (*CreditBorrowRequest) GetPermit2Deadline

func (*CreditBorrowRequest) GetPermit2Nonce

func (*CreditBorrowRequest) GetPermit2Signature

func (c *CreditBorrowRequest) GetPermit2Signature() optionalnullable.OptionalNullable[string]

func (*CreditBorrowRequest) GetProtocol added in v0.1.27

func (c *CreditBorrowRequest) GetProtocol() *CreditProtocol

func (*CreditBorrowRequest) GetSlippage

func (*CreditBorrowRequest) GetSubAccountID added in v0.1.41

func (c *CreditBorrowRequest) GetSubAccountID() *int64

func (*CreditBorrowRequest) GetTokenIn

func (CreditBorrowRequest) MarshalJSON

func (c CreditBorrowRequest) MarshalJSON() ([]byte, error)

func (*CreditBorrowRequest) UnmarshalJSON

func (c *CreditBorrowRequest) UnmarshalJSON(data []byte) error

type CreditBorrowRequestAmountIn

type CreditBorrowRequestAmountIn struct {
	Number *float64 `queryParam:"inline" union:"member"`
	Str    *string  `queryParam:"inline" union:"member"`

	Type CreditBorrowRequestAmountInType
}

CreditBorrowRequestAmountIn - Amount of token_in to use (in token units, not wei). Omit together with token_in and collateral_token for borrow-only mode.

func CreateCreditBorrowRequestAmountInNumber

func CreateCreditBorrowRequestAmountInNumber(number float64) CreditBorrowRequestAmountIn

func CreateCreditBorrowRequestAmountInStr

func CreateCreditBorrowRequestAmountInStr(str string) CreditBorrowRequestAmountIn

func (CreditBorrowRequestAmountIn) MarshalJSON

func (u CreditBorrowRequestAmountIn) MarshalJSON() ([]byte, error)

func (*CreditBorrowRequestAmountIn) UnmarshalJSON

func (u *CreditBorrowRequestAmountIn) UnmarshalJSON(data []byte) (err error)

type CreditBorrowRequestAmountInType

type CreditBorrowRequestAmountInType string
const (
	CreditBorrowRequestAmountInTypeNumber CreditBorrowRequestAmountInType = "number"
	CreditBorrowRequestAmountInTypeStr    CreditBorrowRequestAmountInType = "str"
)

type CreditBorrowRequestChain added in v0.1.53

type CreditBorrowRequestChain string

CreditBorrowRequestChain - Blockchain network.

const (
	CreditBorrowRequestChainArbitrum CreditBorrowRequestChain = "arbitrum"
	CreditBorrowRequestChainBase     CreditBorrowRequestChain = "base"
	CreditBorrowRequestChainBsc      CreditBorrowRequestChain = "bsc"
	CreditBorrowRequestChainEthereum CreditBorrowRequestChain = "ethereum"
	CreditBorrowRequestChainHyperevm CreditBorrowRequestChain = "hyperevm"
	CreditBorrowRequestChainTempo    CreditBorrowRequestChain = "tempo"
)

func (CreditBorrowRequestChain) ToPointer added in v0.1.53

func (*CreditBorrowRequestChain) UnmarshalJSON added in v0.1.53

func (e *CreditBorrowRequestChain) UnmarshalJSON(data []byte) error

type CreditBorrowRequestSlippage

type CreditBorrowRequestSlippage struct {
	Number *float64 `queryParam:"inline" union:"member"`
	Str    *string  `queryParam:"inline" union:"member"`

	Type CreditBorrowRequestSlippageType
}

CreditBorrowRequestSlippage - Maximum slippage tolerance as a percentage (e.g., 0.5 = 0.5%). Only used when a swap is needed.

func CreateCreditBorrowRequestSlippageNumber

func CreateCreditBorrowRequestSlippageNumber(number float64) CreditBorrowRequestSlippage

func CreateCreditBorrowRequestSlippageStr

func CreateCreditBorrowRequestSlippageStr(str string) CreditBorrowRequestSlippage

func (CreditBorrowRequestSlippage) MarshalJSON

func (u CreditBorrowRequestSlippage) MarshalJSON() ([]byte, error)

func (*CreditBorrowRequestSlippage) UnmarshalJSON

func (u *CreditBorrowRequestSlippage) UnmarshalJSON(data []byte) (err error)

type CreditBorrowRequestSlippageType

type CreditBorrowRequestSlippageType string
const (
	CreditBorrowRequestSlippageTypeNumber CreditBorrowRequestSlippageType = "number"
	CreditBorrowRequestSlippageTypeStr    CreditBorrowRequestSlippageType = "str"
)

type CreditBorrowResponse

type CreditBorrowResponse struct {
	// Unsigned transaction to execute the borrow bundle. Present when gas_sponsorship is false.
	Transaction optionalnullable.OptionalNullable[UnsignedTransaction] `json:"transaction,omitzero"`
	// EIP-712 typed data for gas-sponsored execution. Present when gas_sponsorship is true.
	Eip712 optionalnullable.OptionalNullable[BatchedSafeOperationsResponseOutput] `json:"eip_712,omitzero"`
	// Estimated amount of collateral token received from swap. Only present when token_in differs from collateral_token.
	EstimatedCollateralAmount optionalnullable.OptionalNullable[string] `json:"estimated_collateral_amount,omitzero"`
	// The fee amount charged on the borrow, in borrow token units. Present when a fee was applied.
	FeeAmount optionalnullable.OptionalNullable[string] `json:"fee_amount,omitzero"`
}

func (*CreditBorrowResponse) GetEstimatedCollateralAmount

func (c *CreditBorrowResponse) GetEstimatedCollateralAmount() optionalnullable.OptionalNullable[string]

func (*CreditBorrowResponse) GetFeeAmount

func (*CreditBorrowResponse) GetTransaction

func (CreditBorrowResponse) MarshalJSON

func (c CreditBorrowResponse) MarshalJSON() ([]byte, error)

func (*CreditBorrowResponse) UnmarshalJSON

func (c *CreditBorrowResponse) UnmarshalJSON(data []byte) error

type CreditBundleRequest

type CreditBundleRequest struct {
	// The owner's wallet address that controls the Credit Account.
	Owner string `json:"owner"`
	// Target blockchain network where the bundled actions will execute.
	Chain CreditBundleRequestChain `json:"chain"`
	// List of actions to bundle. Actions are executed in order.
	Actions []CreditUserOperation `json:"actions"`
	// If true, returns EIP-712 typed data for gas-sponsored execution.
	GasSponsorship *bool `json:"gas_sponsorship,omitzero"`
}

CreditBundleRequest - Request to execute multiple credit actions in a single atomic transaction.

func (*CreditBundleRequest) GetActions

func (c *CreditBundleRequest) GetActions() []CreditUserOperation

func (*CreditBundleRequest) GetChain

func (*CreditBundleRequest) GetGasSponsorship

func (c *CreditBundleRequest) GetGasSponsorship() *bool

func (*CreditBundleRequest) GetOwner

func (c *CreditBundleRequest) GetOwner() string

type CreditBundleRequestChain added in v0.1.53

type CreditBundleRequestChain string

CreditBundleRequestChain - Target blockchain network where the bundled actions will execute.

const (
	CreditBundleRequestChainArbitrum CreditBundleRequestChain = "arbitrum"
	CreditBundleRequestChainBase     CreditBundleRequestChain = "base"
	CreditBundleRequestChainBsc      CreditBundleRequestChain = "bsc"
	CreditBundleRequestChainEthereum CreditBundleRequestChain = "ethereum"
	CreditBundleRequestChainHyperevm CreditBundleRequestChain = "hyperevm"
	CreditBundleRequestChainTempo    CreditBundleRequestChain = "tempo"
)

func (CreditBundleRequestChain) ToPointer added in v0.1.53

func (*CreditBundleRequestChain) UnmarshalJSON added in v0.1.53

func (e *CreditBundleRequestChain) UnmarshalJSON(data []byte) error

type CreditBundleResponse

type CreditBundleResponse struct {
	// Unsigned transaction for direct execution by the owner. Present when gas_sponsorship=false.
	Transaction optionalnullable.OptionalNullable[UnsignedTransaction] `json:"transaction,omitzero"`
	// EIP-712 typed data for gas-sponsored execution. Present when gas_sponsorship=true. Owner must sign and submit to /gas_sponsorship/prepare.
	Eip712 optionalnullable.OptionalNullable[BatchedSafeOperationsResponseOutput] `json:"eip_712,omitzero"`
	// Number of individual transactions bundled in this execution.
	ActionsCount int64 `json:"actions_count"`
}

func (*CreditBundleResponse) GetActionsCount

func (c *CreditBundleResponse) GetActionsCount() int64

func (*CreditBundleResponse) GetTransaction

func (CreditBundleResponse) MarshalJSON

func (c CreditBundleResponse) MarshalJSON() ([]byte, error)

func (*CreditBundleResponse) UnmarshalJSON

func (c *CreditBundleResponse) UnmarshalJSON(data []byte) error

type CreditEnableCollateralParams

type CreditEnableCollateralParams struct {

	// The underlying reserve token to enable as collateral (e.g. USDC, not aUSDC).
	Token string `json:"token"`
	// Which lending protocol a credit action targets.
	//
	// “AAVE“ is the default so existing callers (which never send a “protocol“
	// field) keep hitting the unchanged Aave code path; markets are named by token
	// symbol. “MORPHO“ identifies Morpho Blue lending markets by their bytes32
	// “market_id“. “EULER“ identifies Euler V2 markets by their EVK
	// “collateral_vault“ + “borrow_vault“ addresses and supports isolated
	// per-sub-account positions (“sub_account_id“).
	//
	// Deployment is per chain, so a valid protocol can still 422 on a given chain:
	// AAVE on Ethereum, Base, Arbitrum, BSC and HyperEVM (where it is Hyperlend, the
	// chain's Aave V3 deployment); MORPHO on Ethereum, Base, Arbitrum and HyperEVM
	// (where it is Felix); EULER on Ethereum, Base, Arbitrum and BSC.
	//
	// All three support “/v2/credit/loop“, “/v2/credit/unloop“,
	// “/v2/credit/looped_positions“ and “/v2/credit/rebalance“.
	Protocol *CreditProtocol `json:"protocol,omitzero"`
	// Euler only: the EVK collateral vault to enable. Required when protocol=EULER.
	CollateralVault optionalnullable.OptionalNullable[string] `json:"collateral_vault,omitzero"`
	// Euler only: EVC sub-account (0–255) to enable the collateral for. Each sub-account is an independent Euler position with its own collateral, borrow controller, and health. Defaults to 0. Ignored for Aave/Morpho.
	SubAccountID *int64 `json:"sub_account_id,omitzero"`
	// contains filtered or unexported fields
}

CreditEnableCollateralParams - Enable a reserve asset as collateral in Aave via Credit Account.

Required after receiving aTokens via direct ERC-20 transfer (not via Pool.supply()), since Aave V3 does not auto-enable collateral for transferred aTokens.

func (*CreditEnableCollateralParams) GetActionType

func (c *CreditEnableCollateralParams) GetActionType() *string

func (*CreditEnableCollateralParams) GetCollateralVault added in v0.1.27

func (*CreditEnableCollateralParams) GetProtocol added in v0.1.27

func (c *CreditEnableCollateralParams) GetProtocol() *CreditProtocol

func (*CreditEnableCollateralParams) GetSubAccountID added in v0.1.41

func (c *CreditEnableCollateralParams) GetSubAccountID() *int64

func (*CreditEnableCollateralParams) GetToken

func (c *CreditEnableCollateralParams) GetToken() string

func (CreditEnableCollateralParams) MarshalJSON

func (c CreditEnableCollateralParams) MarshalJSON() ([]byte, error)

func (*CreditEnableCollateralParams) UnmarshalJSON

func (c *CreditEnableCollateralParams) UnmarshalJSON(data []byte) error

type CreditEvent

type CreditEvent struct {
	// Type of credit event.
	EventType CreditEventEventType `json:"event_type"`
	// Block number when the event occurred
	BlockNumber int64 `json:"block_number"`
	// Timestamp when the event occurred
	BlockTimestamp time.Time `json:"block_timestamp"`
	// Transaction hash of the event
	TransactionHash string `json:"transaction_hash"`
	// Amount involved in the event
	Amount string `json:"amount"`
	// Symbol of the token
	Symbol string `json:"symbol"`
}

CreditEvent - A single historical event in a credit position.

func (*CreditEvent) GetAmount

func (c *CreditEvent) GetAmount() string

func (*CreditEvent) GetBlockNumber

func (c *CreditEvent) GetBlockNumber() int64

func (*CreditEvent) GetBlockTimestamp

func (c *CreditEvent) GetBlockTimestamp() time.Time

func (*CreditEvent) GetEventType

func (c *CreditEvent) GetEventType() CreditEventEventType

func (*CreditEvent) GetSymbol

func (c *CreditEvent) GetSymbol() string

func (*CreditEvent) GetTransactionHash

func (c *CreditEvent) GetTransactionHash() string

func (CreditEvent) MarshalJSON

func (c CreditEvent) MarshalJSON() ([]byte, error)

func (*CreditEvent) UnmarshalJSON

func (c *CreditEvent) UnmarshalJSON(data []byte) error

type CreditEventEventType added in v0.1.23

type CreditEventEventType string

CreditEventEventType - Type of credit event.

const (
	CreditEventEventTypeSupply      CreditEventEventType = "supply"
	CreditEventEventTypeWithdraw    CreditEventEventType = "withdraw"
	CreditEventEventTypeBorrow      CreditEventEventType = "borrow"
	CreditEventEventTypeRepay       CreditEventEventType = "repay"
	CreditEventEventTypeLiquidation CreditEventEventType = "liquidation"
	CreditEventEventTypeTransferIn  CreditEventEventType = "transfer_in"
	CreditEventEventTypeTransferOut CreditEventEventType = "transfer_out"
)

func (*CreditEventEventType) IsExact added in v0.1.23

func (e *CreditEventEventType) IsExact() bool

IsExact returns true if the value matches a known enum value, false otherwise.

func (CreditEventEventType) ToPointer added in v0.1.23

type CreditFee

type CreditFee struct {
	// The wallet address that will receive the fee.
	Recipient string `json:"recipient"`
	// The fee amount. If `denomination` is 'PERCENTAGE', this is a percentage of the transaction amount (e.g., 1.5 for 1.5%). If `denomination` is 'FIXED', this is a fixed amount in token units (e.g., 0.1 for 0.1 tokens). If `denomination` is 'PERFORMANCE', this is a percentage of realized profit calculated using FIFO cost basis (e.g., 10 for 10% of profit).
	Amount CreditFeeAmount `json:"amount"`
	// The unit type for the fee amount. Use 'PERCENTAGE' for a percentage-based fee (e.g., 1.5 means 1.5% of the borrow amount), or 'FIXED' for a fixed token amount (e.g., 0.1 means 0.1 tokens).
	Denomination *CreditFeeDenomination `json:"denomination,omitzero"`
}

CreditFee - Fee configuration for credit-product actions.

Same shape as `Fee`, but narrows `denomination` to the values supported by credit borrows. PERFORMANCE is not supported because realized-profit fees are not meaningful for debt positions.

func (*CreditFee) GetAmount

func (c *CreditFee) GetAmount() CreditFeeAmount

func (*CreditFee) GetDenomination

func (c *CreditFee) GetDenomination() *CreditFeeDenomination

func (*CreditFee) GetRecipient

func (c *CreditFee) GetRecipient() string

func (CreditFee) MarshalJSON

func (c CreditFee) MarshalJSON() ([]byte, error)

func (*CreditFee) UnmarshalJSON

func (c *CreditFee) UnmarshalJSON(data []byte) error

type CreditFeeAmount

type CreditFeeAmount struct {
	Number *float64 `queryParam:"inline" union:"member"`
	Str    *string  `queryParam:"inline" union:"member"`

	Type CreditFeeAmountType
}

CreditFeeAmount - The fee amount. If `denomination` is 'PERCENTAGE', this is a percentage of the transaction amount (e.g., 1.5 for 1.5%). If `denomination` is 'FIXED', this is a fixed amount in token units (e.g., 0.1 for 0.1 tokens). If `denomination` is 'PERFORMANCE', this is a percentage of realized profit calculated using FIFO cost basis (e.g., 10 for 10% of profit).

func CreateCreditFeeAmountNumber

func CreateCreditFeeAmountNumber(number float64) CreditFeeAmount

func CreateCreditFeeAmountStr

func CreateCreditFeeAmountStr(str string) CreditFeeAmount

func (CreditFeeAmount) MarshalJSON

func (u CreditFeeAmount) MarshalJSON() ([]byte, error)

func (*CreditFeeAmount) UnmarshalJSON

func (u *CreditFeeAmount) UnmarshalJSON(data []byte) (err error)

type CreditFeeAmountType

type CreditFeeAmountType string
const (
	CreditFeeAmountTypeNumber CreditFeeAmountType = "number"
	CreditFeeAmountTypeStr    CreditFeeAmountType = "str"
)

type CreditFeeDenomination

type CreditFeeDenomination string

CreditFeeDenomination - The unit type for the fee amount. Use 'PERCENTAGE' for a percentage-based fee (e.g., 1.5 means 1.5% of the borrow amount), or 'FIXED' for a fixed token amount (e.g., 0.1 means 0.1 tokens).

const (
	CreditFeeDenominationPercentage CreditFeeDenomination = "PERCENTAGE"
	CreditFeeDenominationFixed      CreditFeeDenomination = "FIXED"
)

func (CreditFeeDenomination) ToPointer

func (*CreditFeeDenomination) UnmarshalJSON

func (e *CreditFeeDenomination) UnmarshalJSON(data []byte) error

type CreditLoopPreview added in v0.1.34

type CreditLoopPreview struct {
	// Number of loop iterations bundled.
	Iterations int64 `json:"iterations"`
	// Guaranteed minimum total collateral supplied (token units); actual can only be higher (swap fills above the floor become dust).
	TotalCollateralSupplied string `json:"total_collateral_supplied"`
	// Total loan tokens borrowed across iterations.
	TotalBorrowed string `json:"total_borrowed"`
	// Guaranteed leverage floor: total_collateral_supplied / initial_collateral_amount.
	AchievedMultiplier string `json:"achieved_multiplier"`
	// Projected end loan-to-value in percent, at the sizing oracle prices.
	ProjectedLtv string `json:"projected_ltv"`
	// Projected health factor (liquidation threshold / projected LTV). Below 1 would be liquidatable — the request is rejected long before that.
	ProjectedHealthFactor string `json:"projected_health_factor"`
	// Upper bound of collateral-token surplus the swaps can leave in the Credit Account (sum of quote − guaranteed floor per swap). It is bounded by max_slippage_percent per iteration, stays in the account, and is never lost.
	EstimatedMaxDust string `json:"estimated_max_dust"`
	// Expected one-off cost of entering this loop, in COLLATERAL token units: the sum over swap legs of the market oracle's fair output minus the router's quote. This is the DEX fee plus price impact — the amount the position must earn back before it is ahead. Multiply by the collateral price for a USD figure. Distinct from estimated_max_dust, which is surplus retained in the account, not a cost. Excludes gas. Measured against the protocol's own oracle, so it also carries any oracle-to-market basis; clamped at zero.
	EstimatedSwapCost string `json:"estimated_swap_cost"`
	// Per-iteration breakdown.
	Legs []LoopLegPreview `json:"legs,omitzero"`
}

CreditLoopPreview - Projected end state of the loop, computed on GUARANTEED swap floors.

func (*CreditLoopPreview) GetAchievedMultiplier added in v0.1.34

func (c *CreditLoopPreview) GetAchievedMultiplier() string

func (*CreditLoopPreview) GetEstimatedMaxDust added in v0.1.34

func (c *CreditLoopPreview) GetEstimatedMaxDust() string

func (*CreditLoopPreview) GetEstimatedSwapCost added in v0.1.52

func (c *CreditLoopPreview) GetEstimatedSwapCost() string

func (*CreditLoopPreview) GetIterations added in v0.1.34

func (c *CreditLoopPreview) GetIterations() int64

func (*CreditLoopPreview) GetLegs added in v0.1.34

func (c *CreditLoopPreview) GetLegs() []LoopLegPreview

func (*CreditLoopPreview) GetProjectedHealthFactor added in v0.1.34

func (c *CreditLoopPreview) GetProjectedHealthFactor() string

func (*CreditLoopPreview) GetProjectedLtv added in v0.1.34

func (c *CreditLoopPreview) GetProjectedLtv() string

func (*CreditLoopPreview) GetTotalBorrowed added in v0.1.34

func (c *CreditLoopPreview) GetTotalBorrowed() string

func (*CreditLoopPreview) GetTotalCollateralSupplied added in v0.1.34

func (c *CreditLoopPreview) GetTotalCollateralSupplied() string

func (CreditLoopPreview) MarshalJSON added in v0.1.34

func (c CreditLoopPreview) MarshalJSON() ([]byte, error)

func (*CreditLoopPreview) UnmarshalJSON added in v0.1.34

func (c *CreditLoopPreview) UnmarshalJSON(data []byte) error

type CreditLoopRequest added in v0.1.34

type CreditLoopRequest struct {
	// The address that owns the Credit Account.
	Owner string `json:"owner"`
	// Blockchain network. Not every protocol is deployed on every chain — see the protocol field — and a chain with no credit venue at all returns a 422 naming the chains that do.
	Chain CreditLoopRequestChain `json:"chain"`
	// Which lending protocol a credit action targets.
	//
	// “AAVE“ is the default so existing callers (which never send a “protocol“
	// field) keep hitting the unchanged Aave code path; markets are named by token
	// symbol. “MORPHO“ identifies Morpho Blue lending markets by their bytes32
	// “market_id“. “EULER“ identifies Euler V2 markets by their EVK
	// “collateral_vault“ + “borrow_vault“ addresses and supports isolated
	// per-sub-account positions (“sub_account_id“).
	//
	// Deployment is per chain, so a valid protocol can still 422 on a given chain:
	// AAVE on Ethereum, Base, Arbitrum, BSC and HyperEVM (where it is Hyperlend, the
	// chain's Aave V3 deployment); MORPHO on Ethereum, Base, Arbitrum and HyperEVM
	// (where it is Felix); EULER on Ethereum, Base, Arbitrum and BSC.
	//
	// All three support “/v2/credit/loop“, “/v2/credit/unloop“,
	// “/v2/credit/looped_positions“ and “/v2/credit/rebalance“.
	Protocol *CreditProtocol `json:"protocol,omitzero"`
	// Morpho only: the bytes32 market id (from /v2/credit/morpho_markets). Required when protocol=MORPHO.
	MarketID optionalnullable.OptionalNullable[string] `json:"market_id,omitzero"`
	// Euler only: the EVK vault address collateral is supplied to (from /v2/credit/euler_markets). Required when protocol=EULER.
	CollateralVault optionalnullable.OptionalNullable[string] `json:"collateral_vault,omitzero"`
	// Euler only: the EVK vault address borrowed from (the sub-account's controller). Required when protocol=EULER.
	BorrowVault optionalnullable.OptionalNullable[string] `json:"borrow_vault,omitzero"`
	// Euler only: the EVC sub-account (0-255) holding this isolated looped position. 0 is the Credit Account itself.
	SubAccountID *int64 `json:"sub_account_id,omitzero"`
	// Token supplied as collateral each iteration. Must already be in the Credit Account for the initial amount. For MORPHO it must be the market's collateral token.
	CollateralToken string `json:"collateral_token"`
	// Token borrowed each iteration and swapped back to the collateral token. For MORPHO it must be the market's loan token.
	BorrowToken string `json:"borrow_token"`
	// Collateral (in token units) that the Credit Account must ALREADY hold when this is called — the loop never pulls from the owner's wallet mid-transaction. Fund the account first via /v2/credit/transfer (action=DEPOSIT).
	InitialCollateralAmount InitialCollateralAmount `json:"initial_collateral_amount"`
	// Target leverage: total collateral exposure = multiplier × initial_collateral_amount. Must be achievable at the requested loan_to_value (max ≈ 0.9 / (1 − LTV)).
	Multiplier Multiplier `json:"multiplier"`
	// Per-iteration borrow LTV in percent. Must not exceed the protocol's maximum for the market (Aave reserve/e-mode LTV; Morpho LLTV with a safety margin; Euler's borrow LTV for the collateral vault); borrows are sized slightly inside the requested value so no leg sits on the protocol's revert boundary.
	LoanToValue LoanToValue `json:"loan_to_value"`
	// Per-swap slippage tolerance in percent. Loop dust is bounded by this per iteration, so tighter slippage means less dust.
	MaxSlippagePercent *CreditLoopRequestMaxSlippagePercent `json:"max_slippage_percent,omitzero"`
	// Aave only: e-mode category to enable before looping (higher LTV for correlated pairs, e.g. ETH-correlated). Both tokens must belong to the category or the build returns a 422. On Hyperlend (chain=hyperevm) category 1 is the HYPE-correlated set covering wstHYPE and WHYPE.
	EmodeCategory optionalnullable.OptionalNullable[int64] `json:"emode_category,omitzero"`
	// If true, returns EIP-712 typed data for gas-sponsored execution instead of an unsigned transaction.
	GasSponsorship *bool `json:"gas_sponsorship,omitzero"`
	// If true, build a display ESTIMATE: no firm RFQ quote is ever requested (quote_expires_at stays null). NOTE that this guarantees only that no firm quote was spent — it does not guarantee an absent transaction: on a pair no firm provider covers, and under pricing=market, the call still falls through to the aggregator and returns a signable transaction. How the estimate is priced follows `pricing`: on a firm-covered pair under 'auto' or 'firm' it is computed from the firm provider's live price levels (indicative); otherwise swap legs are priced by the default aggregator. Set it on every call made while a user is exploring parameters, and leave it false only for the build they actually intend to sign — firm quotes are single-use maker commitments, and requesting them for displays that are never executed degrades the pricing this API is offered.
	Preview *bool `json:"preview,omitzero"`
	// Swap-leg routing policy. 'auto': firm quotes where a firm venue covers the pair, transparent fallback to the market aggregator otherwise. 'firm': never price on the market route — previews whose target the firm venue cannot serve return the coverage advisory alone (preview=null, zero aggregator calls), and executions fail with a typed error instead of silently substituting market pricing. 'market': never route through the firm venue; every leg is priced by the aggregator and bounded by max_slippage_percent (which firm legs ignore). 'firm' is incompatible with gas_sponsorship (sponsored loops force market routing).
	Pricing *CreditLoopRequestPricing `json:"pricing,omitzero"`
}

CreditLoopRequest - Open a leveraged loop: repeatedly supply collateral, borrow, and swap the borrow back to collateral — all in ONE atomic transaction from the Credit Account.

func (*CreditLoopRequest) GetBorrowToken added in v0.1.34

func (c *CreditLoopRequest) GetBorrowToken() string

func (*CreditLoopRequest) GetBorrowVault added in v0.1.45

func (*CreditLoopRequest) GetChain added in v0.1.34

func (*CreditLoopRequest) GetCollateralToken added in v0.1.34

func (c *CreditLoopRequest) GetCollateralToken() string

func (*CreditLoopRequest) GetCollateralVault added in v0.1.45

func (c *CreditLoopRequest) GetCollateralVault() optionalnullable.OptionalNullable[string]

func (*CreditLoopRequest) GetEmodeCategory added in v0.1.34

func (*CreditLoopRequest) GetGasSponsorship added in v0.1.34

func (c *CreditLoopRequest) GetGasSponsorship() *bool

func (*CreditLoopRequest) GetInitialCollateralAmount added in v0.1.34

func (c *CreditLoopRequest) GetInitialCollateralAmount() InitialCollateralAmount

func (*CreditLoopRequest) GetLoanToValue added in v0.1.34

func (c *CreditLoopRequest) GetLoanToValue() LoanToValue

func (*CreditLoopRequest) GetMarketID added in v0.1.34

func (*CreditLoopRequest) GetMaxSlippagePercent added in v0.1.34

func (c *CreditLoopRequest) GetMaxSlippagePercent() *CreditLoopRequestMaxSlippagePercent

func (*CreditLoopRequest) GetMultiplier added in v0.1.34

func (c *CreditLoopRequest) GetMultiplier() Multiplier

func (*CreditLoopRequest) GetOwner added in v0.1.34

func (c *CreditLoopRequest) GetOwner() string

func (*CreditLoopRequest) GetPreview added in v0.1.55

func (c *CreditLoopRequest) GetPreview() *bool

func (*CreditLoopRequest) GetPricing added in v0.1.58

func (*CreditLoopRequest) GetProtocol added in v0.1.34

func (c *CreditLoopRequest) GetProtocol() *CreditProtocol

func (*CreditLoopRequest) GetSubAccountID added in v0.1.45

func (c *CreditLoopRequest) GetSubAccountID() *int64

type CreditLoopRequestChain added in v0.1.53

type CreditLoopRequestChain string

CreditLoopRequestChain - Blockchain network. Not every protocol is deployed on every chain — see the protocol field — and a chain with no credit venue at all returns a 422 naming the chains that do.

const (
	CreditLoopRequestChainArbitrum CreditLoopRequestChain = "arbitrum"
	CreditLoopRequestChainBase     CreditLoopRequestChain = "base"
	CreditLoopRequestChainBsc      CreditLoopRequestChain = "bsc"
	CreditLoopRequestChainEthereum CreditLoopRequestChain = "ethereum"
	CreditLoopRequestChainHyperevm CreditLoopRequestChain = "hyperevm"
	CreditLoopRequestChainTempo    CreditLoopRequestChain = "tempo"
)

func (CreditLoopRequestChain) ToPointer added in v0.1.53

func (*CreditLoopRequestChain) UnmarshalJSON added in v0.1.53

func (e *CreditLoopRequestChain) UnmarshalJSON(data []byte) error

type CreditLoopRequestMaxSlippagePercent added in v0.1.35

type CreditLoopRequestMaxSlippagePercent struct {
	Number *float64 `queryParam:"inline" union:"member"`
	Str    *string  `queryParam:"inline" union:"member"`

	Type CreditLoopRequestMaxSlippagePercentType
}

CreditLoopRequestMaxSlippagePercent - Per-swap slippage tolerance in percent. Loop dust is bounded by this per iteration, so tighter slippage means less dust.

func CreateCreditLoopRequestMaxSlippagePercentNumber added in v0.1.35

func CreateCreditLoopRequestMaxSlippagePercentNumber(number float64) CreditLoopRequestMaxSlippagePercent

func CreateCreditLoopRequestMaxSlippagePercentStr added in v0.1.35

func CreateCreditLoopRequestMaxSlippagePercentStr(str string) CreditLoopRequestMaxSlippagePercent

func (CreditLoopRequestMaxSlippagePercent) MarshalJSON added in v0.1.35

func (u CreditLoopRequestMaxSlippagePercent) MarshalJSON() ([]byte, error)

func (*CreditLoopRequestMaxSlippagePercent) UnmarshalJSON added in v0.1.35

func (u *CreditLoopRequestMaxSlippagePercent) UnmarshalJSON(data []byte) (err error)

type CreditLoopRequestMaxSlippagePercentType added in v0.1.35

type CreditLoopRequestMaxSlippagePercentType string
const (
	CreditLoopRequestMaxSlippagePercentTypeNumber CreditLoopRequestMaxSlippagePercentType = "number"
	CreditLoopRequestMaxSlippagePercentTypeStr    CreditLoopRequestMaxSlippagePercentType = "str"
)

type CreditLoopRequestPricing added in v0.1.59

type CreditLoopRequestPricing string

CreditLoopRequestPricing - Swap-leg routing policy. 'auto': firm quotes where a firm venue covers the pair, transparent fallback to the market aggregator otherwise. 'firm': never price on the market route — previews whose target the firm venue cannot serve return the coverage advisory alone (preview=null, zero aggregator calls), and executions fail with a typed error instead of silently substituting market pricing. 'market': never route through the firm venue; every leg is priced by the aggregator and bounded by max_slippage_percent (which firm legs ignore). 'firm' is incompatible with gas_sponsorship (sponsored loops force market routing).

const (
	CreditLoopRequestPricingAuto   CreditLoopRequestPricing = "auto"
	CreditLoopRequestPricingFirm   CreditLoopRequestPricing = "firm"
	CreditLoopRequestPricingMarket CreditLoopRequestPricing = "market"
)

func (CreditLoopRequestPricing) ToPointer added in v0.1.59

func (*CreditLoopRequestPricing) UnmarshalJSON added in v0.1.59

func (e *CreditLoopRequestPricing) UnmarshalJSON(data []byte) error

type CreditLoopResponse added in v0.1.34

type CreditLoopResponse struct {
	// Unsigned transaction for direct execution by the owner. Present when gas_sponsorship=false — except firm-priced previews (preview=true on a firm-priced build), which carry numbers only: the firm quotes are fetched at execution time, so there is no payload to sign yet.
	Transaction optionalnullable.OptionalNullable[UnsignedTransaction] `json:"transaction,omitzero"`
	// EIP-712 typed data for gas-sponsored execution. Present when gas_sponsorship=true.
	Eip712 optionalnullable.OptionalNullable[BatchedSafeOperationsResponseOutput] `json:"eip_712,omitzero"`
	// Projected end state, computed on guaranteed swap floors. Null only on pricing='firm' preview responses whose target the firm venue cannot serve: no leg was priced on any venue, and the response carries the coverage advisory (max_firm_multiplier) alone.
	Preview *CreditLoopPreview `json:"preview"`
	// Maturity of the Pendle principal token supplied as collateral, ISO-8601 UTC. Present only for principal-token collateral, whose yield is fixed until this date; after it the position can be unwound (by redemption at par) but not increased.
	PtMaturity optionalnullable.OptionalNullable[string] `json:"pt_maturity,omitzero"`
	// Identifies which route priced the swap leg(s): 'market' — a DEX aggregator (iterative loop across pool liquidity, slippage-bounded floors) — or 'firm' — zero-slippage quotes, one per swap leg, each partially filled at the leg's size (exact fills, zero dust). On preview=true responses 'firm' means the numbers are INDICATIVE, computed from live maker price levels without spending any quote; execution fetches the firm quotes at signing time. Always present, including on fallbacks. This is the authoritative firm-vs-market signal and clients do need to read it: `pricing` is only what was REQUESTED (under 'auto' a firm build can fall back to market transparently), and `quote_expires_at` is absent on every preview — so neither substitutes for this field.
	SwapProvider *CreditLoopResponseSwapProvider `json:"swap_provider,omitzero"`
	// Deadline of the firm swap quotes (the earliest across the loop's swap legs) — sign and broadcast before it or the transaction reverts on-chain; refresh by re-calling this endpoint (discard the previous payload). Present only on executable firm-priced builds; null on previews (no quote is spent for a preview).
	QuoteExpiresAt optionalnullable.OptionalNullable[time.Time] `json:"quote_expires_at,omitzero"`
	// Multiplier bound firm zero-slippage quotes can fill for the requested position size, LTV and target (estimated without spending any quote). The requested multiplier is firm-servable iff it is <= this value; above it the loop executes at market rate with slippage-bounded floors instead. Present only on preview=true responses when a firm-quote venue covers the pair; null otherwise. Recompute per parameter change - minimum-size floors make reachability target-dependent.
	MaxFirmMultiplier optionalnullable.OptionalNullable[string] `json:"max_firm_multiplier,omitzero"`
}

CreditLoopResponse - The atomic loop transaction plus its guaranteed-floor preview.

func (*CreditLoopResponse) GetEip712 added in v0.1.34

func (*CreditLoopResponse) GetMaxFirmMultiplier added in v0.1.55

func (c *CreditLoopResponse) GetMaxFirmMultiplier() optionalnullable.OptionalNullable[string]

func (*CreditLoopResponse) GetPreview added in v0.1.34

func (c *CreditLoopResponse) GetPreview() *CreditLoopPreview

func (*CreditLoopResponse) GetPtMaturity added in v0.1.70

func (*CreditLoopResponse) GetQuoteExpiresAt added in v0.1.55

func (*CreditLoopResponse) GetSwapProvider added in v0.1.55

func (c *CreditLoopResponse) GetSwapProvider() *CreditLoopResponseSwapProvider

func (*CreditLoopResponse) GetTransaction added in v0.1.34

func (CreditLoopResponse) MarshalJSON added in v0.1.34

func (c CreditLoopResponse) MarshalJSON() ([]byte, error)

func (*CreditLoopResponse) UnmarshalJSON added in v0.1.34

func (c *CreditLoopResponse) UnmarshalJSON(data []byte) error

type CreditLoopResponseSwapProvider added in v0.1.55

type CreditLoopResponseSwapProvider string

CreditLoopResponseSwapProvider - Identifies which route priced the swap leg(s): 'market' — a DEX aggregator (iterative loop across pool liquidity, slippage-bounded floors) — or 'firm' — zero-slippage quotes, one per swap leg, each partially filled at the leg's size (exact fills, zero dust). On preview=true responses 'firm' means the numbers are INDICATIVE, computed from live maker price levels without spending any quote; execution fetches the firm quotes at signing time. Always present, including on fallbacks. This is the authoritative firm-vs-market signal and clients do need to read it: `pricing` is only what was REQUESTED (under 'auto' a firm build can fall back to market transparently), and `quote_expires_at` is absent on every preview — so neither substitutes for this field.

const (
	CreditLoopResponseSwapProviderMarket CreditLoopResponseSwapProvider = "market"
	CreditLoopResponseSwapProviderFirm   CreditLoopResponseSwapProvider = "firm"
)

func (*CreditLoopResponseSwapProvider) IsExact added in v0.1.55

func (e *CreditLoopResponseSwapProvider) IsExact() bool

IsExact returns true if the value matches a known enum value, false otherwise.

func (CreditLoopResponseSwapProvider) ToPointer added in v0.1.55

type CreditLoopedPositionsResponse added in v0.1.34

type CreditLoopedPositionsResponse struct {
	// The credit product account address derived from the owner.
	CreditAccountAddress string `json:"credit_account_address"`
	// Every leveraged position the account holds, across Aave, Morpho and Euler — each with its live state, lifetime totals and full transaction history, whether it is still open or already closed.
	Positions []LoopedPosition `json:"positions,omitzero"`
	// Aave account-level summary (health factor, LTV, borrow capacity). Present when the account holds any open Aave looped position, since Aave collateral is pooled and health is account-level. Null for accounts with no open Aave loop — Morpho and Euler positions carry their own isolated health factor on each position instead.
	AaveAccountSummary optionalnullable.OptionalNullable[AccountSummary] `json:"aave_account_summary,omitzero"`
}

CreditLoopedPositionsResponse - Looped positions across Aave V3, Morpho Blue and Euler V2 for a credit account.

func (*CreditLoopedPositionsResponse) GetAaveAccountSummary added in v0.1.34

func (*CreditLoopedPositionsResponse) GetCreditAccountAddress added in v0.1.34

func (c *CreditLoopedPositionsResponse) GetCreditAccountAddress() string

func (*CreditLoopedPositionsResponse) GetPositions added in v0.1.34

func (c *CreditLoopedPositionsResponse) GetPositions() []LoopedPosition

func (CreditLoopedPositionsResponse) MarshalJSON added in v0.1.34

func (c CreditLoopedPositionsResponse) MarshalJSON() ([]byte, error)

func (*CreditLoopedPositionsResponse) UnmarshalJSON added in v0.1.34

func (c *CreditLoopedPositionsResponse) UnmarshalJSON(data []byte) error

type CreditPositionsResponse

type CreditPositionsResponse struct {
	// All collateral positions, one per reserve.
	CollateralPositions []CollateralPosition `json:"collateral_positions,omitzero"`
	// All debt positions, one per reserve.
	DebtPositions []DebtPosition `json:"debt_positions,omitzero"`
	// Account-level summary for one lending protocol.
	//
	// Populated from Aave “getUserAccountData()“ or, for Euler, from the
	// controller vault's risk engine (“accountLiquidity“). The E-Mode fields are
	// Aave-only and stay at their defaults for Euler.
	AccountSummary AccountSummary `json:"account_summary"`
	// Euler account-level summaries — ONE PER ACTIVE EVC SUB-ACCOUNT (Euler health is per-sub-account, so an owner with positions on sub-accounts 0 and 3 gets two entries, each carrying its sub_account_id and independent health factor). Empty for accounts with no Euler positions. Supersedes the singular euler_account_summary.
	EulerAccountSummaries []AccountSummary `json:"euler_account_summaries,omitzero"`
	// DEPRECATED (use euler_account_summaries): the sub-account-0 Euler account-level summary, kept for one release for backwards compatibility. Present only when the account holds Euler positions; for a multi-sub-account owner it reflects only sub-account 0 (or the first active sub-account if 0 is empty). Null for Aave-only accounts.
	EulerAccountSummary optionalnullable.OptionalNullable[AccountSummary] `json:"euler_account_summary,omitzero"`
	// Euler-only: additional borrowable amounts given the account's current Euler controller (i.e. borrow more of the controller's asset). Empty for accounts with no Euler borrow position — use /credit/euler_markets to discover a new market to borrow from.
	EulerBorrowableTokens []BorrowableToken `json:"euler_borrowable_tokens,omitzero"`
	// All tokens available for borrowing with max amounts based on current collateral.
	BorrowableTokens []BorrowableToken `json:"borrowable_tokens,omitzero"`
	// Net position value in USD (total collateral - total debt). Null if prices unavailable.
	TotalUsdValue optionalnullable.OptionalNullable[string] `json:"total_usd_value,omitzero"`
}

CreditPositionsResponse - Credit account positions response with per-reserve positions and account summary.

func (*CreditPositionsResponse) GetAccountSummary

func (c *CreditPositionsResponse) GetAccountSummary() AccountSummary

func (*CreditPositionsResponse) GetBorrowableTokens

func (c *CreditPositionsResponse) GetBorrowableTokens() []BorrowableToken

func (*CreditPositionsResponse) GetCollateralPositions

func (c *CreditPositionsResponse) GetCollateralPositions() []CollateralPosition

func (*CreditPositionsResponse) GetDebtPositions

func (c *CreditPositionsResponse) GetDebtPositions() []DebtPosition

func (*CreditPositionsResponse) GetEulerAccountSummaries added in v0.1.41

func (c *CreditPositionsResponse) GetEulerAccountSummaries() []AccountSummary

func (*CreditPositionsResponse) GetEulerAccountSummary added in v0.1.27

func (*CreditPositionsResponse) GetEulerBorrowableTokens added in v0.1.29

func (c *CreditPositionsResponse) GetEulerBorrowableTokens() []BorrowableToken

func (*CreditPositionsResponse) GetTotalUsdValue

func (CreditPositionsResponse) MarshalJSON

func (c CreditPositionsResponse) MarshalJSON() ([]byte, error)

func (*CreditPositionsResponse) UnmarshalJSON

func (c *CreditPositionsResponse) UnmarshalJSON(data []byte) error

type CreditProtocol added in v0.1.27

type CreditProtocol string

CreditProtocol - Which lending protocol a credit action targets.

“AAVE“ is the default so existing callers (which never send a “protocol“ field) keep hitting the unchanged Aave code path; markets are named by token symbol. “MORPHO“ identifies Morpho Blue lending markets by their bytes32 “market_id“. “EULER“ identifies Euler V2 markets by their EVK “collateral_vault“ + “borrow_vault“ addresses and supports isolated per-sub-account positions (“sub_account_id“).

Deployment is per chain, so a valid protocol can still 422 on a given chain: AAVE on Ethereum, Base, Arbitrum, BSC and HyperEVM (where it is Hyperlend, the chain's Aave V3 deployment); MORPHO on Ethereum, Base, Arbitrum and HyperEVM (where it is Felix); EULER on Ethereum, Base, Arbitrum and BSC.

All three support “/v2/credit/loop“, “/v2/credit/unloop“, “/v2/credit/looped_positions“ and “/v2/credit/rebalance“.

const (
	CreditProtocolAave   CreditProtocol = "AAVE"
	CreditProtocolEuler  CreditProtocol = "EULER"
	CreditProtocolMorpho CreditProtocol = "MORPHO"
)

func (*CreditProtocol) IsExact added in v0.1.27

func (e *CreditProtocol) IsExact() bool

IsExact returns true if the value matches a known enum value, false otherwise.

func (CreditProtocol) ToPointer added in v0.1.27

func (e CreditProtocol) ToPointer() *CreditProtocol

type CreditRebalancePreview added in v0.1.37

type CreditRebalancePreview struct {
	// Signed net equity moved: Σ(target − current equity, in USD) over the named targets. Positive = net book growth funded from the Credit Account's idle balance; negative = surplus equity released to idle. Truncated toward zero, so the reported magnitude is never larger than the true amount in either sign.
	NetEquityMovedUsd string `json:"net_equity_moved_usd"`
	// Total on-chain legs across the whole transaction, including capital-routing swaps. A rebalance too large for one transaction is rejected with a 422.
	TotalLegs int64 `json:"total_legs"`
	// The capital-routing swaps that move freed tokens between positions, at a guaranteed minimum output enforced on-chain.
	RoutingSwaps []RoutingSwapPreview `json:"routing_swaps,omitzero"`
	// Upper bound of surplus all swaps (per-target and routing) can leave in the Credit Account (sum of each swap's quote minus its guaranteed floor). It accumulates in the Credit Account, is recoverable, and is never lost.
	EstimatedMaxDust string `json:"estimated_max_dust"`
	// Projected account-level Aave health factor after the rebalance — Aave collateral is pooled, so this is shared by every Aave target. Present whenever the end state holds any Aave collateral or debt; null for Morpho-only books. Never overstated at the 1.0 boundary.
	AaveAccountHealthFactor optionalnullable.OptionalNullable[string] `json:"aave_account_health_factor,omitzero"`
	// Per-target end state, in the same order as the request targets.
	PerTarget []RebalanceTargetPreview `json:"per_target"`
}

CreditRebalancePreview - Projected end state of the whole rebalance, computed on GUARANTEED swap floors.

func (*CreditRebalancePreview) GetAaveAccountHealthFactor added in v0.1.37

func (c *CreditRebalancePreview) GetAaveAccountHealthFactor() optionalnullable.OptionalNullable[string]

func (*CreditRebalancePreview) GetEstimatedMaxDust added in v0.1.37

func (c *CreditRebalancePreview) GetEstimatedMaxDust() string

func (*CreditRebalancePreview) GetNetEquityMovedUsd added in v0.1.37

func (c *CreditRebalancePreview) GetNetEquityMovedUsd() string

func (*CreditRebalancePreview) GetPerTarget added in v0.1.37

func (c *CreditRebalancePreview) GetPerTarget() []RebalanceTargetPreview

func (*CreditRebalancePreview) GetRoutingSwaps added in v0.1.37

func (c *CreditRebalancePreview) GetRoutingSwaps() []RoutingSwapPreview

func (*CreditRebalancePreview) GetTotalLegs added in v0.1.37

func (c *CreditRebalancePreview) GetTotalLegs() int64

func (CreditRebalancePreview) MarshalJSON added in v0.1.37

func (c CreditRebalancePreview) MarshalJSON() ([]byte, error)

func (*CreditRebalancePreview) UnmarshalJSON added in v0.1.37

func (c *CreditRebalancePreview) UnmarshalJSON(data []byte) error

type CreditRebalanceRequest added in v0.1.37

type CreditRebalanceRequest struct {
	// The address that owns the Credit Account.
	Owner string `json:"owner"`
	// Blockchain network. Rebalance is not available on HyperEVM yet; use loop/unloop there.
	Chain CreditRebalanceRequestChain `json:"chain"`
	// The positions to change. Scoped: only positions named here are touched; any position not listed is left untouched.
	Targets []RebalanceTarget `json:"targets"`
	// Request-level per-swap slippage tolerance in percent (including routing swaps). A per-target max_slippage_percent overrides it where set.
	MaxSlippagePercent *CreditRebalanceRequestMaxSlippagePercent `json:"max_slippage_percent,omitzero"`
	// If true, returns EIP-712 typed data for gas-sponsored execution instead of an unsigned transaction.
	GasSponsorship *bool `json:"gas_sponsorship,omitzero"`
}

CreditRebalanceRequest - Rebalance one or more Credit Account positions to their named end-states — lever up or down, grow or shrink equity, open a new position, close an existing one, or migrate (close one and open another) — all in ONE atomic transaction from the Credit Account.

func (*CreditRebalanceRequest) GetChain added in v0.1.37

func (*CreditRebalanceRequest) GetGasSponsorship added in v0.1.37

func (c *CreditRebalanceRequest) GetGasSponsorship() *bool

func (*CreditRebalanceRequest) GetMaxSlippagePercent added in v0.1.37

func (*CreditRebalanceRequest) GetOwner added in v0.1.37

func (c *CreditRebalanceRequest) GetOwner() string

func (*CreditRebalanceRequest) GetTargets added in v0.1.37

func (c *CreditRebalanceRequest) GetTargets() []RebalanceTarget

type CreditRebalanceRequestChain added in v0.1.53

type CreditRebalanceRequestChain string

CreditRebalanceRequestChain - Blockchain network. Rebalance is not available on HyperEVM yet; use loop/unloop there.

const (
	CreditRebalanceRequestChainArbitrum CreditRebalanceRequestChain = "arbitrum"
	CreditRebalanceRequestChainBase     CreditRebalanceRequestChain = "base"
	CreditRebalanceRequestChainBsc      CreditRebalanceRequestChain = "bsc"
	CreditRebalanceRequestChainEthereum CreditRebalanceRequestChain = "ethereum"
	CreditRebalanceRequestChainTempo    CreditRebalanceRequestChain = "tempo"
)

func (CreditRebalanceRequestChain) ToPointer added in v0.1.53

func (*CreditRebalanceRequestChain) UnmarshalJSON added in v0.1.53

func (e *CreditRebalanceRequestChain) UnmarshalJSON(data []byte) error

type CreditRebalanceRequestMaxSlippagePercent added in v0.1.37

type CreditRebalanceRequestMaxSlippagePercent struct {
	Number *float64 `queryParam:"inline" union:"member"`
	Str    *string  `queryParam:"inline" union:"member"`

	Type CreditRebalanceRequestMaxSlippagePercentType
}

CreditRebalanceRequestMaxSlippagePercent - Request-level per-swap slippage tolerance in percent (including routing swaps). A per-target max_slippage_percent overrides it where set.

func CreateCreditRebalanceRequestMaxSlippagePercentNumber added in v0.1.37

func CreateCreditRebalanceRequestMaxSlippagePercentNumber(number float64) CreditRebalanceRequestMaxSlippagePercent

func CreateCreditRebalanceRequestMaxSlippagePercentStr added in v0.1.37

func CreateCreditRebalanceRequestMaxSlippagePercentStr(str string) CreditRebalanceRequestMaxSlippagePercent

func (CreditRebalanceRequestMaxSlippagePercent) MarshalJSON added in v0.1.37

func (*CreditRebalanceRequestMaxSlippagePercent) UnmarshalJSON added in v0.1.37

func (u *CreditRebalanceRequestMaxSlippagePercent) UnmarshalJSON(data []byte) (err error)

type CreditRebalanceRequestMaxSlippagePercentType added in v0.1.37

type CreditRebalanceRequestMaxSlippagePercentType string
const (
	CreditRebalanceRequestMaxSlippagePercentTypeNumber CreditRebalanceRequestMaxSlippagePercentType = "number"
	CreditRebalanceRequestMaxSlippagePercentTypeStr    CreditRebalanceRequestMaxSlippagePercentType = "str"
)

type CreditRebalanceResponse added in v0.1.37

type CreditRebalanceResponse struct {
	// Unsigned transaction for direct execution by the owner. Present when gas_sponsorship=false. Null when the book is already at its target — nothing to execute.
	Transaction optionalnullable.OptionalNullable[UnsignedTransaction] `json:"transaction,omitzero"`
	// EIP-712 typed data for gas-sponsored execution. Present when gas_sponsorship=true.
	Eip712 optionalnullable.OptionalNullable[BatchedSafeOperationsResponseOutput] `json:"eip_712,omitzero"`
	// Projected end state of the whole rebalance, computed on GUARANTEED swap floors.
	Preview CreditRebalancePreview `json:"preview"`
}

CreditRebalanceResponse - The atomic rebalance transaction plus its guaranteed-floor preview.

func (*CreditRebalanceResponse) GetEip712 added in v0.1.37

func (*CreditRebalanceResponse) GetPreview added in v0.1.37

func (*CreditRebalanceResponse) GetTransaction added in v0.1.37

func (CreditRebalanceResponse) MarshalJSON added in v0.1.37

func (c CreditRebalanceResponse) MarshalJSON() ([]byte, error)

func (*CreditRebalanceResponse) UnmarshalJSON added in v0.1.37

func (c *CreditRebalanceResponse) UnmarshalJSON(data []byte) error

type CreditRepayParams

type CreditRepayParams struct {

	// Token to repay.
	Token string `json:"token"`
	// Amount in token units to repay.
	Amount CreditRepayParamsAmount `json:"amount"`
	// On AAVE there are 2 different interest modes.
	//
	// A stable (but typically higher rate), or a variable rate.
	InterestRateMode *InterestRateMode `json:"interest_rate_mode,omitzero"`
	// Which lending protocol a credit action targets.
	//
	// “AAVE“ is the default so existing callers (which never send a “protocol“
	// field) keep hitting the unchanged Aave code path; markets are named by token
	// symbol. “MORPHO“ identifies Morpho Blue lending markets by their bytes32
	// “market_id“. “EULER“ identifies Euler V2 markets by their EVK
	// “collateral_vault“ + “borrow_vault“ addresses and supports isolated
	// per-sub-account positions (“sub_account_id“).
	//
	// Deployment is per chain, so a valid protocol can still 422 on a given chain:
	// AAVE on Ethereum, Base, Arbitrum, BSC and HyperEVM (where it is Hyperlend, the
	// chain's Aave V3 deployment); MORPHO on Ethereum, Base, Arbitrum and HyperEVM
	// (where it is Felix); EULER on Ethereum, Base, Arbitrum and BSC.
	//
	// All three support “/v2/credit/loop“, “/v2/credit/unloop“,
	// “/v2/credit/looped_positions“ and “/v2/credit/rebalance“.
	Protocol *CreditProtocol `json:"protocol,omitzero"`
	// Euler only: the EVK vault the debt is owed to. Required when protocol=EULER.
	BorrowVault optionalnullable.OptionalNullable[string] `json:"borrow_vault,omitzero"`
	// Euler only: EVC sub-account (0–255) holding the debt to repay. Each sub-account is an independent Euler position with its own collateral, borrow controller, and health. Defaults to 0. Ignored for Aave/Morpho.
	SubAccountID *int64 `json:"sub_account_id,omitzero"`
	// Morpho only: the bytes32 market id (from /v2/credit/morpho_markets). Required when protocol=MORPHO.
	MarketID optionalnullable.OptionalNullable[string] `json:"market_id,omitzero"`
	// contains filtered or unexported fields
}

CreditRepayParams - Repay debt to Aave via Credit Account.

func (*CreditRepayParams) GetActionType

func (c *CreditRepayParams) GetActionType() *string

func (*CreditRepayParams) GetAmount

func (*CreditRepayParams) GetBorrowVault added in v0.1.27

func (*CreditRepayParams) GetInterestRateMode

func (c *CreditRepayParams) GetInterestRateMode() *InterestRateMode

func (*CreditRepayParams) GetMarketID added in v0.1.34

func (*CreditRepayParams) GetProtocol added in v0.1.27

func (c *CreditRepayParams) GetProtocol() *CreditProtocol

func (*CreditRepayParams) GetSubAccountID added in v0.1.41

func (c *CreditRepayParams) GetSubAccountID() *int64

func (*CreditRepayParams) GetToken

func (c *CreditRepayParams) GetToken() string

func (CreditRepayParams) MarshalJSON

func (c CreditRepayParams) MarshalJSON() ([]byte, error)

func (*CreditRepayParams) UnmarshalJSON

func (c *CreditRepayParams) UnmarshalJSON(data []byte) error

type CreditRepayParamsAmount

type CreditRepayParamsAmount struct {
	Number *float64 `queryParam:"inline" union:"member"`
	Str    *string  `queryParam:"inline" union:"member"`

	Type CreditRepayParamsAmountType
}

CreditRepayParamsAmount - Amount in token units to repay.

func CreateCreditRepayParamsAmountNumber

func CreateCreditRepayParamsAmountNumber(number float64) CreditRepayParamsAmount

func CreateCreditRepayParamsAmountStr

func CreateCreditRepayParamsAmountStr(str string) CreditRepayParamsAmount

func (CreditRepayParamsAmount) MarshalJSON

func (u CreditRepayParamsAmount) MarshalJSON() ([]byte, error)

func (*CreditRepayParamsAmount) UnmarshalJSON

func (u *CreditRepayParamsAmount) UnmarshalJSON(data []byte) (err error)

type CreditRepayParamsAmountType

type CreditRepayParamsAmountType string
const (
	CreditRepayParamsAmountTypeNumber CreditRepayParamsAmountType = "number"
	CreditRepayParamsAmountTypeStr    CreditRepayParamsAmountType = "str"
)

type CreditRepayRequest

type CreditRepayRequest struct {
	// The address that owns the Credit Account.
	Owner string `json:"owner"`
	// Blockchain network.
	Chain CreditRepayRequestChain `json:"chain"`
	// Which lending protocol a credit action targets.
	//
	// “AAVE“ is the default so existing callers (which never send a “protocol“
	// field) keep hitting the unchanged Aave code path; markets are named by token
	// symbol. “MORPHO“ identifies Morpho Blue lending markets by their bytes32
	// “market_id“. “EULER“ identifies Euler V2 markets by their EVK
	// “collateral_vault“ + “borrow_vault“ addresses and supports isolated
	// per-sub-account positions (“sub_account_id“).
	//
	// Deployment is per chain, so a valid protocol can still 422 on a given chain:
	// AAVE on Ethereum, Base, Arbitrum, BSC and HyperEVM (where it is Hyperlend, the
	// chain's Aave V3 deployment); MORPHO on Ethereum, Base, Arbitrum and HyperEVM
	// (where it is Felix); EULER on Ethereum, Base, Arbitrum and BSC.
	//
	// All three support “/v2/credit/loop“, “/v2/credit/unloop“,
	// “/v2/credit/looped_positions“ and “/v2/credit/rebalance“.
	Protocol *CreditProtocol `json:"protocol,omitzero"`
	// Euler only: the EVK vault the debt is owed to (repay target). Required when protocol=EULER.
	BorrowVault optionalnullable.OptionalNullable[string] `json:"borrow_vault,omitzero"`
	// Morpho only: the bytes32 market id (from /v2/credit/morpho_markets). Required when protocol=MORPHO.
	MarketID optionalnullable.OptionalNullable[string] `json:"market_id,omitzero"`
	// Euler only: the EVK collateral vault to withdraw from. Required when protocol=EULER and withdrawing collateral.
	CollateralVault optionalnullable.OptionalNullable[string] `json:"collateral_vault,omitzero"`
	// Euler only: EVC sub-account (0–255) holding the debt to repay. Each sub-account is an independent Euler position with its own collateral, borrow controller, and health. Defaults to 0. Ignored for Aave/Morpho.
	SubAccountID *int64 `json:"sub_account_id,omitzero"`
	// The borrowed asset to repay (e.g. WETH). Must match the debt position's token.
	RepayToken string `json:"repay_token"`
	// Amount of repay_token to repay (in token units, not wei).
	RepayAmount RepayAmount `json:"repay_amount"`
	// On AAVE there are 2 different interest modes.
	//
	// A stable (but typically higher rate), or a variable rate.
	InterestRateMode *InterestRateMode `json:"interest_rate_mode,omitzero"`
	// Collateral token to withdraw from Aave after repaying debt. Omit together with withdraw_amount for repay-only mode.
	WithdrawToken optionalnullable.OptionalNullable[string] `json:"withdraw_token,omitzero"`
	// Amount of collateral to withdraw (in token units, not wei). Omit together with withdraw_token for repay-only mode.
	WithdrawAmount optionalnullable.OptionalNullable[WithdrawAmount] `json:"withdraw_amount,omitzero"`
	// Desired output token. If different from withdraw_token, a swap is performed after withdrawal. If None, the withdrawn collateral is kept as-is.
	TokenOut optionalnullable.OptionalNullable[string] `json:"token_out,omitzero"`
	// Maximum slippage tolerance as a percentage (e.g., 0.5 = 0.5%). Only used when a swap is needed.
	Slippage *CreditRepayRequestSlippage `json:"slippage,omitzero"`
	// If true, returns EIP-712 signature data instead of an unsigned transaction.
	GasSponsorship *bool `json:"gas_sponsorship,omitzero"`
	// The EOA owner's signature of the Permit2 PermitTransferFrom typed data. When provided, the repay bundle will first pull repay_token from the owner's EOA into the Credit Account via Permit2. Obtain by calling /v2/credit/transfer and signing the returned EIP-712 data.
	Permit2Signature optionalnullable.OptionalNullable[string] `json:"permit2_signature,omitzero"`
	// The nonce used in the Permit2 signature (from the signed typed data).
	Permit2Nonce optionalnullable.OptionalNullable[int64] `json:"permit2_nonce,omitzero"`
	// The deadline timestamp used in the Permit2 signature (from the signed typed data).
	Permit2Deadline optionalnullable.OptionalNullable[int64] `json:"permit2_deadline,omitzero"`
}

func (*CreditRepayRequest) GetBorrowVault added in v0.1.27

func (*CreditRepayRequest) GetChain

func (*CreditRepayRequest) GetCollateralVault added in v0.1.27

func (*CreditRepayRequest) GetGasSponsorship

func (c *CreditRepayRequest) GetGasSponsorship() *bool

func (*CreditRepayRequest) GetInterestRateMode

func (c *CreditRepayRequest) GetInterestRateMode() *InterestRateMode

func (*CreditRepayRequest) GetMarketID added in v0.1.34

func (*CreditRepayRequest) GetOwner

func (c *CreditRepayRequest) GetOwner() string

func (*CreditRepayRequest) GetPermit2Deadline

func (c *CreditRepayRequest) GetPermit2Deadline() optionalnullable.OptionalNullable[int64]

func (*CreditRepayRequest) GetPermit2Nonce

func (*CreditRepayRequest) GetPermit2Signature

func (c *CreditRepayRequest) GetPermit2Signature() optionalnullable.OptionalNullable[string]

func (*CreditRepayRequest) GetProtocol added in v0.1.27

func (c *CreditRepayRequest) GetProtocol() *CreditProtocol

func (*CreditRepayRequest) GetRepayAmount

func (c *CreditRepayRequest) GetRepayAmount() RepayAmount

func (*CreditRepayRequest) GetRepayToken

func (c *CreditRepayRequest) GetRepayToken() string

func (*CreditRepayRequest) GetSlippage

func (*CreditRepayRequest) GetSubAccountID added in v0.1.41

func (c *CreditRepayRequest) GetSubAccountID() *int64

func (*CreditRepayRequest) GetTokenOut

func (*CreditRepayRequest) GetWithdrawAmount

func (*CreditRepayRequest) GetWithdrawToken

type CreditRepayRequestChain added in v0.1.53

type CreditRepayRequestChain string

CreditRepayRequestChain - Blockchain network.

const (
	CreditRepayRequestChainArbitrum CreditRepayRequestChain = "arbitrum"
	CreditRepayRequestChainBase     CreditRepayRequestChain = "base"
	CreditRepayRequestChainBsc      CreditRepayRequestChain = "bsc"
	CreditRepayRequestChainEthereum CreditRepayRequestChain = "ethereum"
	CreditRepayRequestChainHyperevm CreditRepayRequestChain = "hyperevm"
	CreditRepayRequestChainTempo    CreditRepayRequestChain = "tempo"
)

func (CreditRepayRequestChain) ToPointer added in v0.1.53

func (*CreditRepayRequestChain) UnmarshalJSON added in v0.1.53

func (e *CreditRepayRequestChain) UnmarshalJSON(data []byte) error

type CreditRepayRequestSlippage

type CreditRepayRequestSlippage struct {
	Number *float64 `queryParam:"inline" union:"member"`
	Str    *string  `queryParam:"inline" union:"member"`

	Type CreditRepayRequestSlippageType
}

CreditRepayRequestSlippage - Maximum slippage tolerance as a percentage (e.g., 0.5 = 0.5%). Only used when a swap is needed.

func CreateCreditRepayRequestSlippageNumber

func CreateCreditRepayRequestSlippageNumber(number float64) CreditRepayRequestSlippage

func CreateCreditRepayRequestSlippageStr

func CreateCreditRepayRequestSlippageStr(str string) CreditRepayRequestSlippage

func (CreditRepayRequestSlippage) MarshalJSON

func (u CreditRepayRequestSlippage) MarshalJSON() ([]byte, error)

func (*CreditRepayRequestSlippage) UnmarshalJSON

func (u *CreditRepayRequestSlippage) UnmarshalJSON(data []byte) (err error)

type CreditRepayRequestSlippageType

type CreditRepayRequestSlippageType string
const (
	CreditRepayRequestSlippageTypeNumber CreditRepayRequestSlippageType = "number"
	CreditRepayRequestSlippageTypeStr    CreditRepayRequestSlippageType = "str"
)

type CreditRepayResponse

type CreditRepayResponse struct {
	// Unsigned transaction to execute the repay bundle. Present when gas_sponsorship is false.
	Transaction optionalnullable.OptionalNullable[UnsignedTransaction] `json:"transaction,omitzero"`
	// EIP-712 typed data for gas-sponsored execution. Present when gas_sponsorship is true.
	Eip712 optionalnullable.OptionalNullable[BatchedSafeOperationsResponseOutput] `json:"eip_712,omitzero"`
	// Estimated amount of token_out received from swap. Only present when token_out differs from withdraw_token.
	EstimatedTokenOutAmount optionalnullable.OptionalNullable[string] `json:"estimated_token_out_amount,omitzero"`
}

func (*CreditRepayResponse) GetEstimatedTokenOutAmount

func (c *CreditRepayResponse) GetEstimatedTokenOutAmount() optionalnullable.OptionalNullable[string]

func (*CreditRepayResponse) GetTransaction

func (CreditRepayResponse) MarshalJSON

func (c CreditRepayResponse) MarshalJSON() ([]byte, error)

func (*CreditRepayResponse) UnmarshalJSON

func (c *CreditRepayResponse) UnmarshalJSON(data []byte) error

type CreditSupplyParams

type CreditSupplyParams struct {

	// Collateral token to supply.
	Token string `json:"token"`
	// Amount in token units to supply.
	Amount CreditSupplyParamsAmount `json:"amount"`
	// Which lending protocol a credit action targets.
	//
	// “AAVE“ is the default so existing callers (which never send a “protocol“
	// field) keep hitting the unchanged Aave code path; markets are named by token
	// symbol. “MORPHO“ identifies Morpho Blue lending markets by their bytes32
	// “market_id“. “EULER“ identifies Euler V2 markets by their EVK
	// “collateral_vault“ + “borrow_vault“ addresses and supports isolated
	// per-sub-account positions (“sub_account_id“).
	//
	// Deployment is per chain, so a valid protocol can still 422 on a given chain:
	// AAVE on Ethereum, Base, Arbitrum, BSC and HyperEVM (where it is Hyperlend, the
	// chain's Aave V3 deployment); MORPHO on Ethereum, Base, Arbitrum and HyperEVM
	// (where it is Felix); EULER on Ethereum, Base, Arbitrum and BSC.
	//
	// All three support “/v2/credit/loop“, “/v2/credit/unloop“,
	// “/v2/credit/looped_positions“ and “/v2/credit/rebalance“.
	Protocol *CreditProtocol `json:"protocol,omitzero"`
	// Euler only: the EVK collateral vault to supply into. Required when protocol=EULER.
	CollateralVault optionalnullable.OptionalNullable[string] `json:"collateral_vault,omitzero"`
	// Euler only: EVC sub-account (0–255) to isolate this position. Each sub-account is an independent Euler position with its own collateral, borrow controller, and health. Defaults to 0. Ignored for Aave/Morpho.
	SubAccountID *int64 `json:"sub_account_id,omitzero"`
	// Morpho only: the bytes32 market id (from /v2/credit/morpho_markets). Required when protocol=MORPHO.
	MarketID optionalnullable.OptionalNullable[string] `json:"market_id,omitzero"`
	// contains filtered or unexported fields
}

CreditSupplyParams - Supply collateral to Aave via Credit Account.

func (*CreditSupplyParams) GetActionType

func (c *CreditSupplyParams) GetActionType() *string

func (*CreditSupplyParams) GetAmount

func (*CreditSupplyParams) GetCollateralVault added in v0.1.27

func (*CreditSupplyParams) GetMarketID added in v0.1.34

func (*CreditSupplyParams) GetProtocol added in v0.1.27

func (c *CreditSupplyParams) GetProtocol() *CreditProtocol

func (*CreditSupplyParams) GetSubAccountID added in v0.1.41

func (c *CreditSupplyParams) GetSubAccountID() *int64

func (*CreditSupplyParams) GetToken

func (c *CreditSupplyParams) GetToken() string

func (CreditSupplyParams) MarshalJSON

func (c CreditSupplyParams) MarshalJSON() ([]byte, error)

func (*CreditSupplyParams) UnmarshalJSON

func (c *CreditSupplyParams) UnmarshalJSON(data []byte) error

type CreditSupplyParamsAmount

type CreditSupplyParamsAmount struct {
	Number *float64 `queryParam:"inline" union:"member"`
	Str    *string  `queryParam:"inline" union:"member"`

	Type CreditSupplyParamsAmountType
}

CreditSupplyParamsAmount - Amount in token units to supply.

func CreateCreditSupplyParamsAmountNumber

func CreateCreditSupplyParamsAmountNumber(number float64) CreditSupplyParamsAmount

func CreateCreditSupplyParamsAmountStr

func CreateCreditSupplyParamsAmountStr(str string) CreditSupplyParamsAmount

func (CreditSupplyParamsAmount) MarshalJSON

func (u CreditSupplyParamsAmount) MarshalJSON() ([]byte, error)

func (*CreditSupplyParamsAmount) UnmarshalJSON

func (u *CreditSupplyParamsAmount) UnmarshalJSON(data []byte) (err error)

type CreditSupplyParamsAmountType

type CreditSupplyParamsAmountType string
const (
	CreditSupplyParamsAmountTypeNumber CreditSupplyParamsAmountType = "number"
	CreditSupplyParamsAmountTypeStr    CreditSupplyParamsAmountType = "str"
)

type CreditSwapRequest added in v0.1.68

type CreditSwapRequest struct {

	// Token to sell (input). Provide a token symbol from a limited set (e.g., 'USDC') or any token address.
	TokenIn string `json:"token_in"`
	// Token to buy (output). Provide a token symbol from a limited set (e.g., 'USDT') or any token address.
	TokenOut string `json:"token_out"`
	// Human-readable amount of `token_in` to swap (token units, not wei).
	AmountIn CreditSwapRequestAmountIn `json:"amount_in"`
	// Maximum slippage tolerance as a percentage (e.g., 0.5 = 0.5%). Bounds the market route only; a firm quote fills exactly and ignores it.
	Slippage *CreditSwapRequestSlippage `json:"slippage,omitzero"`
	// The owner's wallet address. Their Credit Account must already exist (create it with `/v2/credit/create_account`) and hold `token_in` (deposit with `/v2/credit/transfer`).
	Owner string `json:"owner"`
	// Target blockchain network where the swap will execute.
	Chain CreditSwapRequestChain `json:"chain"`
	// Optionally request gas sponsorship. If `true`, EIP-712 typed data will be returned that must be signed by the `owner` and submitted to the 'Prepare gas-sponsored transaction' endpoint (`/gas_sponsorship/prepare`). Gas-sponsored builds always execute at market rate.
	GasSponsorship *bool `json:"gas_sponsorship,omitzero"`
	// If true, build a display ESTIMATE: no firm RFQ quote is ever requested (quote_expires_at stays null). NOTE that this guarantees only that no firm quote was spent — it does not guarantee an absent payload: under 'auto' when the firm provider does not cover or cannot currently price the pair, and always under pricing=market, the call falls through to the aggregator and returns a signable market build (an unsigned transaction, or EIP-712 typed data when gas_sponsorship=true), without requiring the account to hold token_in yet. How the estimate is priced follows `pricing`: on a firm-covered pair whose size the firm provider's live price levels can serve, 'auto' and 'firm' price it from those levels (indicative, transaction stays null — re-call with preview=false for the signable build); otherwise it comes from the market build above (pricing='firm' instead refuses with a typed error). Set it on every call made while a user is exploring parameters, and leave it false only for the build they actually intend to sign — firm quotes are single-use maker commitments, and requesting them for displays that are never executed degrades the pricing this API is offered.
	Preview *bool `json:"preview,omitzero"`
	// Swap routing policy. 'auto': a firm zero-slippage quote when a firm venue covers the pair, transparent fallback to the market aggregator otherwise. 'firm': never price on the market route; an uncovered pair fails with a typed error instead of silently substituting market pricing — previews included: a preview the firm provider's live price levels cannot price returns the same typed error rather than market numbers. 'market': never route through the firm venue; the swap is priced by the aggregator and bounded by `slippage` (which firm fills ignore). 'firm' is incompatible with gas_sponsorship (sponsored swaps force market routing).
	Pricing *CreditSwapRequestPricing `json:"pricing,omitzero"`
	// contains filtered or unexported fields
}

CreditSwapRequest - Swap one token held in the Credit Account for another, in a single atomic transaction, at a firm quote where one covers the pair and at market rate otherwise.

func (*CreditSwapRequest) GetActionType added in v0.1.68

func (c *CreditSwapRequest) GetActionType() *string

func (*CreditSwapRequest) GetAmountIn added in v0.1.68

func (*CreditSwapRequest) GetChain added in v0.1.68

func (*CreditSwapRequest) GetGasSponsorship added in v0.1.68

func (c *CreditSwapRequest) GetGasSponsorship() *bool

func (*CreditSwapRequest) GetOwner added in v0.1.68

func (c *CreditSwapRequest) GetOwner() string

func (*CreditSwapRequest) GetPreview added in v0.1.68

func (c *CreditSwapRequest) GetPreview() *bool

func (*CreditSwapRequest) GetPricing added in v0.1.68

func (*CreditSwapRequest) GetSlippage added in v0.1.68

func (c *CreditSwapRequest) GetSlippage() *CreditSwapRequestSlippage

func (*CreditSwapRequest) GetTokenIn added in v0.1.68

func (c *CreditSwapRequest) GetTokenIn() string

func (*CreditSwapRequest) GetTokenOut added in v0.1.68

func (c *CreditSwapRequest) GetTokenOut() string

func (CreditSwapRequest) MarshalJSON added in v0.1.68

func (c CreditSwapRequest) MarshalJSON() ([]byte, error)

func (*CreditSwapRequest) UnmarshalJSON added in v0.1.68

func (c *CreditSwapRequest) UnmarshalJSON(data []byte) error

type CreditSwapRequestAmountIn added in v0.1.68

type CreditSwapRequestAmountIn struct {
	Number *float64 `queryParam:"inline" union:"member"`
	Str    *string  `queryParam:"inline" union:"member"`

	Type CreditSwapRequestAmountInType
}

CreditSwapRequestAmountIn - Human-readable amount of `token_in` to swap (token units, not wei).

func CreateCreditSwapRequestAmountInNumber added in v0.1.68

func CreateCreditSwapRequestAmountInNumber(number float64) CreditSwapRequestAmountIn

func CreateCreditSwapRequestAmountInStr added in v0.1.68

func CreateCreditSwapRequestAmountInStr(str string) CreditSwapRequestAmountIn

func (CreditSwapRequestAmountIn) MarshalJSON added in v0.1.68

func (u CreditSwapRequestAmountIn) MarshalJSON() ([]byte, error)

func (*CreditSwapRequestAmountIn) UnmarshalJSON added in v0.1.68

func (u *CreditSwapRequestAmountIn) UnmarshalJSON(data []byte) (err error)

type CreditSwapRequestAmountInType added in v0.1.68

type CreditSwapRequestAmountInType string
const (
	CreditSwapRequestAmountInTypeNumber CreditSwapRequestAmountInType = "number"
	CreditSwapRequestAmountInTypeStr    CreditSwapRequestAmountInType = "str"
)

type CreditSwapRequestChain added in v0.1.68

type CreditSwapRequestChain string

CreditSwapRequestChain - Target blockchain network where the swap will execute.

const (
	CreditSwapRequestChainArbitrum CreditSwapRequestChain = "arbitrum"
	CreditSwapRequestChainBase     CreditSwapRequestChain = "base"
	CreditSwapRequestChainBsc      CreditSwapRequestChain = "bsc"
	CreditSwapRequestChainEthereum CreditSwapRequestChain = "ethereum"
	CreditSwapRequestChainHyperevm CreditSwapRequestChain = "hyperevm"
	CreditSwapRequestChainTempo    CreditSwapRequestChain = "tempo"
)

func (CreditSwapRequestChain) ToPointer added in v0.1.68

func (*CreditSwapRequestChain) UnmarshalJSON added in v0.1.68

func (e *CreditSwapRequestChain) UnmarshalJSON(data []byte) error

type CreditSwapRequestPricing added in v0.1.68

type CreditSwapRequestPricing string

CreditSwapRequestPricing - Swap routing policy. 'auto': a firm zero-slippage quote when a firm venue covers the pair, transparent fallback to the market aggregator otherwise. 'firm': never price on the market route; an uncovered pair fails with a typed error instead of silently substituting market pricing — previews included: a preview the firm provider's live price levels cannot price returns the same typed error rather than market numbers. 'market': never route through the firm venue; the swap is priced by the aggregator and bounded by `slippage` (which firm fills ignore). 'firm' is incompatible with gas_sponsorship (sponsored swaps force market routing).

const (
	CreditSwapRequestPricingAuto   CreditSwapRequestPricing = "auto"
	CreditSwapRequestPricingFirm   CreditSwapRequestPricing = "firm"
	CreditSwapRequestPricingMarket CreditSwapRequestPricing = "market"
)

func (CreditSwapRequestPricing) ToPointer added in v0.1.68

func (*CreditSwapRequestPricing) UnmarshalJSON added in v0.1.68

func (e *CreditSwapRequestPricing) UnmarshalJSON(data []byte) error

type CreditSwapRequestSlippage added in v0.1.68

type CreditSwapRequestSlippage struct {
	Number *float64 `queryParam:"inline" union:"member"`
	Str    *string  `queryParam:"inline" union:"member"`

	Type CreditSwapRequestSlippageType
}

CreditSwapRequestSlippage - Maximum slippage tolerance as a percentage (e.g., 0.5 = 0.5%). Bounds the market route only; a firm quote fills exactly and ignores it.

func CreateCreditSwapRequestSlippageNumber added in v0.1.68

func CreateCreditSwapRequestSlippageNumber(number float64) CreditSwapRequestSlippage

func CreateCreditSwapRequestSlippageStr added in v0.1.68

func CreateCreditSwapRequestSlippageStr(str string) CreditSwapRequestSlippage

func (CreditSwapRequestSlippage) MarshalJSON added in v0.1.68

func (u CreditSwapRequestSlippage) MarshalJSON() ([]byte, error)

func (*CreditSwapRequestSlippage) UnmarshalJSON added in v0.1.68

func (u *CreditSwapRequestSlippage) UnmarshalJSON(data []byte) (err error)

type CreditSwapRequestSlippageType added in v0.1.68

type CreditSwapRequestSlippageType string
const (
	CreditSwapRequestSlippageTypeNumber CreditSwapRequestSlippageType = "number"
	CreditSwapRequestSlippageTypeStr    CreditSwapRequestSlippageType = "str"
)

type CreditSwapResponse added in v0.1.68

type CreditSwapResponse struct {
	// Unsigned transaction for direct execution. Present when gas_sponsorship=false — except firm-priced previews (preview=true responses reporting swap_provider='firm'), which carry the estimate only: the firm quote is fetched at execution time, so there is no payload to sign yet. A preview whose response reports swap_provider='market' does carry this signable payload.
	Transaction optionalnullable.OptionalNullable[UnsignedTransaction] `json:"transaction,omitzero"`
	// EIP-712 typed data for gas-sponsored execution. Present when gas_sponsorship=true.
	Eip712 optionalnullable.OptionalNullable[BatchedSafeOperationsResponseOutput] `json:"eip_712,omitzero"`
	// Estimated amount of output token received from the swap. Exact on executable firm builds (a firm quote fills at this amount or reverts). On market builds it is a quote-time estimate, and `slippage` sets how far below it the transaction's enforced minimum output sits. On preview=true responses reporting 'firm' it is INDICATIVE — computed from the firm provider's live price levels without spending a quote.
	EstimatedAmountOut string `json:"estimated_amount_out"`
	// Identifies which route priced the swap. 'market': a DEX aggregator, slippage-bounded. 'firm': a zero-slippage quote that fills exactly or reverts. On preview=true responses 'firm' means the estimate is INDICATIVE, computed from live maker price levels without spending any quote; execution fetches the firm quote at signing time. Always present. This is the authoritative firm-vs-market signal and clients do need to read it: `pricing` is only what was REQUESTED, and under 'auto' a firm build can fall back to market transparently.
	SwapProvider *CreditSwapResponseSwapProvider `json:"swap_provider,omitzero"`
	// Deadline of the firm swap quote. Sign and broadcast before it or the transaction reverts on-chain; refresh by re-calling this endpoint (discard the previous payload). Null on market builds and on every preview (a preview never holds a firm quote).
	QuoteExpiresAt optionalnullable.OptionalNullable[time.Time] `json:"quote_expires_at,omitzero"`
}

CreditSwapResponse - The swap transaction to sign, plus which route priced it and how long that price holds.

func (*CreditSwapResponse) GetEip712 added in v0.1.68

func (*CreditSwapResponse) GetEstimatedAmountOut added in v0.1.68

func (c *CreditSwapResponse) GetEstimatedAmountOut() string

func (*CreditSwapResponse) GetQuoteExpiresAt added in v0.1.68

func (*CreditSwapResponse) GetSwapProvider added in v0.1.68

func (c *CreditSwapResponse) GetSwapProvider() *CreditSwapResponseSwapProvider

func (*CreditSwapResponse) GetTransaction added in v0.1.68

func (CreditSwapResponse) MarshalJSON added in v0.1.68

func (c CreditSwapResponse) MarshalJSON() ([]byte, error)

func (*CreditSwapResponse) UnmarshalJSON added in v0.1.68

func (c *CreditSwapResponse) UnmarshalJSON(data []byte) error

type CreditSwapResponseSwapProvider added in v0.1.68

type CreditSwapResponseSwapProvider string

CreditSwapResponseSwapProvider - Identifies which route priced the swap. 'market': a DEX aggregator, slippage-bounded. 'firm': a zero-slippage quote that fills exactly or reverts. On preview=true responses 'firm' means the estimate is INDICATIVE, computed from live maker price levels without spending any quote; execution fetches the firm quote at signing time. Always present. This is the authoritative firm-vs-market signal and clients do need to read it: `pricing` is only what was REQUESTED, and under 'auto' a firm build can fall back to market transparently.

const (
	CreditSwapResponseSwapProviderMarket CreditSwapResponseSwapProvider = "market"
	CreditSwapResponseSwapProviderFirm   CreditSwapResponseSwapProvider = "firm"
)

func (*CreditSwapResponseSwapProvider) IsExact added in v0.1.68

func (e *CreditSwapResponseSwapProvider) IsExact() bool

IsExact returns true if the value matches a known enum value, false otherwise.

func (CreditSwapResponseSwapProvider) ToPointer added in v0.1.68

type CreditTransferRequest

type CreditTransferRequest struct {
	// The owner's wallet address (EOA).
	Owner string `json:"owner"`
	// Blockchain network.
	Chain CreditTransferRequestChain `json:"chain"`
	// The token to transfer.
	Token string `json:"token"`
	// The amount of tokens to transfer (in token units, not wei).
	Amount CreditTransferRequestAmount `json:"amount"`
	// Whether you are depositing to or withdrawing from your credit account.
	Action CreditTransferRequestAction `json:"action"`
	// Optionally request gas sponsorship. If set to `true`, EIP-712 signature data will be returned that must be signed by the `owner` and submitted to the `/gas_sponsorship/prepare` endpoint.
	GasSponsorship *bool `json:"gas_sponsorship,omitzero"`
	// The address that will call Permit2's permitTransferFrom to execute the transfer. When `action` is 'DEPOSIT' and `gas_sponsorship` is `true`: - If provided, the signature will authorize this address (typically a gas sponsor) to pull tokens. - If not provided, defaults to the Credit Account (Safe) address, allowing the transfer to be included in a bundle transaction where the Safe pulls the tokens itself.
	Spender optionalnullable.OptionalNullable[string] `json:"spender,omitzero"`
}

func (*CreditTransferRequest) GetAction

func (*CreditTransferRequest) GetAmount

func (*CreditTransferRequest) GetChain

func (*CreditTransferRequest) GetGasSponsorship

func (c *CreditTransferRequest) GetGasSponsorship() *bool

func (*CreditTransferRequest) GetOwner

func (c *CreditTransferRequest) GetOwner() string

func (*CreditTransferRequest) GetSpender

func (*CreditTransferRequest) GetToken

func (c *CreditTransferRequest) GetToken() string

type CreditTransferRequestAction

type CreditTransferRequestAction string

CreditTransferRequestAction - Whether you are depositing to or withdrawing from your credit account.

const (
	CreditTransferRequestActionDeposit  CreditTransferRequestAction = "DEPOSIT"
	CreditTransferRequestActionWithdraw CreditTransferRequestAction = "WITHDRAW"
)

func (CreditTransferRequestAction) ToPointer

func (*CreditTransferRequestAction) UnmarshalJSON

func (e *CreditTransferRequestAction) UnmarshalJSON(data []byte) error

type CreditTransferRequestAmount

type CreditTransferRequestAmount struct {
	Number *float64 `queryParam:"inline" union:"member"`
	Str    *string  `queryParam:"inline" union:"member"`

	Type CreditTransferRequestAmountType
}

CreditTransferRequestAmount - The amount of tokens to transfer (in token units, not wei).

func CreateCreditTransferRequestAmountNumber

func CreateCreditTransferRequestAmountNumber(number float64) CreditTransferRequestAmount

func CreateCreditTransferRequestAmountStr

func CreateCreditTransferRequestAmountStr(str string) CreditTransferRequestAmount

func (CreditTransferRequestAmount) MarshalJSON

func (u CreditTransferRequestAmount) MarshalJSON() ([]byte, error)

func (*CreditTransferRequestAmount) UnmarshalJSON

func (u *CreditTransferRequestAmount) UnmarshalJSON(data []byte) (err error)

type CreditTransferRequestAmountType

type CreditTransferRequestAmountType string
const (
	CreditTransferRequestAmountTypeNumber CreditTransferRequestAmountType = "number"
	CreditTransferRequestAmountTypeStr    CreditTransferRequestAmountType = "str"
)

type CreditTransferRequestChain added in v0.1.53

type CreditTransferRequestChain string

CreditTransferRequestChain - Blockchain network.

const (
	CreditTransferRequestChainArbitrum CreditTransferRequestChain = "arbitrum"
	CreditTransferRequestChainBase     CreditTransferRequestChain = "base"
	CreditTransferRequestChainBsc      CreditTransferRequestChain = "bsc"
	CreditTransferRequestChainEthereum CreditTransferRequestChain = "ethereum"
	CreditTransferRequestChainHyperevm CreditTransferRequestChain = "hyperevm"
	CreditTransferRequestChainTempo    CreditTransferRequestChain = "tempo"
)

func (CreditTransferRequestChain) ToPointer added in v0.1.53

func (*CreditTransferRequestChain) UnmarshalJSON added in v0.1.53

func (e *CreditTransferRequestChain) UnmarshalJSON(data []byte) error

type CreditTransferResponse

type CreditTransferResponse struct {
	Transaction optionalnullable.OptionalNullable[UnsignedTransaction]          `json:"transaction,omitzero"`
	Eip712      optionalnullable.OptionalNullable[CreditTransferResponseEip712] `json:"eip_712,omitzero"`
}

func (*CreditTransferResponse) GetTransaction

func (CreditTransferResponse) MarshalJSON

func (c CreditTransferResponse) MarshalJSON() ([]byte, error)

func (*CreditTransferResponse) UnmarshalJSON

func (c *CreditTransferResponse) UnmarshalJSON(data []byte) error

type CreditTransferResponseEip712

type CreditTransferResponseEip712 struct {
	BatchedSafeOperationsResponseOutput *BatchedSafeOperationsResponseOutput `queryParam:"inline" union:"member"`
	Permit2TypedDataOutput              *Permit2TypedDataOutput              `queryParam:"inline" union:"member"`
	UnknownRaw                          json.RawMessage                      `json:"-" union:"unknown"`

	Type CreditTransferResponseEip712Type
}

func CreateCreditTransferResponseEip712BatchedSafeOperationsResponseOutput

func CreateCreditTransferResponseEip712BatchedSafeOperationsResponseOutput(batchedSafeOperationsResponseOutput BatchedSafeOperationsResponseOutput) CreditTransferResponseEip712

func CreateCreditTransferResponseEip712Permit2TypedDataOutput

func CreateCreditTransferResponseEip712Permit2TypedDataOutput(permit2TypedDataOutput Permit2TypedDataOutput) CreditTransferResponseEip712

func CreateCreditTransferResponseEip712Unknown

func CreateCreditTransferResponseEip712Unknown(raw json.RawMessage) CreditTransferResponseEip712

func (CreditTransferResponseEip712) GetUnknownRaw

func (u CreditTransferResponseEip712) GetUnknownRaw() json.RawMessage

func (CreditTransferResponseEip712) IsUnknown

func (u CreditTransferResponseEip712) IsUnknown() bool

func (CreditTransferResponseEip712) MarshalJSON

func (u CreditTransferResponseEip712) MarshalJSON() ([]byte, error)

func (*CreditTransferResponseEip712) UnmarshalJSON

func (u *CreditTransferResponseEip712) UnmarshalJSON(data []byte) error

type CreditTransferResponseEip712Type

type CreditTransferResponseEip712Type string
const (
	CreditTransferResponseEip712TypeBatchedSafeOperationsResponseOutput CreditTransferResponseEip712Type = "BatchedSafeOperationsResponse-Output"
	CreditTransferResponseEip712TypePermit2TypedDataOutput              CreditTransferResponseEip712Type = "Permit2TypedData-Output"
	CreditTransferResponseEip712TypeUnknown                             CreditTransferResponseEip712Type = "Unknown"
)

type CreditTransferToAddressParams

type CreditTransferToAddressParams struct {

	// The ERC20 token to transfer from the Credit Account.
	Token string `json:"token"`
	// The amount of tokens to transfer (in token units, not wei).
	Amount CreditTransferToAddressParamsAmount `json:"amount"`
	// The destination address to receive the tokens.
	Recipient string `json:"recipient"`
	// contains filtered or unexported fields
}

CreditTransferToAddressParams - Transfer tokens from Credit Account to an arbitrary address.

Requires all debt positions to be fully repaid (totalDebtBase == 0) before the transfer is allowed.

func (*CreditTransferToAddressParams) GetActionType

func (c *CreditTransferToAddressParams) GetActionType() *string

func (*CreditTransferToAddressParams) GetAmount

func (*CreditTransferToAddressParams) GetRecipient

func (c *CreditTransferToAddressParams) GetRecipient() string

func (*CreditTransferToAddressParams) GetToken

func (c *CreditTransferToAddressParams) GetToken() string

func (CreditTransferToAddressParams) MarshalJSON

func (c CreditTransferToAddressParams) MarshalJSON() ([]byte, error)

func (*CreditTransferToAddressParams) UnmarshalJSON

func (c *CreditTransferToAddressParams) UnmarshalJSON(data []byte) error

type CreditTransferToAddressParamsAmount

type CreditTransferToAddressParamsAmount struct {
	Number *float64 `queryParam:"inline" union:"member"`
	Str    *string  `queryParam:"inline" union:"member"`

	Type CreditTransferToAddressParamsAmountType
}

CreditTransferToAddressParamsAmount - The amount of tokens to transfer (in token units, not wei).

func CreateCreditTransferToAddressParamsAmountNumber

func CreateCreditTransferToAddressParamsAmountNumber(number float64) CreditTransferToAddressParamsAmount

func CreateCreditTransferToAddressParamsAmountStr

func CreateCreditTransferToAddressParamsAmountStr(str string) CreditTransferToAddressParamsAmount

func (CreditTransferToAddressParamsAmount) MarshalJSON

func (u CreditTransferToAddressParamsAmount) MarshalJSON() ([]byte, error)

func (*CreditTransferToAddressParamsAmount) UnmarshalJSON

func (u *CreditTransferToAddressParamsAmount) UnmarshalJSON(data []byte) (err error)

type CreditTransferToAddressParamsAmountType

type CreditTransferToAddressParamsAmountType string
const (
	CreditTransferToAddressParamsAmountTypeNumber CreditTransferToAddressParamsAmountType = "number"
	CreditTransferToAddressParamsAmountTypeStr    CreditTransferToAddressParamsAmountType = "str"
)

type CreditUnloopPreview added in v0.1.35

type CreditUnloopPreview struct {
	// Number of swap-bearing unwind iterations bundled (the final collateral sweep leg does not count).
	Iterations int64 `json:"iterations"`
	// Guaranteed minimum total collateral withdrawn (token units).
	TotalCollateralWithdrawn string `json:"total_collateral_withdrawn"`
	// Guaranteed minimum total debt repaid (borrow-token units); actual can only be higher (swap fills above the floor repay more).
	TotalDebtRepaid string `json:"total_debt_repaid"`
	// Pair collateral left supplied after the unwind (token units). On a full close this is 0 when the sweep can take everything; when the final sweep must be an exact amount (non-pair Aave debt needs backing, or a shared reserve caps it) this reports the residual left supplied, including a dust-scale rounding margin.
	EndingCollateral string `json:"ending_collateral"`
	// Projected remaining debt (borrow-token units); 0 on a full close.
	EndingDebt string `json:"ending_debt"`
	// Projected leverage after the unwind; 1 when the debt is cleared. Never promises more deleverage than is guaranteed.
	EndingMultiplier string `json:"ending_multiplier"`
	// Projected end loan-to-value in percent, at the sizing oracle prices; 0 when the debt is cleared.
	ProjectedLtv string `json:"projected_ltv"`
	// Projected health factor (Aave account-level / Morpho market-level). Never overstated at the 1.0 boundary.
	ProjectedHealthFactor string `json:"projected_health_factor"`
	// Upper bound of borrow-token surplus the unwind can leave in the Credit Account — the sum of each swap's quote minus its guaranteed floor plus the full-close overshoot. It accumulates in the Credit Account, is recoverable, and is never lost.
	EstimatedMaxDust string `json:"estimated_max_dust"`
	// True when the requested target was fully reached in this transaction. False on a partial-progress plan (allow_partial=true) — call unloop again to finish.
	FullyUnwound bool `json:"fully_unwound"`
	// Per-iteration breakdown.
	Legs []UnloopLegPreview `json:"legs,omitzero"`
}

CreditUnloopPreview - Projected end state of the unwind, computed on GUARANTEED swap floors.

func (*CreditUnloopPreview) GetEndingCollateral added in v0.1.35

func (c *CreditUnloopPreview) GetEndingCollateral() string

func (*CreditUnloopPreview) GetEndingDebt added in v0.1.35

func (c *CreditUnloopPreview) GetEndingDebt() string

func (*CreditUnloopPreview) GetEndingMultiplier added in v0.1.35

func (c *CreditUnloopPreview) GetEndingMultiplier() string

func (*CreditUnloopPreview) GetEstimatedMaxDust added in v0.1.35

func (c *CreditUnloopPreview) GetEstimatedMaxDust() string

func (*CreditUnloopPreview) GetFullyUnwound added in v0.1.35

func (c *CreditUnloopPreview) GetFullyUnwound() bool

func (*CreditUnloopPreview) GetIterations added in v0.1.35

func (c *CreditUnloopPreview) GetIterations() int64

func (*CreditUnloopPreview) GetLegs added in v0.1.35

func (c *CreditUnloopPreview) GetLegs() []UnloopLegPreview

func (*CreditUnloopPreview) GetProjectedHealthFactor added in v0.1.35

func (c *CreditUnloopPreview) GetProjectedHealthFactor() string

func (*CreditUnloopPreview) GetProjectedLtv added in v0.1.35

func (c *CreditUnloopPreview) GetProjectedLtv() string

func (*CreditUnloopPreview) GetTotalCollateralWithdrawn added in v0.1.35

func (c *CreditUnloopPreview) GetTotalCollateralWithdrawn() string

func (*CreditUnloopPreview) GetTotalDebtRepaid added in v0.1.35

func (c *CreditUnloopPreview) GetTotalDebtRepaid() string

func (CreditUnloopPreview) MarshalJSON added in v0.1.35

func (c CreditUnloopPreview) MarshalJSON() ([]byte, error)

func (*CreditUnloopPreview) UnmarshalJSON added in v0.1.35

func (c *CreditUnloopPreview) UnmarshalJSON(data []byte) error

type CreditUnloopRequest added in v0.1.35

type CreditUnloopRequest struct {
	// The address that owns the Credit Account.
	Owner string `json:"owner"`
	// Blockchain network. Not every protocol is deployed on every chain — see the protocol field — and a chain with no credit venue at all returns a 422 naming the chains that do.
	Chain CreditUnloopRequestChain `json:"chain"`
	// Which lending protocol a credit action targets.
	//
	// “AAVE“ is the default so existing callers (which never send a “protocol“
	// field) keep hitting the unchanged Aave code path; markets are named by token
	// symbol. “MORPHO“ identifies Morpho Blue lending markets by their bytes32
	// “market_id“. “EULER“ identifies Euler V2 markets by their EVK
	// “collateral_vault“ + “borrow_vault“ addresses and supports isolated
	// per-sub-account positions (“sub_account_id“).
	//
	// Deployment is per chain, so a valid protocol can still 422 on a given chain:
	// AAVE on Ethereum, Base, Arbitrum, BSC and HyperEVM (where it is Hyperlend, the
	// chain's Aave V3 deployment); MORPHO on Ethereum, Base, Arbitrum and HyperEVM
	// (where it is Felix); EULER on Ethereum, Base, Arbitrum and BSC.
	//
	// All three support “/v2/credit/loop“, “/v2/credit/unloop“,
	// “/v2/credit/looped_positions“ and “/v2/credit/rebalance“.
	Protocol *CreditProtocol `json:"protocol,omitzero"`
	// Morpho only: the bytes32 market id (from /v2/credit/morpho_markets). Required when protocol=MORPHO.
	MarketID optionalnullable.OptionalNullable[string] `json:"market_id,omitzero"`
	// Euler only: the EVK vault the loop's collateral is in. Required when protocol=EULER.
	CollateralVault optionalnullable.OptionalNullable[string] `json:"collateral_vault,omitzero"`
	// Euler only: the EVK vault the loop borrowed from (the sub-account's controller). Required when protocol=EULER.
	BorrowVault optionalnullable.OptionalNullable[string] `json:"borrow_vault,omitzero"`
	// Euler only: the EVC sub-account (0-255) holding the looped position to unwind. 0 is the Credit Account itself.
	SubAccountID *int64 `json:"sub_account_id,omitzero"`
	// Token supplied as collateral in the loop being unwound. For MORPHO it must be the market's collateral token.
	CollateralToken string `json:"collateral_token"`
	// Token borrowed in the loop; withdrawn collateral is swapped back to it and used to repay. For MORPHO it must be the market's loan token.
	BorrowToken string `json:"borrow_token"`
	// Target leverage after the unwind. Omit (null) for a FULL unwind: the debt is cleared exactly — accrued interest included — and all pair collateral is withdrawn back to the Credit Account. `1` runs the same exact debt close but leaves the collateral supplied (earning). A value greater than 1 delevers the position to that multiplier. Must be below the position's current multiplier.
	TargetMultiplier optionalnullable.OptionalNullable[CreditUnloopRequestTargetMultiplier] `json:"target_multiplier,omitzero"`
	// Per-swap slippage tolerance in percent. Unwind dust is bounded by this per iteration, so tighter slippage means less dust.
	MaxSlippagePercent *CreditUnloopRequestMaxSlippagePercent `json:"max_slippage_percent,omitzero"`
	// If the target cannot be reached in one transaction, return the maximum-progress plan (preview.fully_unwound=false) instead of a 400. This can happen because every withdrawal is sized to keep the health factor at or above 1.02 at that step, so a position opened very close to its liquidation threshold runs out of headroom before the target is met. A second unloop call, now from a much lower leverage, finishes the job.
	AllowPartial *bool `json:"allow_partial,omitzero"`
	// If true, returns EIP-712 typed data for gas-sponsored execution instead of an unsigned transaction.
	GasSponsorship *bool `json:"gas_sponsorship,omitzero"`
	// If true, build a display estimate only — no single-use firm quote is ever spent. NOTE that this guarantees only that no firm quote was spent — it does not guarantee an absent transaction: on an unwind no firm provider covers, and under pricing=market, the call still falls through to the aggregator and returns a signable transaction. On a firm-covered unwind (pricing 'auto' or 'firm') the numbers are firm-INDICATIVE, priced off the firm provider's live maker levels; otherwise they are market-priced with slippage-bounded floors. Under pricing='firm' a preview no firm provider can serve returns the advisory alone (preview=null + firm_available). Set it on every parameter-exploration call and omit it only on the build the user is about to sign.
	Preview *bool `json:"preview,omitzero"`
	// Swap-leg routing policy. 'auto': firm quotes where a firm venue covers the pair, transparent fallback to the market aggregator otherwise. 'firm': never price on the market route — previews the firm venue cannot serve return the firm_available advisory alone (preview=null, zero aggregator calls), and executions fail with a typed error instead of silently substituting market pricing. 'market': never route through the firm venue; every leg is priced by the aggregator. max_slippage_percent applies on EVERY policy — unlike the loop, firm unwinds consume it to size the guaranteed withdraw/repay floors (the fills themselves are exact). 'firm' is incompatible with gas_sponsorship (sponsored unwinds force market routing).
	Pricing *CreditUnloopRequestPricing `json:"pricing,omitzero"`
}

CreditUnloopRequest - Unwind a leveraged loop: repeatedly withdraw collateral, swap it back to the borrow token at a guaranteed minimum output, and repay — all in ONE atomic transaction from the Credit Account.

func (*CreditUnloopRequest) GetAllowPartial added in v0.1.35

func (c *CreditUnloopRequest) GetAllowPartial() *bool

func (*CreditUnloopRequest) GetBorrowToken added in v0.1.35

func (c *CreditUnloopRequest) GetBorrowToken() string

func (*CreditUnloopRequest) GetBorrowVault added in v0.1.45

func (*CreditUnloopRequest) GetChain added in v0.1.35

func (*CreditUnloopRequest) GetCollateralToken added in v0.1.35

func (c *CreditUnloopRequest) GetCollateralToken() string

func (*CreditUnloopRequest) GetCollateralVault added in v0.1.45

func (*CreditUnloopRequest) GetGasSponsorship added in v0.1.35

func (c *CreditUnloopRequest) GetGasSponsorship() *bool

func (*CreditUnloopRequest) GetMarketID added in v0.1.35

func (*CreditUnloopRequest) GetMaxSlippagePercent added in v0.1.35

func (c *CreditUnloopRequest) GetMaxSlippagePercent() *CreditUnloopRequestMaxSlippagePercent

func (*CreditUnloopRequest) GetOwner added in v0.1.35

func (c *CreditUnloopRequest) GetOwner() string

func (*CreditUnloopRequest) GetPreview added in v0.1.55

func (c *CreditUnloopRequest) GetPreview() *bool

func (*CreditUnloopRequest) GetPricing added in v0.1.59

func (*CreditUnloopRequest) GetProtocol added in v0.1.35

func (c *CreditUnloopRequest) GetProtocol() *CreditProtocol

func (*CreditUnloopRequest) GetSubAccountID added in v0.1.45

func (c *CreditUnloopRequest) GetSubAccountID() *int64

func (*CreditUnloopRequest) GetTargetMultiplier added in v0.1.35

type CreditUnloopRequestChain added in v0.1.53

type CreditUnloopRequestChain string

CreditUnloopRequestChain - Blockchain network. Not every protocol is deployed on every chain — see the protocol field — and a chain with no credit venue at all returns a 422 naming the chains that do.

const (
	CreditUnloopRequestChainArbitrum CreditUnloopRequestChain = "arbitrum"
	CreditUnloopRequestChainBase     CreditUnloopRequestChain = "base"
	CreditUnloopRequestChainBsc      CreditUnloopRequestChain = "bsc"
	CreditUnloopRequestChainEthereum CreditUnloopRequestChain = "ethereum"
	CreditUnloopRequestChainHyperevm CreditUnloopRequestChain = "hyperevm"
	CreditUnloopRequestChainTempo    CreditUnloopRequestChain = "tempo"
)

func (CreditUnloopRequestChain) ToPointer added in v0.1.53

func (*CreditUnloopRequestChain) UnmarshalJSON added in v0.1.53

func (e *CreditUnloopRequestChain) UnmarshalJSON(data []byte) error

type CreditUnloopRequestMaxSlippagePercent added in v0.1.35

type CreditUnloopRequestMaxSlippagePercent struct {
	Number *float64 `queryParam:"inline" union:"member"`
	Str    *string  `queryParam:"inline" union:"member"`

	Type CreditUnloopRequestMaxSlippagePercentType
}

CreditUnloopRequestMaxSlippagePercent - Per-swap slippage tolerance in percent. Unwind dust is bounded by this per iteration, so tighter slippage means less dust.

func CreateCreditUnloopRequestMaxSlippagePercentNumber added in v0.1.35

func CreateCreditUnloopRequestMaxSlippagePercentNumber(number float64) CreditUnloopRequestMaxSlippagePercent

func CreateCreditUnloopRequestMaxSlippagePercentStr added in v0.1.35

func CreateCreditUnloopRequestMaxSlippagePercentStr(str string) CreditUnloopRequestMaxSlippagePercent

func (CreditUnloopRequestMaxSlippagePercent) MarshalJSON added in v0.1.35

func (u CreditUnloopRequestMaxSlippagePercent) MarshalJSON() ([]byte, error)

func (*CreditUnloopRequestMaxSlippagePercent) UnmarshalJSON added in v0.1.35

func (u *CreditUnloopRequestMaxSlippagePercent) UnmarshalJSON(data []byte) (err error)

type CreditUnloopRequestMaxSlippagePercentType added in v0.1.35

type CreditUnloopRequestMaxSlippagePercentType string
const (
	CreditUnloopRequestMaxSlippagePercentTypeNumber CreditUnloopRequestMaxSlippagePercentType = "number"
	CreditUnloopRequestMaxSlippagePercentTypeStr    CreditUnloopRequestMaxSlippagePercentType = "str"
)

type CreditUnloopRequestPricing added in v0.1.59

type CreditUnloopRequestPricing string

CreditUnloopRequestPricing - Swap-leg routing policy. 'auto': firm quotes where a firm venue covers the pair, transparent fallback to the market aggregator otherwise. 'firm': never price on the market route — previews the firm venue cannot serve return the firm_available advisory alone (preview=null, zero aggregator calls), and executions fail with a typed error instead of silently substituting market pricing. 'market': never route through the firm venue; every leg is priced by the aggregator. max_slippage_percent applies on EVERY policy — unlike the loop, firm unwinds consume it to size the guaranteed withdraw/repay floors (the fills themselves are exact). 'firm' is incompatible with gas_sponsorship (sponsored unwinds force market routing).

const (
	CreditUnloopRequestPricingAuto   CreditUnloopRequestPricing = "auto"
	CreditUnloopRequestPricingFirm   CreditUnloopRequestPricing = "firm"
	CreditUnloopRequestPricingMarket CreditUnloopRequestPricing = "market"
)

func (CreditUnloopRequestPricing) ToPointer added in v0.1.59

func (*CreditUnloopRequestPricing) UnmarshalJSON added in v0.1.59

func (e *CreditUnloopRequestPricing) UnmarshalJSON(data []byte) error

type CreditUnloopRequestTargetMultiplier added in v0.1.37

type CreditUnloopRequestTargetMultiplier struct {
	Number *float64 `queryParam:"inline" union:"member"`
	Str    *string  `queryParam:"inline" union:"member"`

	Type CreditUnloopRequestTargetMultiplierType
}

CreditUnloopRequestTargetMultiplier - Target leverage after the unwind. Omit (null) for a FULL unwind: the debt is cleared exactly — accrued interest included — and all pair collateral is withdrawn back to the Credit Account. `1` runs the same exact debt close but leaves the collateral supplied (earning). A value greater than 1 delevers the position to that multiplier. Must be below the position's current multiplier.

func CreateCreditUnloopRequestTargetMultiplierNumber added in v0.1.37

func CreateCreditUnloopRequestTargetMultiplierNumber(number float64) CreditUnloopRequestTargetMultiplier

func CreateCreditUnloopRequestTargetMultiplierStr added in v0.1.37

func CreateCreditUnloopRequestTargetMultiplierStr(str string) CreditUnloopRequestTargetMultiplier

func (CreditUnloopRequestTargetMultiplier) MarshalJSON added in v0.1.37

func (u CreditUnloopRequestTargetMultiplier) MarshalJSON() ([]byte, error)

func (*CreditUnloopRequestTargetMultiplier) UnmarshalJSON added in v0.1.37

func (u *CreditUnloopRequestTargetMultiplier) UnmarshalJSON(data []byte) (err error)

type CreditUnloopRequestTargetMultiplierType added in v0.1.37

type CreditUnloopRequestTargetMultiplierType string
const (
	CreditUnloopRequestTargetMultiplierTypeNumber CreditUnloopRequestTargetMultiplierType = "number"
	CreditUnloopRequestTargetMultiplierTypeStr    CreditUnloopRequestTargetMultiplierType = "str"
)

type CreditUnloopResponse added in v0.1.35

type CreditUnloopResponse struct {
	// Unsigned transaction for direct execution by the owner. Present when gas_sponsorship=false — except firm-priced previews (preview=true on a firm-priced build), which carry numbers only: the firm quotes are fetched at execution time, so there is no payload to sign yet.
	Transaction optionalnullable.OptionalNullable[UnsignedTransaction] `json:"transaction,omitzero"`
	// EIP-712 typed data for gas-sponsored execution. Present when gas_sponsorship=true.
	Eip712 optionalnullable.OptionalNullable[BatchedSafeOperationsResponseOutput] `json:"eip_712,omitzero"`
	// Projected end state, computed on guaranteed swap floors. Null only on pricing='firm' preview responses whose unwind the firm venue cannot serve: no leg was priced on any venue, and the response carries the firm_available advisory alone.
	Preview *CreditUnloopPreview `json:"preview"`
	// Identifies which route priced the swap leg(s): 'market' — a DEX aggregator (pool liquidity, slippage-bounded floors) — or 'firm' — quotes, one per swap leg, each partially filled at the leg's size. On preview=true responses 'firm' means the numbers are INDICATIVE, computed from live maker price levels without spending any quote; execution fetches the firm quotes at signing time. Always present, including on fallbacks. This is the authoritative firm-vs-market signal and clients do need to read it: `pricing` is only what was REQUESTED (under 'auto' a firm build can fall back to market transparently), and `quote_expires_at` is absent on every preview — so neither substitutes for this field.
	SwapProvider *CreditUnloopResponseSwapProvider `json:"swap_provider,omitzero"`
	// Deadline of the firm swap quotes (the earliest across the unwind's swap legs) — sign and broadcast before it or the transaction reverts on-chain; refresh by re-calling this endpoint (discard the previous payload). Present only on executable firm-priced builds; null on previews (no quote is spent for a preview).
	QuoteExpiresAt optionalnullable.OptionalNullable[time.Time] `json:"quote_expires_at,omitzero"`
	// Preview-only advisory: whether a firm-quote venue can serve this unwind's swap legs (estimated without spending any quote). Present only on preview=true responses; null otherwise. Computed on every policy — including pricing='market', whose preview numbers stay market-priced — so a client that opted out can keep the boundary visible.
	FirmAvailable optionalnullable.OptionalNullable[bool] `json:"firm_available,omitzero"`
}

CreditUnloopResponse - The atomic unwind transaction plus its guaranteed-floor preview.

func (*CreditUnloopResponse) GetEip712 added in v0.1.35

func (*CreditUnloopResponse) GetFirmAvailable added in v0.1.55

func (*CreditUnloopResponse) GetPreview added in v0.1.35

func (c *CreditUnloopResponse) GetPreview() *CreditUnloopPreview

func (*CreditUnloopResponse) GetQuoteExpiresAt added in v0.1.55

func (*CreditUnloopResponse) GetSwapProvider added in v0.1.55

func (*CreditUnloopResponse) GetTransaction added in v0.1.35

func (CreditUnloopResponse) MarshalJSON added in v0.1.35

func (c CreditUnloopResponse) MarshalJSON() ([]byte, error)

func (*CreditUnloopResponse) UnmarshalJSON added in v0.1.35

func (c *CreditUnloopResponse) UnmarshalJSON(data []byte) error

type CreditUnloopResponseSwapProvider added in v0.1.55

type CreditUnloopResponseSwapProvider string

CreditUnloopResponseSwapProvider - Identifies which route priced the swap leg(s): 'market' — a DEX aggregator (pool liquidity, slippage-bounded floors) — or 'firm' — quotes, one per swap leg, each partially filled at the leg's size. On preview=true responses 'firm' means the numbers are INDICATIVE, computed from live maker price levels without spending any quote; execution fetches the firm quotes at signing time. Always present, including on fallbacks. This is the authoritative firm-vs-market signal and clients do need to read it: `pricing` is only what was REQUESTED (under 'auto' a firm build can fall back to market transparently), and `quote_expires_at` is absent on every preview — so neither substitutes for this field.

const (
	CreditUnloopResponseSwapProviderMarket CreditUnloopResponseSwapProvider = "market"
	CreditUnloopResponseSwapProviderFirm   CreditUnloopResponseSwapProvider = "firm"
)

func (*CreditUnloopResponseSwapProvider) IsExact added in v0.1.55

IsExact returns true if the value matches a known enum value, false otherwise.

func (CreditUnloopResponseSwapProvider) ToPointer added in v0.1.55

type CreditUserOperation

type CreditUserOperation struct {
	Body CreditUserOperationBody `json:"body"`
}

CreditUserOperation - A single operation in a credit bundle.

func (*CreditUserOperation) GetBody

func (*CreditUserOperation) GetBodyCreditBorrow

func (c *CreditUserOperation) GetBodyCreditBorrow() *CreditBorrowParams

func (*CreditUserOperation) GetBodyCreditEnableCollateral

func (c *CreditUserOperation) GetBodyCreditEnableCollateral() *CreditEnableCollateralParams

func (*CreditUserOperation) GetBodyCreditRepay

func (c *CreditUserOperation) GetBodyCreditRepay() *CreditRepayParams

func (*CreditUserOperation) GetBodyCreditSupply

func (c *CreditUserOperation) GetBodyCreditSupply() *CreditSupplyParams

func (*CreditUserOperation) GetBodyCreditTransferToAddress

func (c *CreditUserOperation) GetBodyCreditTransferToAddress() *CreditTransferToAddressParams

func (*CreditUserOperation) GetBodyCreditWithdraw

func (c *CreditUserOperation) GetBodyCreditWithdraw() *CreditWithdrawParams

func (*CreditUserOperation) GetBodyV2Swap

func (c *CreditUserOperation) GetBodyV2Swap() *EarnSwapParams

func (*CreditUserOperation) GetBodyV2TransferFromEoa

func (c *CreditUserOperation) GetBodyV2TransferFromEoa() *EarnTransferFromEOAParams

func (*CreditUserOperation) GetBodyV2TransferToEoa

func (c *CreditUserOperation) GetBodyV2TransferToEoa() *EarnTransferToEOAParams

type CreditUserOperationBody

type CreditUserOperationBody struct {
	EarnSwapParams                *EarnSwapParams                `queryParam:"inline" union:"member"`
	EarnTransferFromEOAParams     *EarnTransferFromEOAParams     `queryParam:"inline" union:"member"`
	EarnTransferToEOAParams       *EarnTransferToEOAParams       `queryParam:"inline" union:"member"`
	CreditSupplyParams            *CreditSupplyParams            `queryParam:"inline" union:"member"`
	CreditWithdrawParams          *CreditWithdrawParams          `queryParam:"inline" union:"member"`
	CreditBorrowParams            *CreditBorrowParams            `queryParam:"inline" union:"member"`
	CreditRepayParams             *CreditRepayParams             `queryParam:"inline" union:"member"`
	CreditEnableCollateralParams  *CreditEnableCollateralParams  `queryParam:"inline" union:"member"`
	CreditTransferToAddressParams *CreditTransferToAddressParams `queryParam:"inline" union:"member"`

	Type CreditUserOperationBodyType
}

func CreateCreditUserOperationBodyCreditBorrow

func CreateCreditUserOperationBodyCreditBorrow(creditBorrow CreditBorrowParams) CreditUserOperationBody

func CreateCreditUserOperationBodyCreditEnableCollateral

func CreateCreditUserOperationBodyCreditEnableCollateral(creditEnableCollateral CreditEnableCollateralParams) CreditUserOperationBody

func CreateCreditUserOperationBodyCreditRepay

func CreateCreditUserOperationBodyCreditRepay(creditRepay CreditRepayParams) CreditUserOperationBody

func CreateCreditUserOperationBodyCreditSupply

func CreateCreditUserOperationBodyCreditSupply(creditSupply CreditSupplyParams) CreditUserOperationBody

func CreateCreditUserOperationBodyCreditTransferToAddress

func CreateCreditUserOperationBodyCreditTransferToAddress(creditTransferToAddress CreditTransferToAddressParams) CreditUserOperationBody

func CreateCreditUserOperationBodyCreditWithdraw

func CreateCreditUserOperationBodyCreditWithdraw(creditWithdraw CreditWithdrawParams) CreditUserOperationBody

func CreateCreditUserOperationBodyV2Swap

func CreateCreditUserOperationBodyV2Swap(v2Swap EarnSwapParams) CreditUserOperationBody

func CreateCreditUserOperationBodyV2TransferFromEoa

func CreateCreditUserOperationBodyV2TransferFromEoa(v2TransferFromEoa EarnTransferFromEOAParams) CreditUserOperationBody

func CreateCreditUserOperationBodyV2TransferToEoa

func CreateCreditUserOperationBodyV2TransferToEoa(v2TransferToEoa EarnTransferToEOAParams) CreditUserOperationBody

func (CreditUserOperationBody) MarshalJSON

func (u CreditUserOperationBody) MarshalJSON() ([]byte, error)

func (*CreditUserOperationBody) UnmarshalJSON

func (u *CreditUserOperationBody) UnmarshalJSON(data []byte) (err error)

type CreditUserOperationBodyType

type CreditUserOperationBodyType string
const (
	CreditUserOperationBodyTypeCreditBorrow            CreditUserOperationBodyType = "CREDIT_BORROW"
	CreditUserOperationBodyTypeCreditEnableCollateral  CreditUserOperationBodyType = "CREDIT_ENABLE_COLLATERAL"
	CreditUserOperationBodyTypeCreditRepay             CreditUserOperationBodyType = "CREDIT_REPAY"
	CreditUserOperationBodyTypeCreditSupply            CreditUserOperationBodyType = "CREDIT_SUPPLY"
	CreditUserOperationBodyTypeCreditTransferToAddress CreditUserOperationBodyType = "CREDIT_TRANSFER_TO_ADDRESS"
	CreditUserOperationBodyTypeCreditWithdraw          CreditUserOperationBodyType = "CREDIT_WITHDRAW"
	CreditUserOperationBodyTypeV2Swap                  CreditUserOperationBodyType = "V2_SWAP"
	CreditUserOperationBodyTypeV2TransferFromEoa       CreditUserOperationBodyType = "V2_TRANSFER_FROM_EOA"
	CreditUserOperationBodyTypeV2TransferToEoa         CreditUserOperationBodyType = "V2_TRANSFER_TO_EOA"
)

type CreditWithdrawParams

type CreditWithdrawParams struct {

	// Collateral token to withdraw.
	Token string `json:"token"`
	// Amount in token units to withdraw.
	Amount CreditWithdrawParamsAmount `json:"amount"`
	// Which lending protocol a credit action targets.
	//
	// “AAVE“ is the default so existing callers (which never send a “protocol“
	// field) keep hitting the unchanged Aave code path; markets are named by token
	// symbol. “MORPHO“ identifies Morpho Blue lending markets by their bytes32
	// “market_id“. “EULER“ identifies Euler V2 markets by their EVK
	// “collateral_vault“ + “borrow_vault“ addresses and supports isolated
	// per-sub-account positions (“sub_account_id“).
	//
	// Deployment is per chain, so a valid protocol can still 422 on a given chain:
	// AAVE on Ethereum, Base, Arbitrum, BSC and HyperEVM (where it is Hyperlend, the
	// chain's Aave V3 deployment); MORPHO on Ethereum, Base, Arbitrum and HyperEVM
	// (where it is Felix); EULER on Ethereum, Base, Arbitrum and BSC.
	//
	// All three support “/v2/credit/loop“, “/v2/credit/unloop“,
	// “/v2/credit/looped_positions“ and “/v2/credit/rebalance“.
	Protocol *CreditProtocol `json:"protocol,omitzero"`
	// Euler only: the EVK collateral vault to withdraw from. Required when protocol=EULER.
	CollateralVault optionalnullable.OptionalNullable[string] `json:"collateral_vault,omitzero"`
	// Euler only: EVC sub-account (0–255) holding the collateral to withdraw. Each sub-account is an independent Euler position with its own collateral, borrow controller, and health. Defaults to 0. Ignored for Aave/Morpho.
	SubAccountID *int64 `json:"sub_account_id,omitzero"`
	// Morpho only: the bytes32 market id (from /v2/credit/morpho_markets). Required when protocol=MORPHO.
	MarketID optionalnullable.OptionalNullable[string] `json:"market_id,omitzero"`
	// contains filtered or unexported fields
}

CreditWithdrawParams - Withdraw collateral from Aave via Credit Account.

func (*CreditWithdrawParams) GetActionType

func (c *CreditWithdrawParams) GetActionType() *string

func (*CreditWithdrawParams) GetAmount

func (*CreditWithdrawParams) GetCollateralVault added in v0.1.27

func (*CreditWithdrawParams) GetMarketID added in v0.1.34

func (*CreditWithdrawParams) GetProtocol added in v0.1.27

func (c *CreditWithdrawParams) GetProtocol() *CreditProtocol

func (*CreditWithdrawParams) GetSubAccountID added in v0.1.41

func (c *CreditWithdrawParams) GetSubAccountID() *int64

func (*CreditWithdrawParams) GetToken

func (c *CreditWithdrawParams) GetToken() string

func (CreditWithdrawParams) MarshalJSON

func (c CreditWithdrawParams) MarshalJSON() ([]byte, error)

func (*CreditWithdrawParams) UnmarshalJSON

func (c *CreditWithdrawParams) UnmarshalJSON(data []byte) error

type CreditWithdrawParamsAmount

type CreditWithdrawParamsAmount struct {
	Number *float64 `queryParam:"inline" union:"member"`
	Str    *string  `queryParam:"inline" union:"member"`

	Type CreditWithdrawParamsAmountType
}

CreditWithdrawParamsAmount - Amount in token units to withdraw.

func CreateCreditWithdrawParamsAmountNumber

func CreateCreditWithdrawParamsAmountNumber(number float64) CreditWithdrawParamsAmount

func CreateCreditWithdrawParamsAmountStr

func CreateCreditWithdrawParamsAmountStr(str string) CreditWithdrawParamsAmount

func (CreditWithdrawParamsAmount) MarshalJSON

func (u CreditWithdrawParamsAmount) MarshalJSON() ([]byte, error)

func (*CreditWithdrawParamsAmount) UnmarshalJSON

func (u *CreditWithdrawParamsAmount) UnmarshalJSON(data []byte) (err error)

type CreditWithdrawParamsAmountType

type CreditWithdrawParamsAmountType string
const (
	CreditWithdrawParamsAmountTypeNumber CreditWithdrawParamsAmountType = "number"
	CreditWithdrawParamsAmountTypeStr    CreditWithdrawParamsAmountType = "str"
)

type DebtPosition

type DebtPosition struct {
	// Address of the borrow token.
	Token string `json:"token"`
	// Symbol of the borrow token (e.g. WETH).
	Symbol string `json:"symbol"`
	// Which lending protocol a credit action targets.
	//
	// “AAVE“ is the default so existing callers (which never send a “protocol“
	// field) keep hitting the unchanged Aave code path; markets are named by token
	// symbol. “MORPHO“ identifies Morpho Blue lending markets by their bytes32
	// “market_id“. “EULER“ identifies Euler V2 markets by their EVK
	// “collateral_vault“ + “borrow_vault“ addresses and supports isolated
	// per-sub-account positions (“sub_account_id“).
	//
	// Deployment is per chain, so a valid protocol can still 422 on a given chain:
	// AAVE on Ethereum, Base, Arbitrum, BSC and HyperEVM (where it is Hyperlend, the
	// chain's Aave V3 deployment); MORPHO on Ethereum, Base, Arbitrum and HyperEVM
	// (where it is Felix); EULER on Ethereum, Base, Arbitrum and BSC.
	//
	// All three support “/v2/credit/loop“, “/v2/credit/unloop“,
	// “/v2/credit/looped_positions“ and “/v2/credit/rebalance“.
	Protocol *CreditProtocol `json:"protocol,omitzero"`
	// Euler only: the EVK borrow vault this debt is owed to.
	Vault optionalnullable.OptionalNullable[string] `json:"vault,omitzero"`
	// Euler only: the EVC sub-account (0–255) this debt belongs to. Each sub-account is an independent Euler position with its own health. Null for Aave/Morpho.
	SubAccountID optionalnullable.OptionalNullable[int64] `json:"sub_account_id,omitzero"`
	// Morpho only: the bytes32 id of the isolated market this debt is owed to.
	MarketID optionalnullable.OptionalNullable[string] `json:"market_id,omitzero"`
	// Morpho only: this market's health factor (markets are isolated, so health is per market — below 1 the position is liquidatable). Null for other protocols and when the oracle read fails.
	HealthFactor optionalnullable.OptionalNullable[string] `json:"health_factor,omitzero"`
	// Current on-chain debt balance (the vault's underlying asset for Euler).
	AmountBorrowed *string `json:"amount_borrowed"`
	// Debt value in USD.
	UsdValue optionalnullable.OptionalNullable[string] `json:"usd_value,omitzero"`
	// Current borrow APY in percentage (e.g. 4.5 means 4.5%).
	BorrowApy optionalnullable.OptionalNullable[string] `json:"borrow_apy,omitzero"`
	// Total amount borrowed across all borrow events.
	TotalBorrowed optionalnullable.OptionalNullable[string] `json:"total_borrowed,omitzero"`
	// Total amount repaid across all repay events.
	TotalRepaid optionalnullable.OptionalNullable[string] `json:"total_repaid,omitzero"`
	// Interest paid on debt: on_chain_balance + total_repaid - total_borrowed.
	InterestPaid optionalnullable.OptionalNullable[string] `json:"interest_paid,omitzero"`
	// All historical events for this debt reserve.
	Events []CreditEvent `json:"events,omitzero"`
}

DebtPosition - A per-reserve debt position.

func (*DebtPosition) GetAmountBorrowed

func (d *DebtPosition) GetAmountBorrowed() *string

func (*DebtPosition) GetBorrowApy

func (*DebtPosition) GetEvents

func (d *DebtPosition) GetEvents() []CreditEvent

func (*DebtPosition) GetHealthFactor added in v0.1.34

func (d *DebtPosition) GetHealthFactor() optionalnullable.OptionalNullable[string]

func (*DebtPosition) GetInterestPaid

func (d *DebtPosition) GetInterestPaid() optionalnullable.OptionalNullable[string]

func (*DebtPosition) GetMarketID added in v0.1.34

func (*DebtPosition) GetProtocol added in v0.1.27

func (d *DebtPosition) GetProtocol() *CreditProtocol

func (*DebtPosition) GetSubAccountID added in v0.1.41

func (d *DebtPosition) GetSubAccountID() optionalnullable.OptionalNullable[int64]

func (*DebtPosition) GetSymbol

func (d *DebtPosition) GetSymbol() string

func (*DebtPosition) GetToken

func (d *DebtPosition) GetToken() string

func (*DebtPosition) GetTotalBorrowed

func (d *DebtPosition) GetTotalBorrowed() optionalnullable.OptionalNullable[string]

func (*DebtPosition) GetTotalRepaid

func (*DebtPosition) GetUsdValue

func (*DebtPosition) GetVault added in v0.1.27

func (DebtPosition) MarshalJSON

func (d DebtPosition) MarshalJSON() ([]byte, error)

func (*DebtPosition) UnmarshalJSON

func (d *DebtPosition) UnmarshalJSON(data []byte) error

type DepositEvent

type DepositEvent struct {
	// Block number when deposit occurred
	BlockNumber int64 `json:"block_number"`
	// Timestamp when deposit occurred
	BlockTimestamp time.Time `json:"block_timestamp"`
	// Transaction hash of the deposit
	TransactionHash string `json:"transaction_hash"`
	// Amount deposited (underlying asset or swap token)
	InputAmount string `json:"input_amount"`
	// Symbol of token deposited
	InputSymbol string `json:"input_symbol"`
	// Units received (shares, aTokens, or PT)
	OutputAmount string `json:"output_amount"`
	// Symbol of units received
	OutputSymbol string `json:"output_symbol"`
	// Cost basis per unit at time of deposit
	CostPerUnit string `json:"cost_per_unit"`
}

DepositEvent - Historical deposit event for position transparency.

Uses generic input/output format that works across all protocols: - Vault: input=underlying, output=shares - Aave: input=underlying, output=aTokens - Pendle: input=token (varies), output=PT

func (*DepositEvent) GetBlockNumber

func (d *DepositEvent) GetBlockNumber() int64

func (*DepositEvent) GetBlockTimestamp

func (d *DepositEvent) GetBlockTimestamp() time.Time

func (*DepositEvent) GetCostPerUnit

func (d *DepositEvent) GetCostPerUnit() string

func (*DepositEvent) GetInputAmount

func (d *DepositEvent) GetInputAmount() string

func (*DepositEvent) GetInputSymbol

func (d *DepositEvent) GetInputSymbol() string

func (*DepositEvent) GetOutputAmount

func (d *DepositEvent) GetOutputAmount() string

func (*DepositEvent) GetOutputSymbol

func (d *DepositEvent) GetOutputSymbol() string

func (*DepositEvent) GetTransactionHash

func (d *DepositEvent) GetTransactionHash() string

func (DepositEvent) MarshalJSON

func (d DepositEvent) MarshalJSON() ([]byte, error)

func (*DepositEvent) UnmarshalJSON

func (d *DepositEvent) UnmarshalJSON(data []byte) error

type Direction

type Direction string

Direction relative to the product account: 'in' for received, 'out' for sent.

const (
	DirectionIn  Direction = "in"
	DirectionOut Direction = "out"
)

func (*Direction) IsExact

func (e *Direction) IsExact() bool

IsExact returns true if the value matches a known enum value, false otherwise.

func (Direction) ToPointer

func (e Direction) ToPointer() *Direction

type EarnBalancesResponse

type EarnBalancesResponse struct {
	// The derived earn account address.
	EarnAccountAddress string `json:"earn_account_address"`
	// Token balances keyed by token symbol. Symbols are not unique on-chain: when two tokens collide, each key becomes 'SYMBOL (0xAddress)' — match on token_address for exactness.
	Balances map[string]CompassAPIBackendV2ModelsBalancesTokenBalance `json:"balances,omitzero"`
	// Total USD value of all balances (sum of available values).
	TotalUsdValue optionalnullable.OptionalNullable[string] `json:"total_usd_value,omitzero"`
}

EarnBalancesResponse - Response containing earn account balances and transfer history.

func (*EarnBalancesResponse) GetBalances

func (*EarnBalancesResponse) GetEarnAccountAddress

func (e *EarnBalancesResponse) GetEarnAccountAddress() string

func (*EarnBalancesResponse) GetTotalUsdValue

func (EarnBalancesResponse) MarshalJSON

func (e EarnBalancesResponse) MarshalJSON() ([]byte, error)

func (*EarnBalancesResponse) UnmarshalJSON

func (e *EarnBalancesResponse) UnmarshalJSON(data []byte) error

type EarnManageParams

type EarnManageParams struct {

	// The earn venue.
	Venue EarnManageParamsVenue `json:"venue"`
	// Whether you are depositing into or withdrawing from the given Earn `venue`.
	Action EarnManageParamsAction `json:"action"`
	// Amount of the underlying asset to act on (deposit or withdraw). For VAULT, this is the vault's underlying token; for AAVE, this is the Aave reserve asset; for PENDLE_PT, this is the amount of `token` to spend (DEPOSIT) or PT to sell (WITHDRAW). Provide as a decimal in token units (not wei); must be > 0.
	Amount EarnManageParamsAmount `json:"amount"`
	// Optional fee configuration. If provided, a fee will be applied to the transaction amount and sent to the specified recipient address. The fee can be specified as a percentage of the transaction amount, as a fixed token amount, or as a percentage of realized profit (PERFORMANCE).
	Fee optionalnullable.OptionalNullable[Fee] `json:"fee,omitzero"`
	// contains filtered or unexported fields
}

EarnManageParams - Parameters for earn manage operations (deposit/withdraw to vault/Aave/Pendle PT).

Used by multicall/bundle endpoint to specify manage actions. EarnManageRequest inherits from this class.

func (*EarnManageParams) GetAction

func (*EarnManageParams) GetActionType

func (e *EarnManageParams) GetActionType() *string

func (*EarnManageParams) GetAmount

func (*EarnManageParams) GetFee

func (*EarnManageParams) GetVenue

func (*EarnManageParams) GetVenueAave

func (e *EarnManageParams) GetVenueAave() *AaveVenue

func (*EarnManageParams) GetVenuePendlePt

func (e *EarnManageParams) GetVenuePendlePt() *PendlePTVenue

func (*EarnManageParams) GetVenueVault

func (e *EarnManageParams) GetVenueVault() *VaultVenue

func (EarnManageParams) MarshalJSON

func (e EarnManageParams) MarshalJSON() ([]byte, error)

func (*EarnManageParams) UnmarshalJSON

func (e *EarnManageParams) UnmarshalJSON(data []byte) error

type EarnManageParamsAction

type EarnManageParamsAction string

EarnManageParamsAction - Whether you are depositing into or withdrawing from the given Earn `venue`.

const (
	EarnManageParamsActionDeposit  EarnManageParamsAction = "DEPOSIT"
	EarnManageParamsActionWithdraw EarnManageParamsAction = "WITHDRAW"
)

func (EarnManageParamsAction) ToPointer

func (*EarnManageParamsAction) UnmarshalJSON

func (e *EarnManageParamsAction) UnmarshalJSON(data []byte) error

type EarnManageParamsAmount

type EarnManageParamsAmount struct {
	Number *float64 `queryParam:"inline" union:"member"`
	Str    *string  `queryParam:"inline" union:"member"`

	Type EarnManageParamsAmountType
}

EarnManageParamsAmount - Amount of the underlying asset to act on (deposit or withdraw). For VAULT, this is the vault's underlying token; for AAVE, this is the Aave reserve asset; for PENDLE_PT, this is the amount of `token` to spend (DEPOSIT) or PT to sell (WITHDRAW). Provide as a decimal in token units (not wei); must be > 0.

func CreateEarnManageParamsAmountNumber

func CreateEarnManageParamsAmountNumber(number float64) EarnManageParamsAmount

func CreateEarnManageParamsAmountStr

func CreateEarnManageParamsAmountStr(str string) EarnManageParamsAmount

func (EarnManageParamsAmount) MarshalJSON

func (u EarnManageParamsAmount) MarshalJSON() ([]byte, error)

func (*EarnManageParamsAmount) UnmarshalJSON

func (u *EarnManageParamsAmount) UnmarshalJSON(data []byte) (err error)

type EarnManageParamsAmountType

type EarnManageParamsAmountType string
const (
	EarnManageParamsAmountTypeNumber EarnManageParamsAmountType = "number"
	EarnManageParamsAmountTypeStr    EarnManageParamsAmountType = "str"
)

type EarnManageParamsVenue

type EarnManageParamsVenue struct {
	VaultVenue    *VaultVenue    `queryParam:"inline" union:"member"`
	AaveVenue     *AaveVenue     `queryParam:"inline" union:"member"`
	PendlePTVenue *PendlePTVenue `queryParam:"inline" union:"member"`

	Type EarnManageParamsVenueType
}

EarnManageParamsVenue - The earn venue.

func CreateEarnManageParamsVenueAave

func CreateEarnManageParamsVenueAave(aave AaveVenue) EarnManageParamsVenue

func CreateEarnManageParamsVenuePendlePt

func CreateEarnManageParamsVenuePendlePt(pendlePt PendlePTVenue) EarnManageParamsVenue

func CreateEarnManageParamsVenueVault

func CreateEarnManageParamsVenueVault(vault VaultVenue) EarnManageParamsVenue

func (EarnManageParamsVenue) MarshalJSON

func (u EarnManageParamsVenue) MarshalJSON() ([]byte, error)

func (*EarnManageParamsVenue) UnmarshalJSON

func (u *EarnManageParamsVenue) UnmarshalJSON(data []byte) (err error)

type EarnManageParamsVenueType

type EarnManageParamsVenueType string
const (
	EarnManageParamsVenueTypeAave     EarnManageParamsVenueType = "AAVE"
	EarnManageParamsVenueTypePendlePt EarnManageParamsVenueType = "PENDLE_PT"
	EarnManageParamsVenueTypeVault    EarnManageParamsVenueType = "VAULT"
)

type EarnManageRequest

type EarnManageRequest struct {

	// The earn venue.
	Venue EarnManageRequestVenue `json:"venue"`
	// Whether you are depositing into or withdrawing from the given Earn `venue`.
	Action EarnManageRequestAction `json:"action"`
	// Amount of the underlying asset to act on (deposit or withdraw). For VAULT, this is the vault's underlying token; for AAVE, this is the Aave reserve asset; for PENDLE_PT, this is the amount of `token` to spend (DEPOSIT) or PT to sell (WITHDRAW). Provide as a decimal in token units (not wei); must be > 0.
	Amount EarnManageRequestAmount `json:"amount"`
	// Optional fee configuration. If provided, a fee will be applied to the transaction amount and sent to the specified recipient address. The fee can be specified as a percentage of the transaction amount, as a fixed token amount, or as a percentage of realized profit (PERFORMANCE).
	Fee optionalnullable.OptionalNullable[Fee] `json:"fee,omitzero"`
	// The primary wallet address that owns and controls the Earn Account.
	Owner string `json:"owner"`
	// Blockchain network
	Chain EarnManageRequestChain `json:"chain"`
	// Optionally request gas sponsorship. If set to `true`, EIP-712 typed data will be returned that must be signed by the `owner` and submitted to the 'Prepare gas-sponsored transaction' endpoint (`/gas_sponsorship/prepare`).
	GasSponsorship *bool `json:"gas_sponsorship,omitzero"`
	// contains filtered or unexported fields
}

EarnManageRequest - Request model for the unified manage endpoint.

Inherits from EarnManageParams and adds context fields (owner, chain, etc).

func (*EarnManageRequest) GetAction

func (*EarnManageRequest) GetActionType

func (e *EarnManageRequest) GetActionType() *string

func (*EarnManageRequest) GetAmount

func (*EarnManageRequest) GetChain

func (*EarnManageRequest) GetFee

func (*EarnManageRequest) GetGasSponsorship

func (e *EarnManageRequest) GetGasSponsorship() *bool

func (*EarnManageRequest) GetOwner

func (e *EarnManageRequest) GetOwner() string

func (*EarnManageRequest) GetVenue

func (*EarnManageRequest) GetVenueAave

func (e *EarnManageRequest) GetVenueAave() *AaveVenue

func (*EarnManageRequest) GetVenuePendlePt

func (e *EarnManageRequest) GetVenuePendlePt() *PendlePTVenue

func (*EarnManageRequest) GetVenueVault

func (e *EarnManageRequest) GetVenueVault() *VaultVenue

func (EarnManageRequest) MarshalJSON

func (e EarnManageRequest) MarshalJSON() ([]byte, error)

func (*EarnManageRequest) UnmarshalJSON

func (e *EarnManageRequest) UnmarshalJSON(data []byte) error

type EarnManageRequestAction

type EarnManageRequestAction string

EarnManageRequestAction - Whether you are depositing into or withdrawing from the given Earn `venue`.

const (
	EarnManageRequestActionDeposit  EarnManageRequestAction = "DEPOSIT"
	EarnManageRequestActionWithdraw EarnManageRequestAction = "WITHDRAW"
)

func (EarnManageRequestAction) ToPointer

func (*EarnManageRequestAction) UnmarshalJSON

func (e *EarnManageRequestAction) UnmarshalJSON(data []byte) error

type EarnManageRequestAmount

type EarnManageRequestAmount struct {
	Number *float64 `queryParam:"inline" union:"member"`
	Str    *string  `queryParam:"inline" union:"member"`

	Type EarnManageRequestAmountType
}

EarnManageRequestAmount - Amount of the underlying asset to act on (deposit or withdraw). For VAULT, this is the vault's underlying token; for AAVE, this is the Aave reserve asset; for PENDLE_PT, this is the amount of `token` to spend (DEPOSIT) or PT to sell (WITHDRAW). Provide as a decimal in token units (not wei); must be > 0.

func CreateEarnManageRequestAmountNumber

func CreateEarnManageRequestAmountNumber(number float64) EarnManageRequestAmount

func CreateEarnManageRequestAmountStr

func CreateEarnManageRequestAmountStr(str string) EarnManageRequestAmount

func (EarnManageRequestAmount) MarshalJSON

func (u EarnManageRequestAmount) MarshalJSON() ([]byte, error)

func (*EarnManageRequestAmount) UnmarshalJSON

func (u *EarnManageRequestAmount) UnmarshalJSON(data []byte) (err error)

type EarnManageRequestAmountType

type EarnManageRequestAmountType string
const (
	EarnManageRequestAmountTypeNumber EarnManageRequestAmountType = "number"
	EarnManageRequestAmountTypeStr    EarnManageRequestAmountType = "str"
)

type EarnManageRequestChain added in v0.1.72

type EarnManageRequestChain string

EarnManageRequestChain - Blockchain network

const (
	EarnManageRequestChainArbitrum EarnManageRequestChain = "arbitrum"
	EarnManageRequestChainBase     EarnManageRequestChain = "base"
	EarnManageRequestChainBsc      EarnManageRequestChain = "bsc"
	EarnManageRequestChainEthereum EarnManageRequestChain = "ethereum"
	EarnManageRequestChainHyperevm EarnManageRequestChain = "hyperevm"
	EarnManageRequestChainTempo    EarnManageRequestChain = "tempo"
)

func (EarnManageRequestChain) ToPointer added in v0.1.72

func (*EarnManageRequestChain) UnmarshalJSON added in v0.1.72

func (e *EarnManageRequestChain) UnmarshalJSON(data []byte) error

type EarnManageRequestVenue

type EarnManageRequestVenue struct {
	VaultVenue    *VaultVenue    `queryParam:"inline" union:"member"`
	AaveVenue     *AaveVenue     `queryParam:"inline" union:"member"`
	PendlePTVenue *PendlePTVenue `queryParam:"inline" union:"member"`

	Type EarnManageRequestVenueType
}

EarnManageRequestVenue - The earn venue.

func CreateEarnManageRequestVenueAave

func CreateEarnManageRequestVenueAave(aave AaveVenue) EarnManageRequestVenue

func CreateEarnManageRequestVenuePendlePt

func CreateEarnManageRequestVenuePendlePt(pendlePt PendlePTVenue) EarnManageRequestVenue

func CreateEarnManageRequestVenueVault

func CreateEarnManageRequestVenueVault(vault VaultVenue) EarnManageRequestVenue

func (EarnManageRequestVenue) MarshalJSON

func (u EarnManageRequestVenue) MarshalJSON() ([]byte, error)

func (*EarnManageRequestVenue) UnmarshalJSON

func (u *EarnManageRequestVenue) UnmarshalJSON(data []byte) (err error)

type EarnManageRequestVenueType

type EarnManageRequestVenueType string
const (
	EarnManageRequestVenueTypeAave     EarnManageRequestVenueType = "AAVE"
	EarnManageRequestVenueTypePendlePt EarnManageRequestVenueType = "PENDLE_PT"
	EarnManageRequestVenueTypeVault    EarnManageRequestVenueType = "VAULT"
)

type EarnManageResponse

type EarnManageResponse struct {
	// Unsigned transaction for direct execution. Present when gas_sponsorship=false.
	Transaction optionalnullable.OptionalNullable[UnsignedTransaction] `json:"transaction,omitzero"`
	// EIP-712 typed data for gas-sponsored execution. Present when gas_sponsorship=true.
	Eip712 optionalnullable.OptionalNullable[BatchedSafeOperationsResponseOutput] `json:"eip_712,omitzero"`
}

func (*EarnManageResponse) GetTransaction

func (EarnManageResponse) MarshalJSON

func (e EarnManageResponse) MarshalJSON() ([]byte, error)

func (*EarnManageResponse) UnmarshalJSON

func (e *EarnManageResponse) UnmarshalJSON(data []byte) error

type EarnPositionsAllResponse

type EarnPositionsAllResponse struct {
	// Positions grouped by chain. Keys: 'ethereum', 'base', 'arbitrum', 'hyperevm'. Every key is present; chains without a deployed earn account carry empty lists.
	Chains map[string]EarnPositionsResponse `json:"chains"`
	// Total USD value of all positions across all chains.
	TotalUsdValue optionalnullable.OptionalNullable[string] `json:"total_usd_value,omitzero"`
}

EarnPositionsAllResponse - Positions across all chains, grouped by chain name.

Each chain key maps to an EarnPositionsResponse containing that chain's aave, vaults, and pendle_pt positions with per-chain total_usd_value.

func (*EarnPositionsAllResponse) GetChains

func (*EarnPositionsAllResponse) GetTotalUsdValue

type EarnPositionsResponse

type EarnPositionsResponse struct {
	// Aave V3 lending positions.
	Aave []AavePosition `json:"aave,omitzero"`
	// ERC-4626 vault positions.
	Vaults []CompassAPIBackendV2ModelsEarnReadResponsePositionsVaultPosition `json:"vaults,omitzero"`
	// Pendle Principal Token positions.
	PendlePt []PendlePTPosition `json:"pendle_pt,omitzero"`
	// Total USD value of all positions (sum of available values).
	TotalUsdValue optionalnullable.OptionalNullable[string] `json:"total_usd_value,omitzero"`
}

EarnPositionsResponse - Grouped positions by protocol.

This new structure groups positions by protocol type for better organization and removes the need for a discriminated union in SDK consumers.

func (*EarnPositionsResponse) GetAave

func (e *EarnPositionsResponse) GetAave() []AavePosition

func (*EarnPositionsResponse) GetPendlePt

func (e *EarnPositionsResponse) GetPendlePt() []PendlePTPosition

func (*EarnPositionsResponse) GetTotalUsdValue

func (EarnPositionsResponse) MarshalJSON

func (e EarnPositionsResponse) MarshalJSON() ([]byte, error)

func (*EarnPositionsResponse) UnmarshalJSON

func (e *EarnPositionsResponse) UnmarshalJSON(data []byte) error

type EarnSwapParams

type EarnSwapParams struct {

	// Token to sell (input). Provide a token symbol from a limited set (e.g., 'USDC') or any token address.
	TokenIn string `json:"token_in"`
	// Token to buy (output). Provide a token symbol from a limited set (e.g., 'USDT') or any token address.
	TokenOut string `json:"token_out"`
	// Human-readable amount of `token_in` to swap (token units, not wei).
	AmountIn EarnSwapParamsAmountIn `json:"amount_in"`
	// Maximum slippage tolerance as a percentage (e.g., 0.5 = 0.5%).
	Slippage *EarnSwapParamsSlippage `json:"slippage,omitzero"`
	// contains filtered or unexported fields
}

EarnSwapParams - Parameters for swap operations (without context like owner/chain).

Used by multicall/bundle endpoint to specify swap actions.

func (*EarnSwapParams) GetActionType

func (e *EarnSwapParams) GetActionType() *string

func (*EarnSwapParams) GetAmountIn

func (e *EarnSwapParams) GetAmountIn() EarnSwapParamsAmountIn

func (*EarnSwapParams) GetSlippage

func (e *EarnSwapParams) GetSlippage() *EarnSwapParamsSlippage

func (*EarnSwapParams) GetTokenIn

func (e *EarnSwapParams) GetTokenIn() string

func (*EarnSwapParams) GetTokenOut

func (e *EarnSwapParams) GetTokenOut() string

func (EarnSwapParams) MarshalJSON

func (e EarnSwapParams) MarshalJSON() ([]byte, error)

func (*EarnSwapParams) UnmarshalJSON

func (e *EarnSwapParams) UnmarshalJSON(data []byte) error

type EarnSwapParamsAmountIn

type EarnSwapParamsAmountIn struct {
	Number *float64 `queryParam:"inline" union:"member"`
	Str    *string  `queryParam:"inline" union:"member"`

	Type EarnSwapParamsAmountInType
}

EarnSwapParamsAmountIn - Human-readable amount of `token_in` to swap (token units, not wei).

func CreateEarnSwapParamsAmountInNumber

func CreateEarnSwapParamsAmountInNumber(number float64) EarnSwapParamsAmountIn

func CreateEarnSwapParamsAmountInStr

func CreateEarnSwapParamsAmountInStr(str string) EarnSwapParamsAmountIn

func (EarnSwapParamsAmountIn) MarshalJSON

func (u EarnSwapParamsAmountIn) MarshalJSON() ([]byte, error)

func (*EarnSwapParamsAmountIn) UnmarshalJSON

func (u *EarnSwapParamsAmountIn) UnmarshalJSON(data []byte) (err error)

type EarnSwapParamsAmountInType

type EarnSwapParamsAmountInType string
const (
	EarnSwapParamsAmountInTypeNumber EarnSwapParamsAmountInType = "number"
	EarnSwapParamsAmountInTypeStr    EarnSwapParamsAmountInType = "str"
)

type EarnSwapParamsSlippage

type EarnSwapParamsSlippage struct {
	Number *float64 `queryParam:"inline" union:"member"`
	Str    *string  `queryParam:"inline" union:"member"`

	Type EarnSwapParamsSlippageType
}

EarnSwapParamsSlippage - Maximum slippage tolerance as a percentage (e.g., 0.5 = 0.5%).

func CreateEarnSwapParamsSlippageNumber

func CreateEarnSwapParamsSlippageNumber(number float64) EarnSwapParamsSlippage

func CreateEarnSwapParamsSlippageStr

func CreateEarnSwapParamsSlippageStr(str string) EarnSwapParamsSlippage

func (EarnSwapParamsSlippage) MarshalJSON

func (u EarnSwapParamsSlippage) MarshalJSON() ([]byte, error)

func (*EarnSwapParamsSlippage) UnmarshalJSON

func (u *EarnSwapParamsSlippage) UnmarshalJSON(data []byte) (err error)

type EarnSwapParamsSlippageType

type EarnSwapParamsSlippageType string
const (
	EarnSwapParamsSlippageTypeNumber EarnSwapParamsSlippageType = "number"
	EarnSwapParamsSlippageTypeStr    EarnSwapParamsSlippageType = "str"
)

type EarnSwapQuoteResponse added in v0.1.16

type EarnSwapQuoteResponse struct {
	// Estimated amount of `token_out` received, in human-readable units. Zero when no route / insufficient liquidity exists for the pair.
	AmountOut string `json:"amount_out"`
	// The token address actually quoted as input. Usually the requested `token_in`; for Pendle (when `sy_address` is supplied) it is the resolved redeem token, which callers should use to value the input.
	TokenIn string `json:"token_in"`
	// The token address quoted as output — what `amount_out` is denominated in (the resolved `token_out` from the request).
	TokenOut string `json:"token_out"`
}

EarnSwapQuoteResponse - Estimated output of a read-only swap quote.

func (*EarnSwapQuoteResponse) GetAmountOut added in v0.1.16

func (e *EarnSwapQuoteResponse) GetAmountOut() string

func (*EarnSwapQuoteResponse) GetTokenIn added in v0.1.16

func (e *EarnSwapQuoteResponse) GetTokenIn() string

func (*EarnSwapQuoteResponse) GetTokenOut added in v0.1.16

func (e *EarnSwapQuoteResponse) GetTokenOut() string

type EarnSwapRequest

type EarnSwapRequest struct {

	// Token to sell (input). Provide a token symbol from a limited set (e.g., 'USDC') or any token address.
	TokenIn string `json:"token_in"`
	// Token to buy (output). Provide a token symbol from a limited set (e.g., 'USDT') or any token address.
	TokenOut string `json:"token_out"`
	// Human-readable amount of `token_in` to swap (token units, not wei).
	AmountIn EarnSwapRequestAmountIn `json:"amount_in"`
	// Maximum slippage tolerance as a percentage (e.g., 0.5 = 0.5%).
	Slippage *EarnSwapRequestSlippage `json:"slippage,omitzero"`
	// The owner's wallet address.
	Owner string `json:"owner"`
	// Target blockchain network where the swap will execute.
	Chain EarnSwapRequestChain `json:"chain"`
	// Optionally request gas sponsorship. If `true`, EIP-712 typed data will be returned that must be signed by the `owner` and submitted to the 'Prepare gas-sponsored transaction' endpoint (`/gas_sponsorship/prepare`).
	GasSponsorship *bool `json:"gas_sponsorship,omitzero"`
	// contains filtered or unexported fields
}

EarnSwapRequest - Swap one token held in the Earn Account for another, in a single atomic transaction.

func (*EarnSwapRequest) GetActionType

func (e *EarnSwapRequest) GetActionType() *string

func (*EarnSwapRequest) GetAmountIn

func (e *EarnSwapRequest) GetAmountIn() EarnSwapRequestAmountIn

func (*EarnSwapRequest) GetChain

func (e *EarnSwapRequest) GetChain() EarnSwapRequestChain

func (*EarnSwapRequest) GetGasSponsorship

func (e *EarnSwapRequest) GetGasSponsorship() *bool

func (*EarnSwapRequest) GetOwner

func (e *EarnSwapRequest) GetOwner() string

func (*EarnSwapRequest) GetSlippage

func (e *EarnSwapRequest) GetSlippage() *EarnSwapRequestSlippage

func (*EarnSwapRequest) GetTokenIn

func (e *EarnSwapRequest) GetTokenIn() string

func (*EarnSwapRequest) GetTokenOut

func (e *EarnSwapRequest) GetTokenOut() string

func (EarnSwapRequest) MarshalJSON

func (e EarnSwapRequest) MarshalJSON() ([]byte, error)

func (*EarnSwapRequest) UnmarshalJSON

func (e *EarnSwapRequest) UnmarshalJSON(data []byte) error

type EarnSwapRequestAmountIn

type EarnSwapRequestAmountIn struct {
	Number *float64 `queryParam:"inline" union:"member"`
	Str    *string  `queryParam:"inline" union:"member"`

	Type EarnSwapRequestAmountInType
}

EarnSwapRequestAmountIn - Human-readable amount of `token_in` to swap (token units, not wei).

func CreateEarnSwapRequestAmountInNumber

func CreateEarnSwapRequestAmountInNumber(number float64) EarnSwapRequestAmountIn

func CreateEarnSwapRequestAmountInStr

func CreateEarnSwapRequestAmountInStr(str string) EarnSwapRequestAmountIn

func (EarnSwapRequestAmountIn) MarshalJSON

func (u EarnSwapRequestAmountIn) MarshalJSON() ([]byte, error)

func (*EarnSwapRequestAmountIn) UnmarshalJSON

func (u *EarnSwapRequestAmountIn) UnmarshalJSON(data []byte) (err error)

type EarnSwapRequestAmountInType

type EarnSwapRequestAmountInType string
const (
	EarnSwapRequestAmountInTypeNumber EarnSwapRequestAmountInType = "number"
	EarnSwapRequestAmountInTypeStr    EarnSwapRequestAmountInType = "str"
)

type EarnSwapRequestChain added in v0.1.72

type EarnSwapRequestChain string

EarnSwapRequestChain - Target blockchain network where the swap will execute.

const (
	EarnSwapRequestChainArbitrum EarnSwapRequestChain = "arbitrum"
	EarnSwapRequestChainBase     EarnSwapRequestChain = "base"
	EarnSwapRequestChainBsc      EarnSwapRequestChain = "bsc"
	EarnSwapRequestChainEthereum EarnSwapRequestChain = "ethereum"
	EarnSwapRequestChainHyperevm EarnSwapRequestChain = "hyperevm"
	EarnSwapRequestChainTempo    EarnSwapRequestChain = "tempo"
)

func (EarnSwapRequestChain) ToPointer added in v0.1.72

func (*EarnSwapRequestChain) UnmarshalJSON added in v0.1.72

func (e *EarnSwapRequestChain) UnmarshalJSON(data []byte) error

type EarnSwapRequestSlippage

type EarnSwapRequestSlippage struct {
	Number *float64 `queryParam:"inline" union:"member"`
	Str    *string  `queryParam:"inline" union:"member"`

	Type EarnSwapRequestSlippageType
}

EarnSwapRequestSlippage - Maximum slippage tolerance as a percentage (e.g., 0.5 = 0.5%).

func CreateEarnSwapRequestSlippageNumber

func CreateEarnSwapRequestSlippageNumber(number float64) EarnSwapRequestSlippage

func CreateEarnSwapRequestSlippageStr

func CreateEarnSwapRequestSlippageStr(str string) EarnSwapRequestSlippage

func (EarnSwapRequestSlippage) MarshalJSON

func (u EarnSwapRequestSlippage) MarshalJSON() ([]byte, error)

func (*EarnSwapRequestSlippage) UnmarshalJSON

func (u *EarnSwapRequestSlippage) UnmarshalJSON(data []byte) (err error)

type EarnSwapRequestSlippageType

type EarnSwapRequestSlippageType string
const (
	EarnSwapRequestSlippageTypeNumber EarnSwapRequestSlippageType = "number"
	EarnSwapRequestSlippageTypeStr    EarnSwapRequestSlippageType = "str"
)

type EarnSwapResponse

type EarnSwapResponse struct {
	// Unsigned transaction for direct execution. Present when gas_sponsorship=false.
	Transaction optionalnullable.OptionalNullable[UnsignedTransaction] `json:"transaction,omitzero"`
	// EIP-712 typed data for gas-sponsored execution. Present when gas_sponsorship=true.
	Eip712 optionalnullable.OptionalNullable[BatchedSafeOperationsResponseOutput] `json:"eip_712,omitzero"`
	// Estimated amount of output token received from the swap.
	EstimatedAmountOut string `json:"estimated_amount_out"`
}

func (*EarnSwapResponse) GetEstimatedAmountOut

func (e *EarnSwapResponse) GetEstimatedAmountOut() string

func (*EarnSwapResponse) GetTransaction

func (EarnSwapResponse) MarshalJSON

func (e EarnSwapResponse) MarshalJSON() ([]byte, error)

func (*EarnSwapResponse) UnmarshalJSON

func (e *EarnSwapResponse) UnmarshalJSON(data []byte) error

type EarnTransferFromEOAParams

type EarnTransferFromEOAParams struct {

	// The token to transfer from EOA to Earn Account.
	Token string `json:"token"`
	// The amount of tokens to transfer (in token units, not wei).
	Amount EarnTransferFromEOAParamsAmount `json:"amount"`
	// The EOA owner's signature of the Permit2 PermitTransferFrom typed data. Obtain this by calling /v2/earn/transfer with action=DEPOSIT and gas_sponsorship=True, then signing the returned EIP-712 data with the owner's wallet.
	Permit2Signature string `json:"permit2_signature"`
	// The nonce used in the Permit2 signature (from the signed typed data).
	Permit2Nonce int64 `json:"permit2_nonce"`
	// The deadline timestamp used in the Permit2 signature (from the signed typed data).
	Permit2Deadline int64 `json:"permit2_deadline"`
	// contains filtered or unexported fields
}

EarnTransferFromEOAParams - Parameters for transferring tokens from EOA to Earn Account via Permit2.

Used by multicall/bundle endpoint to pull tokens from the owner's EOA into their Earn Account (Safe) as part of an atomic bundle transaction.

The owner must have: 1. Previously approved Permit2 for the token (one-time setup via /gas_sponsorship/approve_transfer) 2. Signed a Permit2 message with spender = Earn Account address

The signature is obtained by first calling /v2/earn/transfer with action=DEPOSIT and gas_sponsorship=True, then signing the returned EIP-712 typed data.

func (*EarnTransferFromEOAParams) GetActionType

func (e *EarnTransferFromEOAParams) GetActionType() *string

func (*EarnTransferFromEOAParams) GetAmount

func (*EarnTransferFromEOAParams) GetPermit2Deadline

func (e *EarnTransferFromEOAParams) GetPermit2Deadline() int64

func (*EarnTransferFromEOAParams) GetPermit2Nonce

func (e *EarnTransferFromEOAParams) GetPermit2Nonce() int64

func (*EarnTransferFromEOAParams) GetPermit2Signature

func (e *EarnTransferFromEOAParams) GetPermit2Signature() string

func (*EarnTransferFromEOAParams) GetToken

func (e *EarnTransferFromEOAParams) GetToken() string

func (EarnTransferFromEOAParams) MarshalJSON

func (e EarnTransferFromEOAParams) MarshalJSON() ([]byte, error)

func (*EarnTransferFromEOAParams) UnmarshalJSON

func (e *EarnTransferFromEOAParams) UnmarshalJSON(data []byte) error

type EarnTransferFromEOAParamsAmount

type EarnTransferFromEOAParamsAmount struct {
	Number *float64 `queryParam:"inline" union:"member"`
	Str    *string  `queryParam:"inline" union:"member"`

	Type EarnTransferFromEOAParamsAmountType
}

EarnTransferFromEOAParamsAmount - The amount of tokens to transfer (in token units, not wei).

func CreateEarnTransferFromEOAParamsAmountNumber

func CreateEarnTransferFromEOAParamsAmountNumber(number float64) EarnTransferFromEOAParamsAmount

func CreateEarnTransferFromEOAParamsAmountStr

func CreateEarnTransferFromEOAParamsAmountStr(str string) EarnTransferFromEOAParamsAmount

func (EarnTransferFromEOAParamsAmount) MarshalJSON

func (u EarnTransferFromEOAParamsAmount) MarshalJSON() ([]byte, error)

func (*EarnTransferFromEOAParamsAmount) UnmarshalJSON

func (u *EarnTransferFromEOAParamsAmount) UnmarshalJSON(data []byte) (err error)

type EarnTransferFromEOAParamsAmountType

type EarnTransferFromEOAParamsAmountType string
const (
	EarnTransferFromEOAParamsAmountTypeNumber EarnTransferFromEOAParamsAmountType = "number"
	EarnTransferFromEOAParamsAmountTypeStr    EarnTransferFromEOAParamsAmountType = "str"
)

type EarnTransferRequest

type EarnTransferRequest struct {
	// The owner's wallet address.
	Owner string `json:"owner"`
	// Blockchain network
	Chain EarnTransferRequestChain `json:"chain"`
	// The token you would like to transfer.
	Token string `json:"token"`
	// The amount of 'token' to transfer.
	Amount EarnTransferRequestAmount `json:"amount"`
	// Whether you are depositing to or withdrawing from your earn account.
	Action EarnTransferRequestAction `json:"action"`
	// Optionally request gas sponsorship. If set to `true`, EIP-712 signature data will be returned that must be signed by the `owner` and submitted to the `/gas_sponsorship/prepare` endpoint.
	GasSponsorship *bool `json:"gas_sponsorship,omitzero"`
	// The address that will call Permit2's permitTransferFrom to execute the transfer. When `action` is 'DEPOSIT' and `gas_sponsorship` is `true`: - If provided, the signature will authorize this address (typically a gas sponsor) to pull tokens. - If not provided, defaults to the Earn Account (Safe) address, allowing the transfer to be included in a bundle transaction where the Safe pulls the tokens itself.
	Spender optionalnullable.OptionalNullable[string] `json:"spender,omitzero"`
	// Optional recipient address for withdrawals. When `action` is 'WITHDRAW': - If provided, tokens will be sent to this address instead of the owner. - If not provided, defaults to the owner's address.
	Recipient optionalnullable.OptionalNullable[string] `json:"recipient,omitzero"`
}

func (*EarnTransferRequest) GetAction

func (*EarnTransferRequest) GetAmount

func (*EarnTransferRequest) GetChain

func (*EarnTransferRequest) GetGasSponsorship

func (e *EarnTransferRequest) GetGasSponsorship() *bool

func (*EarnTransferRequest) GetOwner

func (e *EarnTransferRequest) GetOwner() string

func (*EarnTransferRequest) GetRecipient

func (*EarnTransferRequest) GetSpender

func (*EarnTransferRequest) GetToken

func (e *EarnTransferRequest) GetToken() string

type EarnTransferRequestAction

type EarnTransferRequestAction string

EarnTransferRequestAction - Whether you are depositing to or withdrawing from your earn account.

const (
	EarnTransferRequestActionDeposit  EarnTransferRequestAction = "DEPOSIT"
	EarnTransferRequestActionWithdraw EarnTransferRequestAction = "WITHDRAW"
)

func (EarnTransferRequestAction) ToPointer

func (*EarnTransferRequestAction) UnmarshalJSON

func (e *EarnTransferRequestAction) UnmarshalJSON(data []byte) error

type EarnTransferRequestAmount

type EarnTransferRequestAmount struct {
	Number *float64 `queryParam:"inline" union:"member"`
	Str    *string  `queryParam:"inline" union:"member"`

	Type EarnTransferRequestAmountType
}

EarnTransferRequestAmount - The amount of 'token' to transfer.

func CreateEarnTransferRequestAmountNumber

func CreateEarnTransferRequestAmountNumber(number float64) EarnTransferRequestAmount

func CreateEarnTransferRequestAmountStr

func CreateEarnTransferRequestAmountStr(str string) EarnTransferRequestAmount

func (EarnTransferRequestAmount) MarshalJSON

func (u EarnTransferRequestAmount) MarshalJSON() ([]byte, error)

func (*EarnTransferRequestAmount) UnmarshalJSON

func (u *EarnTransferRequestAmount) UnmarshalJSON(data []byte) (err error)

type EarnTransferRequestAmountType

type EarnTransferRequestAmountType string
const (
	EarnTransferRequestAmountTypeNumber EarnTransferRequestAmountType = "number"
	EarnTransferRequestAmountTypeStr    EarnTransferRequestAmountType = "str"
)

type EarnTransferRequestChain added in v0.1.72

type EarnTransferRequestChain string

EarnTransferRequestChain - Blockchain network

const (
	EarnTransferRequestChainArbitrum EarnTransferRequestChain = "arbitrum"
	EarnTransferRequestChainBase     EarnTransferRequestChain = "base"
	EarnTransferRequestChainBsc      EarnTransferRequestChain = "bsc"
	EarnTransferRequestChainEthereum EarnTransferRequestChain = "ethereum"
	EarnTransferRequestChainHyperevm EarnTransferRequestChain = "hyperevm"
	EarnTransferRequestChainTempo    EarnTransferRequestChain = "tempo"
)

func (EarnTransferRequestChain) ToPointer added in v0.1.72

func (*EarnTransferRequestChain) UnmarshalJSON added in v0.1.72

func (e *EarnTransferRequestChain) UnmarshalJSON(data []byte) error

type EarnTransferResponse

type EarnTransferResponse struct {
	// Unsigned transaction for direct execution. Present when gas_sponsorship=false.
	Transaction optionalnullable.OptionalNullable[UnsignedTransaction] `json:"transaction,omitzero"`
	// EIP-712 typed data for gas-sponsored execution. Present when gas_sponsorship=true.
	Eip712 optionalnullable.OptionalNullable[EarnTransferResponseEip712] `json:"eip_712,omitzero"`
}

func (*EarnTransferResponse) GetTransaction

func (EarnTransferResponse) MarshalJSON

func (e EarnTransferResponse) MarshalJSON() ([]byte, error)

func (*EarnTransferResponse) UnmarshalJSON

func (e *EarnTransferResponse) UnmarshalJSON(data []byte) error

type EarnTransferResponseEip712

type EarnTransferResponseEip712 struct {
	BatchedSafeOperationsResponseOutput *BatchedSafeOperationsResponseOutput `queryParam:"inline" union:"member"`
	Permit2TypedDataOutput              *Permit2TypedDataOutput              `queryParam:"inline" union:"member"`
	UnknownRaw                          json.RawMessage                      `json:"-" union:"unknown"`

	Type EarnTransferResponseEip712Type
}

EarnTransferResponseEip712 - EIP-712 typed data for gas-sponsored execution. Present when gas_sponsorship=true.

func CreateEarnTransferResponseEip712BatchedSafeOperationsResponseOutput

func CreateEarnTransferResponseEip712BatchedSafeOperationsResponseOutput(batchedSafeOperationsResponseOutput BatchedSafeOperationsResponseOutput) EarnTransferResponseEip712

func CreateEarnTransferResponseEip712Permit2TypedDataOutput

func CreateEarnTransferResponseEip712Permit2TypedDataOutput(permit2TypedDataOutput Permit2TypedDataOutput) EarnTransferResponseEip712

func CreateEarnTransferResponseEip712Unknown

func CreateEarnTransferResponseEip712Unknown(raw json.RawMessage) EarnTransferResponseEip712

func (EarnTransferResponseEip712) GetUnknownRaw

func (u EarnTransferResponseEip712) GetUnknownRaw() json.RawMessage

func (EarnTransferResponseEip712) IsUnknown

func (u EarnTransferResponseEip712) IsUnknown() bool

func (EarnTransferResponseEip712) MarshalJSON

func (u EarnTransferResponseEip712) MarshalJSON() ([]byte, error)

func (*EarnTransferResponseEip712) UnmarshalJSON

func (u *EarnTransferResponseEip712) UnmarshalJSON(data []byte) error

type EarnTransferResponseEip712Type

type EarnTransferResponseEip712Type string
const (
	EarnTransferResponseEip712TypeBatchedSafeOperationsResponseOutput EarnTransferResponseEip712Type = "BatchedSafeOperationsResponse-Output"
	EarnTransferResponseEip712TypePermit2TypedDataOutput              EarnTransferResponseEip712Type = "Permit2TypedData-Output"
	EarnTransferResponseEip712TypeUnknown                             EarnTransferResponseEip712Type = "Unknown"
)

type EarnTransferToAddressParams

type EarnTransferToAddressParams struct {

	// The ERC20 token to transfer from the product account.
	Token string `json:"token"`
	// The amount of tokens to transfer (in token units, not wei).
	Amount EarnTransferToAddressParamsAmount `json:"amount"`
	// The destination address to receive the tokens.
	Recipient string `json:"recipient"`
	// contains filtered or unexported fields
}

EarnTransferToAddressParams - Parameters for transferring tokens from product account to an arbitrary address.

Used by multicall/bundle endpoint to send ERC20 tokens from the product account to any specified recipient address as part of an atomic bundle transaction.

No signature is required for this action since the product account already owns the tokens and is executing the transfer as part of its own transaction.

func (*EarnTransferToAddressParams) GetActionType

func (e *EarnTransferToAddressParams) GetActionType() *string

func (*EarnTransferToAddressParams) GetAmount

func (*EarnTransferToAddressParams) GetRecipient

func (e *EarnTransferToAddressParams) GetRecipient() string

func (*EarnTransferToAddressParams) GetToken

func (e *EarnTransferToAddressParams) GetToken() string

func (EarnTransferToAddressParams) MarshalJSON

func (e EarnTransferToAddressParams) MarshalJSON() ([]byte, error)

func (*EarnTransferToAddressParams) UnmarshalJSON

func (e *EarnTransferToAddressParams) UnmarshalJSON(data []byte) error

type EarnTransferToAddressParamsAmount

type EarnTransferToAddressParamsAmount struct {
	Number *float64 `queryParam:"inline" union:"member"`
	Str    *string  `queryParam:"inline" union:"member"`

	Type EarnTransferToAddressParamsAmountType
}

EarnTransferToAddressParamsAmount - The amount of tokens to transfer (in token units, not wei).

func CreateEarnTransferToAddressParamsAmountNumber

func CreateEarnTransferToAddressParamsAmountNumber(number float64) EarnTransferToAddressParamsAmount

func CreateEarnTransferToAddressParamsAmountStr

func CreateEarnTransferToAddressParamsAmountStr(str string) EarnTransferToAddressParamsAmount

func (EarnTransferToAddressParamsAmount) MarshalJSON

func (u EarnTransferToAddressParamsAmount) MarshalJSON() ([]byte, error)

func (*EarnTransferToAddressParamsAmount) UnmarshalJSON

func (u *EarnTransferToAddressParamsAmount) UnmarshalJSON(data []byte) (err error)

type EarnTransferToAddressParamsAmountType

type EarnTransferToAddressParamsAmountType string
const (
	EarnTransferToAddressParamsAmountTypeNumber EarnTransferToAddressParamsAmountType = "number"
	EarnTransferToAddressParamsAmountTypeStr    EarnTransferToAddressParamsAmountType = "str"
)

type EarnTransferToEOAParams

type EarnTransferToEOAParams struct {

	// The token to transfer from Earn Account to EOA.
	Token string `json:"token"`
	// The amount of tokens to transfer (in token units, not wei).
	Amount EarnTransferToEOAParamsAmount `json:"amount"`
	// contains filtered or unexported fields
}

EarnTransferToEOAParams - Parameters for transferring tokens from Earn Account to EOA (withdrawal).

Used by multicall/bundle endpoint to send tokens from the Earn Account (Safe) back to the owner's EOA as part of an atomic bundle transaction.

No signature is required for this action since the Safe already owns the tokens and is executing the transfer as part of its own transaction.

func (*EarnTransferToEOAParams) GetActionType

func (e *EarnTransferToEOAParams) GetActionType() *string

func (*EarnTransferToEOAParams) GetAmount

func (*EarnTransferToEOAParams) GetToken

func (e *EarnTransferToEOAParams) GetToken() string

func (EarnTransferToEOAParams) MarshalJSON

func (e EarnTransferToEOAParams) MarshalJSON() ([]byte, error)

func (*EarnTransferToEOAParams) UnmarshalJSON

func (e *EarnTransferToEOAParams) UnmarshalJSON(data []byte) error

type EarnTransferToEOAParamsAmount

type EarnTransferToEOAParamsAmount struct {
	Number *float64 `queryParam:"inline" union:"member"`
	Str    *string  `queryParam:"inline" union:"member"`

	Type EarnTransferToEOAParamsAmountType
}

EarnTransferToEOAParamsAmount - The amount of tokens to transfer (in token units, not wei).

func CreateEarnTransferToEOAParamsAmountNumber

func CreateEarnTransferToEOAParamsAmountNumber(number float64) EarnTransferToEOAParamsAmount

func CreateEarnTransferToEOAParamsAmountStr

func CreateEarnTransferToEOAParamsAmountStr(str string) EarnTransferToEOAParamsAmount

func (EarnTransferToEOAParamsAmount) MarshalJSON

func (u EarnTransferToEOAParamsAmount) MarshalJSON() ([]byte, error)

func (*EarnTransferToEOAParamsAmount) UnmarshalJSON

func (u *EarnTransferToEOAParamsAmount) UnmarshalJSON(data []byte) (err error)

type EarnTransferToEOAParamsAmountType

type EarnTransferToEOAParamsAmountType string
const (
	EarnTransferToEOAParamsAmountTypeNumber EarnTransferToEOAParamsAmountType = "number"
	EarnTransferToEOAParamsAmountTypeStr    EarnTransferToEOAParamsAmountType = "str"
)

type Eip712DomainField

type Eip712DomainField struct {
	Name string `json:"name"`
	Type string `json:"type"`
}

Eip712DomainField - A field in the EIP712Domain type definition.

func (*Eip712DomainField) GetName

func (e *Eip712DomainField) GetName() string

func (*Eip712DomainField) GetType

func (e *Eip712DomainField) GetType() string

func (Eip712DomainField) MarshalJSON

func (e Eip712DomainField) MarshalJSON() ([]byte, error)

func (*Eip712DomainField) UnmarshalJSON

func (e *Eip712DomainField) UnmarshalJSON(data []byte) error

type Eip712Field

type Eip712Field struct {
	// Field name in the struct
	Name string `json:"name"`
	// EVM type (e.g., address, uint256, TokenPermissions)
	Type string `json:"type"`
}

func (*Eip712Field) GetName

func (e *Eip712Field) GetName() string

func (*Eip712Field) GetType

func (e *Eip712Field) GetType() string

func (Eip712Field) MarshalJSON

func (e Eip712Field) MarshalJSON() ([]byte, error)

func (*Eip712Field) UnmarshalJSON

func (e *Eip712Field) UnmarshalJSON(data []byte) error

type EulerMarket added in v0.1.28

type EulerMarket struct {
	// EVK vault to borrow from (pass as borrow_vault when borrowing).
	Vault string `json:"vault"`
	// Symbol of the EVK vault (e.g. eUSDT-2).
	VaultSymbol string `json:"vault_symbol"`
	// Underlying asset this market lends and borrows.
	Asset string `json:"asset"`
	// Symbol of the borrowable asset (e.g. USDT).
	AssetSymbol string `json:"asset_symbol"`
	// Decimals of the borrowable asset.
	AssetDecimals int64 `json:"asset_decimals"`
	// USD price of one whole unit of the borrowable asset. Use it to convert USD borrow capacity into token units. Null if the price feed can't quote it.
	AssetPriceUsd optionalnullable.OptionalNullable[string] `json:"asset_price_usd,omitzero"`
	// Symbol of the market's native unit of account (usually USD). The market's own risk engine denominates collateral and debt in this unit.
	UnitOfAccountSymbol optionalnullable.OptionalNullable[string] `json:"unit_of_account_symbol,omitzero"`
	// Current borrow APY for this market (cost to borrow the asset), in percentage (e.g. 5.25 means 5.25%). Null if the rate is unavailable.
	BorrowApy optionalnullable.OptionalNullable[string] `json:"borrow_apy,omitzero"`
	// Current supply APY for this market (yield for supplying the asset), in percentage (e.g. 3.45 means 3.45%). Null if the rate is unavailable.
	SupplyApy optionalnullable.OptionalNullable[string] `json:"supply_apy,omitzero"`
	// What the borrowable asset earns inside its own price, in percentage, trailing 7 days. Debt owed in such a token grows by this on top of borrow_apy — a borrower's true cost is their sum. Null means unmeasured, NOT zero.
	IntrinsicApy optionalnullable.OptionalNullable[string] `json:"intrinsic_apy,omitzero"`
	// Asset available to borrow right now (vault cash), in token units. A borrow larger than this reverts even if the account is healthy.
	AvailableLiquidity string `json:"available_liquidity"`
	// Total asset supplied to this market, in token units.
	TotalSupplyAssets string `json:"total_supply_assets"`
	// Total asset borrowed from this market, in token units.
	TotalBorrowAssets string `json:"total_borrow_assets"`
	// Borrowed share of supplied assets, in percentage 0-100.
	Utilization string `json:"utilization"`
	// Total asset supplied to this market in USD (total_supply_assets priced by the shared request-time feed). Null when the price feed can't quote the asset — size in token units instead.
	TvlUsd optionalnullable.OptionalNullable[string] `json:"tvl_usd,omitzero"`
	// Asset available to borrow right now in USD (available_liquidity priced by the shared request-time feed; vault cash equals supplied minus borrowed). Null when the price feed can't quote the asset.
	LiquidityUsd optionalnullable.OptionalNullable[string] `json:"liquidity_usd,omitzero"`
	// Maximum total supply allowed, in token units. Null when the market is uncapped.
	SupplyCap optionalnullable.OptionalNullable[string] `json:"supply_cap,omitzero"`
	// Maximum total borrow allowed, in token units. A borrow that would breach this reverts even when cash exists. Null when uncapped.
	BorrowCap optionalnullable.OptionalNullable[string] `json:"borrow_cap,omitzero"`
	// Collateral vaults this market accepts (those currently borrowable, LTV > 0), each with its LTVs.
	Collaterals []EulerMarketCollateral `json:"collaterals,omitzero"`
}

EulerMarket - An Euler V2 borrow market: a vault to borrow from + the collaterals it accepts.

func (*EulerMarket) GetAsset added in v0.1.28

func (e *EulerMarket) GetAsset() string

func (*EulerMarket) GetAssetDecimals added in v0.1.28

func (e *EulerMarket) GetAssetDecimals() int64

func (*EulerMarket) GetAssetPriceUsd added in v0.1.42

func (e *EulerMarket) GetAssetPriceUsd() optionalnullable.OptionalNullable[string]

func (*EulerMarket) GetAssetSymbol added in v0.1.28

func (e *EulerMarket) GetAssetSymbol() string

func (*EulerMarket) GetAvailableLiquidity added in v0.1.42

func (e *EulerMarket) GetAvailableLiquidity() string

func (*EulerMarket) GetBorrowApy added in v0.1.29

func (*EulerMarket) GetBorrowCap added in v0.1.42

func (*EulerMarket) GetCollaterals added in v0.1.28

func (e *EulerMarket) GetCollaterals() []EulerMarketCollateral

func (*EulerMarket) GetIntrinsicApy added in v0.1.67

func (e *EulerMarket) GetIntrinsicApy() optionalnullable.OptionalNullable[string]

func (*EulerMarket) GetLiquidityUsd added in v0.1.67

func (e *EulerMarket) GetLiquidityUsd() optionalnullable.OptionalNullable[string]

func (*EulerMarket) GetSupplyApy added in v0.1.29

func (*EulerMarket) GetSupplyCap added in v0.1.42

func (*EulerMarket) GetTotalBorrowAssets added in v0.1.42

func (e *EulerMarket) GetTotalBorrowAssets() string

func (*EulerMarket) GetTotalSupplyAssets added in v0.1.42

func (e *EulerMarket) GetTotalSupplyAssets() string

func (*EulerMarket) GetTvlUsd added in v0.1.67

func (*EulerMarket) GetUnitOfAccountSymbol added in v0.1.42

func (e *EulerMarket) GetUnitOfAccountSymbol() optionalnullable.OptionalNullable[string]

func (*EulerMarket) GetUtilization added in v0.1.42

func (e *EulerMarket) GetUtilization() string

func (*EulerMarket) GetVault added in v0.1.28

func (e *EulerMarket) GetVault() string

func (*EulerMarket) GetVaultSymbol added in v0.1.28

func (e *EulerMarket) GetVaultSymbol() string

func (EulerMarket) MarshalJSON added in v0.1.28

func (e EulerMarket) MarshalJSON() ([]byte, error)

func (*EulerMarket) UnmarshalJSON added in v0.1.28

func (e *EulerMarket) UnmarshalJSON(data []byte) error

type EulerMarketCollateral added in v0.1.28

type EulerMarketCollateral struct {
	// EVK collateral vault to supply into (pass as collateral_vault when borrowing).
	Vault string `json:"vault"`
	// Underlying asset of the collateral vault.
	Asset string `json:"asset"`
	// Symbol of the collateral's underlying asset (e.g. USDC).
	AssetSymbol string `json:"asset_symbol"`
	// Decimals of the collateral's underlying asset.
	AssetDecimals int64 `json:"asset_decimals"`
	// USD price of one whole unit of the collateral asset. Null if the price feed can't quote it (size the supply in token units instead).
	AssetPriceUsd optionalnullable.OptionalNullable[string] `json:"asset_price_usd,omitzero"`
	// Maximum loan-to-value when borrowing against this collateral, in percentage (e.g. 94 means 94%).
	BorrowLtv string `json:"borrow_ltv"`
	// Loan-to-value at which this collateral is liquidated, in percentage (e.g. 96 means 96%).
	LiquidationLtv string `json:"liquidation_ltv"`
	// Current supply APY earned on this collateral while it backs a loan, in percentage (e.g. 3.5 means 3.5%). Null if the rate is unavailable.
	SupplyApy optionalnullable.OptionalNullable[string] `json:"supply_apy,omitzero"`
	// What the collateral token earns inside its own price, in percentage: an ERC-4626 share's vault yield, a staking token's rewards, or an RWA token's NAV accrual, trailing 7 days. Earned on top of supply_apy — the collateral leg's whole yield is their sum. Null means unmeasured, NOT zero: a plain token (USDC, cbBTC) earns nothing and a yield-bearing one may simply not be indexed yet.
	IntrinsicApy optionalnullable.OptionalNullable[string] `json:"intrinsic_apy,omitzero"`
}

EulerMarketCollateral - A collateral vault an Euler borrow market accepts, with its loan-to-value.

func (*EulerMarketCollateral) GetAsset added in v0.1.28

func (e *EulerMarketCollateral) GetAsset() string

func (*EulerMarketCollateral) GetAssetDecimals added in v0.1.42

func (e *EulerMarketCollateral) GetAssetDecimals() int64

func (*EulerMarketCollateral) GetAssetPriceUsd added in v0.1.42

func (*EulerMarketCollateral) GetAssetSymbol added in v0.1.28

func (e *EulerMarketCollateral) GetAssetSymbol() string

func (*EulerMarketCollateral) GetBorrowLtv added in v0.1.28

func (e *EulerMarketCollateral) GetBorrowLtv() string

func (*EulerMarketCollateral) GetIntrinsicApy added in v0.1.67

func (*EulerMarketCollateral) GetLiquidationLtv added in v0.1.28

func (e *EulerMarketCollateral) GetLiquidationLtv() string

func (*EulerMarketCollateral) GetSupplyApy added in v0.1.29

func (*EulerMarketCollateral) GetVault added in v0.1.28

func (e *EulerMarketCollateral) GetVault() string

type EulerMarketsResponse added in v0.1.28

type EulerMarketsResponse struct {
	// Euler Governed Perspective contract the curated vault set was read from.
	Perspective string `json:"perspective"`
	// Curated borrow markets, each with its accepted collateral vaults and LTVs.
	Markets []EulerMarket `json:"markets,omitzero"`
}

EulerMarketsResponse - Curated Euler V2 borrow markets, read from Euler's Governed Perspective.

func (*EulerMarketsResponse) GetMarkets added in v0.1.28

func (e *EulerMarketsResponse) GetMarkets() []EulerMarket

func (*EulerMarketsResponse) GetPerspective added in v0.1.28

func (e *EulerMarketsResponse) GetPerspective() string

func (EulerMarketsResponse) MarshalJSON added in v0.1.28

func (e EulerMarketsResponse) MarshalJSON() ([]byte, error)

func (*EulerMarketsResponse) UnmarshalJSON added in v0.1.28

func (e *EulerMarketsResponse) UnmarshalJSON(data []byte) error

type Fee

type Fee struct {
	// The wallet address that will receive the fee.
	Recipient string `json:"recipient"`
	// The fee amount. If `denomination` is 'PERCENTAGE', this is a percentage of the transaction amount (e.g., 1.5 for 1.5%). If `denomination` is 'FIXED', this is a fixed amount in token units (e.g., 0.1 for 0.1 tokens). If `denomination` is 'PERFORMANCE', this is a percentage of realized profit calculated using FIFO cost basis (e.g., 10 for 10% of profit).
	Amount FeeAmount `json:"amount"`
	// The unit type for the fee amount. Use 'PERCENTAGE' for a percentage-based fee (e.g., 1.5 means 1.5% of the transaction amount), 'FIXED' for a fixed token amount (e.g., 0.1 means 0.1 tokens), or 'PERFORMANCE' for a fee based on realized profit using FIFO cost basis (e.g., 10 means 10% of profit).
	Denomination *FeeDenomination `json:"denomination,omitzero"`
}

func (*Fee) GetAmount

func (f *Fee) GetAmount() FeeAmount

func (*Fee) GetDenomination

func (f *Fee) GetDenomination() *FeeDenomination

func (*Fee) GetRecipient

func (f *Fee) GetRecipient() string

func (Fee) MarshalJSON

func (f Fee) MarshalJSON() ([]byte, error)

func (*Fee) UnmarshalJSON

func (f *Fee) UnmarshalJSON(data []byte) error

type FeeAmount

type FeeAmount struct {
	Number *float64 `queryParam:"inline" union:"member"`
	Str    *string  `queryParam:"inline" union:"member"`

	Type FeeAmountType
}

FeeAmount - The fee amount. If `denomination` is 'PERCENTAGE', this is a percentage of the transaction amount (e.g., 1.5 for 1.5%). If `denomination` is 'FIXED', this is a fixed amount in token units (e.g., 0.1 for 0.1 tokens). If `denomination` is 'PERFORMANCE', this is a percentage of realized profit calculated using FIFO cost basis (e.g., 10 for 10% of profit).

func CreateFeeAmountNumber

func CreateFeeAmountNumber(number float64) FeeAmount

func CreateFeeAmountStr

func CreateFeeAmountStr(str string) FeeAmount

func (FeeAmount) MarshalJSON

func (u FeeAmount) MarshalJSON() ([]byte, error)

func (*FeeAmount) UnmarshalJSON

func (u *FeeAmount) UnmarshalJSON(data []byte) (err error)

type FeeAmountType

type FeeAmountType string
const (
	FeeAmountTypeNumber FeeAmountType = "number"
	FeeAmountTypeStr    FeeAmountType = "str"
)

type FeeDenomination

type FeeDenomination string

FeeDenomination - The unit type for the fee amount. Use 'PERCENTAGE' for a percentage-based fee (e.g., 1.5 means 1.5% of the transaction amount), 'FIXED' for a fixed token amount (e.g., 0.1 means 0.1 tokens), or 'PERFORMANCE' for a fee based on realized profit using FIFO cost basis (e.g., 10 means 10% of profit).

const (
	FeeDenominationPercentage  FeeDenomination = "PERCENTAGE"
	FeeDenominationFixed       FeeDenomination = "FIXED"
	FeeDenominationPerformance FeeDenomination = "PERFORMANCE"
)

func (FeeDenomination) ToPointer

func (e FeeDenomination) ToPointer() *FeeDenomination

func (*FeeDenomination) UnmarshalJSON

func (e *FeeDenomination) UnmarshalJSON(data []byte) error

type HTTPMetadata

type HTTPMetadata struct {
	// Raw HTTP response; suitable for custom response parsing
	Response *http.Response `json:"-"`
	// Raw HTTP request; suitable for debugging
	Request *http.Request `json:"-"`
}

func (*HTTPMetadata) GetRequest

func (h *HTTPMetadata) GetRequest() *http.Request

func (*HTTPMetadata) GetResponse

func (h *HTTPMetadata) GetResponse() *http.Response

type InitialCollateralAmount added in v0.1.34

type InitialCollateralAmount struct {
	Number *float64 `queryParam:"inline" union:"member"`
	Str    *string  `queryParam:"inline" union:"member"`

	Type InitialCollateralAmountType
}

InitialCollateralAmount - Collateral (in token units) that the Credit Account must ALREADY hold when this is called — the loop never pulls from the owner's wallet mid-transaction. Fund the account first via /v2/credit/transfer (action=DEPOSIT).

func CreateInitialCollateralAmountNumber added in v0.1.34

func CreateInitialCollateralAmountNumber(number float64) InitialCollateralAmount

func CreateInitialCollateralAmountStr added in v0.1.34

func CreateInitialCollateralAmountStr(str string) InitialCollateralAmount

func (InitialCollateralAmount) MarshalJSON added in v0.1.34

func (u InitialCollateralAmount) MarshalJSON() ([]byte, error)

func (*InitialCollateralAmount) UnmarshalJSON added in v0.1.34

func (u *InitialCollateralAmount) UnmarshalJSON(data []byte) (err error)

type InitialCollateralAmountType added in v0.1.34

type InitialCollateralAmountType string
const (
	InitialCollateralAmountTypeNumber InitialCollateralAmountType = "number"
	InitialCollateralAmountTypeStr    InitialCollateralAmountType = "str"
)

type InterestRateMode

type InterestRateMode string

InterestRateMode - On AAVE there are 2 different interest modes.

A stable (but typically higher rate), or a variable rate.

const (
	InterestRateModeStable   InterestRateMode = "stable"
	InterestRateModeVariable InterestRateMode = "variable"
)

func (InterestRateMode) ToPointer

func (e InterestRateMode) ToPointer() *InterestRateMode

func (*InterestRateMode) UnmarshalJSON

func (e *InterestRateMode) UnmarshalJSON(data []byte) error

type ListAaveMarketsResponse

type ListAaveMarketsResponse struct {
	// Market data keyed by token symbol. Each token contains chain-specific data and information about which chain has the highest supply APY.
	Markets map[string]TokenMarketData `json:"markets"`
}

ListAaveMarketsResponse - Response containing Aave market rates organized by token symbol.

func (*ListAaveMarketsResponse) GetMarkets

func (l *ListAaveMarketsResponse) GetMarkets() map[string]TokenMarketData

type LoanToValue added in v0.1.34

type LoanToValue struct {
	Number *float64 `queryParam:"inline" union:"member"`
	Str    *string  `queryParam:"inline" union:"member"`

	Type LoanToValueType
}

LoanToValue - Per-iteration borrow LTV in percent. Must not exceed the protocol's maximum for the market (Aave reserve/e-mode LTV; Morpho LLTV with a safety margin; Euler's borrow LTV for the collateral vault); borrows are sized slightly inside the requested value so no leg sits on the protocol's revert boundary.

func CreateLoanToValueNumber added in v0.1.34

func CreateLoanToValueNumber(number float64) LoanToValue

func CreateLoanToValueStr added in v0.1.34

func CreateLoanToValueStr(str string) LoanToValue

func (LoanToValue) MarshalJSON added in v0.1.34

func (u LoanToValue) MarshalJSON() ([]byte, error)

func (*LoanToValue) UnmarshalJSON added in v0.1.34

func (u *LoanToValue) UnmarshalJSON(data []byte) (err error)

type LoanToValueType added in v0.1.34

type LoanToValueType string
const (
	LoanToValueTypeNumber LoanToValueType = "number"
	LoanToValueTypeStr    LoanToValueType = "str"
)

type Loc

type Loc struct {
	Str        *string         `queryParam:"inline" union:"member"`
	Integer    *int64          `queryParam:"inline" union:"member"`
	UnknownRaw json.RawMessage `json:"-" union:"unknown"`

	Type LocType
}

func CreateLocInteger

func CreateLocInteger(integer int64) Loc

func CreateLocStr

func CreateLocStr(str string) Loc

func CreateLocUnknown

func CreateLocUnknown(raw json.RawMessage) Loc

func (Loc) GetUnknownRaw

func (u Loc) GetUnknownRaw() json.RawMessage

func (Loc) IsUnknown

func (u Loc) IsUnknown() bool

func (Loc) MarshalJSON

func (u Loc) MarshalJSON() ([]byte, error)

func (*Loc) UnmarshalJSON

func (u *Loc) UnmarshalJSON(data []byte) error

type LocType

type LocType string
const (
	LocTypeStr     LocType = "str"
	LocTypeInteger LocType = "integer"
	LocTypeUnknown LocType = "Unknown"
)

type LoopLegPreview added in v0.1.34

type LoopLegPreview struct {
	// Collateral supplied this iteration (token units).
	SupplyAmount *string `json:"supply_amount"`
	// Loan borrowed this iteration; null on the final supply-only iteration.
	BorrowAmount optionalnullable.OptionalNullable[string] `json:"borrow_amount,omitzero"`
	// Guaranteed swap output (collateral units) — the next iteration's supply. Enforced on-chain by the swap's minimum-return.
	MinSwapOut optionalnullable.OptionalNullable[string] `json:"min_swap_out,omitzero"`
	// Quoted swap output (collateral units) before the slippage floor is applied. Only min_swap_out is guaranteed on-chain; the gap between the two is the adverse-slippage tolerance, bounded by max_slippage_percent, not a surplus that is certain to arrive. Whatever the fill actually delivers above min_swap_out stays in the account, and estimated_max_dust is the upper bound on that.
	ExpectedSwapOut optionalnullable.OptionalNullable[string] `json:"expected_swap_out,omitzero"`
}

LoopLegPreview - One planned loop iteration.

func (*LoopLegPreview) GetBorrowAmount added in v0.1.34

func (*LoopLegPreview) GetExpectedSwapOut added in v0.1.52

func (l *LoopLegPreview) GetExpectedSwapOut() optionalnullable.OptionalNullable[string]

func (*LoopLegPreview) GetMinSwapOut added in v0.1.34

func (*LoopLegPreview) GetSupplyAmount added in v0.1.34

func (l *LoopLegPreview) GetSupplyAmount() *string

type LoopedPosition added in v0.1.34

type LoopedPosition struct {
	// Which lending protocol a credit action targets.
	//
	// “AAVE“ is the default so existing callers (which never send a “protocol“
	// field) keep hitting the unchanged Aave code path; markets are named by token
	// symbol. “MORPHO“ identifies Morpho Blue lending markets by their bytes32
	// “market_id“. “EULER“ identifies Euler V2 markets by their EVK
	// “collateral_vault“ + “borrow_vault“ addresses and supports isolated
	// per-sub-account positions (“sub_account_id“).
	//
	// Deployment is per chain, so a valid protocol can still 422 on a given chain:
	// AAVE on Ethereum, Base, Arbitrum, BSC and HyperEVM (where it is Hyperlend, the
	// chain's Aave V3 deployment); MORPHO on Ethereum, Base, Arbitrum and HyperEVM
	// (where it is Felix); EULER on Ethereum, Base, Arbitrum and BSC.
	//
	// All three support “/v2/credit/loop“, “/v2/credit/unloop“,
	// “/v2/credit/looped_positions“ and “/v2/credit/rebalance“.
	Protocol CreditProtocol `json:"protocol"`
	// Morpho only: the bytes32 id of the isolated market.
	MarketID optionalnullable.OptionalNullable[string] `json:"market_id,omitzero"`
	// Euler only: the EVC sub-account (0-255) holding this position. Euler isolates each loop in its own sub-account, so this is part of the position's identity — two loops on the same vault pair in different sub-accounts are two separate positions.
	SubAccountID optionalnullable.OptionalNullable[int64] `json:"sub_account_id,omitzero"`
	// Euler only: the EVK vault holding the collateral. Euler markets are identified by their vault pair rather than by a market id, and the same underlying token can back several different vaults.
	CollateralVault optionalnullable.OptionalNullable[string] `json:"collateral_vault,omitzero"`
	// Euler only: the EVK controller vault the debt is owed to.
	BorrowVault optionalnullable.OptionalNullable[string] `json:"borrow_vault,omitzero"`
	// Address of the collateral token.
	CollateralToken string `json:"collateral_token"`
	// Symbol of the collateral token.
	CollateralSymbol string `json:"collateral_symbol"`
	// Address of the debt token.
	DebtToken string `json:"debt_token"`
	// Symbol of the debt token.
	DebtSymbol string `json:"debt_symbol"`
	// Whether the position is currently open or fully closed.
	Status LoopedPositionStatus `json:"status"`
	// Timestamp of the position's first transaction.
	OpenedAt time.Time `json:"opened_at"`
	// Timestamp the position was fully closed; null while open.
	ClosedAt optionalnullable.OptionalNullable[time.Time] `json:"closed_at,omitzero"`
	// Live on-chain state; null for CLOSED positions.
	Current optionalnullable.OptionalNullable[LoopedPositionCurrentState] `json:"current,omitzero"`
	// Lifetime totals across all of a looped position's transactions.
	Totals LoopedPositionTotals `json:"totals"`
	// All transactions for this position, chronological.
	History []LoopedPositionHistoryEntry `json:"history,omitzero"`
}

LoopedPosition - A single looped (leveraged) position with its full history.

func (*LoopedPosition) GetBorrowVault added in v0.1.65

func (*LoopedPosition) GetClosedAt added in v0.1.34

func (*LoopedPosition) GetCollateralSymbol added in v0.1.34

func (l *LoopedPosition) GetCollateralSymbol() string

func (*LoopedPosition) GetCollateralToken added in v0.1.34

func (l *LoopedPosition) GetCollateralToken() string

func (*LoopedPosition) GetCollateralVault added in v0.1.65

func (l *LoopedPosition) GetCollateralVault() optionalnullable.OptionalNullable[string]

func (*LoopedPosition) GetCurrent added in v0.1.34

func (*LoopedPosition) GetDebtSymbol added in v0.1.34

func (l *LoopedPosition) GetDebtSymbol() string

func (*LoopedPosition) GetDebtToken added in v0.1.34

func (l *LoopedPosition) GetDebtToken() string

func (*LoopedPosition) GetHistory added in v0.1.34

func (l *LoopedPosition) GetHistory() []LoopedPositionHistoryEntry

func (*LoopedPosition) GetMarketID added in v0.1.34

func (*LoopedPosition) GetOpenedAt added in v0.1.34

func (l *LoopedPosition) GetOpenedAt() time.Time

func (*LoopedPosition) GetProtocol added in v0.1.34

func (l *LoopedPosition) GetProtocol() CreditProtocol

func (*LoopedPosition) GetStatus added in v0.1.34

func (l *LoopedPosition) GetStatus() LoopedPositionStatus

func (*LoopedPosition) GetSubAccountID added in v0.1.65

func (l *LoopedPosition) GetSubAccountID() optionalnullable.OptionalNullable[int64]

func (*LoopedPosition) GetTotals added in v0.1.34

func (l *LoopedPosition) GetTotals() LoopedPositionTotals

func (LoopedPosition) MarshalJSON added in v0.1.34

func (l LoopedPosition) MarshalJSON() ([]byte, error)

func (*LoopedPosition) UnmarshalJSON added in v0.1.34

func (l *LoopedPosition) UnmarshalJSON(data []byte) error

type LoopedPositionCurrentState added in v0.1.34

type LoopedPositionCurrentState struct {
	// Current on-chain collateral amount for this position. When multiple open Aave positions share one collateral reserve (Aave holds a single pooled aToken balance per reserve), that pooled balance is attributed across them pro-rata by each position's event-ledger contribution — bookkeeping, not protocol truth; liquidation sees the pooled account, not this per-position split.
	CollateralAmount *string `json:"collateral_amount"`
	// Current on-chain debt amount for this position.
	DebtAmount *string `json:"debt_amount"`
	// Collateral value in USD (null if unpriced). Derived from the attributed collateral_amount for shared-reserve Aave positions.
	CollateralUsd optionalnullable.OptionalNullable[string] `json:"collateral_usd,omitzero"`
	// Debt value in USD (null if unpriced).
	DebtUsd optionalnullable.OptionalNullable[string] `json:"debt_usd,omitzero"`
	// Net position value in USD (collateral - debt); null if unpriced. For shared-reserve Aave positions the collateral side uses the pro-rata attributed balance (bookkeeping, not protocol truth).
	NetUsdValue optionalnullable.OptionalNullable[string] `json:"net_usd_value,omitzero"`
	// Leverage multiplier: collateral_usd / (collateral_usd - debt_usd). Null when unpriced or net value is non-positive. For shared-reserve Aave positions this is derived from the pro-rata attributed collateral (bookkeeping, not protocol truth).
	Leverage optionalnullable.OptionalNullable[string] `json:"leverage,omitzero"`
	// Health factor. Above 1 is safe; below 1 risks liquidation. See health_factor_scope for what it covers.
	HealthFactor optionalnullable.OptionalNullable[string] `json:"health_factor,omitzero"`
	// How widely this health factor applies. 'market' means it is isolated rather than account-wide: a Morpho market's collateral backs only that market's debt, and an Euler sub-account's collateral backs only its own controller's debt. Note that an Euler figure is scoped to the SUB-ACCOUNT, so if several positions share one sub-account they all report the same health factor and are liquidated together — it is not each position's independent health. 'account' for Aave: collateral is pooled, so all collateral backs all debt and this health factor is shared by every Aave position on the account — see aave_account_summary for the account-level figures.
	HealthFactorScope LoopedPositionCurrentStateHealthFactorScope `json:"health_factor_scope"`
	// What the collateral leg currently earns, in percentage (e.g. 6.12 = 6.12%) — the sum of collateral_lending_apy and collateral_intrinsic_apy where both apply. Null when the token earns a yield outside the lending pool (a staked or wrapped asset) and no source for that yield is available: the pool's supply APY alone would understate the leg by percentage points and can invert the sign of net_apy, so it is withheld rather than reported as the whole yield.
	CollateralApy optionalnullable.OptionalNullable[string] `json:"collateral_apy,omitzero"`
	// The supply half of the collateral leg, in percentage: interest paid by borrowers of the collateral asset (Aave supply APY). Near zero for staked assets, which almost nobody borrows. Exactly 0 on Morpho, whose collateral is held rather than lent — which is why a Morpho position's whole collateral leg is its vault yield.
	CollateralLendingApy optionalnullable.OptionalNullable[string] `json:"collateral_lending_apy,omitzero"`
	// The yield the collateral token earns inside its own price, in percentage, independent of the lending pool — a liquid-staking token's staking rewards (wstHYPE against HYPE) or an ERC-4626 share's vault yield — which of the two follows from the position's protocol. Null when the token has none or none is indexed.
	//
	// A TRAILING 7-DAY measurement, not a forward rate: a week is a short sample of a staking rate, so consecutive readings move around the longer-run average by a few tenths of a percent.
	//
	// A null here alongside a null collateral_apy and a NON-null collateral_lending_apy is the meaningful case: the token does earn outside the pool, but no source for that yield is available, so the total is withheld rather than understated.
	CollateralIntrinsicApy optionalnullable.OptionalNullable[string] `json:"collateral_intrinsic_apy,omitzero"`
	// What the debt leg currently costs, in percentage — the sum of borrow_lending_apy and borrow_intrinsic_apy where both apply. Debt owed in a token that appreciates inside its own price (a staked or wrapped asset) grows by that appreciation on top of the pool's interest, so the pool rate alone would understate the cost and overstate net_apy; for such a token with no yield source available this is null (withheld) rather than the pool rate. For ordinary debt assets it equals the market's spot borrow APY. Null also when the rate read was unavailable.
	BorrowApy optionalnullable.OptionalNullable[string] `json:"borrow_apy,omitzero"`
	// The pool half of the debt leg, in percentage: the market's spot borrow APY (Morpho IRM rate / Aave variable borrow rate) — interest charged on the debt by the lending market itself.
	BorrowLendingApy optionalnullable.OptionalNullable[string] `json:"borrow_lending_apy,omitzero"`
	// The yield the DEBT token earns inside its own price, in percentage — which the borrower owes on top of pool interest, since the debt is denominated in an appreciating token. Same source and trailing 7-day window as collateral_intrinsic_apy. Null when the token has none or none is indexed; null alongside a null borrow_apy and a NON-null borrow_lending_apy means the debt token does earn outside the pool but no source is available, so the total cost is withheld rather than understated.
	BorrowIntrinsicApy optionalnullable.OptionalNullable[string] `json:"borrow_intrinsic_apy,omitzero"`
	// Levered net yield on the position's equity, in percentage: leverage x collateral_apy - (leverage - 1) x borrow_apy. Negative means the carry is upside down (borrowing costs more than the collateral earns). Null when leverage or either leg is unknown. This is a SNAPSHOT at today's rates, not a forecast, and it mixes a trailing collateral measurement with a spot borrow rate. It is also denominated in the debt asset, not USD: a wstHYPE/WHYPE loop earning a positive net_apy still loses USD value if HYPE falls. The borrow leg floats with the debt reserve's utilisation, so this figure can move without the position changing at all.
	NetApy optionalnullable.OptionalNullable[string] `json:"net_apy,omitzero"`
}

LoopedPositionCurrentState - Live on-chain state of an OPEN looped position.

func (*LoopedPositionCurrentState) GetBorrowApy added in v0.1.50

func (*LoopedPositionCurrentState) GetBorrowIntrinsicApy added in v0.1.54

func (*LoopedPositionCurrentState) GetBorrowLendingApy added in v0.1.54

func (*LoopedPositionCurrentState) GetCollateralAmount added in v0.1.34

func (l *LoopedPositionCurrentState) GetCollateralAmount() *string

func (*LoopedPositionCurrentState) GetCollateralApy added in v0.1.50

func (*LoopedPositionCurrentState) GetCollateralIntrinsicApy added in v0.1.54

func (l *LoopedPositionCurrentState) GetCollateralIntrinsicApy() optionalnullable.OptionalNullable[string]

func (*LoopedPositionCurrentState) GetCollateralLendingApy added in v0.1.54

func (*LoopedPositionCurrentState) GetCollateralUsd added in v0.1.34

func (*LoopedPositionCurrentState) GetDebtAmount added in v0.1.34

func (l *LoopedPositionCurrentState) GetDebtAmount() *string

func (*LoopedPositionCurrentState) GetDebtUsd added in v0.1.34

func (*LoopedPositionCurrentState) GetHealthFactor added in v0.1.34

func (*LoopedPositionCurrentState) GetHealthFactorScope added in v0.1.34

func (*LoopedPositionCurrentState) GetLeverage added in v0.1.34

func (*LoopedPositionCurrentState) GetNetApy added in v0.1.50

func (*LoopedPositionCurrentState) GetNetUsdValue added in v0.1.34

type LoopedPositionCurrentStateHealthFactorScope added in v0.1.37

type LoopedPositionCurrentStateHealthFactorScope string

LoopedPositionCurrentStateHealthFactorScope - How widely this health factor applies. 'market' means it is isolated rather than account-wide: a Morpho market's collateral backs only that market's debt, and an Euler sub-account's collateral backs only its own controller's debt. Note that an Euler figure is scoped to the SUB-ACCOUNT, so if several positions share one sub-account they all report the same health factor and are liquidated together — it is not each position's independent health. 'account' for Aave: collateral is pooled, so all collateral backs all debt and this health factor is shared by every Aave position on the account — see aave_account_summary for the account-level figures.

const (
	LoopedPositionCurrentStateHealthFactorScopeMarket  LoopedPositionCurrentStateHealthFactorScope = "market"
	LoopedPositionCurrentStateHealthFactorScopeAccount LoopedPositionCurrentStateHealthFactorScope = "account"
)

func (*LoopedPositionCurrentStateHealthFactorScope) IsExact added in v0.1.37

IsExact returns true if the value matches a known enum value, false otherwise.

func (LoopedPositionCurrentStateHealthFactorScope) ToPointer added in v0.1.37

type LoopedPositionHistoryEntry added in v0.1.34

type LoopedPositionHistoryEntry struct {
	// Transaction hash.
	TransactionHash string `json:"transaction_hash"`
	// Block number of the transaction.
	BlockNumber int64 `json:"block_number"`
	// Timestamp of the transaction.
	BlockTimestamp time.Time `json:"block_timestamp"`
	// What this transaction did to the position: loop_open / loop_increase (lever up with a swap), unwind (delever), single-sided supply/withdraw/borrow/repay, liquidation, or mixed.
	Classification Classification `json:"classification"`
	// Loop transactions only: number of borrow legs in this transaction (one per loop iteration). Null for non-loop transactions.
	Iterations optionalnullable.OptionalNullable[int64] `json:"iterations,omitzero"`
	// Signed change in collateral in this transaction (positive = added).
	CollateralDelta string `json:"collateral_delta"`
	// Signed change in debt in this transaction (positive = borrowed).
	DebtDelta string `json:"debt_delta"`
	// The swap leg detected in this transaction, if any.
	Swap optionalnullable.OptionalNullable[SwapInfo] `json:"swap,omitzero"`
	// The raw lending events that make up this transaction (Morpho supply_collateral maps to 'supply', withdraw_collateral to 'withdraw').
	Events []CreditEvent `json:"events,omitzero"`
}

LoopedPositionHistoryEntry - One transaction in a looped position's lifetime.

func (*LoopedPositionHistoryEntry) GetBlockNumber added in v0.1.34

func (l *LoopedPositionHistoryEntry) GetBlockNumber() int64

func (*LoopedPositionHistoryEntry) GetBlockTimestamp added in v0.1.34

func (l *LoopedPositionHistoryEntry) GetBlockTimestamp() time.Time

func (*LoopedPositionHistoryEntry) GetClassification added in v0.1.34

func (l *LoopedPositionHistoryEntry) GetClassification() Classification

func (*LoopedPositionHistoryEntry) GetCollateralDelta added in v0.1.34

func (l *LoopedPositionHistoryEntry) GetCollateralDelta() string

func (*LoopedPositionHistoryEntry) GetDebtDelta added in v0.1.34

func (l *LoopedPositionHistoryEntry) GetDebtDelta() string

func (*LoopedPositionHistoryEntry) GetEvents added in v0.1.34

func (l *LoopedPositionHistoryEntry) GetEvents() []CreditEvent

func (*LoopedPositionHistoryEntry) GetIterations added in v0.1.34

func (*LoopedPositionHistoryEntry) GetSwap added in v0.1.34

func (*LoopedPositionHistoryEntry) GetTransactionHash added in v0.1.34

func (l *LoopedPositionHistoryEntry) GetTransactionHash() string

func (LoopedPositionHistoryEntry) MarshalJSON added in v0.1.34

func (l LoopedPositionHistoryEntry) MarshalJSON() ([]byte, error)

func (*LoopedPositionHistoryEntry) UnmarshalJSON added in v0.1.34

func (l *LoopedPositionHistoryEntry) UnmarshalJSON(data []byte) error

type LoopedPositionStatus added in v0.1.34

type LoopedPositionStatus string

LoopedPositionStatus - Whether the position is currently open or fully closed.

const (
	LoopedPositionStatusOpen   LoopedPositionStatus = "OPEN"
	LoopedPositionStatusClosed LoopedPositionStatus = "CLOSED"
)

func (*LoopedPositionStatus) IsExact added in v0.1.34

func (e *LoopedPositionStatus) IsExact() bool

IsExact returns true if the value matches a known enum value, false otherwise.

func (LoopedPositionStatus) ToPointer added in v0.1.34

type LoopedPositionTotals added in v0.1.34

type LoopedPositionTotals struct {
	// Total collateral added over the position's lifetime.
	TotalCollateralAdded string `json:"total_collateral_added"`
	// Total collateral removed over the position's lifetime.
	TotalCollateralRemoved string `json:"total_collateral_removed"`
	// Total debt borrowed over the position's lifetime.
	TotalDebtAdded string `json:"total_debt_added"`
	// Total debt repaid over the position's lifetime.
	TotalDebtRemoved string `json:"total_debt_removed"`
	// Number of loop_open + loop_increase transactions.
	LoopTxCount int64 `json:"loop_tx_count"`
	// Number of unwind transactions.
	UnwindTxCount int64 `json:"unwind_tx_count"`
	// Number of liquidation events.
	LiquidationCount int64 `json:"liquidation_count"`
}

LoopedPositionTotals - Lifetime totals across all of a looped position's transactions.

func (*LoopedPositionTotals) GetLiquidationCount added in v0.1.34

func (l *LoopedPositionTotals) GetLiquidationCount() int64

func (*LoopedPositionTotals) GetLoopTxCount added in v0.1.34

func (l *LoopedPositionTotals) GetLoopTxCount() int64

func (*LoopedPositionTotals) GetTotalCollateralAdded added in v0.1.34

func (l *LoopedPositionTotals) GetTotalCollateralAdded() string

func (*LoopedPositionTotals) GetTotalCollateralRemoved added in v0.1.34

func (l *LoopedPositionTotals) GetTotalCollateralRemoved() string

func (*LoopedPositionTotals) GetTotalDebtAdded added in v0.1.34

func (l *LoopedPositionTotals) GetTotalDebtAdded() string

func (*LoopedPositionTotals) GetTotalDebtRemoved added in v0.1.34

func (l *LoopedPositionTotals) GetTotalDebtRemoved() string

func (*LoopedPositionTotals) GetUnwindTxCount added in v0.1.34

func (l *LoopedPositionTotals) GetUnwindTxCount() int64

type MarketAllocation

type MarketAllocation struct {
	// Morpho Blue market unique identifier (bytes32 hex string).
	MarketID string `json:"market_id"`
	// Address of the token being lent in this market.
	LoanToken string `json:"loan_token"`
	// Symbol of the loan token (e.g., 'USDC').
	LoanTokenSymbol optionalnullable.OptionalNullable[string] `json:"loan_token_symbol,omitzero"`
	// Address of the collateral token accepted by this market.
	CollateralToken string `json:"collateral_token"`
	// Symbol of the collateral token (e.g., 'WETH').
	CollateralTokenSymbol optionalnullable.OptionalNullable[string] `json:"collateral_token_symbol,omitzero"`
	// Liquidation Loan-To-Value ratio as a raw uint256 string. Divide by 1e18 to get the decimal ratio (e.g., '860000000000000000' = 86%).
	Lltv string `json:"lltv"`
	// Maximum amount the vault is allowed to supply to this market, as a raw uint184 string in the smallest token unit.
	SupplyCap optionalnullable.OptionalNullable[string] `json:"supply_cap,omitzero"`
	// Amount currently supplied by the vault to this market, in the smallest token unit (converted from shares).
	SupplyAssets optionalnullable.OptionalNullable[string] `json:"supply_assets,omitzero"`
	// Percentage of the vault's total supplied capital allocated to this market (e.g., 45.5 means 45.5%).
	AllocationPct optionalnullable.OptionalNullable[float64] `json:"allocation_pct,omitzero"`
}

MarketAllocation - A Morpho Blue market that a vault allocates capital to.

func (*MarketAllocation) GetAllocationPct

func (*MarketAllocation) GetCollateralToken

func (m *MarketAllocation) GetCollateralToken() string

func (*MarketAllocation) GetCollateralTokenSymbol

func (m *MarketAllocation) GetCollateralTokenSymbol() optionalnullable.OptionalNullable[string]

func (*MarketAllocation) GetLltv

func (m *MarketAllocation) GetLltv() string

func (*MarketAllocation) GetLoanToken

func (m *MarketAllocation) GetLoanToken() string

func (*MarketAllocation) GetLoanTokenSymbol

func (m *MarketAllocation) GetLoanTokenSymbol() optionalnullable.OptionalNullable[string]

func (*MarketAllocation) GetMarketID

func (m *MarketAllocation) GetMarketID() string

func (*MarketAllocation) GetSupplyAssets

func (*MarketAllocation) GetSupplyCap

type MarketDetail

type MarketDetail struct {
	// On-chain token symbol (e.g. 'TSLAon').
	Symbol string `json:"symbol"`
	// Underlying equity ticker (e.g. 'TSLA').
	UnderlyingTicker string `json:"underlying_ticker"`
	// Underlying equity full name (e.g. 'Tesla, Inc. Common Stock').
	Name string `json:"name"`
	// On-chain ERC-20 address for this token, on the network given by `chain`.
	ContractAddress string `json:"contract_address"`
	// ERC-20 decimals for this token.
	Decimals int64 `json:"decimals"`
	// Latest price in USD as a decimal string.
	CurrentPriceUsd string `json:"current_price_usd"`
	// Absolute USD price change vs 24h ago (decimal string).
	Change24hUsd optionalnullable.OptionalNullable[string] `json:"change_24h_usd,omitzero"`
	// Percent price change vs 24h ago (decimal string).
	Change24hPct optionalnullable.OptionalNullable[string] `json:"change_24h_pct,omitzero"`
	// Sector / industry tags from the issuer (e.g. ['Technology']).
	Sectors []string `json:"sectors,omitzero"`
	// Regional market exposure tags (e.g. ['US']).
	RegionExposure []string `json:"region_exposure,omitzero"`
	// Issuer/provider of a tokenized asset.
	Provider TokenizedAssetProvider `json:"provider"`
	// Asset class of a tokenized asset.
	//
	// `EQUITY` trades via the order endpoints (build/submit/cancel); the RWA
	// yield classes (`T_BILLS`, `BASIS_TRADE`, `BTC_YIELD`), `MANAGED_VAULT`, and
	// `DERWA` trade via the swap-based `transact/buy` and `transact/sell`
	// endpoints. `MANAGED_VAULT` (IXS ERC-4626 vaults) is special in that a sell
	// is an *asynchronous* redemption request settled off-chain by the vault
	// operator. `DERWA` (Centrifuge freely-transferable RWA wrappers) settles
	// each buy/sell as a single instant DEX swap.
	//
	// `MONEY_MARKET` (WisdomTree Connect digital funds) also uses `transact/buy`
	// and `transact/sell`, but neither swaps nor mints: a buy transfers the
	// settlement stablecoin to the issuer's deposit address and the issuer mints
	// fund shares back at the next NAV cycle, so settlement is *asynchronous*.
	AssetClass TokenizedAssetClass `json:"asset_class"`
	// The chain to use.
	Chain Chain `json:"chain"`
	// Trailing 7-day annualized NAV growth (decimal fraction string, e.g. '0.0512' = 5.12%). RWA yield assets only; null until enough NAV history exists.
	Apy7d optionalnullable.OptionalNullable[string] `json:"apy_7d,omitzero"`
	// Trailing 30-day annualized NAV growth (decimal fraction string). RWA yield assets only; null until enough NAV history exists.
	Apy30d optionalnullable.OptionalNullable[string] `json:"apy_30d,omitzero"`
	// Total value locked in USD (RWA yield assets only).
	TvlUsd optionalnullable.OptionalNullable[string] `json:"tvl_usd,omitzero"`
	// Live tradability: whether this market can be traded right now, and if not, why (and when it reopens). Equities follow US market sessions (some are 24-7 via an off-hours track); RWA yield / vault assets trade continuously unless the issuer pauses. Null if status is unavailable.
	Status optionalnullable.OptionalNullable[TradingStatus] `json:"status,omitzero"`
	// ISO country codes where this asset must not be offered (e.g. ['US']). Regulation-S instruments (Centrifuge deRWA) restrict US persons; the API surfaces the restriction for integrators to enforce — it does not itself geo-gate. Empty for unrestricted assets (Ondo/Midas/IXS).
	RestrictedJurisdictions []string `json:"restricted_jurisdictions,omitzero"`
	// 24h price sparkline as `(timestamp, price)` samples in chronological order.
	PriceHistory24h []PricePoint `json:"price_history_24h,omitzero"`
	// 52-week high of the underlying equity (USD).
	PriceHigh52w optionalnullable.OptionalNullable[string] `json:"price_high_52w,omitzero"`
	// 52-week low of the underlying equity (USD).
	PriceLow52w optionalnullable.OptionalNullable[string] `json:"price_low_52w,omitzero"`
	// 24h trading volume of the underlying equity.
	Volume24h optionalnullable.OptionalNullable[string] `json:"volume_24h,omitzero"`
	// Average trading volume of the underlying equity.
	AverageVolume optionalnullable.OptionalNullable[string] `json:"average_volume,omitzero"`
	// Shares outstanding of the underlying equity.
	SharesOutstanding optionalnullable.OptionalNullable[string] `json:"shares_outstanding,omitzero"`
	// Market cap of the underlying equity (USD).
	MarketCap optionalnullable.OptionalNullable[string] `json:"market_cap,omitzero"`
	// On-chain holder count for the tokenized equity.
	TotalHolders optionalnullable.OptionalNullable[int64] `json:"total_holders,omitzero"`
	// Sessions in which the token can be traded (e.g. 'regular', 'premarket').
	TradableSessions []string `json:"tradable_sessions,omitzero"`
	// Shares-multiplier ratio (= 1 if no recent split / corporate action).
	SharesMultiplier optionalnullable.OptionalNullable[string] `json:"shares_multiplier,omitzero"`
	// OHLC candles. Present only when both `interval` and `range` query params are provided and form a valid pair; omitted otherwise.
	Candles optionalnullable.OptionalNullable[[]OhlcCandle] `json:"candles,omitzero"`
}

MarketDetail - Extended market view returned when fetching a single market.

func (*MarketDetail) GetApy7d added in v0.1.17

func (*MarketDetail) GetApy30d added in v0.1.17

func (*MarketDetail) GetAssetClass added in v0.1.17

func (m *MarketDetail) GetAssetClass() TokenizedAssetClass

func (*MarketDetail) GetAverageVolume

func (m *MarketDetail) GetAverageVolume() optionalnullable.OptionalNullable[string]

func (*MarketDetail) GetCandles

func (*MarketDetail) GetChain

func (m *MarketDetail) GetChain() Chain

func (*MarketDetail) GetChange24hPct

func (m *MarketDetail) GetChange24hPct() optionalnullable.OptionalNullable[string]

func (*MarketDetail) GetChange24hUsd

func (m *MarketDetail) GetChange24hUsd() optionalnullable.OptionalNullable[string]

func (*MarketDetail) GetContractAddress

func (m *MarketDetail) GetContractAddress() string

func (*MarketDetail) GetCurrentPriceUsd

func (m *MarketDetail) GetCurrentPriceUsd() string

func (*MarketDetail) GetDecimals

func (m *MarketDetail) GetDecimals() int64

func (*MarketDetail) GetMarketCap

func (*MarketDetail) GetName

func (m *MarketDetail) GetName() string

func (*MarketDetail) GetPriceHigh52w

func (m *MarketDetail) GetPriceHigh52w() optionalnullable.OptionalNullable[string]

func (*MarketDetail) GetPriceHistory24h

func (m *MarketDetail) GetPriceHistory24h() []PricePoint

func (*MarketDetail) GetPriceLow52w

func (*MarketDetail) GetProvider added in v0.1.17

func (m *MarketDetail) GetProvider() TokenizedAssetProvider

func (*MarketDetail) GetRegionExposure

func (m *MarketDetail) GetRegionExposure() []string

func (*MarketDetail) GetRestrictedJurisdictions added in v0.1.47

func (m *MarketDetail) GetRestrictedJurisdictions() []string

func (*MarketDetail) GetSectors

func (m *MarketDetail) GetSectors() []string

func (*MarketDetail) GetSharesMultiplier

func (m *MarketDetail) GetSharesMultiplier() optionalnullable.OptionalNullable[string]

func (*MarketDetail) GetSharesOutstanding

func (m *MarketDetail) GetSharesOutstanding() optionalnullable.OptionalNullable[string]

func (*MarketDetail) GetStatus added in v0.1.36

func (*MarketDetail) GetSymbol

func (m *MarketDetail) GetSymbol() string

func (*MarketDetail) GetTotalHolders

func (m *MarketDetail) GetTotalHolders() optionalnullable.OptionalNullable[int64]

func (*MarketDetail) GetTradableSessions

func (m *MarketDetail) GetTradableSessions() []string

func (*MarketDetail) GetTvlUsd added in v0.1.17

func (*MarketDetail) GetUnderlyingTicker

func (m *MarketDetail) GetUnderlyingTicker() string

func (*MarketDetail) GetVolume24h

func (MarketDetail) MarshalJSON

func (m MarketDetail) MarshalJSON() ([]byte, error)

func (*MarketDetail) UnmarshalJSON

func (m *MarketDetail) UnmarshalJSON(data []byte) error

type MaxSupplyApyInfo

type MaxSupplyApyInfo struct {
	// Chain name with the highest supply APY for this token.
	Chain string `json:"chain"`
	// Token contract address on the chain with highest supply APY.
	Address string `json:"address"`
	// Aave aToken contract address on the chain with highest supply APY.
	ATokenAddress string `json:"a_token_address"`
	// The highest supply APY for this token across all chains, in percentage.
	SupplyApy string `json:"supply_apy"`
	// Borrow APY on the chain with the highest supply APY, in percentage.
	BorrowApy string `json:"borrow_apy"`
}

MaxSupplyApyInfo - Information about the chain with the highest supply APY for a token.

func (*MaxSupplyApyInfo) GetATokenAddress

func (m *MaxSupplyApyInfo) GetATokenAddress() string

func (*MaxSupplyApyInfo) GetAddress

func (m *MaxSupplyApyInfo) GetAddress() string

func (*MaxSupplyApyInfo) GetBorrowApy

func (m *MaxSupplyApyInfo) GetBorrowApy() string

func (*MaxSupplyApyInfo) GetChain

func (m *MaxSupplyApyInfo) GetChain() string

func (*MaxSupplyApyInfo) GetSupplyApy

func (m *MaxSupplyApyInfo) GetSupplyApy() string

type MorphoLendingMarket added in v0.1.34

type MorphoLendingMarket struct {
	// Morpho Blue market id — the bytes32 keccak of the market's (loanToken, collateralToken, oracle, irm, lltv) tuple. Pass this to the Morpho credit actions to identify the market.
	MarketID string `json:"market_id"`
	// Token that is supplied and borrowed in this market.
	LoanToken string `json:"loan_token"`
	// Symbol of the loan token (e.g. USDC).
	LoanTokenSymbol string `json:"loan_token_symbol"`
	// Decimals of the loan token.
	LoanTokenDecimals int64 `json:"loan_token_decimals"`
	// Token accepted as collateral in this market.
	CollateralToken string `json:"collateral_token"`
	// Symbol of the collateral token (e.g. wstETH).
	CollateralTokenSymbol string `json:"collateral_token_symbol"`
	// Decimals of the collateral token.
	CollateralTokenDecimals int64 `json:"collateral_token_decimals"`
	// Oracle pricing the collateral in loan-token terms for this market.
	Oracle string `json:"oracle"`
	// Interest rate model contract of this market.
	Irm string `json:"irm"`
	// Liquidation loan-to-value in percentage (e.g. 86 means a position is liquidatable once debt exceeds 86% of collateral value).
	Lltv string `json:"lltv"`
	// Current supply APY for lending the loan token, in percentage (e.g. 3.5 means 3.5%). Null if the rate is unavailable.
	SupplyApy optionalnullable.OptionalNullable[string] `json:"supply_apy,omitzero"`
	// Current borrow APY for the loan token, in percentage (e.g. 5.25 means 5.25%). Null if the rate is unavailable.
	BorrowApy optionalnullable.OptionalNullable[string] `json:"borrow_apy,omitzero"`
	// What the COLLATERAL token earns inside its own price, in percentage: an ERC-4626 share's vault yield or a staking token's rewards, trailing 7 days. Morpho holds collateral without lending it out, so this is the collateral leg's ENTIRE yield. Null means unmeasured, NOT zero — a plain token (WETH, cbBTC) earns nothing and a yield-bearing one may simply not be indexed yet.
	CollateralIntrinsicApy optionalnullable.OptionalNullable[string] `json:"collateral_intrinsic_apy,omitzero"`
	// What the LOAN token earns inside its own price, in percentage, trailing 7 days. Debt owed in such a token grows by this on top of borrow_apy — a borrower's true cost is their sum. Null means unmeasured, NOT zero.
	LoanIntrinsicApy optionalnullable.OptionalNullable[string] `json:"loan_intrinsic_apy,omitzero"`

	// Maturity date of the principal-token collateral, ISO-8601 UTC. Present only on principal-token markets.
	PtMaturity optionalnullable.OptionalNullable[string] `json:"pt_maturity,omitzero"`
	// Whether the principal-token collateral has passed its maturity. Matured markets stay listed so open positions can still be unwound, so clients should use this to disable opening rather than to hide the row. Present only on principal-token markets.
	PtExpired optionalnullable.OptionalNullable[bool] `json:"pt_expired,omitzero"`
	// Whether a NEW loop may be opened on this principal-token market. False once the market is matured or too close to maturity to earn back a loop's entry cost. Computed server-side, so clients need no copy of the threshold. Present only on principal-token markets.
	PtLoopable optionalnullable.OptionalNullable[bool] `json:"pt_loopable,omitzero"`
	// Borrowed share of supplied assets, in percentage 0-100.
	Utilization string `json:"utilization"`
	// Total loan tokens supplied to the market, in token units.
	TotalSupplyAssets string `json:"total_supply_assets"`
	// Total loan tokens borrowed from the market, in token units.
	TotalBorrowAssets string `json:"total_borrow_assets"`
	// Loan tokens available to borrow or withdraw (supplied - borrowed), in token units.
	AvailableLiquidity string `json:"available_liquidity"`
	// Protocol fee taken from interest, in percentage of interest (e.g. 0 means no fee).
	Fee string `json:"fee"`
	// Total value locked (total supplied assets) in USD, sourced from the indexer. Null if the indexer hasn't priced this market yet.
	TvlUsd optionalnullable.OptionalNullable[string] `json:"tvl_usd,omitzero"`
	// Available liquidity (supplied - borrowed) in USD, sourced from the indexer. Null if the indexer hasn't priced this market yet.
	LiquidityUsd optionalnullable.OptionalNullable[string] `json:"liquidity_usd,omitzero"`
	// contains filtered or unexported fields
}

MorphoLendingMarket - A Morpho Blue lending market: one isolated (collateral, loan) pair.

func (*MorphoLendingMarket) GetAvailableLiquidity added in v0.1.34

func (m *MorphoLendingMarket) GetAvailableLiquidity() string

func (*MorphoLendingMarket) GetBorrowApy added in v0.1.34

func (*MorphoLendingMarket) GetCollateralIntrinsicApy added in v0.1.54

func (m *MorphoLendingMarket) GetCollateralIntrinsicApy() optionalnullable.OptionalNullable[string]

func (*MorphoLendingMarket) GetCollateralToken added in v0.1.34

func (m *MorphoLendingMarket) GetCollateralToken() string

func (*MorphoLendingMarket) GetCollateralTokenDecimals added in v0.1.34

func (m *MorphoLendingMarket) GetCollateralTokenDecimals() int64

func (*MorphoLendingMarket) GetCollateralTokenSymbol added in v0.1.34

func (m *MorphoLendingMarket) GetCollateralTokenSymbol() string

func (*MorphoLendingMarket) GetCollateralYieldKind added in v0.1.70

func (m *MorphoLendingMarket) GetCollateralYieldKind() optionalnullable.OptionalNullable[string]

func (*MorphoLendingMarket) GetFee added in v0.1.34

func (m *MorphoLendingMarket) GetFee() string

func (*MorphoLendingMarket) GetIrm added in v0.1.34

func (m *MorphoLendingMarket) GetIrm() string

func (*MorphoLendingMarket) GetLiquidityUsd added in v0.1.43

func (*MorphoLendingMarket) GetLltv added in v0.1.34

func (m *MorphoLendingMarket) GetLltv() string

func (*MorphoLendingMarket) GetLoanIntrinsicApy added in v0.1.54

func (m *MorphoLendingMarket) GetLoanIntrinsicApy() optionalnullable.OptionalNullable[string]

func (*MorphoLendingMarket) GetLoanToken added in v0.1.34

func (m *MorphoLendingMarket) GetLoanToken() string

func (*MorphoLendingMarket) GetLoanTokenDecimals added in v0.1.34

func (m *MorphoLendingMarket) GetLoanTokenDecimals() int64

func (*MorphoLendingMarket) GetLoanTokenSymbol added in v0.1.34

func (m *MorphoLendingMarket) GetLoanTokenSymbol() string

func (*MorphoLendingMarket) GetMarketID added in v0.1.34

func (m *MorphoLendingMarket) GetMarketID() string

func (*MorphoLendingMarket) GetOracle added in v0.1.34

func (m *MorphoLendingMarket) GetOracle() string

func (*MorphoLendingMarket) GetPtExpired added in v0.1.70

func (*MorphoLendingMarket) GetPtLoopable added in v0.1.70

func (*MorphoLendingMarket) GetPtMaturity added in v0.1.70

func (*MorphoLendingMarket) GetSupplyApy added in v0.1.34

func (*MorphoLendingMarket) GetTotalBorrowAssets added in v0.1.34

func (m *MorphoLendingMarket) GetTotalBorrowAssets() string

func (*MorphoLendingMarket) GetTotalSupplyAssets added in v0.1.34

func (m *MorphoLendingMarket) GetTotalSupplyAssets() string

func (*MorphoLendingMarket) GetTvlUsd added in v0.1.43

func (*MorphoLendingMarket) GetUtilization added in v0.1.34

func (m *MorphoLendingMarket) GetUtilization() string

func (MorphoLendingMarket) MarshalJSON added in v0.1.70

func (m MorphoLendingMarket) MarshalJSON() ([]byte, error)

func (*MorphoLendingMarket) UnmarshalJSON added in v0.1.70

func (m *MorphoLendingMarket) UnmarshalJSON(data []byte) error

type MorphoMarketsResponse added in v0.1.34

type MorphoMarketsResponse struct {
	Total  int64 `json:"total"`
	Offset int64 `json:"offset"`
	Limit  int64 `json:"limit"`
	// Morpho Blue singleton contract the markets were read from.
	Morpho string `json:"morpho"`
	// This page of lending markets (already ordered) with live LLTV, APYs, utilization, and liquidity. `total` is the full market count.
	Markets []MorphoLendingMarket `json:"markets,omitzero"`
}

MorphoMarketsResponse - A page of Morpho Blue lending markets, ordered + paginated on the DB set; each returned market is enriched with live on-chain LLTV/APY/utilisation.

func (*MorphoMarketsResponse) GetLimit added in v0.1.44

func (m *MorphoMarketsResponse) GetLimit() int64

func (*MorphoMarketsResponse) GetMarkets added in v0.1.34

func (m *MorphoMarketsResponse) GetMarkets() []MorphoLendingMarket

func (*MorphoMarketsResponse) GetMorpho added in v0.1.34

func (m *MorphoMarketsResponse) GetMorpho() string

func (*MorphoMarketsResponse) GetOffset added in v0.1.44

func (m *MorphoMarketsResponse) GetOffset() int64

func (*MorphoMarketsResponse) GetTotal added in v0.1.44

func (m *MorphoMarketsResponse) GetTotal() int64

func (MorphoMarketsResponse) MarshalJSON added in v0.1.34

func (m MorphoMarketsResponse) MarshalJSON() ([]byte, error)

func (*MorphoMarketsResponse) UnmarshalJSON added in v0.1.34

func (m *MorphoMarketsResponse) UnmarshalJSON(data []byte) error

type Multiplier added in v0.1.34

type Multiplier struct {
	Number *float64 `queryParam:"inline" union:"member"`
	Str    *string  `queryParam:"inline" union:"member"`

	Type MultiplierType
}

Multiplier - Target leverage: total collateral exposure = multiplier × initial_collateral_amount. Must be achievable at the requested loan_to_value (max ≈ 0.9 / (1 − LTV)).

func CreateMultiplierNumber added in v0.1.34

func CreateMultiplierNumber(number float64) Multiplier

func CreateMultiplierStr added in v0.1.34

func CreateMultiplierStr(str string) Multiplier

func (Multiplier) MarshalJSON added in v0.1.34

func (u Multiplier) MarshalJSON() ([]byte, error)

func (*Multiplier) UnmarshalJSON added in v0.1.34

func (u *Multiplier) UnmarshalJSON(data []byte) (err error)

type MultiplierType added in v0.1.34

type MultiplierType string
const (
	MultiplierTypeNumber MultiplierType = "number"
	MultiplierTypeStr    MultiplierType = "str"
)

type OhlcCandle

type OhlcCandle struct {
	// ISO 8601 UTC timestamp at candle open.
	Timestamp string `json:"timestamp"`
	// Open price (decimal string).
	Open string `json:"open"`
	// High price (decimal string).
	High string `json:"high"`
	// Low price (decimal string).
	Low string `json:"low"`
	// Close price (decimal string).
	Close string `json:"close"`
}

OhlcCandle - A single OHLC candle. Per-candle volume is not provided.

func (*OhlcCandle) GetClose

func (o *OhlcCandle) GetClose() string

func (*OhlcCandle) GetHigh

func (o *OhlcCandle) GetHigh() string

func (*OhlcCandle) GetLow

func (o *OhlcCandle) GetLow() string

func (*OhlcCandle) GetOpen

func (o *OhlcCandle) GetOpen() string

func (*OhlcCandle) GetTimestamp

func (o *OhlcCandle) GetTimestamp() string

type OperationType

type OperationType int64

OperationType - Safe operation types.

const (
	OperationTypeZero OperationType = 0
	OperationTypeOne  OperationType = 1
)

func (*OperationType) IsExact

func (e *OperationType) IsExact() bool

IsExact returns true if the value matches a known enum value, false otherwise.

func (OperationType) ToPointer

func (e OperationType) ToPointer() *OperationType

type OrderStatus

type OrderStatus struct {
	// On-chain order hash.
	OrderHash string `json:"order_hash"`
	// Order lifecycle state. One of `pending`, `filled`, `expired`, or `cancelled`. Upstream protocol states beyond these four (e.g. `partially-filled`, `refunded`) are mapped onto this set.
	Status OrderStatusStatus `json:"status"`
	// Transaction hash of the most recent fill. Populated for fully filled orders and for partial fills while `status` is still `pending`.
	FillTxHash optionalnullable.OptionalNullable[string] `json:"fill_tx_hash,omitzero"`
	// Implied USD execution rate per unit of the received token, derived from filled amounts and the input token's USD price. For USDC → equity buys, this is the USD paid per equity unit. Omitted when token decimals or pricing are not available.
	FillPriceUsd optionalnullable.OptionalNullable[string] `json:"fill_price_usd,omitzero"`
	// Total amount filled so far, expressed as a raw integer in the input token's decimals. Populated for partial fills while `status` is still `pending`, and for fully filled orders.
	FilledAmount optionalnullable.OptionalNullable[string] `json:"filled_amount,omitzero"`
	// ISO 8601 UTC timestamp at which the order was submitted.
	SubmittedAt optionalnullable.OptionalNullable[string] `json:"submitted_at,omitzero"`
	// ISO 8601 UTC timestamp at which this status was read.
	UpdatedAt string `json:"updated_at"`
}

OrderStatus - Returned from `GET /order/{hash}` — current state of a relayed order.

func (*OrderStatus) GetFillPriceUsd

func (o *OrderStatus) GetFillPriceUsd() optionalnullable.OptionalNullable[string]

func (*OrderStatus) GetFillTxHash

func (*OrderStatus) GetFilledAmount

func (o *OrderStatus) GetFilledAmount() optionalnullable.OptionalNullable[string]

func (*OrderStatus) GetOrderHash

func (o *OrderStatus) GetOrderHash() string

func (*OrderStatus) GetStatus

func (o *OrderStatus) GetStatus() OrderStatusStatus

func (*OrderStatus) GetSubmittedAt

func (o *OrderStatus) GetSubmittedAt() optionalnullable.OptionalNullable[string]

func (*OrderStatus) GetUpdatedAt

func (o *OrderStatus) GetUpdatedAt() string

type OrderStatusStatus added in v0.1.26

type OrderStatusStatus string

OrderStatusStatus - Order lifecycle state. One of `pending`, `filled`, `expired`, or `cancelled`. Upstream protocol states beyond these four (e.g. `partially-filled`, `refunded`) are mapped onto this set.

const (
	OrderStatusStatusPending   OrderStatusStatus = "pending"
	OrderStatusStatusFilled    OrderStatusStatus = "filled"
	OrderStatusStatusExpired   OrderStatusStatus = "expired"
	OrderStatusStatusCancelled OrderStatusStatus = "cancelled"
)

func (*OrderStatusStatus) IsExact added in v0.1.26

func (e *OrderStatusStatus) IsExact() bool

IsExact returns true if the value matches a known enum value, false otherwise.

func (OrderStatusStatus) ToPointer added in v0.1.26

func (e OrderStatusStatus) ToPointer() *OrderStatusStatus

type OrderToSign

type OrderToSign struct {
	// The on-chain order hash. Wrapped inside `safe_message_eip712.message.message` for the owner to sign; also passed back to `/order/submit` so the API can return a usable handle even if the upstream submit response omits the hash.
	OrderHash string `json:"order_hash"`
	// Opaque hex blob from the upstream quote — pass back to `/order/submit` unchanged.
	Extension string `json:"extension"`
	// Upstream quote identifier — must be echoed back at `/order/submit`.
	QuoteID string `json:"quote_id"`
	// Order struct (maker, makerAsset, makingAmount, etc.) — pass back to `/order/submit` unchanged. The maker is the Tokenized Equities Account, not the owner's wallet.
	OrderMessage map[string]any `json:"order_message"`
	// “signTypedData“ payload for “SafeMessage(bytes message)“.
	SafeMessageEip712 SafeMessageEip712Response `json:"safe_message_eip712"`
}

OrderToSign - Order metadata plus the EIP-712 payload the owner signs to authorize it.

The owner signs “safe_message_eip712“ off-chain. At submit time the signature is sent back to “/order/submit“ together with “order_message“, “extension“, and “quote_id“; the signature is validated against the Tokenized Assets Account at fill time.

func (*OrderToSign) GetExtension

func (o *OrderToSign) GetExtension() string

func (*OrderToSign) GetOrderHash

func (o *OrderToSign) GetOrderHash() string

func (*OrderToSign) GetOrderMessage

func (o *OrderToSign) GetOrderMessage() map[string]any

func (*OrderToSign) GetQuoteID

func (o *OrderToSign) GetQuoteID() string

func (*OrderToSign) GetSafeMessageEip712

func (o *OrderToSign) GetSafeMessageEip712() SafeMessageEip712Response

type PendleDepositEvent

type PendleDepositEvent struct {
	// Block number when deposit occurred
	BlockNumber int64 `json:"block_number"`
	// Timestamp when deposit occurred
	BlockTimestamp time.Time `json:"block_timestamp"`
	// Transaction hash of the deposit
	TransactionHash string `json:"transaction_hash"`
	// Amount deposited (token spent)
	InputAmount string `json:"input_amount"`
	// Symbol of token deposited
	InputSymbol string `json:"input_symbol"`
	// PT tokens received
	OutputAmount string `json:"output_amount"`
	// Symbol (PT)
	OutputSymbol string `json:"output_symbol"`
	// Cost basis per PT at deposit (SY spent per PT acquired)
	CostPerUnit string `json:"cost_per_unit"`
}

PendleDepositEvent - Pendle PT deposit event with cost basis at time of deposit.

func (*PendleDepositEvent) GetBlockNumber

func (p *PendleDepositEvent) GetBlockNumber() int64

func (*PendleDepositEvent) GetBlockTimestamp

func (p *PendleDepositEvent) GetBlockTimestamp() time.Time

func (*PendleDepositEvent) GetCostPerUnit

func (p *PendleDepositEvent) GetCostPerUnit() string

func (*PendleDepositEvent) GetInputAmount

func (p *PendleDepositEvent) GetInputAmount() string

func (*PendleDepositEvent) GetInputSymbol

func (p *PendleDepositEvent) GetInputSymbol() string

func (*PendleDepositEvent) GetOutputAmount

func (p *PendleDepositEvent) GetOutputAmount() string

func (*PendleDepositEvent) GetOutputSymbol

func (p *PendleDepositEvent) GetOutputSymbol() string

func (*PendleDepositEvent) GetTransactionHash

func (p *PendleDepositEvent) GetTransactionHash() string

func (PendleDepositEvent) MarshalJSON

func (p PendleDepositEvent) MarshalJSON() ([]byte, error)

func (*PendleDepositEvent) UnmarshalJSON

func (p *PendleDepositEvent) UnmarshalJSON(data []byte) error

type PendleMarketInfo

type PendleMarketInfo struct {
	// The Pendle market contract address.
	MarketAddress string `json:"market_address"`
	// Blockchain name (e.g., 'ethereum', 'arbitrum').
	Chain string `json:"chain"`
	// The Principal Token (PT) address.
	PtAddress string `json:"pt_address"`
	// The Standardized Yield (SY) token address.
	SyAddress optionalnullable.OptionalNullable[string] `json:"sy_address,omitzero"`
	// The Yield Token (YT) address.
	YtAddress optionalnullable.OptionalNullable[string] `json:"yt_address,omitzero"`
	// The market maturity timestamp (Unix epoch seconds).
	Expiry optionalnullable.OptionalNullable[int64] `json:"expiry,omitzero"`
	// The underlying asset contract address.
	UnderlyingAsset optionalnullable.OptionalNullable[string] `json:"underlying_asset,omitzero"`
	// The name of the underlying asset.
	UnderlyingName optionalnullable.OptionalNullable[string] `json:"underlying_name,omitzero"`
	// The symbol of the underlying asset (e.g., 'USDC').
	UnderlyingSymbol optionalnullable.OptionalNullable[string] `json:"underlying_symbol,omitzero"`
	// The name of the Principal Token.
	PtName optionalnullable.OptionalNullable[string] `json:"pt_name,omitzero"`
	// The symbol of the Principal Token.
	PtSymbol optionalnullable.OptionalNullable[string] `json:"pt_symbol,omitzero"`
	// Total Value Locked in USD.
	TvlUsd optionalnullable.OptionalNullable[string] `json:"tvl_usd,omitzero"`
	// Implied APY as a percentage (e.g., 5.25 = 5.25%).
	ImpliedApy optionalnullable.OptionalNullable[string] `json:"implied_apy,omitzero"`
}

PendleMarketInfo - Information about a single Pendle market from the database.

func (*PendleMarketInfo) GetChain

func (p *PendleMarketInfo) GetChain() string

func (*PendleMarketInfo) GetExpiry

func (*PendleMarketInfo) GetImpliedApy

func (*PendleMarketInfo) GetMarketAddress

func (p *PendleMarketInfo) GetMarketAddress() string

func (*PendleMarketInfo) GetPtAddress

func (p *PendleMarketInfo) GetPtAddress() string

func (*PendleMarketInfo) GetPtName

func (*PendleMarketInfo) GetPtSymbol

func (*PendleMarketInfo) GetSyAddress

func (*PendleMarketInfo) GetTvlUsd

func (*PendleMarketInfo) GetUnderlyingAsset

func (p *PendleMarketInfo) GetUnderlyingAsset() optionalnullable.OptionalNullable[string]

func (*PendleMarketInfo) GetUnderlyingName

func (p *PendleMarketInfo) GetUnderlyingName() optionalnullable.OptionalNullable[string]

func (*PendleMarketInfo) GetUnderlyingSymbol

func (p *PendleMarketInfo) GetUnderlyingSymbol() optionalnullable.OptionalNullable[string]

func (*PendleMarketInfo) GetYtAddress

type PendleMarketsResponse

type PendleMarketsResponse struct {
	Total  int64 `json:"total"`
	Offset int64 `json:"offset"`
	Limit  int64 `json:"limit"`
	// A list of Pendle market information objects.
	Markets []PendleMarketInfo `json:"markets"`
}

PendleMarketsResponse - Response model for a paginated list of Pendle markets.

func (*PendleMarketsResponse) GetLimit

func (p *PendleMarketsResponse) GetLimit() int64

func (*PendleMarketsResponse) GetMarkets

func (p *PendleMarketsResponse) GetMarkets() []PendleMarketInfo

func (*PendleMarketsResponse) GetOffset

func (p *PendleMarketsResponse) GetOffset() int64

func (*PendleMarketsResponse) GetTotal

func (p *PendleMarketsResponse) GetTotal() int64

type PendlePTPosition

type PendlePTPosition struct {

	// The Pendle market address.
	MarketAddress string `json:"market_address"`
	// The PT (Principal Token) contract address.
	PtAddress string `json:"pt_address"`
	// Symbol of the underlying asset (e.g., rsETH, weETH).
	UnderlyingSymbol string `json:"underlying_symbol"`
	// Address of the underlying asset (base asset from SY).
	UnderlyingAddress string `json:"underlying_address"`
	// Address of the yield token (e.g., weETH) used for USD pricing.
	YieldTokenAddress string `json:"yield_token_address"`
	// The user's PT token balance.
	PtBalance *string `json:"pt_balance"`
	// Market expiry timestamp (Unix seconds).
	Expiry int64 `json:"expiry"`
	// Current PT-to-SY exchange rate (SY received per PT if sold now).
	CurrentPtToSyRate *string `json:"current_pt_to_sy_rate"`
	// Position value in USD (null if price unavailable).
	UsdValue optionalnullable.OptionalNullable[string] `json:"usd_value,omitzero"`
	// PnL metrics (in SY terms) for this position.
	Pnl optionalnullable.OptionalNullable[PositionPnL] `json:"pnl,omitzero"`
	// All buy PT events for this position.
	Deposits []PendleDepositEvent `json:"deposits,omitzero"`
	// All sell/redeem PT events for this position.
	Withdrawals []PendleWithdrawalEvent `json:"withdrawals,omitzero"`
	// Implied APY (percentage).
	ImpliedApy optionalnullable.OptionalNullable[string] `json:"implied_apy,omitzero"`
	// contains filtered or unexported fields
}

PendlePTPosition - Pendle Principal Token position.

func (*PendlePTPosition) GetCurrentPtToSyRate

func (p *PendlePTPosition) GetCurrentPtToSyRate() *string

func (*PendlePTPosition) GetDeposits

func (p *PendlePTPosition) GetDeposits() []PendleDepositEvent

func (*PendlePTPosition) GetExpiry

func (p *PendlePTPosition) GetExpiry() int64

func (*PendlePTPosition) GetImpliedApy

func (*PendlePTPosition) GetMarketAddress

func (p *PendlePTPosition) GetMarketAddress() string

func (*PendlePTPosition) GetPnl

func (*PendlePTPosition) GetPtAddress

func (p *PendlePTPosition) GetPtAddress() string

func (*PendlePTPosition) GetPtBalance

func (p *PendlePTPosition) GetPtBalance() *string

func (*PendlePTPosition) GetType

func (p *PendlePTPosition) GetType() string

func (*PendlePTPosition) GetUnderlyingAddress

func (p *PendlePTPosition) GetUnderlyingAddress() string

func (*PendlePTPosition) GetUnderlyingSymbol

func (p *PendlePTPosition) GetUnderlyingSymbol() string

func (*PendlePTPosition) GetUsdValue

func (*PendlePTPosition) GetWithdrawals

func (p *PendlePTPosition) GetWithdrawals() []PendleWithdrawalEvent

func (*PendlePTPosition) GetYieldTokenAddress

func (p *PendlePTPosition) GetYieldTokenAddress() string

func (PendlePTPosition) MarshalJSON

func (p PendlePTPosition) MarshalJSON() ([]byte, error)

func (*PendlePTPosition) UnmarshalJSON

func (p *PendlePTPosition) UnmarshalJSON(data []byte) error

type PendlePTVenue

type PendlePTVenue struct {

	// The Pendle market address identifying which PT to trade.
	MarketAddress string `json:"market_address"`
	// The token to exchange for PT (only used for DEPOSIT/buy). For WITHDRAW/sell, this field must not be provided - withdrawals always return the underlying asset to ensure accurate yield fee calculation.
	Token optionalnullable.OptionalNullable[string] `json:"token,omitzero"`
	// Maximum slippage allowed in percent (e.g., 1 means 1% slippage).
	MaxSlippagePercent *float64 `json:"max_slippage_percent,omitzero"`
	// contains filtered or unexported fields
}

PendlePTVenue - Venue for Pendle Principal Token (PT) positions.

func (*PendlePTVenue) GetMarketAddress

func (p *PendlePTVenue) GetMarketAddress() string

func (*PendlePTVenue) GetMaxSlippagePercent

func (p *PendlePTVenue) GetMaxSlippagePercent() *float64

func (*PendlePTVenue) GetToken

func (*PendlePTVenue) GetType

func (p *PendlePTVenue) GetType() string

func (PendlePTVenue) MarshalJSON

func (p PendlePTVenue) MarshalJSON() ([]byte, error)

func (*PendlePTVenue) UnmarshalJSON

func (p *PendlePTVenue) UnmarshalJSON(data []byte) error

type PendleWithdrawalEvent

type PendleWithdrawalEvent struct {
	// Block number when withdrawal occurred
	BlockNumber int64 `json:"block_number"`
	// Timestamp when withdrawal occurred
	BlockTimestamp time.Time `json:"block_timestamp"`
	// Transaction hash of the withdrawal
	TransactionHash string `json:"transaction_hash"`
	// PT tokens sold/redeemed
	InputAmount string `json:"input_amount"`
	// Symbol (PT)
	InputSymbol string `json:"input_symbol"`
	// Amount received (SY or token)
	OutputAmount string `json:"output_amount"`
	// Symbol of token received
	OutputSymbol string `json:"output_symbol"`
	// Profit/loss: output value - cost basis consumed
	RealizedPnl string `json:"realized_pnl"`
	// Cost basis per PT at withdrawal (SY received per PT sold)
	CostPerUnit string `json:"cost_per_unit"`
}

PendleWithdrawalEvent - Pendle PT withdrawal event with cost basis at time of withdrawal.

func (*PendleWithdrawalEvent) GetBlockNumber

func (p *PendleWithdrawalEvent) GetBlockNumber() int64

func (*PendleWithdrawalEvent) GetBlockTimestamp

func (p *PendleWithdrawalEvent) GetBlockTimestamp() time.Time

func (*PendleWithdrawalEvent) GetCostPerUnit

func (p *PendleWithdrawalEvent) GetCostPerUnit() string

func (*PendleWithdrawalEvent) GetInputAmount

func (p *PendleWithdrawalEvent) GetInputAmount() string

func (*PendleWithdrawalEvent) GetInputSymbol

func (p *PendleWithdrawalEvent) GetInputSymbol() string

func (*PendleWithdrawalEvent) GetOutputAmount

func (p *PendleWithdrawalEvent) GetOutputAmount() string

func (*PendleWithdrawalEvent) GetOutputSymbol

func (p *PendleWithdrawalEvent) GetOutputSymbol() string

func (*PendleWithdrawalEvent) GetRealizedPnl

func (p *PendleWithdrawalEvent) GetRealizedPnl() string

func (*PendleWithdrawalEvent) GetTransactionHash

func (p *PendleWithdrawalEvent) GetTransactionHash() string

func (PendleWithdrawalEvent) MarshalJSON

func (p PendleWithdrawalEvent) MarshalJSON() ([]byte, error)

func (*PendleWithdrawalEvent) UnmarshalJSON

func (p *PendleWithdrawalEvent) UnmarshalJSON(data []byte) error

type Permit2TypedDataInput

type Permit2TypedDataInput struct {
	Types CompassAPIBackendV2ModelsGasSponsorshipPermit2TypedDataEip712Types `json:"types"`

	Domain  CompassAPIBackendV2ModelsGasSponsorshipPermit2TypedDataEip712Domain `json:"domain"`
	Message PermitTransferFromMessage                                           `json:"message"`
	// contains filtered or unexported fields
}

func (*Permit2TypedDataInput) GetMessage

func (*Permit2TypedDataInput) GetPrimaryType

func (p *Permit2TypedDataInput) GetPrimaryType() *string

func (Permit2TypedDataInput) MarshalJSON

func (p Permit2TypedDataInput) MarshalJSON() ([]byte, error)

func (*Permit2TypedDataInput) UnmarshalJSON

func (p *Permit2TypedDataInput) UnmarshalJSON(data []byte) error

type Permit2TypedDataOutput

type Permit2TypedDataOutput struct {
	Types CompassAPIBackendV2ModelsGasSponsorshipPermit2TypedDataEip712Types `json:"types"`

	Domain  CompassAPIBackendV2ModelsGasSponsorshipPermit2TypedDataEip712Domain `json:"domain"`
	Message PermitTransferFromMessage                                           `json:"message"`
	// contains filtered or unexported fields
}

func (*Permit2TypedDataOutput) GetMessage

func (*Permit2TypedDataOutput) GetPrimaryType

func (p *Permit2TypedDataOutput) GetPrimaryType() *string

func (Permit2TypedDataOutput) MarshalJSON

func (p Permit2TypedDataOutput) MarshalJSON() ([]byte, error)

func (*Permit2TypedDataOutput) UnmarshalJSON

func (p *Permit2TypedDataOutput) UnmarshalJSON(data []byte) error

type PermitField

type PermitField struct {
	Name string `json:"name"`
	Type string `json:"type"`
}

PermitField - A field in the Permit type definition.

func (*PermitField) GetName

func (p *PermitField) GetName() string

func (*PermitField) GetType

func (p *PermitField) GetType() string

func (PermitField) MarshalJSON

func (p PermitField) MarshalJSON() ([]byte, error)

func (*PermitField) UnmarshalJSON

func (p *PermitField) UnmarshalJSON(data []byte) error

type PermitMessage

type PermitMessage struct {
	// Token owner address
	Owner string `json:"owner"`
	// Address authorized to spend tokens
	Spender string `json:"spender"`
	// Amount to approve (as string)
	Value string `json:"value"`
	// Current permit nonce for the owner
	Nonce string `json:"nonce"`
	// Permit expiry timestamp
	Deadline string `json:"deadline"`
}

PermitMessage - The message data for an ERC-20 Permit.

func (*PermitMessage) GetDeadline

func (p *PermitMessage) GetDeadline() string

func (*PermitMessage) GetNonce

func (p *PermitMessage) GetNonce() string

func (*PermitMessage) GetOwner

func (p *PermitMessage) GetOwner() string

func (*PermitMessage) GetSpender

func (p *PermitMessage) GetSpender() string

func (*PermitMessage) GetValue

func (p *PermitMessage) GetValue() string

func (PermitMessage) MarshalJSON

func (p PermitMessage) MarshalJSON() ([]byte, error)

func (*PermitMessage) UnmarshalJSON

func (p *PermitMessage) UnmarshalJSON(data []byte) error

type PermitTransferFromMessage

type PermitTransferFromMessage struct {
	Permitted TokenPermissions `json:"permitted"`
	// Address allowed to transfer (caller of permitTransferFrom)
	Spender string `json:"spender"`
	// Unique nonce to prevent replay
	Nonce int64 `json:"nonce"`
	// Unix timestamp after which signature expires
	Deadline int64 `json:"deadline"`
}

func (*PermitTransferFromMessage) GetDeadline

func (p *PermitTransferFromMessage) GetDeadline() int64

func (*PermitTransferFromMessage) GetNonce

func (p *PermitTransferFromMessage) GetNonce() int64

func (*PermitTransferFromMessage) GetPermitted

func (p *PermitTransferFromMessage) GetPermitted() TokenPermissions

func (*PermitTransferFromMessage) GetSpender

func (p *PermitTransferFromMessage) GetSpender() string

func (PermitTransferFromMessage) MarshalJSON

func (p PermitTransferFromMessage) MarshalJSON() ([]byte, error)

func (*PermitTransferFromMessage) UnmarshalJSON

func (p *PermitTransferFromMessage) UnmarshalJSON(data []byte) error

type PermitTypedDataResponseInput

type PermitTypedDataResponseInput struct {
	// The EIP-712 domain separator for ERC-20 Permit.
	Domain CompassAPIBackendV2ModelsGasSponsorshipPermitTypedDataEip712Domain `json:"domain"`
	// The type definitions for EIP-712 structured data (ERC-20 Permit).
	Types CompassAPIBackendV2ModelsGasSponsorshipPermitTypedDataEip712Types `json:"types"`

	// The message data for an ERC-20 Permit.
	Message PermitMessage `json:"message"`
	// contains filtered or unexported fields
}

PermitTypedDataResponseInput - Response containing EIP-712 typed data for ERC-20 Permit signing.

func (*PermitTypedDataResponseInput) GetMessage

func (*PermitTypedDataResponseInput) GetPrimaryType

func (p *PermitTypedDataResponseInput) GetPrimaryType() string

func (PermitTypedDataResponseInput) MarshalJSON

func (p PermitTypedDataResponseInput) MarshalJSON() ([]byte, error)

func (*PermitTypedDataResponseInput) UnmarshalJSON

func (p *PermitTypedDataResponseInput) UnmarshalJSON(data []byte) error

type PermitTypedDataResponseOutput

type PermitTypedDataResponseOutput struct {
	// The EIP-712 domain separator for ERC-20 Permit.
	Domain CompassAPIBackendV2ModelsGasSponsorshipPermitTypedDataEip712Domain `json:"domain"`
	// The type definitions for EIP-712 structured data (ERC-20 Permit).
	Types CompassAPIBackendV2ModelsGasSponsorshipPermitTypedDataEip712Types `json:"types"`

	// The message data for an ERC-20 Permit.
	Message PermitMessage `json:"message"`
	// contains filtered or unexported fields
}

PermitTypedDataResponseOutput - Response containing EIP-712 typed data for ERC-20 Permit signing.

func (*PermitTypedDataResponseOutput) GetMessage

func (*PermitTypedDataResponseOutput) GetPrimaryType

func (p *PermitTypedDataResponseOutput) GetPrimaryType() string

func (PermitTypedDataResponseOutput) MarshalJSON

func (p PermitTypedDataResponseOutput) MarshalJSON() ([]byte, error)

func (*PermitTypedDataResponseOutput) UnmarshalJSON

func (p *PermitTypedDataResponseOutput) UnmarshalJSON(data []byte) error

type PerpetualTradingActivityPartialError added in v0.1.51

type PerpetualTradingActivityPartialError struct {
	Section Section `json:"section"`
	Message string  `json:"message"`
}

PerpetualTradingActivityPartialError - One section of /activity failed to load.

func (*PerpetualTradingActivityPartialError) GetMessage added in v0.1.51

func (*PerpetualTradingActivityPartialError) GetSection added in v0.1.51

type PerpetualTradingActivityResponse added in v0.1.51

type PerpetualTradingActivityResponse struct {
	// Owner address that was queried (checksummed)
	Owner string `json:"owner"`
	// Open positions (null if the upstream call failed)
	Positions []PerpetualTradingPosition `json:"positions"`
	// Total account value in USDC (null if positions failed)
	AccountValue *string `json:"account_value"`
	// Withdrawable USDC balance (null if positions failed)
	Withdrawable *string `json:"withdrawable"`
	// Recent fills (null if the upstream call failed)
	Fills []PerpetualTradingFill `json:"fills"`
	// Resting orders (null if the upstream call failed)
	OpenOrders []PerpetualTradingOpenOrder `json:"open_orders"`
	// Builder approval state — only present when the `builder` query parameter was supplied (null on upstream failure).
	BuilderApproval optionalnullable.OptionalNullable[PerpetualTradingBuilderApproval] `json:"builder_approval,omitzero"`
	// One entry per section that failed to load.
	PartialErrors []PerpetualTradingActivityPartialError `json:"partial_errors,omitzero"`
}

PerpetualTradingActivityResponse - Aggregated HL activity for a single end-user.

Any section may be “null“ if its upstream HL call failed — see “partial_errors“ for details. “positions“/“fills“/“open_orders“ are always either a populated list or “null“; an empty list means the user has no activity of that type, not a failure.

func (*PerpetualTradingActivityResponse) GetAccountValue added in v0.1.51

func (p *PerpetualTradingActivityResponse) GetAccountValue() *string

func (*PerpetualTradingActivityResponse) GetBuilderApproval added in v0.1.51

func (*PerpetualTradingActivityResponse) GetFills added in v0.1.51

func (*PerpetualTradingActivityResponse) GetOpenOrders added in v0.1.51

func (*PerpetualTradingActivityResponse) GetOwner added in v0.1.51

func (*PerpetualTradingActivityResponse) GetPartialErrors added in v0.1.51

func (*PerpetualTradingActivityResponse) GetPositions added in v0.1.51

func (*PerpetualTradingActivityResponse) GetWithdrawable added in v0.1.51

func (p *PerpetualTradingActivityResponse) GetWithdrawable() *string

func (PerpetualTradingActivityResponse) MarshalJSON added in v0.1.51

func (p PerpetualTradingActivityResponse) MarshalJSON() ([]byte, error)

func (*PerpetualTradingActivityResponse) UnmarshalJSON added in v0.1.51

func (p *PerpetualTradingActivityResponse) UnmarshalJSON(data []byte) error

type PerpetualTradingApproveBuilderFeeRequest added in v0.1.51

type PerpetualTradingApproveBuilderFeeRequest struct {
	// User's EOA address
	Owner string `json:"owner"`
	// Builder address + max fee rate the end-user authorizes.
	Builder Builder `json:"builder"`
}

PerpetualTradingApproveBuilderFeeRequest - Request to approve builder fees before trading on the perpetual trading DEX.

func (*PerpetualTradingApproveBuilderFeeRequest) GetBuilder added in v0.1.51

func (*PerpetualTradingApproveBuilderFeeRequest) GetOwner added in v0.1.51

type PerpetualTradingBuilderApproval added in v0.1.51

type PerpetualTradingBuilderApproval struct {
	// Builder address that was queried
	Builder string `json:"builder"`
	// Maximum fee rate the user has approved for this builder, in tenths of basis points (10 = 1bp = 0.01%). Zero means the user has not approved.
	MaxFeeTenthBps int64 `json:"max_fee_tenth_bps"`
	// Convenience flag — true when max_fee_tenth_bps > 0
	Approved bool `json:"approved"`
}

PerpetualTradingBuilderApproval - Current builder-fee approval state for a (user, builder) pair.

func (*PerpetualTradingBuilderApproval) GetApproved added in v0.1.51

func (p *PerpetualTradingBuilderApproval) GetApproved() bool

func (*PerpetualTradingBuilderApproval) GetBuilder added in v0.1.51

func (p *PerpetualTradingBuilderApproval) GetBuilder() string

func (*PerpetualTradingBuilderApproval) GetMaxFeeTenthBps added in v0.1.51

func (p *PerpetualTradingBuilderApproval) GetMaxFeeTenthBps() int64

type PerpetualTradingCancelOrderRequest added in v0.1.51

type PerpetualTradingCancelOrderRequest struct {
	// Owner of the perpetual trading product account
	Owner string `json:"owner"`
	// Asset ticker symbol (e.g. AAPL, GOLD, EUR)
	Asset string `json:"asset"`
	// Hyperliquid order ID to cancel
	OrderID optionalnullable.OptionalNullable[int64] `json:"order_id,omitzero"`
	// Client order ID to cancel (alternative to order_id)
	ClientOrderID optionalnullable.OptionalNullable[int64] `json:"client_order_id,omitzero"`
}

PerpetualTradingCancelOrderRequest - Request to cancel an open order on a perpetual trading market.

func (*PerpetualTradingCancelOrderRequest) GetAsset added in v0.1.51

func (*PerpetualTradingCancelOrderRequest) GetClientOrderID added in v0.1.51

func (*PerpetualTradingCancelOrderRequest) GetOrderID added in v0.1.51

func (*PerpetualTradingCancelOrderRequest) GetOwner added in v0.1.51

type PerpetualTradingCandlesResponse added in v0.1.51

type PerpetualTradingCandlesResponse struct {
	// Asset ticker the candles are for (without DEX prefix)
	Symbol string `json:"symbol"`
	// Candle interval that was requested
	Interval string `json:"interval"`
	// Candles ordered oldest → newest
	Candles []Candle `json:"candles"`
}

PerpetualTradingCandlesResponse - OHLCV candle series for a single asset/interval.

func (*PerpetualTradingCandlesResponse) GetCandles added in v0.1.51

func (p *PerpetualTradingCandlesResponse) GetCandles() []Candle

func (*PerpetualTradingCandlesResponse) GetInterval added in v0.1.51

func (p *PerpetualTradingCandlesResponse) GetInterval() string

func (*PerpetualTradingCandlesResponse) GetSymbol added in v0.1.51

func (p *PerpetualTradingCandlesResponse) GetSymbol() string

type PerpetualTradingCategory added in v0.1.51

type PerpetualTradingCategory string
const (
	PerpetualTradingCategoryStock     PerpetualTradingCategory = "stock"
	PerpetualTradingCategoryCommodity PerpetualTradingCategory = "commodity"
	PerpetualTradingCategoryForex     PerpetualTradingCategory = "forex"
)

func (PerpetualTradingCategory) ToPointer added in v0.1.51

func (*PerpetualTradingCategory) UnmarshalJSON added in v0.1.51

func (e *PerpetualTradingCategory) UnmarshalJSON(data []byte) error

type PerpetualTradingDepositRequest added in v0.1.51

type PerpetualTradingDepositRequest struct {
	// The user's EOA address on Arbitrum
	Owner string `json:"owner"`
	// USDC amount to deposit (human-readable, e.g. '1000.0')
	Amount string `json:"amount"`
}

PerpetualTradingDepositRequest - Request to deposit USDC from Arbitrum into the user's perpetual trading account.

func (*PerpetualTradingDepositRequest) GetAmount added in v0.1.51

func (p *PerpetualTradingDepositRequest) GetAmount() string

func (*PerpetualTradingDepositRequest) GetOwner added in v0.1.51

func (p *PerpetualTradingDepositRequest) GetOwner() string

type PerpetualTradingDepositResponse added in v0.1.51

type PerpetualTradingDepositResponse struct {
	// Response containing EIP-712 typed data for ERC-20 Permit signing.
	Permit PermitTypedDataResponseOutput `json:"permit"`
	// USDC amount in raw 6-decimal units. Pass this and the signature to /deposit/sponsor_prepare.
	AmountRaw int64 `json:"amount_raw"`
	// Address that will be credited on Hyperliquid (equals the deposit owner EOA — HL keys accounts by EVM address).
	Destination string `json:"destination"`
}

PerpetualTradingDepositResponse - EIP-2612 permit data the user signs to authorize a USDC bridge deposit.

After signing, submit the signature to /v2/perpetual_trading/deposit/sponsor_prepare to get a ready-to-broadcast Arbitrum tx that calls Bridge2.batchedDepositWithPermit. The integrator's sponsor wallet broadcasts that tx — Compass does not broadcast.

func (*PerpetualTradingDepositResponse) GetAmountRaw added in v0.1.51

func (p *PerpetualTradingDepositResponse) GetAmountRaw() int64

func (*PerpetualTradingDepositResponse) GetDestination added in v0.1.51

func (p *PerpetualTradingDepositResponse) GetDestination() string

func (*PerpetualTradingDepositResponse) GetPermit added in v0.1.51

type PerpetualTradingDepositSponsorPrepareRequest added in v0.1.51

type PerpetualTradingDepositSponsorPrepareRequest struct {
	// The user's EOA address on Arbitrum (the permit signer).
	Owner string `json:"owner"`
	// USDC amount in raw 6-decimal units, as returned by /deposit.
	AmountRaw int64 `json:"amount_raw"`
	// Permit deadline (unix seconds), as returned in the permit.message from /deposit.
	Deadline int64 `json:"deadline"`
	// The user's EIP-2612 permit signature (65-byte hex, 0x-prefixed or raw).
	Signature string `json:"signature"`
	// Sponsor wallet address that will broadcast the returned tx (used for `from` and nonce).
	Sender string `json:"sender"`
}

PerpetualTradingDepositSponsorPrepareRequest - Take a user's signed EIP-2612 USDC permit and build an Arbitrum tx that calls Bridge2.batchedDepositWithPermit.

The customer broadcasts the returned tx from their own sponsor wallet — Compass does not hold gas keys (non-custodial).

func (*PerpetualTradingDepositSponsorPrepareRequest) GetAmountRaw added in v0.1.51

func (*PerpetualTradingDepositSponsorPrepareRequest) GetDeadline added in v0.1.51

func (*PerpetualTradingDepositSponsorPrepareRequest) GetOwner added in v0.1.51

func (*PerpetualTradingDepositSponsorPrepareRequest) GetSender added in v0.1.51

func (*PerpetualTradingDepositSponsorPrepareRequest) GetSignature added in v0.1.51

type PerpetualTradingDepositSponsorPrepareResponse added in v0.1.51

type PerpetualTradingDepositSponsorPrepareResponse struct {
	Transaction UnsignedTransaction `json:"transaction"`
}

PerpetualTradingDepositSponsorPrepareResponse - Fully-encoded Arbitrum tx that completes a HL Bridge2 deposit.

Broadcast `transaction` from the `sender` wallet supplied in the request. After the receipt confirms, verify a USDC `Transfer` event was emitted — Bridge2 can silently no-op without reverting.

func (*PerpetualTradingDepositSponsorPrepareResponse) GetTransaction added in v0.1.51

type PerpetualTradingEnableUnifiedAccountRequest added in v0.1.51

type PerpetualTradingEnableUnifiedAccountRequest struct {
	// User's EOA address
	Owner string `json:"owner"`
}

PerpetualTradingEnableUnifiedAccountRequest - Request to enable unified account mode on Hyperliquid.

func (*PerpetualTradingEnableUnifiedAccountRequest) GetOwner added in v0.1.51

type PerpetualTradingEnableUnifiedAccountResponse added in v0.1.51

type PerpetualTradingEnableUnifiedAccountResponse struct {
	// Current account abstraction mode (e.g. 'default', 'unifiedAccount')
	Mode string `json:"mode"`
	// EIP-712 typed data for wallet signing, or null if already unified
	TypedData optionalnullable.OptionalNullable[map[string]any] `json:"typed_data,omitzero"`
	// Raw Hyperliquid action (passed back to the execute endpoint), or null
	Action optionalnullable.OptionalNullable[map[string]any] `json:"action,omitzero"`
	// Timestamp-based nonce, or null if no action needed
	Nonce optionalnullable.OptionalNullable[int64] `json:"nonce,omitzero"`
}

PerpetualTradingEnableUnifiedAccountResponse - Returned by the enable_unified_account endpoint.

If the account is already in unified mode, typed_data/action/nonce are null. If not, they contain the EIP-712 payload the user must sign.

func (*PerpetualTradingEnableUnifiedAccountResponse) GetAction added in v0.1.51

func (*PerpetualTradingEnableUnifiedAccountResponse) GetMode added in v0.1.51

func (*PerpetualTradingEnableUnifiedAccountResponse) GetNonce added in v0.1.51

func (*PerpetualTradingEnableUnifiedAccountResponse) GetTypedData added in v0.1.51

func (PerpetualTradingEnableUnifiedAccountResponse) MarshalJSON added in v0.1.51

func (*PerpetualTradingEnableUnifiedAccountResponse) UnmarshalJSON added in v0.1.51

func (p *PerpetualTradingEnableUnifiedAccountResponse) UnmarshalJSON(data []byte) error

type PerpetualTradingEnsureLeverageRequest added in v0.1.51

type PerpetualTradingEnsureLeverageRequest struct {
	// User's EOA address
	Owner string `json:"owner"`
	// Asset ticker (e.g. 'AAPL', 'CL')
	Asset string `json:"asset"`
}

PerpetualTradingEnsureLeverageRequest - Request to check and set leverage to 1x cross on a perpetual trading asset.

func (*PerpetualTradingEnsureLeverageRequest) GetAsset added in v0.1.51

func (*PerpetualTradingEnsureLeverageRequest) GetOwner added in v0.1.51

type PerpetualTradingEnsureLeverageResponse added in v0.1.51

type PerpetualTradingEnsureLeverageResponse struct {
	// True if leverage is already 1x cross, false if update needed
	LeverageOk bool `json:"leverage_ok"`
	// EIP-712 typed data for wallet signing, or null if already 1x cross
	TypedData optionalnullable.OptionalNullable[map[string]any] `json:"typed_data,omitzero"`
	// Raw Hyperliquid action (passed back to the execute endpoint), or null
	Action optionalnullable.OptionalNullable[map[string]any] `json:"action,omitzero"`
	// Timestamp-based nonce, or null if no action needed
	Nonce optionalnullable.OptionalNullable[int64] `json:"nonce,omitzero"`
}

PerpetualTradingEnsureLeverageResponse - Returned by the ensure_leverage endpoint.

If the asset is already at 1x cross leverage, typed_data/action/nonce are null. If not (or no position exists), they contain the EIP-712 payload the user must sign.

func (*PerpetualTradingEnsureLeverageResponse) GetAction added in v0.1.51

func (*PerpetualTradingEnsureLeverageResponse) GetLeverageOk added in v0.1.51

func (p *PerpetualTradingEnsureLeverageResponse) GetLeverageOk() bool

func (*PerpetualTradingEnsureLeverageResponse) GetNonce added in v0.1.51

func (*PerpetualTradingEnsureLeverageResponse) GetTypedData added in v0.1.51

func (PerpetualTradingEnsureLeverageResponse) MarshalJSON added in v0.1.51

func (p PerpetualTradingEnsureLeverageResponse) MarshalJSON() ([]byte, error)

func (*PerpetualTradingEnsureLeverageResponse) UnmarshalJSON added in v0.1.51

func (p *PerpetualTradingEnsureLeverageResponse) UnmarshalJSON(data []byte) error

type PerpetualTradingExecuteRequest added in v0.1.51

type PerpetualTradingExecuteRequest struct {
	// Raw Hyperliquid action from the prepare step
	Action map[string]any `json:"action"`
	// Nonce from the prepare step
	Nonce int64 `json:"nonce"`
	// User's EIP-712 signature (hex, 65 bytes)
	Signature string `json:"signature"`
	// Optional vault address
	VaultAddress optionalnullable.OptionalNullable[string] `json:"vault_address,omitzero"`
}

PerpetualTradingExecuteRequest - Submit a signed Hyperliquid action for execution.

func (*PerpetualTradingExecuteRequest) GetAction added in v0.1.51

func (p *PerpetualTradingExecuteRequest) GetAction() map[string]any

func (*PerpetualTradingExecuteRequest) GetNonce added in v0.1.51

func (p *PerpetualTradingExecuteRequest) GetNonce() int64

func (*PerpetualTradingExecuteRequest) GetSignature added in v0.1.51

func (p *PerpetualTradingExecuteRequest) GetSignature() string

func (*PerpetualTradingExecuteRequest) GetVaultAddress added in v0.1.51

type PerpetualTradingExecuteResponse added in v0.1.51

type PerpetualTradingExecuteResponse struct {
	// 'ok' or 'error'
	Status string `json:"status"`
	// Hyperliquid response data (order statuses, etc.)
	Response map[string]any `json:"response,omitzero"`
}

PerpetualTradingExecuteResponse - Returned after submitting a signed action to the Hyperliquid exchange.

func (*PerpetualTradingExecuteResponse) GetResponse added in v0.1.51

func (p *PerpetualTradingExecuteResponse) GetResponse() map[string]any

func (*PerpetualTradingExecuteResponse) GetStatus added in v0.1.51

func (p *PerpetualTradingExecuteResponse) GetStatus() string

func (PerpetualTradingExecuteResponse) MarshalJSON added in v0.1.51

func (p PerpetualTradingExecuteResponse) MarshalJSON() ([]byte, error)

func (*PerpetualTradingExecuteResponse) UnmarshalJSON added in v0.1.51

func (p *PerpetualTradingExecuteResponse) UnmarshalJSON(data []byte) error

type PerpetualTradingFill added in v0.1.51

type PerpetualTradingFill struct {
	// Asset ticker symbol (xyz prefix stripped)
	Asset string `json:"asset"`
	// Order side
	Side PerpetualTradingFillSide `json:"side"`
	// Fill price
	Price string `json:"price"`
	// Fill size in contracts
	Size string `json:"size"`
	// Total fee paid (USDC)
	Fee string `json:"fee"`
	// Portion of fee routed to the builder address (USDC)
	BuilderFee optionalnullable.OptionalNullable[string] `json:"builder_fee,omitzero"`
	// Realized PnL closed by this fill (USDC)
	ClosedPnl optionalnullable.OptionalNullable[string] `json:"closed_pnl,omitzero"`
	// HL order id (oid) this fill belongs to
	OrderID int64 `json:"order_id"`
	// Fill timestamp (ms since epoch)
	TimeMs int64 `json:"time_ms"`
}

PerpetualTradingFill - A single fill (executed trade) from HL `userFills`.

func (*PerpetualTradingFill) GetAsset added in v0.1.51

func (p *PerpetualTradingFill) GetAsset() string

func (*PerpetualTradingFill) GetBuilderFee added in v0.1.51

func (*PerpetualTradingFill) GetClosedPnl added in v0.1.51

func (*PerpetualTradingFill) GetFee added in v0.1.51

func (p *PerpetualTradingFill) GetFee() string

func (*PerpetualTradingFill) GetOrderID added in v0.1.51

func (p *PerpetualTradingFill) GetOrderID() int64

func (*PerpetualTradingFill) GetPrice added in v0.1.51

func (p *PerpetualTradingFill) GetPrice() string

func (*PerpetualTradingFill) GetSide added in v0.1.51

func (*PerpetualTradingFill) GetSize added in v0.1.51

func (p *PerpetualTradingFill) GetSize() string

func (*PerpetualTradingFill) GetTimeMs added in v0.1.51

func (p *PerpetualTradingFill) GetTimeMs() int64

type PerpetualTradingFillSide added in v0.1.51

type PerpetualTradingFillSide string

PerpetualTradingFillSide - Order side

const (
	PerpetualTradingFillSideBuy  PerpetualTradingFillSide = "buy"
	PerpetualTradingFillSideSell PerpetualTradingFillSide = "sell"
)

func (*PerpetualTradingFillSide) IsExact added in v0.1.51

func (e *PerpetualTradingFillSide) IsExact() bool

IsExact returns true if the value matches a known enum value, false otherwise.

func (PerpetualTradingFillSide) ToPointer added in v0.1.51

type PerpetualTradingLimitOrderRequest added in v0.1.51

type PerpetualTradingLimitOrderRequest struct {
	// Owner of the perpetual trading product account
	Owner string `json:"owner"`
	// Asset ticker symbol (e.g. AAPL, GOLD, EUR)
	Asset string `json:"asset"`
	// Order side: 'buy' or 'sell'
	Side string `json:"side"`
	// Number of contracts (human-readable)
	Size string `json:"size"`
	// Limit price (human-readable)
	Price string `json:"price"`
	// Time-in-force: 'gtc' (good til cancel) or 'alo' (add liquidity only)
	TimeInForce *string `json:"time_in_force,omitzero"`
	// If true, order can only reduce an existing position
	ReduceOnly *bool `json:"reduce_only,omitzero"`
	// Optional client order ID for idempotency (uint128)
	ClientOrderID optionalnullable.OptionalNullable[int64] `json:"client_order_id,omitzero"`
	// Optional builder fee. When provided, the order action carries the builder address and fee — the end-user must have already approved this builder via /approve_builder_fee up to at least this rate. Omit (or pass null) to place the order with no builder fee.
	Builder optionalnullable.OptionalNullable[Builder] `json:"builder,omitzero"`
}

PerpetualTradingLimitOrderRequest - Request to place a limit order on a perpetual trading market.

func (*PerpetualTradingLimitOrderRequest) GetAsset added in v0.1.51

func (*PerpetualTradingLimitOrderRequest) GetBuilder added in v0.1.51

func (*PerpetualTradingLimitOrderRequest) GetClientOrderID added in v0.1.51

func (*PerpetualTradingLimitOrderRequest) GetOwner added in v0.1.51

func (*PerpetualTradingLimitOrderRequest) GetPrice added in v0.1.51

func (*PerpetualTradingLimitOrderRequest) GetReduceOnly added in v0.1.51

func (p *PerpetualTradingLimitOrderRequest) GetReduceOnly() *bool

func (*PerpetualTradingLimitOrderRequest) GetSide added in v0.1.51

func (*PerpetualTradingLimitOrderRequest) GetSize added in v0.1.51

func (*PerpetualTradingLimitOrderRequest) GetTimeInForce added in v0.1.51

func (p *PerpetualTradingLimitOrderRequest) GetTimeInForce() *string

func (PerpetualTradingLimitOrderRequest) MarshalJSON added in v0.1.51

func (p PerpetualTradingLimitOrderRequest) MarshalJSON() ([]byte, error)

func (*PerpetualTradingLimitOrderRequest) UnmarshalJSON added in v0.1.51

func (p *PerpetualTradingLimitOrderRequest) UnmarshalJSON(data []byte) error

type PerpetualTradingMarketOrderRequest added in v0.1.51

type PerpetualTradingMarketOrderRequest struct {
	// Owner of the perpetual trading product account
	Owner string `json:"owner"`
	// Asset ticker symbol (e.g. AAPL, GOLD, EUR)
	Asset string `json:"asset"`
	// Order side: 'buy' or 'sell'
	Side string `json:"side"`
	// Number of contracts (human-readable)
	Size string `json:"size"`
	// Max slippage percentage for price protection
	SlippagePercent *float64 `json:"slippage_percent,omitzero"`
	// If true, order can only reduce an existing position
	ReduceOnly *bool `json:"reduce_only,omitzero"`
	// Optional builder fee. When provided, the order action carries the builder address and fee — the end-user must have already approved this builder via /approve_builder_fee up to at least this rate. Omit (or pass null) to place the order with no builder fee.
	Builder optionalnullable.OptionalNullable[Builder] `json:"builder,omitzero"`
}

PerpetualTradingMarketOrderRequest - Request to place a market order on a perpetual trading market.

func (*PerpetualTradingMarketOrderRequest) GetAsset added in v0.1.51

func (*PerpetualTradingMarketOrderRequest) GetBuilder added in v0.1.51

func (*PerpetualTradingMarketOrderRequest) GetOwner added in v0.1.51

func (*PerpetualTradingMarketOrderRequest) GetReduceOnly added in v0.1.51

func (p *PerpetualTradingMarketOrderRequest) GetReduceOnly() *bool

func (*PerpetualTradingMarketOrderRequest) GetSide added in v0.1.51

func (*PerpetualTradingMarketOrderRequest) GetSize added in v0.1.51

func (*PerpetualTradingMarketOrderRequest) GetSlippagePercent added in v0.1.51

func (p *PerpetualTradingMarketOrderRequest) GetSlippagePercent() *float64

func (PerpetualTradingMarketOrderRequest) MarshalJSON added in v0.1.51

func (p PerpetualTradingMarketOrderRequest) MarshalJSON() ([]byte, error)

func (*PerpetualTradingMarketOrderRequest) UnmarshalJSON added in v0.1.51

func (p *PerpetualTradingMarketOrderRequest) UnmarshalJSON(data []byte) error

type PerpetualTradingOpenOrder added in v0.1.51

type PerpetualTradingOpenOrder struct {
	// Asset ticker symbol (xyz prefix stripped)
	Asset string `json:"asset"`
	// Order side
	Side PerpetualTradingOpenOrderSide `json:"side"`
	// Limit price
	LimitPrice string `json:"limit_price"`
	// Order size in contracts
	Size string `json:"size"`
	// HL order id (oid)
	OrderID int64 `json:"order_id"`
	// Order timestamp (ms since epoch)
	TimeMs int64 `json:"time_ms"`
	// True if order can only reduce position
	ReduceOnly bool `json:"reduce_only"`
}

PerpetualTradingOpenOrder - A single resting order from HL `openOrders`.

func (*PerpetualTradingOpenOrder) GetAsset added in v0.1.51

func (p *PerpetualTradingOpenOrder) GetAsset() string

func (*PerpetualTradingOpenOrder) GetLimitPrice added in v0.1.51

func (p *PerpetualTradingOpenOrder) GetLimitPrice() string

func (*PerpetualTradingOpenOrder) GetOrderID added in v0.1.51

func (p *PerpetualTradingOpenOrder) GetOrderID() int64

func (*PerpetualTradingOpenOrder) GetReduceOnly added in v0.1.51

func (p *PerpetualTradingOpenOrder) GetReduceOnly() bool

func (*PerpetualTradingOpenOrder) GetSide added in v0.1.51

func (*PerpetualTradingOpenOrder) GetSize added in v0.1.51

func (p *PerpetualTradingOpenOrder) GetSize() string

func (*PerpetualTradingOpenOrder) GetTimeMs added in v0.1.51

func (p *PerpetualTradingOpenOrder) GetTimeMs() int64

type PerpetualTradingOpenOrderSide added in v0.1.51

type PerpetualTradingOpenOrderSide string

PerpetualTradingOpenOrderSide - Order side

const (
	PerpetualTradingOpenOrderSideBuy  PerpetualTradingOpenOrderSide = "buy"
	PerpetualTradingOpenOrderSideSell PerpetualTradingOpenOrderSide = "sell"
)

func (*PerpetualTradingOpenOrderSide) IsExact added in v0.1.51

func (e *PerpetualTradingOpenOrderSide) IsExact() bool

IsExact returns true if the value matches a known enum value, false otherwise.

func (PerpetualTradingOpenOrderSide) ToPointer added in v0.1.51

type PerpetualTradingOpportunitiesResponse added in v0.1.51

type PerpetualTradingOpportunitiesResponse struct {
	// Available perpetual trading markets
	Opportunities []PerpetualTradingOpportunity `json:"opportunities"`
}

PerpetualTradingOpportunitiesResponse - List of available perpetual trading markets.

func (*PerpetualTradingOpportunitiesResponse) GetOpportunities added in v0.1.51

type PerpetualTradingOpportunity added in v0.1.51

type PerpetualTradingOpportunity struct {
	// Asset ticker symbol (e.g. AAPL, GOLD, EUR)
	Asset string `json:"asset"`
	// Hyperliquid asset index
	AssetID int64 `json:"asset_id"`
	// Asset category: stock, commodity, forex
	Category string `json:"category"`
	// Current mark price
	MarkPrice string `json:"mark_price"`
	// Oracle reference price
	OraclePrice string `json:"oracle_price"`
	// Price 24 hours ago, for computing 24h price change (0 for newly listed markets)
	PrevDayPrice string `json:"prev_day_price"`
	// Open interest in USD
	OpenInterest string `json:"open_interest"`
	// 24-hour trading volume in USD
	Volume24h string `json:"volume_24h"`
	// Current hourly funding rate
	FundingRate string `json:"funding_rate"`
	// Maximum allowed leverage
	MaxLeverage int64 `json:"max_leverage"`
	// Size decimal places for order quantities
	SzDecimals int64 `json:"sz_decimals"`
}

PerpetualTradingOpportunity - A single perpetual trading market.

func (*PerpetualTradingOpportunity) GetAsset added in v0.1.51

func (p *PerpetualTradingOpportunity) GetAsset() string

func (*PerpetualTradingOpportunity) GetAssetID added in v0.1.51

func (p *PerpetualTradingOpportunity) GetAssetID() int64

func (*PerpetualTradingOpportunity) GetCategory added in v0.1.51

func (p *PerpetualTradingOpportunity) GetCategory() string

func (*PerpetualTradingOpportunity) GetFundingRate added in v0.1.51

func (p *PerpetualTradingOpportunity) GetFundingRate() string

func (*PerpetualTradingOpportunity) GetMarkPrice added in v0.1.51

func (p *PerpetualTradingOpportunity) GetMarkPrice() string

func (*PerpetualTradingOpportunity) GetMaxLeverage added in v0.1.51

func (p *PerpetualTradingOpportunity) GetMaxLeverage() int64

func (*PerpetualTradingOpportunity) GetOpenInterest added in v0.1.51

func (p *PerpetualTradingOpportunity) GetOpenInterest() string

func (*PerpetualTradingOpportunity) GetOraclePrice added in v0.1.51

func (p *PerpetualTradingOpportunity) GetOraclePrice() string

func (*PerpetualTradingOpportunity) GetPrevDayPrice added in v0.1.69

func (p *PerpetualTradingOpportunity) GetPrevDayPrice() string

func (*PerpetualTradingOpportunity) GetSzDecimals added in v0.1.51

func (p *PerpetualTradingOpportunity) GetSzDecimals() int64

func (*PerpetualTradingOpportunity) GetVolume24h added in v0.1.51

func (p *PerpetualTradingOpportunity) GetVolume24h() string

type PerpetualTradingPosition added in v0.1.51

type PerpetualTradingPosition struct {
	// Asset ticker symbol
	Asset string `json:"asset"`
	// Hyperliquid asset index
	AssetID int64 `json:"asset_id"`
	// Position side: 'long' or 'short'
	Side PerpetualTradingPositionSide `json:"side"`
	// Position size in contracts
	Size string `json:"size"`
	// Average entry price
	EntryPrice string `json:"entry_price"`
	// Current mark price
	MarkPrice string `json:"mark_price"`
	// Estimated liquidation price
	LiquidationPrice optionalnullable.OptionalNullable[string] `json:"liquidation_price,omitzero"`
	// Unrealized PnL in USD
	UnrealizedPnl string `json:"unrealized_pnl"`
	// Current leverage
	Leverage string `json:"leverage"`
	// Margin used for this position in USD
	MarginUsed string `json:"margin_used"`
	// Cumulative funding payments (negative = paid)
	FundingAccrued string `json:"funding_accrued"`
}

PerpetualTradingPosition - A single open perpetual futures position.

func (*PerpetualTradingPosition) GetAsset added in v0.1.51

func (p *PerpetualTradingPosition) GetAsset() string

func (*PerpetualTradingPosition) GetAssetID added in v0.1.51

func (p *PerpetualTradingPosition) GetAssetID() int64

func (*PerpetualTradingPosition) GetEntryPrice added in v0.1.51

func (p *PerpetualTradingPosition) GetEntryPrice() string

func (*PerpetualTradingPosition) GetFundingAccrued added in v0.1.51

func (p *PerpetualTradingPosition) GetFundingAccrued() string

func (*PerpetualTradingPosition) GetLeverage added in v0.1.51

func (p *PerpetualTradingPosition) GetLeverage() string

func (*PerpetualTradingPosition) GetLiquidationPrice added in v0.1.51

func (*PerpetualTradingPosition) GetMarginUsed added in v0.1.51

func (p *PerpetualTradingPosition) GetMarginUsed() string

func (*PerpetualTradingPosition) GetMarkPrice added in v0.1.51

func (p *PerpetualTradingPosition) GetMarkPrice() string

func (*PerpetualTradingPosition) GetSide added in v0.1.51

func (*PerpetualTradingPosition) GetSize added in v0.1.51

func (p *PerpetualTradingPosition) GetSize() string

func (*PerpetualTradingPosition) GetUnrealizedPnl added in v0.1.51

func (p *PerpetualTradingPosition) GetUnrealizedPnl() string

type PerpetualTradingPositionSide added in v0.1.51

type PerpetualTradingPositionSide string

PerpetualTradingPositionSide - Position side: 'long' or 'short'

const (
	PerpetualTradingPositionSideLong  PerpetualTradingPositionSide = "long"
	PerpetualTradingPositionSideShort PerpetualTradingPositionSide = "short"
)

func (*PerpetualTradingPositionSide) IsExact added in v0.1.51

func (e *PerpetualTradingPositionSide) IsExact() bool

IsExact returns true if the value matches a known enum value, false otherwise.

func (PerpetualTradingPositionSide) ToPointer added in v0.1.51

type PerpetualTradingPositionsResponse added in v0.1.51

type PerpetualTradingPositionsResponse struct {
	// Open perpetual futures positions
	Positions []PerpetualTradingPosition `json:"positions"`
	// Total account value in USD (margin + unrealized PnL)
	AccountValue *string `json:"account_value,omitzero"`
	// Available USDC balance (withdrawable margin)
	Withdrawable *string `json:"withdrawable,omitzero"`
}

PerpetualTradingPositionsResponse - List of open perpetual trading positions with account balance.

func (*PerpetualTradingPositionsResponse) GetAccountValue added in v0.1.51

func (p *PerpetualTradingPositionsResponse) GetAccountValue() *string

func (*PerpetualTradingPositionsResponse) GetPositions added in v0.1.51

func (*PerpetualTradingPositionsResponse) GetWithdrawable added in v0.1.51

func (p *PerpetualTradingPositionsResponse) GetWithdrawable() *string

type PerpetualTradingSetLeverageRequest added in v0.1.51

type PerpetualTradingSetLeverageRequest struct {
	// User's EOA address
	Owner string `json:"owner"`
	// Asset ticker (e.g. 'AAPL', 'CL')
	Asset string `json:"asset"`
	// Target leverage as a whole-number multiplier. Omit (or pass null) to use the asset's maximum leverage. Must be between 1 and the asset's max leverage, which is available from the /opportunities endpoint.
	Leverage optionalnullable.OptionalNullable[int64] `json:"leverage,omitzero"`
}

PerpetualTradingSetLeverageRequest - Request to set leverage on a perpetual trading asset.

Omit “leverage“ (or pass null) to target the asset's maximum leverage.

func (*PerpetualTradingSetLeverageRequest) GetAsset added in v0.1.51

func (*PerpetualTradingSetLeverageRequest) GetLeverage added in v0.1.51

func (*PerpetualTradingSetLeverageRequest) GetOwner added in v0.1.51

type PerpetualTradingSetLeverageResponse added in v0.1.51

type PerpetualTradingSetLeverageResponse struct {
	// True if leverage already matches the requested value, false if an update is needed
	LeverageOk bool `json:"leverage_ok"`
	// EIP-712 typed data for wallet signing, or null if no change is needed
	TypedData optionalnullable.OptionalNullable[map[string]any] `json:"typed_data,omitzero"`
	// Raw Hyperliquid action (passed back to the execute endpoint), or null
	Action optionalnullable.OptionalNullable[map[string]any] `json:"action,omitzero"`
	// Timestamp-based nonce, or null if no action needed
	Nonce optionalnullable.OptionalNullable[int64] `json:"nonce,omitzero"`
}

PerpetualTradingSetLeverageResponse - Returned by the set_leverage endpoint.

If the asset is already at the requested leverage, typed_data/action/nonce are null. If not, they contain the EIP-712 payload the user must sign.

func (*PerpetualTradingSetLeverageResponse) GetAction added in v0.1.51

func (*PerpetualTradingSetLeverageResponse) GetLeverageOk added in v0.1.51

func (p *PerpetualTradingSetLeverageResponse) GetLeverageOk() bool

func (*PerpetualTradingSetLeverageResponse) GetNonce added in v0.1.51

func (*PerpetualTradingSetLeverageResponse) GetTypedData added in v0.1.51

func (PerpetualTradingSetLeverageResponse) MarshalJSON added in v0.1.51

func (p PerpetualTradingSetLeverageResponse) MarshalJSON() ([]byte, error)

func (*PerpetualTradingSetLeverageResponse) UnmarshalJSON added in v0.1.51

func (p *PerpetualTradingSetLeverageResponse) UnmarshalJSON(data []byte) error

type PerpetualTradingSignableActionResponse added in v0.1.51

type PerpetualTradingSignableActionResponse struct {
	// EIP-712 typed data for wallet signing (domain, types, primaryType, message)
	TypedData map[string]any `json:"typed_data"`
	// Raw Hyperliquid action (passed back to the execute endpoint)
	Action map[string]any `json:"action"`
	// Timestamp-based nonce used during signing
	Nonce int64 `json:"nonce"`
}

PerpetualTradingSignableActionResponse - Returned by prepare endpoints — contains EIP-712 typed data for the user to sign.

func (*PerpetualTradingSignableActionResponse) GetAction added in v0.1.51

func (*PerpetualTradingSignableActionResponse) GetNonce added in v0.1.51

func (*PerpetualTradingSignableActionResponse) GetTypedData added in v0.1.51

func (p *PerpetualTradingSignableActionResponse) GetTypedData() map[string]any

type PerpetualTradingWithdrawRequest added in v0.1.51

type PerpetualTradingWithdrawRequest struct {
	// The user's EOA address (owner of the perpetual trading account)
	Owner string `json:"owner"`
	// USDC amount to withdraw (human-readable, e.g. '500.0')
	Amount string `json:"amount"`
	// Arbitrum destination address (defaults to owner if not specified)
	Destination optionalnullable.OptionalNullable[string] `json:"destination,omitzero"`
}

PerpetualTradingWithdrawRequest - Request to withdraw USDC from HyperEVM perpetual trading account to Arbitrum.

func (*PerpetualTradingWithdrawRequest) GetAmount added in v0.1.51

func (p *PerpetualTradingWithdrawRequest) GetAmount() string

func (*PerpetualTradingWithdrawRequest) GetDestination added in v0.1.51

func (*PerpetualTradingWithdrawRequest) GetOwner added in v0.1.51

type PositionPnL

type PositionPnL struct {
	// Total assets deposited over all time
	TotalDeposited string `json:"total_deposited"`
	// Current position value in underlying
	CurrentValue string `json:"current_value"`
	// current_value - cost_basis_remaining
	UnrealizedPnl string `json:"unrealized_pnl"`
	// Sum of profits/losses from all withdrawals
	RealizedPnl string `json:"realized_pnl"`
	// unrealized_pnl + realized_pnl
	TotalPnl string `json:"total_pnl"`
	// (total_pnl / total_deposited) * 100
	TotalPnlPercent string `json:"total_pnl_percent"`
}

PositionPnL - Simplified PnL metrics for API response.

Historical events (deposits/withdrawals) are now at the position level, not inside PnL.

func (*PositionPnL) GetCurrentValue

func (p *PositionPnL) GetCurrentValue() string

func (*PositionPnL) GetRealizedPnl

func (p *PositionPnL) GetRealizedPnl() string

func (*PositionPnL) GetTotalDeposited

func (p *PositionPnL) GetTotalDeposited() string

func (*PositionPnL) GetTotalPnl

func (p *PositionPnL) GetTotalPnl() string

func (*PositionPnL) GetTotalPnlPercent

func (p *PositionPnL) GetTotalPnlPercent() string

func (*PositionPnL) GetUnrealizedPnl

func (p *PositionPnL) GetUnrealizedPnl() string

type PricePoint

type PricePoint struct {
	// ISO 8601 UTC timestamp.
	Timestamp string `json:"timestamp"`
	// Price in USD as a decimal string.
	Price string `json:"price"`
}

PricePoint - A single (timestamp, price) sample from a 24h price-history sparkline.

func (*PricePoint) GetPrice

func (p *PricePoint) GetPrice() string

func (*PricePoint) GetTimestamp

func (p *PricePoint) GetTimestamp() string

type Product

type Product string

Product - Which product the gas sponsorship is for. Determines which Product Account (Safe) address to use.

const (
	ProductEarn            Product = "earn"
	ProductCredit          Product = "credit"
	ProductTokenizedAssets Product = "tokenized_assets"
)

func (Product) ToPointer

func (e Product) ToPointer() *Product

func (*Product) UnmarshalJSON

func (e *Product) UnmarshalJSON(data []byte) error

type Protocol added in v0.1.31

type Protocol string

Protocol - Lending protocol backing this vault. 'MORPHO' for Morpho vaults, 'EULER' for Euler V2 (EVK) vaults. Both are ERC-4626 and are deposited into / withdrawn from the same way (by `vault_address`, via the Earn `VAULT` venue).

const (
	ProtocolMorpho Protocol = "MORPHO"
	ProtocolEuler  Protocol = "EULER"
)

func (*Protocol) IsExact added in v0.1.31

func (e *Protocol) IsExact() bool

IsExact returns true if the value matches a known enum value, false otherwise.

func (Protocol) ToPointer added in v0.1.31

func (e Protocol) ToPointer() *Protocol

type Quote

type Quote struct {
	// A token + amount pair for one leg of the quote.
	Input TokenAmount `json:"input"`
	// A token + amount pair for one leg of the quote.
	Output TokenAmount `json:"output"`
	// Aggregate fee charged for the order.
	Fee QuoteFee `json:"fee"`
	// Estimated upper bound on time-to-fill, in seconds.
	EstFillSeconds int64 `json:"est_fill_seconds"`
}

Quote preview returned alongside an order.

func (*Quote) GetEstFillSeconds

func (q *Quote) GetEstFillSeconds() int64

func (*Quote) GetFee

func (q *Quote) GetFee() QuoteFee

func (*Quote) GetInput

func (q *Quote) GetInput() TokenAmount

func (*Quote) GetOutput

func (q *Quote) GetOutput() TokenAmount

type QuoteFee

type QuoteFee struct {
	// Total fee in USD as a decimal string.
	AmountUsd optionalnullable.OptionalNullable[string] `json:"amount_usd,omitzero"`
	// Fee as basis points of the input amount.
	Bps optionalnullable.OptionalNullable[int64] `json:"bps,omitzero"`
}

QuoteFee - Aggregate fee charged for the order.

func (*QuoteFee) GetAmountUsd

func (q *QuoteFee) GetAmountUsd() optionalnullable.OptionalNullable[string]

func (*QuoteFee) GetBps

type RebalanceDirection added in v0.1.37

type RebalanceDirection string

RebalanceDirection - What the plan does to one named target.

const (
	RebalanceDirectionOpen      RebalanceDirection = "open"
	RebalanceDirectionClose     RebalanceDirection = "close"
	RebalanceDirectionGrow      RebalanceDirection = "grow"
	RebalanceDirectionShrink    RebalanceDirection = "shrink"
	RebalanceDirectionLeverUp   RebalanceDirection = "lever_up"
	RebalanceDirectionLeverDown RebalanceDirection = "lever_down"
	RebalanceDirectionNoop      RebalanceDirection = "noop"
)

func (*RebalanceDirection) IsExact added in v0.1.37

func (e *RebalanceDirection) IsExact() bool

IsExact returns true if the value matches a known enum value, false otherwise.

func (RebalanceDirection) ToPointer added in v0.1.37

func (e RebalanceDirection) ToPointer() *RebalanceDirection

type RebalanceTarget added in v0.1.37

type RebalanceTarget struct {
	// Which lending protocol a credit action targets.
	//
	// “AAVE“ is the default so existing callers (which never send a “protocol“
	// field) keep hitting the unchanged Aave code path; markets are named by token
	// symbol. “MORPHO“ identifies Morpho Blue lending markets by their bytes32
	// “market_id“. “EULER“ identifies Euler V2 markets by their EVK
	// “collateral_vault“ + “borrow_vault“ addresses and supports isolated
	// per-sub-account positions (“sub_account_id“).
	//
	// Deployment is per chain, so a valid protocol can still 422 on a given chain:
	// AAVE on Ethereum, Base, Arbitrum, BSC and HyperEVM (where it is Hyperlend, the
	// chain's Aave V3 deployment); MORPHO on Ethereum, Base, Arbitrum and HyperEVM
	// (where it is Felix); EULER on Ethereum, Base, Arbitrum and BSC.
	//
	// All three support “/v2/credit/loop“, “/v2/credit/unloop“,
	// “/v2/credit/looped_positions“ and “/v2/credit/rebalance“.
	Protocol *CreditProtocol `json:"protocol,omitzero"`
	// Morpho only: the bytes32 market id (from /v2/credit/morpho_markets). Required when protocol=MORPHO.
	MarketID optionalnullable.OptionalNullable[string] `json:"market_id,omitzero"`
	// Euler only: the EVK vault the collateral is supplied to (from /v2/credit/euler_markets). Required when protocol=EULER.
	CollateralVault optionalnullable.OptionalNullable[string] `json:"collateral_vault,omitzero"`
	// Euler only: the EVK vault borrowed from (the sub-account's controller). Required when protocol=EULER.
	BorrowVault optionalnullable.OptionalNullable[string] `json:"borrow_vault,omitzero"`
	// Euler only: the EVC sub-account (0-255) this position lives in. Omit it and the plan resolves it from the live book: the sub-account already holding this vault pair, else the lowest free sub-account for a new position. The resolved id is echoed in the preview. Pass it explicitly when the same pair is open on several sub-accounts.
	SubAccountID optionalnullable.OptionalNullable[int64] `json:"sub_account_id,omitzero"`
	// Token supplied as collateral for this position. For MORPHO it must be the market's collateral token.
	CollateralToken string `json:"collateral_token"`
	// Token borrowed against the collateral for this position. For MORPHO it must be the market's loan token.
	BorrowToken string `json:"borrow_token"`
	// SIZE knob: the net value (collateral − debt, in USD) to commit to this position; total collateral ≈ target_equity_usd × target_multiplier. To remove a position use close=true, never target_equity_usd=0.
	TargetEquityUsd optionalnullable.OptionalNullable[TargetEquityUsd] `json:"target_equity_usd,omitzero"`
	// LEVERAGE knob: total collateral exposure ÷ equity. 1 means unlevered supplied collateral. The protocol maximum is enforced when the plan is built.
	TargetMultiplier optionalnullable.OptionalNullable[RebalanceTargetTargetMultiplier] `json:"target_multiplier,omitzero"`
	// If true, fully unwind this position: the debt is cleared exactly (accrued interest included) and the pair collateral is returned to the Credit Account.
	Close *bool `json:"close,omitzero"`
	// Per-target override of the request-level per-swap slippage tolerance in percent.
	MaxSlippagePercent optionalnullable.OptionalNullable[RebalanceTargetMaxSlippagePercent] `json:"max_slippage_percent,omitzero"`
}

RebalanceTarget - The desired end-state of ONE position in the Credit Account.

Scoped-declarative: only positions named in “targets“ are touched; anything unlisted is left as-is. Set “close=true“ to fully unwind a position — never “target_equity_usd=0“.

func (*RebalanceTarget) GetBorrowToken added in v0.1.37

func (r *RebalanceTarget) GetBorrowToken() string

func (*RebalanceTarget) GetBorrowVault added in v0.1.71

func (*RebalanceTarget) GetClose added in v0.1.37

func (r *RebalanceTarget) GetClose() *bool

func (*RebalanceTarget) GetCollateralToken added in v0.1.37

func (r *RebalanceTarget) GetCollateralToken() string

func (*RebalanceTarget) GetCollateralVault added in v0.1.71

func (r *RebalanceTarget) GetCollateralVault() optionalnullable.OptionalNullable[string]

func (*RebalanceTarget) GetMarketID added in v0.1.37

func (*RebalanceTarget) GetMaxSlippagePercent added in v0.1.37

func (*RebalanceTarget) GetProtocol added in v0.1.37

func (r *RebalanceTarget) GetProtocol() *CreditProtocol

func (*RebalanceTarget) GetSubAccountID added in v0.1.71

func (*RebalanceTarget) GetTargetEquityUsd added in v0.1.37

func (*RebalanceTarget) GetTargetMultiplier added in v0.1.37

type RebalanceTargetMaxSlippagePercent added in v0.1.37

type RebalanceTargetMaxSlippagePercent struct {
	Number *float64 `queryParam:"inline" union:"member"`
	Str    *string  `queryParam:"inline" union:"member"`

	Type RebalanceTargetMaxSlippagePercentType
}

RebalanceTargetMaxSlippagePercent - Per-target override of the request-level per-swap slippage tolerance in percent.

func CreateRebalanceTargetMaxSlippagePercentNumber added in v0.1.37

func CreateRebalanceTargetMaxSlippagePercentNumber(number float64) RebalanceTargetMaxSlippagePercent

func CreateRebalanceTargetMaxSlippagePercentStr added in v0.1.37

func CreateRebalanceTargetMaxSlippagePercentStr(str string) RebalanceTargetMaxSlippagePercent

func (RebalanceTargetMaxSlippagePercent) MarshalJSON added in v0.1.37

func (u RebalanceTargetMaxSlippagePercent) MarshalJSON() ([]byte, error)

func (*RebalanceTargetMaxSlippagePercent) UnmarshalJSON added in v0.1.37

func (u *RebalanceTargetMaxSlippagePercent) UnmarshalJSON(data []byte) (err error)

type RebalanceTargetMaxSlippagePercentType added in v0.1.37

type RebalanceTargetMaxSlippagePercentType string
const (
	RebalanceTargetMaxSlippagePercentTypeNumber RebalanceTargetMaxSlippagePercentType = "number"
	RebalanceTargetMaxSlippagePercentTypeStr    RebalanceTargetMaxSlippagePercentType = "str"
)

type RebalanceTargetPreview added in v0.1.37

type RebalanceTargetPreview struct {
	// Which lending protocol a credit action targets.
	//
	// “AAVE“ is the default so existing callers (which never send a “protocol“
	// field) keep hitting the unchanged Aave code path; markets are named by token
	// symbol. “MORPHO“ identifies Morpho Blue lending markets by their bytes32
	// “market_id“. “EULER“ identifies Euler V2 markets by their EVK
	// “collateral_vault“ + “borrow_vault“ addresses and supports isolated
	// per-sub-account positions (“sub_account_id“).
	//
	// Deployment is per chain, so a valid protocol can still 422 on a given chain:
	// AAVE on Ethereum, Base, Arbitrum, BSC and HyperEVM (where it is Hyperlend, the
	// chain's Aave V3 deployment); MORPHO on Ethereum, Base, Arbitrum and HyperEVM
	// (where it is Felix); EULER on Ethereum, Base, Arbitrum and BSC.
	//
	// All three support “/v2/credit/loop“, “/v2/credit/unloop“,
	// “/v2/credit/looped_positions“ and “/v2/credit/rebalance“.
	Protocol CreditProtocol `json:"protocol"`
	// Morpho only: the bytes32 market id of this position.
	MarketID optionalnullable.OptionalNullable[string] `json:"market_id,omitzero"`
	// Euler only: the EVC sub-account (0-255) this position lives in — the id the request named, or the one the plan resolved when the target omitted it. Feed it back to /v2/credit/unloop and match it on /v2/credit/looped_positions.
	SubAccountID optionalnullable.OptionalNullable[int64] `json:"sub_account_id,omitzero"`
	// Euler only: the EVK vault holding the collateral (echoes the request target).
	CollateralVault optionalnullable.OptionalNullable[string] `json:"collateral_vault,omitzero"`
	// Euler only: the EVK controller vault the debt is owed to (echoes the request target).
	BorrowVault optionalnullable.OptionalNullable[string] `json:"borrow_vault,omitzero"`
	// Collateral token address (echoes the request target; joins against /v2/credit/looped_positions).
	CollateralToken string `json:"collateral_token"`
	// Borrow token address (echoes the request target).
	BorrowToken string `json:"borrow_token"`
	// What the plan does to one named target.
	Direction RebalanceDirection `json:"direction"`
	// On-chain legs planned for this target (loop + unloop iterations); 0 for a noop.
	Legs int64 `json:"legs"`
	// Per-iteration unwind breakdown — populated for releasers (close / shrink / lever_down).
	UnloopLegs []UnloopLegPreview `json:"unloop_legs,omitzero"`
	// Per-iteration loop breakdown — populated for consumers (open / grow / lever_up).
	LoopLegs []LoopLegPreview `json:"loop_legs,omitzero"`
	// Guaranteed minimum collateral supplied to this position after the rebalance (token units).
	ResultingCollateral string `json:"resulting_collateral"`
	// Projected debt owed by this position after the rebalance (borrow-token units); 0 on a close.
	ResultingDebt string `json:"resulting_debt"`
	// Projected leverage of this position after the rebalance; 1 when the debt is cleared. Never promises more leverage (or, when deleveraging, more deleverage) than is guaranteed.
	ResultingMultiplier string `json:"resulting_multiplier"`
	// Projected health factor of this position after the rebalance. Never overstated at the 1.0 boundary — a liquidatable position is never presented as safe. See health_factor_scope for what it covers.
	ResultingHealthFactor string `json:"resulting_health_factor"`
	// 'market' for Morpho and Euler (isolated health: per Morpho market, per Euler EVC sub-account). 'account' for Aave: collateral is pooled, so all collateral backs all debt and this health factor is shared by every Aave position on the account.
	HealthFactorScope RebalanceTargetPreviewHealthFactorScope `json:"health_factor_scope"`
	// Upper bound of surplus this target's own swaps can leave in the Credit Account (sum of each swap's quote minus its guaranteed floor). Routing swaps are counted book-level, not here. It accumulates in the Credit Account, is recoverable, and is never lost.
	EstimatedMaxDust string `json:"estimated_max_dust"`
}

RebalanceTargetPreview - Projected end state of ONE named target, computed on guaranteed swap floors.

func (*RebalanceTargetPreview) GetBorrowToken added in v0.1.37

func (r *RebalanceTargetPreview) GetBorrowToken() string

func (*RebalanceTargetPreview) GetBorrowVault added in v0.1.71

func (*RebalanceTargetPreview) GetCollateralToken added in v0.1.37

func (r *RebalanceTargetPreview) GetCollateralToken() string

func (*RebalanceTargetPreview) GetCollateralVault added in v0.1.71

func (*RebalanceTargetPreview) GetDirection added in v0.1.37

func (r *RebalanceTargetPreview) GetDirection() RebalanceDirection

func (*RebalanceTargetPreview) GetEstimatedMaxDust added in v0.1.37

func (r *RebalanceTargetPreview) GetEstimatedMaxDust() string

func (*RebalanceTargetPreview) GetHealthFactorScope added in v0.1.37

func (*RebalanceTargetPreview) GetLegs added in v0.1.37

func (r *RebalanceTargetPreview) GetLegs() int64

func (*RebalanceTargetPreview) GetLoopLegs added in v0.1.37

func (r *RebalanceTargetPreview) GetLoopLegs() []LoopLegPreview

func (*RebalanceTargetPreview) GetMarketID added in v0.1.37

func (*RebalanceTargetPreview) GetProtocol added in v0.1.37

func (r *RebalanceTargetPreview) GetProtocol() CreditProtocol

func (*RebalanceTargetPreview) GetResultingCollateral added in v0.1.37

func (r *RebalanceTargetPreview) GetResultingCollateral() string

func (*RebalanceTargetPreview) GetResultingDebt added in v0.1.37

func (r *RebalanceTargetPreview) GetResultingDebt() string

func (*RebalanceTargetPreview) GetResultingHealthFactor added in v0.1.37

func (r *RebalanceTargetPreview) GetResultingHealthFactor() string

func (*RebalanceTargetPreview) GetResultingMultiplier added in v0.1.37

func (r *RebalanceTargetPreview) GetResultingMultiplier() string

func (*RebalanceTargetPreview) GetSubAccountID added in v0.1.71

func (*RebalanceTargetPreview) GetUnloopLegs added in v0.1.37

func (r *RebalanceTargetPreview) GetUnloopLegs() []UnloopLegPreview

func (RebalanceTargetPreview) MarshalJSON added in v0.1.37

func (r RebalanceTargetPreview) MarshalJSON() ([]byte, error)

func (*RebalanceTargetPreview) UnmarshalJSON added in v0.1.37

func (r *RebalanceTargetPreview) UnmarshalJSON(data []byte) error

type RebalanceTargetPreviewHealthFactorScope added in v0.1.37

type RebalanceTargetPreviewHealthFactorScope string

RebalanceTargetPreviewHealthFactorScope - 'market' for Morpho and Euler (isolated health: per Morpho market, per Euler EVC sub-account). 'account' for Aave: collateral is pooled, so all collateral backs all debt and this health factor is shared by every Aave position on the account.

const (
	RebalanceTargetPreviewHealthFactorScopeMarket  RebalanceTargetPreviewHealthFactorScope = "market"
	RebalanceTargetPreviewHealthFactorScopeAccount RebalanceTargetPreviewHealthFactorScope = "account"
)

func (*RebalanceTargetPreviewHealthFactorScope) IsExact added in v0.1.37

IsExact returns true if the value matches a known enum value, false otherwise.

func (RebalanceTargetPreviewHealthFactorScope) ToPointer added in v0.1.37

type RebalanceTargetTargetMultiplier added in v0.1.37

type RebalanceTargetTargetMultiplier struct {
	Number *float64 `queryParam:"inline" union:"member"`
	Str    *string  `queryParam:"inline" union:"member"`

	Type RebalanceTargetTargetMultiplierType
}

RebalanceTargetTargetMultiplier - LEVERAGE knob: total collateral exposure ÷ equity. 1 means unlevered supplied collateral. The protocol maximum is enforced when the plan is built.

func CreateRebalanceTargetTargetMultiplierNumber added in v0.1.37

func CreateRebalanceTargetTargetMultiplierNumber(number float64) RebalanceTargetTargetMultiplier

func CreateRebalanceTargetTargetMultiplierStr added in v0.1.37

func CreateRebalanceTargetTargetMultiplierStr(str string) RebalanceTargetTargetMultiplier

func (RebalanceTargetTargetMultiplier) MarshalJSON added in v0.1.37

func (u RebalanceTargetTargetMultiplier) MarshalJSON() ([]byte, error)

func (*RebalanceTargetTargetMultiplier) UnmarshalJSON added in v0.1.37

func (u *RebalanceTargetTargetMultiplier) UnmarshalJSON(data []byte) (err error)

type RebalanceTargetTargetMultiplierType added in v0.1.37

type RebalanceTargetTargetMultiplierType string
const (
	RebalanceTargetTargetMultiplierTypeNumber RebalanceTargetTargetMultiplierType = "number"
	RebalanceTargetTargetMultiplierTypeStr    RebalanceTargetTargetMultiplierType = "str"
)

type Redemption added in v0.1.33

type Redemption struct {
	// On-chain redemption request id.
	ID int64 `json:"id"`
	// Lifecycle state: `pending` (awaiting operator settlement), `finalized` (settled — assets paid to the product account), `rejected` (operator declined; shares returned to the account), or `unknown` (an unrecognized on-chain status code — should not occur for the current contract, surfaced defensively instead of erroring).
	Status RedemptionStatus `json:"status"`
	// Vault shares in the request (human units).
	Shares string `json:"shares"`
	// For a `pending` request, the estimated net assets (after the exit fee) it would settle for at the current NAV — a preview, not a guarantee (settlement depends on the operator and the vault's available assets). Null once finalized or rejected.
	ExpectedNetAssets optionalnullable.OptionalNullable[string] `json:"expected_net_assets,omitzero"`
	// Unix timestamp when the redemption was requested.
	RequestedAt int64 `json:"requested_at"`
	// Unix timestamp when finalized/rejected; null while pending.
	ProcessedAt optionalnullable.OptionalNullable[int64] `json:"processed_at,omitzero"`
}

Redemption - One IXS vault redemption request, reconstructed on-chain.

func (*Redemption) GetExpectedNetAssets added in v0.1.33

func (r *Redemption) GetExpectedNetAssets() optionalnullable.OptionalNullable[string]

func (*Redemption) GetID added in v0.1.33

func (r *Redemption) GetID() int64

func (*Redemption) GetProcessedAt added in v0.1.33

func (r *Redemption) GetProcessedAt() optionalnullable.OptionalNullable[int64]

func (*Redemption) GetRequestedAt added in v0.1.33

func (r *Redemption) GetRequestedAt() int64

func (*Redemption) GetShares added in v0.1.33

func (r *Redemption) GetShares() string

func (*Redemption) GetStatus added in v0.1.33

func (r *Redemption) GetStatus() RedemptionStatus

type RedemptionStatus added in v0.1.33

type RedemptionStatus string

RedemptionStatus - Lifecycle state: `pending` (awaiting operator settlement), `finalized` (settled — assets paid to the product account), `rejected` (operator declined; shares returned to the account), or `unknown` (an unrecognized on-chain status code — should not occur for the current contract, surfaced defensively instead of erroring).

const (
	RedemptionStatusPending   RedemptionStatus = "pending"
	RedemptionStatusFinalized RedemptionStatus = "finalized"
	RedemptionStatusRejected  RedemptionStatus = "rejected"
	RedemptionStatusUnknown   RedemptionStatus = "unknown"
)

func (*RedemptionStatus) IsExact added in v0.1.33

func (e *RedemptionStatus) IsExact() bool

IsExact returns true if the value matches a known enum value, false otherwise.

func (RedemptionStatus) ToPointer added in v0.1.33

func (e RedemptionStatus) ToPointer() *RedemptionStatus

type RedemptionsResponse added in v0.1.33

type RedemptionsResponse struct {
	// The owner's non-empty redemption requests for the vault, in ascending id order. Empty when the owner has never requested one.
	Redemptions []Redemption `json:"redemptions,omitzero"`
}

RedemptionsResponse - An owner's IXS redemption requests for one vault.

func (*RedemptionsResponse) GetRedemptions added in v0.1.33

func (r *RedemptionsResponse) GetRedemptions() []Redemption

func (RedemptionsResponse) MarshalJSON added in v0.1.33

func (r RedemptionsResponse) MarshalJSON() ([]byte, error)

func (*RedemptionsResponse) UnmarshalJSON added in v0.1.33

func (r *RedemptionsResponse) UnmarshalJSON(data []byte) error

type RepayAmount

type RepayAmount struct {
	Number *float64 `queryParam:"inline" union:"member"`
	Str    *string  `queryParam:"inline" union:"member"`

	Type RepayAmountType
}

RepayAmount - Amount of repay_token to repay (in token units, not wei).

func CreateRepayAmountNumber

func CreateRepayAmountNumber(number float64) RepayAmount

func CreateRepayAmountStr

func CreateRepayAmountStr(str string) RepayAmount

func (RepayAmount) MarshalJSON

func (u RepayAmount) MarshalJSON() ([]byte, error)

func (*RepayAmount) UnmarshalJSON

func (u *RepayAmount) UnmarshalJSON(data []byte) (err error)

type RepayAmountType

type RepayAmountType string
const (
	RepayAmountTypeNumber RepayAmountType = "number"
	RepayAmountTypeStr    RepayAmountType = "str"
)

type ReserveInfo added in v0.1.16

type ReserveInfo struct {
	// Underlying token (reserve) contract address on this chain. This is Aave's canonical per-reserve identifier.
	Address string `json:"address"`
	// Aave aToken contract address on this chain. This is the interest-bearing token that represents the supply position.
	ATokenAddress string `json:"a_token_address"`
	// Variable rate APY for deposits, in percentage (e.g., 4.5 means 4.5%). This is LENDING interest only — what borrowers pay. For a staked or wrapped asset it is not the whole yield; add `intrinsic_apy`.
	SupplyApy string `json:"supply_apy"`
	// What holding this asset earns OUTSIDE the lending pool, in percentage: staking rewards or vault yield accruing inside the token's own exchange rate, which the pool neither pays nor observes. A trailing 7-day measurement. ABSENT when no measurement is available (the route omits null fields) — absent does not mean zero. For an asset that plainly earns beyond lending (wstETH, sUSDe, wstHYPE) `supply_apy` alone understates what it earns by percentage points, since almost nobody borrows these and their supply rate rounds to nothing: Hyperlend's wstHYPE reserve pays 0.00006% against a ~2.5% staking yield. Treat an absent value as unknown rather than as the asset earning nothing beyond `supply_apy`.
	IntrinsicApy optionalnullable.OptionalNullable[string] `json:"intrinsic_apy,omitzero"`
	// Variable rate APY for loans, in percentage (e.g., 6.2 means 6.2%).
	BorrowApy string `json:"borrow_apy"`
	// Variable rate APY for deposits averaged over the `days` window in the request (default 30 days), in percentage. Computed the same way as the v1 `/v1/aave/avg_rate` endpoint.
	SupplyApyAvg string `json:"supply_apy_avg"`
	// Variable rate APY for loans averaged over the `days` window in the request (default 30 days), in percentage. Computed the same way as the v1 `/v1/aave/avg_rate` endpoint.
	BorrowApyAvg string `json:"borrow_apy_avg"`
	// Total amount currently borrowed from this market, in token units (e.g., 1234567.89 USDC).
	TotalBorrowed string `json:"total_borrowed"`
	// Amount of tokens available to borrow, in token units. Equals total supplied minus total borrowed.
	AvailableLiquidity string `json:"available_liquidity"`
	// Percentage of supplied tokens that are currently borrowed (e.g., 85.0 means 85%).
	UtilizationRate string `json:"utilization_rate"`
	// Maximum loan-to-value when this reserve is used as collateral, in percentage (e.g., 80.0 means 80%). This is the highest LTV you can borrow at against this asset; 0 means it cannot be used as collateral.
	Ltv string `json:"ltv"`
	// Liquidation threshold when this reserve is used as collateral, in percentage (e.g., 82.5 means 82.5%). A position whose LTV crosses this can be liquidated; 0 means the asset cannot be used as collateral.
	LiquidationThreshold string `json:"liquidation_threshold"`
}

ReserveInfo - Rate and liquidity information for a single Aave reserve on a chain.

A reserve is identified by its underlying token `address` — Aave's canonical reserve identifier. The same token symbol can map to more than one reserve on a chain (e.g. native USDC and bridged USDC.e on Arbitrum), each with its own rates and liquidity.

func (*ReserveInfo) GetATokenAddress added in v0.1.16

func (r *ReserveInfo) GetATokenAddress() string

func (*ReserveInfo) GetAddress added in v0.1.16

func (r *ReserveInfo) GetAddress() string

func (*ReserveInfo) GetAvailableLiquidity added in v0.1.16

func (r *ReserveInfo) GetAvailableLiquidity() string

func (*ReserveInfo) GetBorrowApy added in v0.1.16

func (r *ReserveInfo) GetBorrowApy() string

func (*ReserveInfo) GetBorrowApyAvg added in v0.1.16

func (r *ReserveInfo) GetBorrowApyAvg() string

func (*ReserveInfo) GetIntrinsicApy added in v0.1.54

func (r *ReserveInfo) GetIntrinsicApy() optionalnullable.OptionalNullable[string]

func (*ReserveInfo) GetLiquidationThreshold added in v0.1.43

func (r *ReserveInfo) GetLiquidationThreshold() string

func (*ReserveInfo) GetLtv added in v0.1.43

func (r *ReserveInfo) GetLtv() string

func (*ReserveInfo) GetSupplyApy added in v0.1.16

func (r *ReserveInfo) GetSupplyApy() string

func (*ReserveInfo) GetSupplyApyAvg added in v0.1.16

func (r *ReserveInfo) GetSupplyApyAvg() string

func (*ReserveInfo) GetTotalBorrowed added in v0.1.16

func (r *ReserveInfo) GetTotalBorrowed() string

func (*ReserveInfo) GetUtilizationRate added in v0.1.16

func (r *ReserveInfo) GetUtilizationRate() string

type RoutingSwapPreview added in v0.1.37

type RoutingSwapPreview struct {
	// Token sold by the Credit Account into this routing swap.
	TokenIn string `json:"token_in"`
	// Token bought and delivered to fund a consuming position.
	TokenOut string `json:"token_out"`
	// Token-in amount the Credit Account gives up to this swap.
	AmountIn string `json:"amount_in"`
	// Guaranteed minimum output (token-out units), enforced on-chain by the swap's minimum-return. Any fill above it stays in the Credit Account as recoverable dust.
	MinAmountOut string `json:"min_amount_out"`
}

RoutingSwapPreview - One Phase-B capital-routing swap that moves freed tokens between positions.

Book-level: it is not attributable to a single target.

func (*RoutingSwapPreview) GetAmountIn added in v0.1.37

func (r *RoutingSwapPreview) GetAmountIn() string

func (*RoutingSwapPreview) GetMinAmountOut added in v0.1.37

func (r *RoutingSwapPreview) GetMinAmountOut() string

func (*RoutingSwapPreview) GetTokenIn added in v0.1.37

func (r *RoutingSwapPreview) GetTokenIn() string

func (*RoutingSwapPreview) GetTokenOut added in v0.1.37

func (r *RoutingSwapPreview) GetTokenOut() string

type SafeMessageEip712Response

type SafeMessageEip712Response struct {
	// The EIP-712 domain separator.
	Domain CompassAPIBackendV2ModelsSafeTransactResponseBatchedSafeOperationsEip712Domain `json:"domain"`
	// Type definitions for the “SafeMessage“ EIP-712 payload.
	Types SafeMessageEip712Types `json:"types"`

	// Body of the “SafeMessage“ typed-data — a single “bytes message“.
	Message SafeMessageMessage `json:"message"`
	// contains filtered or unexported fields
}

SafeMessageEip712Response - “signTypedData“ payload for “SafeMessage(bytes message)“.

func (*SafeMessageEip712Response) GetMessage

func (*SafeMessageEip712Response) GetPrimaryType

func (s *SafeMessageEip712Response) GetPrimaryType() string

func (*SafeMessageEip712Response) GetTypes

func (SafeMessageEip712Response) MarshalJSON

func (s SafeMessageEip712Response) MarshalJSON() ([]byte, error)

func (*SafeMessageEip712Response) UnmarshalJSON

func (s *SafeMessageEip712Response) UnmarshalJSON(data []byte) error

type SafeMessageEip712Types

type SafeMessageEip712Types struct {
	// EIP712Domain type definition
	Eip712Domain []Eip712DomainField `json:"EIP712Domain"`
	// SafeMessage type definition
	SafeMessage []SafeMessageField `json:"SafeMessage"`
}

SafeMessageEip712Types - Type definitions for the “SafeMessage“ EIP-712 payload.

func (*SafeMessageEip712Types) GetEip712Domain

func (s *SafeMessageEip712Types) GetEip712Domain() []Eip712DomainField

func (*SafeMessageEip712Types) GetSafeMessage

func (s *SafeMessageEip712Types) GetSafeMessage() []SafeMessageField

type SafeMessageField

type SafeMessageField struct {
	Name string `json:"name"`
	Type string `json:"type"`
}

SafeMessageField - A field in the “SafeMessage“ type definition.

func (*SafeMessageField) GetName

func (s *SafeMessageField) GetName() string

func (*SafeMessageField) GetType

func (s *SafeMessageField) GetType() string

type SafeMessageMessage

type SafeMessageMessage struct {
	// Raw bytes the product account is signing under ERC-1271. For a tokenized-asset order this is the 32-byte order hash.
	Message string `json:"message"`
}

SafeMessageMessage - Body of the “SafeMessage“ typed-data — a single “bytes message“.

func (*SafeMessageMessage) GetMessage

func (s *SafeMessageMessage) GetMessage() string

type SafeTxField

type SafeTxField struct {
	Name string `json:"name"`
	Type string `json:"type"`
}

SafeTxField - A field in the SafeTx type definition.

func (*SafeTxField) GetName

func (s *SafeTxField) GetName() string

func (*SafeTxField) GetType

func (s *SafeTxField) GetType() string

func (SafeTxField) MarshalJSON

func (s SafeTxField) MarshalJSON() ([]byte, error)

func (*SafeTxField) UnmarshalJSON

func (s *SafeTxField) UnmarshalJSON(data []byte) error

type SafeTxMessage

type SafeTxMessage struct {
	// Destination address
	To string `json:"to"`
	// Value in wei as a string
	Value string `json:"value"`
	// Transaction data as hex string
	Data string `json:"data"`
	// Safe operation types.
	Operation OperationType `json:"operation"`
	// Gas for the transaction
	SafeTxGas string `json:"safeTxGas"`
	// Base gas costs
	BaseGas string `json:"baseGas"`
	// Gas price
	GasPrice string `json:"gasPrice"`
	// Token address for gas payment
	GasToken string `json:"gasToken"`
	// Address to receive gas refund
	RefundReceiver string `json:"refundReceiver"`
	// Transaction nonce
	Nonce string `json:"nonce"`
}

SafeTxMessage - The message data for the transaction.

func (*SafeTxMessage) GetBaseGas

func (s *SafeTxMessage) GetBaseGas() string

func (*SafeTxMessage) GetData

func (s *SafeTxMessage) GetData() string

func (*SafeTxMessage) GetGasPrice

func (s *SafeTxMessage) GetGasPrice() string

func (*SafeTxMessage) GetGasToken

func (s *SafeTxMessage) GetGasToken() string

func (*SafeTxMessage) GetNonce

func (s *SafeTxMessage) GetNonce() string

func (*SafeTxMessage) GetOperation

func (s *SafeTxMessage) GetOperation() OperationType

func (*SafeTxMessage) GetRefundReceiver

func (s *SafeTxMessage) GetRefundReceiver() string

func (*SafeTxMessage) GetSafeTxGas

func (s *SafeTxMessage) GetSafeTxGas() string

func (*SafeTxMessage) GetTo

func (s *SafeTxMessage) GetTo() string

func (*SafeTxMessage) GetValue

func (s *SafeTxMessage) GetValue() string

func (SafeTxMessage) MarshalJSON

func (s SafeTxMessage) MarshalJSON() ([]byte, error)

func (*SafeTxMessage) UnmarshalJSON

func (s *SafeTxMessage) UnmarshalJSON(data []byte) error

type Section added in v0.1.3

type Section string
const (
	SectionPositions       Section = "positions"
	SectionFills           Section = "fills"
	SectionOpenOrders      Section = "open_orders"
	SectionBuilderApproval Section = "builder_approval"
)

func (*Section) IsExact added in v0.1.3

func (e *Section) IsExact() bool

IsExact returns true if the value matches a known enum value, false otherwise.

func (Section) ToPointer added in v0.1.3

func (e Section) ToPointer() *Section

type Security

type Security struct {
	APIKeyAuth string `security:"scheme,type=apiKey,subtype=header,name=x-api-key"`
}

func (*Security) GetAPIKeyAuth

func (s *Security) GetAPIKeyAuth() string

type Settlement added in v0.1.33

type Settlement string

Settlement - How the trade settles. `instant`: the signed transaction completes the trade (Midas/Ondo swaps and IXS deposits). `async`: the transaction only *requests* an IXS redemption, which the vault operator settles off-chain later — poll `poll_endpoint` for status.

const (
	SettlementInstant Settlement = "instant"
	SettlementAsync   Settlement = "async"
)

func (*Settlement) IsExact added in v0.1.33

func (e *Settlement) IsExact() bool

IsExact returns true if the value matches a known enum value, false otherwise.

func (Settlement) ToPointer added in v0.1.33

func (e Settlement) ToPointer() *Settlement

type SponsorGasRequest

type SponsorGasRequest struct {
	// The wallet address that owns the Product Account.
	Owner string `json:"owner"`
	// The chain to use.
	Chain Chain `json:"chain"`
	// Which product the gas sponsorship is for. Determines which Product Account (Safe) address to use.
	Product *Product `json:"product,omitzero"`
	// The EIP-712 typed data that was signed.
	Eip712 SponsorGasRequestEip712 `json:"eip_712"`
	// The EIP-712 signed typed data signature.
	Signature string `json:"signature"`
	// The address of the wallet which will send the transaction.
	Sender string `json:"sender"`
}

func (*SponsorGasRequest) GetChain

func (s *SponsorGasRequest) GetChain() Chain

func (*SponsorGasRequest) GetEip712

func (*SponsorGasRequest) GetOwner

func (s *SponsorGasRequest) GetOwner() string

func (*SponsorGasRequest) GetProduct

func (s *SponsorGasRequest) GetProduct() *Product

func (*SponsorGasRequest) GetSender

func (s *SponsorGasRequest) GetSender() string

func (*SponsorGasRequest) GetSignature

func (s *SponsorGasRequest) GetSignature() string

type SponsorGasRequestEip712

type SponsorGasRequestEip712 struct {
	BatchedSafeOperationsResponseInput *BatchedSafeOperationsResponseInput `queryParam:"inline" union:"member"`
	PermitTypedDataResponseInput       *PermitTypedDataResponseInput       `queryParam:"inline" union:"member"`
	Permit2TypedDataInput              *Permit2TypedDataInput              `queryParam:"inline" union:"member"`

	Type SponsorGasRequestEip712Type
}

SponsorGasRequestEip712 - The EIP-712 typed data that was signed.

func CreateSponsorGasRequestEip712BatchedSafeOperationsResponseInput

func CreateSponsorGasRequestEip712BatchedSafeOperationsResponseInput(batchedSafeOperationsResponseInput BatchedSafeOperationsResponseInput) SponsorGasRequestEip712

func CreateSponsorGasRequestEip712Permit2TypedDataInput

func CreateSponsorGasRequestEip712Permit2TypedDataInput(permit2TypedDataInput Permit2TypedDataInput) SponsorGasRequestEip712

func CreateSponsorGasRequestEip712PermitTypedDataResponseInput

func CreateSponsorGasRequestEip712PermitTypedDataResponseInput(permitTypedDataResponseInput PermitTypedDataResponseInput) SponsorGasRequestEip712

func (SponsorGasRequestEip712) MarshalJSON

func (u SponsorGasRequestEip712) MarshalJSON() ([]byte, error)

func (*SponsorGasRequestEip712) UnmarshalJSON

func (u *SponsorGasRequestEip712) UnmarshalJSON(data []byte) (err error)

type SponsorGasRequestEip712Type

type SponsorGasRequestEip712Type string
const (
	SponsorGasRequestEip712TypeBatchedSafeOperationsResponseInput SponsorGasRequestEip712Type = "BatchedSafeOperationsResponse-Input"
	SponsorGasRequestEip712TypePermitTypedDataResponseInput       SponsorGasRequestEip712Type = "PermitTypedDataResponse-Input"
	SponsorGasRequestEip712TypePermit2TypedDataInput              SponsorGasRequestEip712Type = "Permit2TypedData-Input"
)

type SponsorGasResponse

type SponsorGasResponse struct {
	Transaction UnsignedTransaction `json:"transaction"`
}

func (*SponsorGasResponse) GetTransaction

func (s *SponsorGasResponse) GetTransaction() UnsignedTransaction

type SwapInfo added in v0.1.34

type SwapInfo struct {
	// Token sold in the swap (the borrowed/debt token).
	SoldToken string `json:"sold_token"`
	// Symbol of the sold token.
	SoldSymbol string `json:"sold_symbol"`
	// Amount of the sold token.
	SoldAmount string `json:"sold_amount"`
	// Token bought in the swap (the collateral token).
	BoughtToken string `json:"bought_token"`
	// Symbol of the bought token.
	BoughtSymbol string `json:"bought_symbol"`
	// Amount of the bought token.
	BoughtAmount string `json:"bought_amount"`
	// The outbound counterparty when it is the swap router itself. Null when the swap settled from an executor contract (informational only — never required to detect the swap).
	Router optionalnullable.OptionalNullable[string] `json:"router,omitzero"`
}

SwapInfo - The DEX swap leg detected inside a loop transaction.

Evidence is token-filtered and executor-proof: the sold (debt) token left the account to a non-protocol counterparty and the bought (collateral) token arrived from a non-protocol counterparty. Aggregator fills often settle from an executor contract, so the router is recorded only when it happens to be the outbound counterparty — it is never required for detection.

func (*SwapInfo) GetBoughtAmount added in v0.1.34

func (s *SwapInfo) GetBoughtAmount() string

func (*SwapInfo) GetBoughtSymbol added in v0.1.34

func (s *SwapInfo) GetBoughtSymbol() string

func (*SwapInfo) GetBoughtToken added in v0.1.34

func (s *SwapInfo) GetBoughtToken() string

func (*SwapInfo) GetRouter added in v0.1.34

func (*SwapInfo) GetSoldAmount added in v0.1.34

func (s *SwapInfo) GetSoldAmount() string

func (*SwapInfo) GetSoldSymbol added in v0.1.34

func (s *SwapInfo) GetSoldSymbol() string

func (*SwapInfo) GetSoldToken added in v0.1.34

func (s *SwapInfo) GetSoldToken() string

type TargetEquityUsd added in v0.1.37

type TargetEquityUsd struct {
	Number *float64 `queryParam:"inline" union:"member"`
	Str    *string  `queryParam:"inline" union:"member"`

	Type TargetEquityUsdType
}

TargetEquityUsd - SIZE knob: the net value (collateral − debt, in USD) to commit to this position; total collateral ≈ target_equity_usd × target_multiplier. To remove a position use close=true, never target_equity_usd=0.

func CreateTargetEquityUsdNumber added in v0.1.37

func CreateTargetEquityUsdNumber(number float64) TargetEquityUsd

func CreateTargetEquityUsdStr added in v0.1.37

func CreateTargetEquityUsdStr(str string) TargetEquityUsd

func (TargetEquityUsd) MarshalJSON added in v0.1.37

func (u TargetEquityUsd) MarshalJSON() ([]byte, error)

func (*TargetEquityUsd) UnmarshalJSON added in v0.1.37

func (u *TargetEquityUsd) UnmarshalJSON(data []byte) (err error)

type TargetEquityUsdType added in v0.1.37

type TargetEquityUsdType string
const (
	TargetEquityUsdTypeNumber TargetEquityUsdType = "number"
	TargetEquityUsdTypeStr    TargetEquityUsdType = "str"
)

type TokenAmount

type TokenAmount struct {
	// On-chain token symbol (e.g. `USDC`, `TSLAon`).
	Symbol string `json:"symbol"`
	// Ethereum mainnet ERC-20 address.
	ContractAddress string `json:"contract_address"`
	// Human-readable amount as a decimal string.
	Amount string `json:"amount"`
	// USD value of `amount`.
	AmountUsd optionalnullable.OptionalNullable[string] `json:"amount_usd,omitzero"`
}

TokenAmount - A token + amount pair for one leg of the quote.

func (*TokenAmount) GetAmount

func (t *TokenAmount) GetAmount() string

func (*TokenAmount) GetAmountUsd

func (*TokenAmount) GetContractAddress

func (t *TokenAmount) GetContractAddress() string

func (*TokenAmount) GetSymbol

func (t *TokenAmount) GetSymbol() string

type TokenMarketData

type TokenMarketData struct {
	// Market data per chain. Keys are chain names (ethereum, base, arbitrum).
	Chains map[string]ChainMarketInfo `json:"chains"`
	// Information about the chain with the highest supply APY for a token.
	MaxSupplyApy MaxSupplyApyInfo `json:"max_supply_apy"`
}

TokenMarketData - Market data for a single token across all chains.

func (*TokenMarketData) GetChains

func (t *TokenMarketData) GetChains() map[string]ChainMarketInfo

func (*TokenMarketData) GetMaxSupplyApy

func (t *TokenMarketData) GetMaxSupplyApy() MaxSupplyApyInfo

type TokenPermissions

type TokenPermissions struct {
	// ERC-20 token address
	Token string `json:"token"`
	// Maximum amount allowed to transfer
	Amount int64 `json:"amount"`
}

func (*TokenPermissions) GetAmount

func (t *TokenPermissions) GetAmount() int64

func (*TokenPermissions) GetToken

func (t *TokenPermissions) GetToken() string

func (TokenPermissions) MarshalJSON

func (t TokenPermissions) MarshalJSON() ([]byte, error)

func (*TokenPermissions) UnmarshalJSON

func (t *TokenPermissions) UnmarshalJSON(data []byte) error

type TokenTransfer

type TokenTransfer struct {
	// The address tokens were sent from.
	FromAddress string `json:"from_address"`
	// The address tokens were sent to.
	ToAddress string `json:"to_address"`
	// The raw transfer amount (in token's smallest unit).
	Amount string `json:"amount"`
	// The human-readable transfer amount.
	AmountFormatted string `json:"amount_formatted"`
	// The block number of the transfer.
	BlockNumber int64 `json:"block_number"`
	// The timestamp of the transfer.
	BlockTimestamp time.Time `json:"block_timestamp"`
	// The transaction hash of the transfer.
	TransactionHash string `json:"transaction_hash"`
	// Direction relative to the product account: 'in' for received, 'out' for sent.
	Direction Direction `json:"direction"`
}

TokenTransfer - A single ERC20 token transfer event.

func (*TokenTransfer) GetAmount

func (t *TokenTransfer) GetAmount() string

func (*TokenTransfer) GetAmountFormatted

func (t *TokenTransfer) GetAmountFormatted() string

func (*TokenTransfer) GetBlockNumber

func (t *TokenTransfer) GetBlockNumber() int64

func (*TokenTransfer) GetBlockTimestamp

func (t *TokenTransfer) GetBlockTimestamp() time.Time

func (*TokenTransfer) GetDirection

func (t *TokenTransfer) GetDirection() Direction

func (*TokenTransfer) GetFromAddress

func (t *TokenTransfer) GetFromAddress() string

func (*TokenTransfer) GetToAddress

func (t *TokenTransfer) GetToAddress() string

func (*TokenTransfer) GetTransactionHash

func (t *TokenTransfer) GetTransactionHash() string

func (TokenTransfer) MarshalJSON

func (t TokenTransfer) MarshalJSON() ([]byte, error)

func (*TokenTransfer) UnmarshalJSON

func (t *TokenTransfer) UnmarshalJSON(data []byte) error

type TokenizedAssetClass added in v0.1.17

type TokenizedAssetClass string

TokenizedAssetClass - Asset class of a tokenized asset.

`EQUITY` trades via the order endpoints (build/submit/cancel); the RWA yield classes (`T_BILLS`, `BASIS_TRADE`, `BTC_YIELD`), `MANAGED_VAULT`, and `DERWA` trade via the swap-based `transact/buy` and `transact/sell` endpoints. `MANAGED_VAULT` (IXS ERC-4626 vaults) is special in that a sell is an *asynchronous* redemption request settled off-chain by the vault operator. `DERWA` (Centrifuge freely-transferable RWA wrappers) settles each buy/sell as a single instant DEX swap.

`MONEY_MARKET` (WisdomTree Connect digital funds) also uses `transact/buy` and `transact/sell`, but neither swaps nor mints: a buy transfers the settlement stablecoin to the issuer's deposit address and the issuer mints fund shares back at the next NAV cycle, so settlement is *asynchronous*.

const (
	TokenizedAssetClassEquity       TokenizedAssetClass = "EQUITY"
	TokenizedAssetClassTBills       TokenizedAssetClass = "T_BILLS"
	TokenizedAssetClassBasisTrade   TokenizedAssetClass = "BASIS_TRADE"
	TokenizedAssetClassBtcYield     TokenizedAssetClass = "BTC_YIELD"
	TokenizedAssetClassManagedVault TokenizedAssetClass = "MANAGED_VAULT"
	TokenizedAssetClassDerwa        TokenizedAssetClass = "DERWA"
	TokenizedAssetClassMoneyMarket  TokenizedAssetClass = "MONEY_MARKET"
)

func (*TokenizedAssetClass) IsExact added in v0.1.17

func (e *TokenizedAssetClass) IsExact() bool

IsExact returns true if the value matches a known enum value, false otherwise.

func (TokenizedAssetClass) ToPointer added in v0.1.17

type TokenizedAssetProvider added in v0.1.17

type TokenizedAssetProvider string

TokenizedAssetProvider - Issuer/provider of a tokenized asset.

const (
	TokenizedAssetProviderOndo       TokenizedAssetProvider = "ondo"
	TokenizedAssetProviderMidas      TokenizedAssetProvider = "midas"
	TokenizedAssetProviderIxs        TokenizedAssetProvider = "ixs"
	TokenizedAssetProviderCentrifuge TokenizedAssetProvider = "centrifuge"
	TokenizedAssetProviderWisdomtree TokenizedAssetProvider = "wisdomtree"
)

func (*TokenizedAssetProvider) IsExact added in v0.1.17

func (e *TokenizedAssetProvider) IsExact() bool

IsExact returns true if the value matches a known enum value, false otherwise.

func (TokenizedAssetProvider) ToPointer added in v0.1.17

type TokenizedAssetsActivityEvent added in v0.1.23

type TokenizedAssetsActivityEvent struct {
	// Kind of activity for this transaction.
	EventType TokenizedAssetsActivityEventEventType `json:"event_type"`
	// Block the transaction was mined in.
	BlockNumber int64 `json:"block_number"`
	// Time the transaction was mined.
	BlockTimestamp time.Time `json:"block_timestamp"`
	// Transaction hash.
	TransactionHash string `json:"transaction_hash"`
	// Amount sent: USDC for a buy, tokens for a sell/transfer_out.
	InputAmount optionalnullable.OptionalNullable[string] `json:"input_amount,omitzero"`
	// Symbol of the sent leg, or `null` for a transfer_in.
	InputSymbol optionalnullable.OptionalNullable[string] `json:"input_symbol,omitzero"`
	// Amount received: tokens for a buy/transfer_in, USDC for a sell.
	OutputAmount optionalnullable.OptionalNullable[string] `json:"output_amount,omitzero"`
	// Symbol of the received leg, or `null` for a transfer_out.
	OutputSymbol optionalnullable.OptionalNullable[string] `json:"output_symbol,omitzero"`
	// Cost basis per token at buy time; `null` for non-buys.
	CostPerUnit optionalnullable.OptionalNullable[string] `json:"cost_per_unit,omitzero"`
	// Realized profit/loss on a sell; `null` for non-sells.
	RealizedPnl optionalnullable.OptionalNullable[string] `json:"realized_pnl,omitzero"`
}

TokenizedAssetsActivityEvent - One classified activity event on a tokenized-asset position.

Mirrors Earn's deposit/withdrawal event shape (generic “input“/“output“ legs) with an “event_type“ discriminator, so buys, sells and transfers share one chronological feed. A “buy“ has “input“ = USDC paid and “output“ = tokens received (“cost_per_unit“ = USDC/token); a “sell“ is the reverse and carries “realized_pnl“; a “transfer_in“/“transfer_out“ carries only the token leg, so the opposite side is “null“. All amounts are decimal strings. Pure-USDC funding movements are not position activity — they appear on the balances endpoint.

func (*TokenizedAssetsActivityEvent) GetBlockNumber added in v0.1.23

func (t *TokenizedAssetsActivityEvent) GetBlockNumber() int64

func (*TokenizedAssetsActivityEvent) GetBlockTimestamp added in v0.1.23

func (t *TokenizedAssetsActivityEvent) GetBlockTimestamp() time.Time

func (*TokenizedAssetsActivityEvent) GetCostPerUnit added in v0.1.23

func (*TokenizedAssetsActivityEvent) GetEventType added in v0.1.23

func (*TokenizedAssetsActivityEvent) GetInputAmount added in v0.1.23

func (*TokenizedAssetsActivityEvent) GetInputSymbol added in v0.1.23

func (*TokenizedAssetsActivityEvent) GetOutputAmount added in v0.1.23

func (*TokenizedAssetsActivityEvent) GetOutputSymbol added in v0.1.23

func (*TokenizedAssetsActivityEvent) GetRealizedPnl added in v0.1.23

func (*TokenizedAssetsActivityEvent) GetTransactionHash added in v0.1.23

func (t *TokenizedAssetsActivityEvent) GetTransactionHash() string

func (TokenizedAssetsActivityEvent) MarshalJSON added in v0.1.23

func (t TokenizedAssetsActivityEvent) MarshalJSON() ([]byte, error)

func (*TokenizedAssetsActivityEvent) UnmarshalJSON added in v0.1.23

func (t *TokenizedAssetsActivityEvent) UnmarshalJSON(data []byte) error

type TokenizedAssetsActivityEventEventType added in v0.1.23

type TokenizedAssetsActivityEventEventType string

TokenizedAssetsActivityEventEventType - Kind of activity for this transaction.

const (
	TokenizedAssetsActivityEventEventTypeBuy         TokenizedAssetsActivityEventEventType = "buy"
	TokenizedAssetsActivityEventEventTypeSell        TokenizedAssetsActivityEventEventType = "sell"
	TokenizedAssetsActivityEventEventTypeTransferIn  TokenizedAssetsActivityEventEventType = "transfer_in"
	TokenizedAssetsActivityEventEventTypeTransferOut TokenizedAssetsActivityEventEventType = "transfer_out"
)

func (*TokenizedAssetsActivityEventEventType) IsExact added in v0.1.23

IsExact returns true if the value matches a known enum value, false otherwise.

func (TokenizedAssetsActivityEventEventType) ToPointer added in v0.1.23

type TokenizedAssetsBalancesResponse added in v0.1.23

type TokenizedAssetsBalancesResponse struct {
	// The derived Tokenized Assets Account address.
	TokenizedAssetsAccountAddress string `json:"tokenized_assets_account_address"`
	// Token balances keyed by symbol. Each entry includes the current balance, its USD value, and transfer history. Symbols are not unique on-chain: when two tokens collide, each key becomes 'SYMBOL (0xAddress)' — match on token_address for exactness.
	Balances map[string]CompassAPIBackendV2ModelsBalancesTokenBalance `json:"balances,omitzero"`
	// Total USD value of all priced balances.
	TotalUsdValue optionalnullable.OptionalNullable[string] `json:"total_usd_value,omitzero"`
}

TokenizedAssetsBalancesResponse - Token balances and transfer history for a Tokenized Assets Account.

Each token held in the account is keyed by symbol with its current balance, USD value, and transfer history. Uses the same `TokenBalance`/`TokenTransfer` shape as the earn and credit balances endpoints.

func (*TokenizedAssetsBalancesResponse) GetBalances added in v0.1.23

func (*TokenizedAssetsBalancesResponse) GetTokenizedAssetsAccountAddress added in v0.1.23

func (t *TokenizedAssetsBalancesResponse) GetTokenizedAssetsAccountAddress() string

func (*TokenizedAssetsBalancesResponse) GetTotalUsdValue added in v0.1.23

func (TokenizedAssetsBalancesResponse) MarshalJSON added in v0.1.23

func (t TokenizedAssetsBalancesResponse) MarshalJSON() ([]byte, error)

func (*TokenizedAssetsBalancesResponse) UnmarshalJSON added in v0.1.23

func (t *TokenizedAssetsBalancesResponse) UnmarshalJSON(data []byte) error

type TokenizedAssetsBuildOrderRequest

type TokenizedAssetsBuildOrderRequest struct {
	// Token the sender is paying. Either an on-chain symbol (e.g. `TSLAon`), the literal `USDC`, or a 0x-prefixed token address.
	FromToken string `json:"from_token"`
	// Token the sender is receiving. Same accepted forms as `from_token`.
	ToToken string `json:"to_token"`
	// Human-readable amount of `from_token` to swap (decimal string). Decimals are applied server-side.
	Amount string `json:"amount"`
	// Wallet that owns the Tokenized Assets Account. The product account address is derived deterministically from this owner. The owner signs the EIP-712 payloads returned by this endpoint (the optional approval and the order itself).
	Owner string `json:"owner"`
	// Max acceptable slippage in basis points (1 bp = 0.01%). Range 1-5000 (0.01%-50%); defaults to 50 (0.5%). The upper bound is intentionally wide so callers can clear the wide auction floors quoted for thinly-traded tokenized stocks.
	SlippageBps *int64 `json:"slippage_bps,omitzero"`
}

TokenizedAssetsBuildOrderRequest - Build a buy or sell order for a tokenized equity.

func (*TokenizedAssetsBuildOrderRequest) GetAmount

func (*TokenizedAssetsBuildOrderRequest) GetFromToken

func (t *TokenizedAssetsBuildOrderRequest) GetFromToken() string

func (*TokenizedAssetsBuildOrderRequest) GetOwner

func (*TokenizedAssetsBuildOrderRequest) GetSlippageBps

func (t *TokenizedAssetsBuildOrderRequest) GetSlippageBps() *int64

func (*TokenizedAssetsBuildOrderRequest) GetToToken

func (t *TokenizedAssetsBuildOrderRequest) GetToToken() string

type TokenizedAssetsBuildOrderResponse

type TokenizedAssetsBuildOrderResponse struct {
	// Quote preview returned alongside an order.
	Quote Quote `json:"quote"`
	// EIP-712 payload that authorizes a one-time max-approve of `from_token` to the settlement contract. Populated when the Tokenized Assets Account's existing allowance is below `amount`. The owner signs it, then it is broadcast via `POST /v2/gas_sponsorship/prepare` (or directly by the owner) to set the allowance on-chain. `null` when the allowance is already sufficient.
	ApprovalSafeTxEip712 optionalnullable.OptionalNullable[BatchedSafeOperationsResponseOutput] `json:"approval_safe_tx_eip712,omitzero"`
	// Order metadata plus the EIP-712 payload the owner signs to authorize it.
	//
	// The owner signs “safe_message_eip712“ off-chain. At submit time the
	// signature is sent back to “/order/submit“ together with
	// “order_message“, “extension“, and “quote_id“; the signature is
	// validated against the Tokenized Assets Account at fill time.
	Order OrderToSign `json:"order"`
}

TokenizedAssetsBuildOrderResponse - Quote, optional approval payload, and the EIP-712 order to sign.

func (*TokenizedAssetsBuildOrderResponse) GetApprovalSafeTxEip712

func (*TokenizedAssetsBuildOrderResponse) GetOrder

func (*TokenizedAssetsBuildOrderResponse) GetQuote

func (TokenizedAssetsBuildOrderResponse) MarshalJSON

func (t TokenizedAssetsBuildOrderResponse) MarshalJSON() ([]byte, error)

func (*TokenizedAssetsBuildOrderResponse) UnmarshalJSON

func (t *TokenizedAssetsBuildOrderResponse) UnmarshalJSON(data []byte) error

type TokenizedAssetsCancelOrderRequest

type TokenizedAssetsCancelOrderRequest struct {
	// Wallet that owns the Tokenized Assets Account. The account address derived from this owner must match the order's on-chain maker; the API rejects otherwise (only the order's maker can cancel it).
	Owner string `json:"owner"`
}

func (*TokenizedAssetsCancelOrderRequest) GetOwner

type TokenizedAssetsCancelOrderResponse

type TokenizedAssetsCancelOrderResponse struct {
	// Response containing EIP-712 typed data for Safe transaction signing.
	CancelSafeTxEip712 BatchedSafeOperationsResponseOutput `json:"cancel_safe_tx_eip712"`
}

func (*TokenizedAssetsCancelOrderResponse) GetCancelSafeTxEip712

type TokenizedAssetsChargeFeeRequest added in v0.1.24

type TokenizedAssetsChargeFeeRequest struct {
	// The owner's wallet address; the product account is derived from it.
	Owner string `json:"owner"`
	// Fee configuration for tokenized-asset trades.
	//
	// Same shape as `Fee`, but narrows `denomination` to the values supported by
	// tokenized-asset trades. PERFORMANCE is not supported because realized-profit
	// fees are not computed for spot buy/sell trades.
	Fee TokenizedAssetsFee `json:"fee"`
	// When true, returns an EIP-712 payload for gas-sponsored execution instead of an unsigned transaction.
	GasSponsorship *bool `json:"gas_sponsorship,omitzero"`
}

TokenizedAssetsChargeFeeRequest - Charge a partner fee on the USDC proceeds of a filled sell order.

Equity orders fill off-chain via a third-party venue, so the fee can't ride inside the trade (unlike Midas/earn/credit). After the sell order fills, call this with the order hash to build a USDC `transfer(recipient, fee)` executed by the product account.

func (*TokenizedAssetsChargeFeeRequest) GetFee added in v0.1.24

func (*TokenizedAssetsChargeFeeRequest) GetGasSponsorship added in v0.1.24

func (t *TokenizedAssetsChargeFeeRequest) GetGasSponsorship() *bool

func (*TokenizedAssetsChargeFeeRequest) GetOwner added in v0.1.24

type TokenizedAssetsChargeFeeResponse added in v0.1.24

type TokenizedAssetsChargeFeeResponse struct {
	// Unsigned transaction transferring the fee from the product account.
	Transaction optionalnullable.OptionalNullable[UnsignedTransaction] `json:"transaction,omitzero"`
	// EIP-712 payload for gas-sponsored execution.
	Eip712 optionalnullable.OptionalNullable[BatchedSafeOperationsResponseOutput] `json:"eip_712,omitzero"`
	// Fee charged, in USDC.
	FeeAmount string `json:"fee_amount"`
	// Filled USDC proceeds the fee was computed on.
	Proceeds string `json:"proceeds"`
}

TokenizedAssetsChargeFeeResponse - Unsigned USDC fee transfer for the owner to sign.

Exactly one of `transaction` (gas_sponsorship=false) or `eip_712` (gas_sponsorship=true) is set.

func (*TokenizedAssetsChargeFeeResponse) GetEip712 added in v0.1.24

func (*TokenizedAssetsChargeFeeResponse) GetFeeAmount added in v0.1.24

func (t *TokenizedAssetsChargeFeeResponse) GetFeeAmount() string

func (*TokenizedAssetsChargeFeeResponse) GetProceeds added in v0.1.24

func (t *TokenizedAssetsChargeFeeResponse) GetProceeds() string

func (*TokenizedAssetsChargeFeeResponse) GetTransaction added in v0.1.24

func (TokenizedAssetsChargeFeeResponse) MarshalJSON added in v0.1.24

func (t TokenizedAssetsChargeFeeResponse) MarshalJSON() ([]byte, error)

func (*TokenizedAssetsChargeFeeResponse) UnmarshalJSON added in v0.1.24

func (t *TokenizedAssetsChargeFeeResponse) UnmarshalJSON(data []byte) error

type TokenizedAssetsFee added in v0.1.24

type TokenizedAssetsFee struct {
	// The wallet address that will receive the fee.
	Recipient string `json:"recipient"`
	// The fee amount. If `denomination` is 'PERCENTAGE', this is a percentage of the transaction amount (e.g., 1.5 for 1.5%). If `denomination` is 'FIXED', this is a fixed amount in token units (e.g., 0.1 for 0.1 tokens). If `denomination` is 'PERFORMANCE', this is a percentage of realized profit calculated using FIFO cost basis (e.g., 10 for 10% of profit).
	Amount TokenizedAssetsFeeAmount `json:"amount"`
	// The unit type for the fee amount. Use 'PERCENTAGE' for a percentage-based fee (e.g., 1.5 means 1.5% of the trade proceeds), or 'FIXED' for a fixed token amount (e.g., 0.1 means 0.1 tokens).
	Denomination *TokenizedAssetsFeeDenomination `json:"denomination,omitzero"`
}

TokenizedAssetsFee - Fee configuration for tokenized-asset trades.

Same shape as `Fee`, but narrows `denomination` to the values supported by tokenized-asset trades. PERFORMANCE is not supported because realized-profit fees are not computed for spot buy/sell trades.

func (*TokenizedAssetsFee) GetAmount added in v0.1.24

func (*TokenizedAssetsFee) GetDenomination added in v0.1.24

func (t *TokenizedAssetsFee) GetDenomination() *TokenizedAssetsFeeDenomination

func (*TokenizedAssetsFee) GetRecipient added in v0.1.24

func (t *TokenizedAssetsFee) GetRecipient() string

type TokenizedAssetsFeeAmount added in v0.1.24

type TokenizedAssetsFeeAmount struct {
	Number *float64 `queryParam:"inline" union:"member"`
	Str    *string  `queryParam:"inline" union:"member"`

	Type TokenizedAssetsFeeAmountType
}

TokenizedAssetsFeeAmount - The fee amount. If `denomination` is 'PERCENTAGE', this is a percentage of the transaction amount (e.g., 1.5 for 1.5%). If `denomination` is 'FIXED', this is a fixed amount in token units (e.g., 0.1 for 0.1 tokens). If `denomination` is 'PERFORMANCE', this is a percentage of realized profit calculated using FIFO cost basis (e.g., 10 for 10% of profit).

func CreateTokenizedAssetsFeeAmountNumber added in v0.1.24

func CreateTokenizedAssetsFeeAmountNumber(number float64) TokenizedAssetsFeeAmount

func CreateTokenizedAssetsFeeAmountStr added in v0.1.24

func CreateTokenizedAssetsFeeAmountStr(str string) TokenizedAssetsFeeAmount

func (TokenizedAssetsFeeAmount) MarshalJSON added in v0.1.24

func (u TokenizedAssetsFeeAmount) MarshalJSON() ([]byte, error)

func (*TokenizedAssetsFeeAmount) UnmarshalJSON added in v0.1.24

func (u *TokenizedAssetsFeeAmount) UnmarshalJSON(data []byte) (err error)

type TokenizedAssetsFeeAmountType added in v0.1.24

type TokenizedAssetsFeeAmountType string
const (
	TokenizedAssetsFeeAmountTypeNumber TokenizedAssetsFeeAmountType = "number"
	TokenizedAssetsFeeAmountTypeStr    TokenizedAssetsFeeAmountType = "str"
)

type TokenizedAssetsFeeDenomination added in v0.1.24

type TokenizedAssetsFeeDenomination string

TokenizedAssetsFeeDenomination - The unit type for the fee amount. Use 'PERCENTAGE' for a percentage-based fee (e.g., 1.5 means 1.5% of the trade proceeds), or 'FIXED' for a fixed token amount (e.g., 0.1 means 0.1 tokens).

const (
	TokenizedAssetsFeeDenominationPercentage TokenizedAssetsFeeDenomination = "PERCENTAGE"
	TokenizedAssetsFeeDenominationFixed      TokenizedAssetsFeeDenomination = "FIXED"
)

func (TokenizedAssetsFeeDenomination) ToPointer added in v0.1.24

func (*TokenizedAssetsFeeDenomination) UnmarshalJSON added in v0.1.24

func (e *TokenizedAssetsFeeDenomination) UnmarshalJSON(data []byte) error

type TokenizedAssetsMarketsListResponse

type TokenizedAssetsMarketsListResponse struct {
	// Tokenized equity markets surfaced on Ethereum.
	Markets []CompassAPIBackendV2ModelsTokenizedAssetsMarketMarket `json:"markets"`
}

TokenizedAssetsMarketsListResponse - List of tokenized equity markets.

func (*TokenizedAssetsMarketsListResponse) GetMarkets

type TokenizedAssetsOhlcInterval

type TokenizedAssetsOhlcInterval string
const (
	TokenizedAssetsOhlcIntervalOnemin     TokenizedAssetsOhlcInterval = "1min"
	TokenizedAssetsOhlcIntervalFivemin    TokenizedAssetsOhlcInterval = "5min"
	TokenizedAssetsOhlcIntervalFifteenmin TokenizedAssetsOhlcInterval = "15min"
	TokenizedAssetsOhlcIntervalOnehour    TokenizedAssetsOhlcInterval = "1hour"
	TokenizedAssetsOhlcIntervalFourhour   TokenizedAssetsOhlcInterval = "4hour"
	TokenizedAssetsOhlcIntervalTwelvehour TokenizedAssetsOhlcInterval = "12hour"
	TokenizedAssetsOhlcIntervalOneday     TokenizedAssetsOhlcInterval = "1day"
)

func (TokenizedAssetsOhlcInterval) ToPointer

func (*TokenizedAssetsOhlcInterval) UnmarshalJSON

func (e *TokenizedAssetsOhlcInterval) UnmarshalJSON(data []byte) error

type TokenizedAssetsOhlcRange

type TokenizedAssetsOhlcRange string
const (
	TokenizedAssetsOhlcRangeOneday     TokenizedAssetsOhlcRange = "1day"
	TokenizedAssetsOhlcRangeOnemonth   TokenizedAssetsOhlcRange = "1month"
	TokenizedAssetsOhlcRangeThreemonth TokenizedAssetsOhlcRange = "3month"
	TokenizedAssetsOhlcRangeSixmonth   TokenizedAssetsOhlcRange = "6month"
	TokenizedAssetsOhlcRangeOneyear    TokenizedAssetsOhlcRange = "1year"
	TokenizedAssetsOhlcRangeAll        TokenizedAssetsOhlcRange = "all"
)

func (TokenizedAssetsOhlcRange) ToPointer

func (*TokenizedAssetsOhlcRange) UnmarshalJSON

func (e *TokenizedAssetsOhlcRange) UnmarshalJSON(data []byte) error

type TokenizedAssetsPnl added in v0.1.21

type TokenizedAssetsPnl struct {
	// Total USDC paid for this position over all time.
	TotalDeposited string `json:"total_deposited"`
	// Current USD value of the held balance (`balance * current_price_usd`).
	CurrentValue string `json:"current_value"`
	// `current_value` minus the remaining cost basis.
	UnrealizedPnl string `json:"unrealized_pnl"`
	// Realized profit/loss banked from past sales.
	RealizedPnl string `json:"realized_pnl"`
	// `unrealized_pnl + realized_pnl`.
	TotalPnl string `json:"total_pnl"`
	// `(total_pnl / total_deposited) * 100`.
	TotalPnlPercent string `json:"total_pnl_percent"`
}

TokenizedAssetsPnl - Realized + unrealized PnL for a tokenized-asset position.

Mirrors Earn's “pnl“ shape so SDK/widget reuse is trivial. Cost basis is the USDC paid for the position through its product account; “current_value“ marks the held balance to the current price. All amounts are USD decimal strings; “total_pnl_percent“ is a percentage (also a decimal string).

func (*TokenizedAssetsPnl) GetCurrentValue added in v0.1.21

func (t *TokenizedAssetsPnl) GetCurrentValue() string

func (*TokenizedAssetsPnl) GetRealizedPnl added in v0.1.21

func (t *TokenizedAssetsPnl) GetRealizedPnl() string

func (*TokenizedAssetsPnl) GetTotalDeposited added in v0.1.21

func (t *TokenizedAssetsPnl) GetTotalDeposited() string

func (*TokenizedAssetsPnl) GetTotalPnl added in v0.1.21

func (t *TokenizedAssetsPnl) GetTotalPnl() string

func (*TokenizedAssetsPnl) GetTotalPnlPercent added in v0.1.21

func (t *TokenizedAssetsPnl) GetTotalPnlPercent() string

func (*TokenizedAssetsPnl) GetUnrealizedPnl added in v0.1.21

func (t *TokenizedAssetsPnl) GetUnrealizedPnl() string

type TokenizedAssetsPositionsResponse

type TokenizedAssetsPositionsResponse struct {
	// Owner address from the request. Balances are read from the Tokenized Assets Account address derived from this owner.
	Owner string `json:"owner"`
	// Non-zero positions only; tokens with a zero balance are omitted.
	Positions []CompassAPIBackendV2ModelsTokenizedAssetsReadResponsePositionsPosition `json:"positions,omitzero"`
	// Sum of `balance_usd` across positions where the price is known.
	TotalUsd string `json:"total_usd"`
	// Account-level PnL summed across positions that have a known PnL; `null` when no position can be priced.
	Pnl optionalnullable.OptionalNullable[TokenizedAssetsPnl] `json:"pnl,omitzero"`
}

TokenizedAssetsPositionsResponse - On-chain tokenized-equity holdings for an owner's Tokenized Assets Account.

func (*TokenizedAssetsPositionsResponse) GetOwner added in v0.1.8

func (*TokenizedAssetsPositionsResponse) GetPnl added in v0.1.21

func (*TokenizedAssetsPositionsResponse) GetTotalUsd

func (t *TokenizedAssetsPositionsResponse) GetTotalUsd() string

func (TokenizedAssetsPositionsResponse) MarshalJSON

func (t TokenizedAssetsPositionsResponse) MarshalJSON() ([]byte, error)

func (*TokenizedAssetsPositionsResponse) UnmarshalJSON

func (t *TokenizedAssetsPositionsResponse) UnmarshalJSON(data []byte) error

type TokenizedAssetsQuoteRequest

type TokenizedAssetsQuoteRequest struct {
	// Token the sender is paying. Either an on-chain symbol (e.g. `TSLAon`), the literal `USDC`, or a 0x-prefixed token address.
	FromToken string `json:"from_token"`
	// Token the sender is receiving. Same accepted forms as `from_token`.
	ToToken string `json:"to_token"`
	// Human-readable amount of `from_token` to swap (decimal string). Decimals are applied server-side.
	Amount string `json:"amount"`
	// Wallet that owns the Tokenized Assets Account. Used to verify the account is deployed before quoting; the account address is derived deterministically from this owner.
	Owner string `json:"owner"`
}

TokenizedAssetsQuoteRequest - Preview a buy or sell quote for a tokenized equity.

Read-only: this previews a quote without consuming a “quote_id“ or committing an order. Use it to surface expected output, fees, and a thin-liquidity warning before the user confirms; pass the same body (plus “slippage_bps“) to “POST /tokenized_assets/order“ when they do.

func (*TokenizedAssetsQuoteRequest) GetAmount

func (t *TokenizedAssetsQuoteRequest) GetAmount() string

func (*TokenizedAssetsQuoteRequest) GetFromToken

func (t *TokenizedAssetsQuoteRequest) GetFromToken() string

func (*TokenizedAssetsQuoteRequest) GetOwner

func (t *TokenizedAssetsQuoteRequest) GetOwner() string

func (*TokenizedAssetsQuoteRequest) GetToToken

func (t *TokenizedAssetsQuoteRequest) GetToToken() string

type TokenizedAssetsQuoteResponse

type TokenizedAssetsQuoteResponse struct {
	// Quote preview returned alongside an order.
	Quote Quote `json:"quote"`
	// Slippage tolerance in basis points (1 bp = 0.01%) the UI should echo back as `slippage_bps` on `POST /tokenized_assets/order`. Derived from the on-chain auction range (`auctionEndAmount` vs `toTokenAmount`) plus a small buffer; capped at 5000 bps.
	RecommendedSlippageBps int64 `json:"recommended_slippage_bps"`
	// Worst-case basis-points gap between the auction's end amount and the reference quote amount. Surfaces as a thin-liquidity warning before the user signs.
	AuctionRangeBps int64 `json:"auction_range_bps"`
}

TokenizedAssetsQuoteResponse - Preview of input/output amounts plus auction-derived risk hints.

func (*TokenizedAssetsQuoteResponse) GetAuctionRangeBps

func (t *TokenizedAssetsQuoteResponse) GetAuctionRangeBps() int64

func (*TokenizedAssetsQuoteResponse) GetQuote

func (t *TokenizedAssetsQuoteResponse) GetQuote() Quote

func (*TokenizedAssetsQuoteResponse) GetRecommendedSlippageBps

func (t *TokenizedAssetsQuoteResponse) GetRecommendedSlippageBps() int64

type TokenizedAssetsSubmitOrderRequest

type TokenizedAssetsSubmitOrderRequest struct {
	// The order struct returned by `/order` (`order.order_message`). `maker` is the Tokenized Assets Account, not the owner's wallet — pass this dict back to the API verbatim.
	SignedOrder map[string]any `json:"signed_order"`
	// Owner's EIP-712 signature over `order.safe_message_eip712` from the `/order` response. The signature is validated against the Tokenized Equities Account at fill time, so it must be a signature over the typed-data hash, not the raw order hash.
	Signature string `json:"signature"`
	// Opaque hex blob from the `/order` response — pass back unchanged.
	Extension string `json:"extension"`
	// `order.quote_id` from the `/order` response — pass back unchanged.
	QuoteID string `json:"quote_id"`
	// `order.order_hash` from the `/order` response. Optional but recommended: the upstream relayer occasionally returns a 2xx with an empty body, and supplying the hash lets the API still return a usable handle for status and cancel lookups instead of failing.
	OrderHash optionalnullable.OptionalNullable[string] `json:"order_hash,omitzero"`
}

TokenizedAssetsSubmitOrderRequest - Submit an owner-signed order for settlement.

The shape echoes what `POST /order` returned plus the owner's EIP-712 signature. The maker is the Tokenized Assets Account, so the signature is validated against the product account at fill time.

func (*TokenizedAssetsSubmitOrderRequest) GetExtension

func (t *TokenizedAssetsSubmitOrderRequest) GetExtension() string

func (*TokenizedAssetsSubmitOrderRequest) GetOrderHash

func (*TokenizedAssetsSubmitOrderRequest) GetQuoteID

func (t *TokenizedAssetsSubmitOrderRequest) GetQuoteID() string

func (*TokenizedAssetsSubmitOrderRequest) GetSignature

func (t *TokenizedAssetsSubmitOrderRequest) GetSignature() string

func (*TokenizedAssetsSubmitOrderRequest) GetSignedOrder

func (t *TokenizedAssetsSubmitOrderRequest) GetSignedOrder() map[string]any

type TokenizedAssetsSubmitOrderResponse

type TokenizedAssetsSubmitOrderResponse struct {
	// On-chain order hash for status / cancel lookups.
	OrderHash string `json:"order_hash"`
	// Server-side ISO 8601 UTC timestamp at which the order was relayed.
	SubmittedAt string `json:"submitted_at"`
}

TokenizedAssetsSubmitOrderResponse - Returned after the signed order is submitted for settlement.

func (*TokenizedAssetsSubmitOrderResponse) GetOrderHash

func (t *TokenizedAssetsSubmitOrderResponse) GetOrderHash() string

func (*TokenizedAssetsSubmitOrderResponse) GetSubmittedAt

func (t *TokenizedAssetsSubmitOrderResponse) GetSubmittedAt() string

type TokenizedAssetsTradeRequest added in v0.1.17

type TokenizedAssetsTradeRequest struct {
	// Token to spend. For a buy this must be a stablecoin the Midas issuance vault accepts (USDC on every supported network; mBASIS also accepts USDT/DAI on Ethereum). For a sell it is the Midas RWA asset to redeem (e.g. 'mTBILL').
	TokenIn string `json:"token_in"`
	// Token to receive. For a buy this is the Midas RWA asset to mint (e.g. 'mTBILL'); for a sell it is the payout stablecoin (USDC).
	TokenOut string `json:"token_out"`
	// Human-readable amount of `token_in` to trade (token units, not wei).
	AmountIn TokenizedAssetsTradeRequestAmountIn `json:"amount_in"`
	// Maximum slippage tolerance as a percentage (e.g., 0.5 = 0.5%).
	Slippage *TokenizedAssetsTradeRequestSlippage `json:"slippage,omitzero"`
	// The owner's wallet address.
	Owner string `json:"owner"`
	// The chain to use.
	Chain Chain `json:"chain"`
	// When true, returns an EIP-712 payload for gas-sponsored execution instead of an unsigned transaction.
	GasSponsorship *bool `json:"gas_sponsorship,omitzero"`
	// WisdomTree Connect API credentials, required only when trading a WisdomTree money-market fund. Each organization authenticates with its own credentials, which are exchanged for a short-lived token to look up the settlement wallet for this trade. They are never stored and are masked in logs.
	Wisdomtree optionalnullable.OptionalNullable[WisdomTreeCredentials] `json:"wisdomtree,omitzero"`
	// Optional partner fee charged when selling (exiting). It is taken from the payout-token (USDC) proceeds and sent to your fee recipient inside the same execution.
	Fee optionalnullable.OptionalNullable[TokenizedAssetsFee] `json:"fee,omitzero"`
}

TokenizedAssetsTradeRequest - Buy or sell a swap-traded tokenized asset inside the product account.

Applies to RWA yield assets (Midas mTokens). Equities trade via the order endpoints instead.

func (*TokenizedAssetsTradeRequest) GetAmountIn added in v0.1.17

func (*TokenizedAssetsTradeRequest) GetChain added in v0.1.17

func (t *TokenizedAssetsTradeRequest) GetChain() Chain

func (*TokenizedAssetsTradeRequest) GetFee added in v0.1.24

func (*TokenizedAssetsTradeRequest) GetGasSponsorship added in v0.1.17

func (t *TokenizedAssetsTradeRequest) GetGasSponsorship() *bool

func (*TokenizedAssetsTradeRequest) GetOwner added in v0.1.17

func (t *TokenizedAssetsTradeRequest) GetOwner() string

func (*TokenizedAssetsTradeRequest) GetSlippage added in v0.1.17

func (*TokenizedAssetsTradeRequest) GetTokenIn added in v0.1.17

func (t *TokenizedAssetsTradeRequest) GetTokenIn() string

func (*TokenizedAssetsTradeRequest) GetTokenOut added in v0.1.17

func (t *TokenizedAssetsTradeRequest) GetTokenOut() string

func (*TokenizedAssetsTradeRequest) GetWisdomtree added in v0.1.56

func (TokenizedAssetsTradeRequest) MarshalJSON added in v0.1.24

func (t TokenizedAssetsTradeRequest) MarshalJSON() ([]byte, error)

func (*TokenizedAssetsTradeRequest) UnmarshalJSON added in v0.1.24

func (t *TokenizedAssetsTradeRequest) UnmarshalJSON(data []byte) error

type TokenizedAssetsTradeRequestAmountIn added in v0.1.17

type TokenizedAssetsTradeRequestAmountIn struct {
	Number *float64 `queryParam:"inline" union:"member"`
	Str    *string  `queryParam:"inline" union:"member"`

	Type TokenizedAssetsTradeRequestAmountInType
}

TokenizedAssetsTradeRequestAmountIn - Human-readable amount of `token_in` to trade (token units, not wei).

func CreateTokenizedAssetsTradeRequestAmountInNumber added in v0.1.17

func CreateTokenizedAssetsTradeRequestAmountInNumber(number float64) TokenizedAssetsTradeRequestAmountIn

func CreateTokenizedAssetsTradeRequestAmountInStr added in v0.1.17

func CreateTokenizedAssetsTradeRequestAmountInStr(str string) TokenizedAssetsTradeRequestAmountIn

func (TokenizedAssetsTradeRequestAmountIn) MarshalJSON added in v0.1.17

func (u TokenizedAssetsTradeRequestAmountIn) MarshalJSON() ([]byte, error)

func (*TokenizedAssetsTradeRequestAmountIn) UnmarshalJSON added in v0.1.17

func (u *TokenizedAssetsTradeRequestAmountIn) UnmarshalJSON(data []byte) (err error)

type TokenizedAssetsTradeRequestAmountInType added in v0.1.17

type TokenizedAssetsTradeRequestAmountInType string
const (
	TokenizedAssetsTradeRequestAmountInTypeNumber TokenizedAssetsTradeRequestAmountInType = "number"
	TokenizedAssetsTradeRequestAmountInTypeStr    TokenizedAssetsTradeRequestAmountInType = "str"
)

type TokenizedAssetsTradeRequestSlippage added in v0.1.17

type TokenizedAssetsTradeRequestSlippage struct {
	Number *float64 `queryParam:"inline" union:"member"`
	Str    *string  `queryParam:"inline" union:"member"`

	Type TokenizedAssetsTradeRequestSlippageType
}

TokenizedAssetsTradeRequestSlippage - Maximum slippage tolerance as a percentage (e.g., 0.5 = 0.5%).

func CreateTokenizedAssetsTradeRequestSlippageNumber added in v0.1.17

func CreateTokenizedAssetsTradeRequestSlippageNumber(number float64) TokenizedAssetsTradeRequestSlippage

func CreateTokenizedAssetsTradeRequestSlippageStr added in v0.1.17

func CreateTokenizedAssetsTradeRequestSlippageStr(str string) TokenizedAssetsTradeRequestSlippage

func (TokenizedAssetsTradeRequestSlippage) MarshalJSON added in v0.1.17

func (u TokenizedAssetsTradeRequestSlippage) MarshalJSON() ([]byte, error)

func (*TokenizedAssetsTradeRequestSlippage) UnmarshalJSON added in v0.1.17

func (u *TokenizedAssetsTradeRequestSlippage) UnmarshalJSON(data []byte) (err error)

type TokenizedAssetsTradeRequestSlippageType added in v0.1.17

type TokenizedAssetsTradeRequestSlippageType string
const (
	TokenizedAssetsTradeRequestSlippageTypeNumber TokenizedAssetsTradeRequestSlippageType = "number"
	TokenizedAssetsTradeRequestSlippageTypeStr    TokenizedAssetsTradeRequestSlippageType = "str"
)

type TokenizedAssetsTradeResponse added in v0.1.17

type TokenizedAssetsTradeResponse struct {
	// Unsigned transaction executing the trade in the product account.
	Transaction optionalnullable.OptionalNullable[UnsignedTransaction] `json:"transaction,omitzero"`
	// EIP-712 payload for gas-sponsored execution.
	Eip712 optionalnullable.OptionalNullable[BatchedSafeOperationsResponseOutput] `json:"eip_712,omitzero"`
	// Estimated amount of `token_out` received (human-readable units).
	EstimatedAmountOut string `json:"estimated_amount_out"`
	// Fee charged on the sell, in payout-token (USDC) units. Null when no fee was applied.
	FeeAmount optionalnullable.OptionalNullable[string] `json:"fee_amount,omitzero"`
	// How the trade settles. `instant`: the signed transaction completes the trade (Midas/Ondo swaps and IXS deposits). `async`: the transaction only *requests* an IXS redemption, which the vault operator settles off-chain later — poll `poll_endpoint` for status.
	Settlement *Settlement `json:"settlement,omitzero"`
	// For `async` settlements, the endpoint to poll for redemption status (`GET /v2/tokenized_assets/redemptions`). Null for instant trades.
	PollEndpoint optionalnullable.OptionalNullable[string] `json:"poll_endpoint,omitzero"`
}

TokenizedAssetsTradeResponse - Unsigned trade execution for the owner to sign.

Exactly one of `transaction` (gas_sponsorship=false) or `eip_712` (gas_sponsorship=true) is set.

func (*TokenizedAssetsTradeResponse) GetEip712 added in v0.1.17

func (*TokenizedAssetsTradeResponse) GetEstimatedAmountOut added in v0.1.17

func (t *TokenizedAssetsTradeResponse) GetEstimatedAmountOut() string

func (*TokenizedAssetsTradeResponse) GetFeeAmount added in v0.1.24

func (*TokenizedAssetsTradeResponse) GetPollEndpoint added in v0.1.33

func (*TokenizedAssetsTradeResponse) GetSettlement added in v0.1.33

func (t *TokenizedAssetsTradeResponse) GetSettlement() *Settlement

func (*TokenizedAssetsTradeResponse) GetTransaction added in v0.1.17

func (TokenizedAssetsTradeResponse) MarshalJSON added in v0.1.17

func (t TokenizedAssetsTradeResponse) MarshalJSON() ([]byte, error)

func (*TokenizedAssetsTradeResponse) UnmarshalJSON added in v0.1.17

func (t *TokenizedAssetsTradeResponse) UnmarshalJSON(data []byte) error

type TokenizedAssetsTransferRequest added in v0.1.18

type TokenizedAssetsTransferRequest struct {
	// The owner's wallet address (EOA).
	Owner string `json:"owner"`
	// The chain to use.
	Chain *Chain `json:"chain,omitzero"`
	// The token to transfer. Tokenized-asset orders settle in USDC.
	Token string `json:"token"`
	// The amount of tokens to transfer (in token units, not wei).
	Amount TokenizedAssetsTransferRequestAmount `json:"amount"`
	// Whether you are depositing to or withdrawing from your Tokenized Assets Account.
	Action TokenizedAssetsTransferRequestAction `json:"action"`
	// Optionally request gas sponsorship. If set to `true`, EIP-712 signature data will be returned that must be signed by the `owner` and submitted to the `/gas_sponsorship/prepare` endpoint.
	GasSponsorship *bool `json:"gas_sponsorship,omitzero"`
	// The address that will call Permit2's permitTransferFrom to execute the transfer. When `action` is 'DEPOSIT' and `gas_sponsorship` is `true`: - If provided, the signature will authorize this address (typically a gas sponsor) to pull tokens. - If not provided, defaults to the Tokenized Assets Account (Safe) address, allowing the transfer to be included in a bundle transaction where the Safe pulls the tokens itself.
	Spender optionalnullable.OptionalNullable[string] `json:"spender,omitzero"`
}

func (*TokenizedAssetsTransferRequest) GetAction added in v0.1.18

func (*TokenizedAssetsTransferRequest) GetAmount added in v0.1.18

func (*TokenizedAssetsTransferRequest) GetChain added in v0.1.18

func (t *TokenizedAssetsTransferRequest) GetChain() *Chain

func (*TokenizedAssetsTransferRequest) GetGasSponsorship added in v0.1.18

func (t *TokenizedAssetsTransferRequest) GetGasSponsorship() *bool

func (*TokenizedAssetsTransferRequest) GetOwner added in v0.1.18

func (t *TokenizedAssetsTransferRequest) GetOwner() string

func (*TokenizedAssetsTransferRequest) GetSpender added in v0.1.18

func (*TokenizedAssetsTransferRequest) GetToken added in v0.1.18

func (t *TokenizedAssetsTransferRequest) GetToken() string

type TokenizedAssetsTransferRequestAction added in v0.1.18

type TokenizedAssetsTransferRequestAction string

TokenizedAssetsTransferRequestAction - Whether you are depositing to or withdrawing from your Tokenized Assets Account.

const (
	TokenizedAssetsTransferRequestActionDeposit  TokenizedAssetsTransferRequestAction = "DEPOSIT"
	TokenizedAssetsTransferRequestActionWithdraw TokenizedAssetsTransferRequestAction = "WITHDRAW"
)

func (TokenizedAssetsTransferRequestAction) ToPointer added in v0.1.18

func (*TokenizedAssetsTransferRequestAction) UnmarshalJSON added in v0.1.18

func (e *TokenizedAssetsTransferRequestAction) UnmarshalJSON(data []byte) error

type TokenizedAssetsTransferRequestAmount added in v0.1.18

type TokenizedAssetsTransferRequestAmount struct {
	Number *float64 `queryParam:"inline" union:"member"`
	Str    *string  `queryParam:"inline" union:"member"`

	Type TokenizedAssetsTransferRequestAmountType
}

TokenizedAssetsTransferRequestAmount - The amount of tokens to transfer (in token units, not wei).

func CreateTokenizedAssetsTransferRequestAmountNumber added in v0.1.18

func CreateTokenizedAssetsTransferRequestAmountNumber(number float64) TokenizedAssetsTransferRequestAmount

func CreateTokenizedAssetsTransferRequestAmountStr added in v0.1.18

func CreateTokenizedAssetsTransferRequestAmountStr(str string) TokenizedAssetsTransferRequestAmount

func (TokenizedAssetsTransferRequestAmount) MarshalJSON added in v0.1.18

func (u TokenizedAssetsTransferRequestAmount) MarshalJSON() ([]byte, error)

func (*TokenizedAssetsTransferRequestAmount) UnmarshalJSON added in v0.1.18

func (u *TokenizedAssetsTransferRequestAmount) UnmarshalJSON(data []byte) (err error)

type TokenizedAssetsTransferRequestAmountType added in v0.1.18

type TokenizedAssetsTransferRequestAmountType string
const (
	TokenizedAssetsTransferRequestAmountTypeNumber TokenizedAssetsTransferRequestAmountType = "number"
	TokenizedAssetsTransferRequestAmountTypeStr    TokenizedAssetsTransferRequestAmountType = "str"
)

type TokenizedAssetsTransferResponse added in v0.1.18

type TokenizedAssetsTransferResponse struct {
	// Unsigned transaction for direct execution. Present when `gas_sponsorship=false`.
	Transaction optionalnullable.OptionalNullable[UnsignedTransaction] `json:"transaction,omitzero"`
	// EIP-712 typed data for gas-sponsored execution. Present when `gas_sponsorship=true`. A Permit2 `PermitTransferFrom` for DEPOSIT, or a Safe transaction for WITHDRAW. The owner signs it and submits to `/v2/gas_sponsorship/prepare`.
	Eip712 optionalnullable.OptionalNullable[TokenizedAssetsTransferResponseEip712] `json:"eip_712,omitzero"`
}

func (*TokenizedAssetsTransferResponse) GetEip712 added in v0.1.18

func (*TokenizedAssetsTransferResponse) GetTransaction added in v0.1.18

func (TokenizedAssetsTransferResponse) MarshalJSON added in v0.1.18

func (t TokenizedAssetsTransferResponse) MarshalJSON() ([]byte, error)

func (*TokenizedAssetsTransferResponse) UnmarshalJSON added in v0.1.18

func (t *TokenizedAssetsTransferResponse) UnmarshalJSON(data []byte) error

type TokenizedAssetsTransferResponseEip712 added in v0.1.18

type TokenizedAssetsTransferResponseEip712 struct {
	BatchedSafeOperationsResponseOutput *BatchedSafeOperationsResponseOutput `queryParam:"inline" union:"member"`
	Permit2TypedDataOutput              *Permit2TypedDataOutput              `queryParam:"inline" union:"member"`
	UnknownRaw                          json.RawMessage                      `json:"-" union:"unknown"`

	Type TokenizedAssetsTransferResponseEip712Type
}

TokenizedAssetsTransferResponseEip712 - EIP-712 typed data for gas-sponsored execution. Present when `gas_sponsorship=true`. A Permit2 `PermitTransferFrom` for DEPOSIT, or a Safe transaction for WITHDRAW. The owner signs it and submits to `/v2/gas_sponsorship/prepare`.

func CreateTokenizedAssetsTransferResponseEip712BatchedSafeOperationsResponseOutput added in v0.1.18

func CreateTokenizedAssetsTransferResponseEip712BatchedSafeOperationsResponseOutput(batchedSafeOperationsResponseOutput BatchedSafeOperationsResponseOutput) TokenizedAssetsTransferResponseEip712

func CreateTokenizedAssetsTransferResponseEip712Permit2TypedDataOutput added in v0.1.18

func CreateTokenizedAssetsTransferResponseEip712Permit2TypedDataOutput(permit2TypedDataOutput Permit2TypedDataOutput) TokenizedAssetsTransferResponseEip712

func CreateTokenizedAssetsTransferResponseEip712Unknown added in v0.1.18

func CreateTokenizedAssetsTransferResponseEip712Unknown(raw json.RawMessage) TokenizedAssetsTransferResponseEip712

func (TokenizedAssetsTransferResponseEip712) GetUnknownRaw added in v0.1.18

func (TokenizedAssetsTransferResponseEip712) IsUnknown added in v0.1.18

func (TokenizedAssetsTransferResponseEip712) MarshalJSON added in v0.1.18

func (u TokenizedAssetsTransferResponseEip712) MarshalJSON() ([]byte, error)

func (*TokenizedAssetsTransferResponseEip712) UnmarshalJSON added in v0.1.18

func (u *TokenizedAssetsTransferResponseEip712) UnmarshalJSON(data []byte) error

type TokenizedAssetsTransferResponseEip712Type added in v0.1.18

type TokenizedAssetsTransferResponseEip712Type string
const (
	TokenizedAssetsTransferResponseEip712TypeBatchedSafeOperationsResponseOutput TokenizedAssetsTransferResponseEip712Type = "BatchedSafeOperationsResponse-Output"
	TokenizedAssetsTransferResponseEip712TypePermit2TypedDataOutput              TokenizedAssetsTransferResponseEip712Type = "Permit2TypedData-Output"
	TokenizedAssetsTransferResponseEip712TypeUnknown                             TokenizedAssetsTransferResponseEip712Type = "Unknown"
)

type TradingState added in v0.1.36

type TradingState string

TradingState - Coarse tradability state for a tokenized market.

const (
	TradingStateOpen    TradingState = "OPEN"
	TradingStateClosed  TradingState = "CLOSED"
	TradingStatePaused  TradingState = "PAUSED"
	TradingStateLimited TradingState = "LIMITED"
)

func (*TradingState) IsExact added in v0.1.36

func (e *TradingState) IsExact() bool

IsExact returns true if the value matches a known enum value, false otherwise.

func (TradingState) ToPointer added in v0.1.36

func (e TradingState) ToPointer() *TradingState

type TradingStatus added in v0.1.36

type TradingStatus struct {
	// True if the market can be traded right now.
	IsOpen bool `json:"is_open"`
	// Coarse tradability state for a tokenized market.
	State TradingState `json:"state"`
	// Why the market is not fully open (e.g. 'Weekend or Holiday', 'cash_dividend'). Null when open.
	Reason optionalnullable.OptionalNullable[string] `json:"reason,omitzero"`
	// Active trading session for equities when open ('regular', 'premarket', 'postmarket', 'overnight', 'offhours'). Null for RWA/vault assets or when closed.
	Session optionalnullable.OptionalNullable[string] `json:"session,omitzero"`
	// ISO 8601 UTC time the market next opens. Null when open now or unknown.
	NextOpen optionalnullable.OptionalNullable[string] `json:"next_open,omitzero"`
	// ISO 8601 UTC time the market next closes. Null when closed now or unknown.
	NextClose optionalnullable.OptionalNullable[string] `json:"next_close,omitzero"`
}

TradingStatus - Whether a tokenized market can be traded right now, and if not, why.

func (*TradingStatus) GetIsOpen added in v0.1.36

func (t *TradingStatus) GetIsOpen() bool

func (*TradingStatus) GetNextClose added in v0.1.36

func (*TradingStatus) GetNextOpen added in v0.1.36

func (*TradingStatus) GetReason added in v0.1.36

func (*TradingStatus) GetSession added in v0.1.36

func (*TradingStatus) GetState added in v0.1.36

func (t *TradingStatus) GetState() TradingState

type UnloopLegPreview added in v0.1.35

type UnloopLegPreview struct {
	// Collateral withdrawn this iteration (token units).
	WithdrawAmount *string `json:"withdraw_amount"`
	// Guaranteed swap output (borrow-token units) — enforced on-chain by the swap's minimum-return. Null on the final collateral sweep leg, which does not swap.
	MinSwapOut optionalnullable.OptionalNullable[string] `json:"min_swap_out,omitzero"`
	// Debt repaid this iteration (borrow-token units); null on the final collateral sweep leg.
	RepayAmount optionalnullable.OptionalNullable[string] `json:"repay_amount,omitzero"`
	// True on the closing leg that clears the remaining debt exactly (Aave clamps to live debt; Morpho repays the remaining shares).
	FullRepay *bool `json:"full_repay,omitzero"`
}

UnloopLegPreview - One planned unwind iteration: withdraw [+ swap + repay].

func (*UnloopLegPreview) GetFullRepay added in v0.1.35

func (u *UnloopLegPreview) GetFullRepay() *bool

func (*UnloopLegPreview) GetMinSwapOut added in v0.1.35

func (*UnloopLegPreview) GetRepayAmount added in v0.1.35

func (*UnloopLegPreview) GetWithdrawAmount added in v0.1.35

func (u *UnloopLegPreview) GetWithdrawAmount() *string

type UnsignedTransaction

type UnsignedTransaction struct {
	// The chain id of the transaction
	ChainID string `json:"chainId"`
	// The data of the transaction
	Data string `json:"data"`
	// The sender of the transaction
	From string `json:"from"`
	// The gas of the transaction
	Gas *string `json:"gas"`
	// The recipient of the transaction
	To string `json:"to"`
	// The value of the transaction
	Value string `json:"value"`
	// The nonce of the address
	Nonce string `json:"nonce"`
	// The max fee per gas of the transaction
	MaxFeePerGas string `json:"maxFeePerGas"`
	// The max priority fee per gas of the transaction
	MaxPriorityFeePerGas string `json:"maxPriorityFeePerGas"`
}

func (*UnsignedTransaction) GetChainID

func (u *UnsignedTransaction) GetChainID() string

func (*UnsignedTransaction) GetData

func (u *UnsignedTransaction) GetData() string

func (*UnsignedTransaction) GetFrom

func (u *UnsignedTransaction) GetFrom() string

func (*UnsignedTransaction) GetGas

func (u *UnsignedTransaction) GetGas() *string

func (*UnsignedTransaction) GetMaxFeePerGas

func (u *UnsignedTransaction) GetMaxFeePerGas() string

func (*UnsignedTransaction) GetMaxPriorityFeePerGas

func (u *UnsignedTransaction) GetMaxPriorityFeePerGas() string

func (*UnsignedTransaction) GetNonce

func (u *UnsignedTransaction) GetNonce() string

func (*UnsignedTransaction) GetTo

func (u *UnsignedTransaction) GetTo() string

func (*UnsignedTransaction) GetValue

func (u *UnsignedTransaction) GetValue() string

type V2BundleRequest

type V2BundleRequest struct {
	// The owner's wallet address that controls the Earn Account.
	Owner string `json:"owner"`
	// Target blockchain network where the bundled actions will execute.
	Chain V2BundleRequestChain `json:"chain"`
	// List of actions to bundle. Actions are executed in order.
	Actions []V2UserOperation `json:"actions"`
	// If true, returns EIP-712 typed data for gas sponsorship. The owner must sign this data and submit to /gas_sponsorship/prepare.
	GasSponsorship *bool `json:"gas_sponsorship,omitzero"`
}

V2BundleRequest - Request to execute multiple earn actions in a single atomic transaction.

## Supported Action Types

  • **V2_TRANSFER_FROM_EOA**: Transfer tokens from the owner's EOA to the product account using Permit2. Requires a signed Permit2 message.
  • **V2_TRANSFER_TO_EOA**: Transfer tokens from the product account back to the owner's EOA. No signature required (product account owns the tokens).
  • **V2_TRANSFER_TO_ADDRESS**: Transfer ERC20 tokens from the product account to any specified recipient address. No signature required (product account owns the tokens).
  • **V2_SWAP**: Swap tokens within the product account using 1inch aggregator.
  • **V2_MANAGE**: Deposit or withdraw from DeFi venues (Aave, Morpho, Vaults, etc.)

## Using V2_TRANSFER_FROM_EOA (Deposit to Product Account)

To include a transfer from EOA in your bundle, follow these steps:

  1. **One-time setup**: Approve Permit2 to spend the token by calling `POST /v2/gas_sponsorship/approve_transfer` and executing the returned transaction.

2. **Get Permit2 signature**: Call `POST /v2/earn/transfer` with:

  • `action`: "DEPOSIT"

  • `gas_sponsorship`: true

  • `spender`: omit this field (defaults to product account address for bundle use)

    This returns EIP-712 typed data. Sign it with the owner's wallet.

    3. **Include in bundle**: Add a V2_TRANSFER_FROM_EOA action with the signature and nonce/deadline from the typed data.

The bundle will atomically: pull tokens from EOA → execute subsequent actions.

## Using V2_TRANSFER_TO_EOA (Withdraw to EOA)

To transfer tokens from the product account back to the owner's EOA, simply add a V2_TRANSFER_TO_EOA action to your bundle. No signature is required since the product account already owns the tokens.

Specify the exact token amount to transfer.

func (*V2BundleRequest) GetActions

func (v *V2BundleRequest) GetActions() []V2UserOperation

func (*V2BundleRequest) GetChain

func (v *V2BundleRequest) GetChain() V2BundleRequestChain

func (*V2BundleRequest) GetGasSponsorship

func (v *V2BundleRequest) GetGasSponsorship() *bool

func (*V2BundleRequest) GetOwner

func (v *V2BundleRequest) GetOwner() string

type V2BundleRequestChain added in v0.1.72

type V2BundleRequestChain string

V2BundleRequestChain - Target blockchain network where the bundled actions will execute.

const (
	V2BundleRequestChainArbitrum V2BundleRequestChain = "arbitrum"
	V2BundleRequestChainBase     V2BundleRequestChain = "base"
	V2BundleRequestChainBsc      V2BundleRequestChain = "bsc"
	V2BundleRequestChainEthereum V2BundleRequestChain = "ethereum"
	V2BundleRequestChainHyperevm V2BundleRequestChain = "hyperevm"
	V2BundleRequestChainTempo    V2BundleRequestChain = "tempo"
)

func (V2BundleRequestChain) ToPointer added in v0.1.72

func (*V2BundleRequestChain) UnmarshalJSON added in v0.1.72

func (e *V2BundleRequestChain) UnmarshalJSON(data []byte) error

type V2BundleResponse

type V2BundleResponse struct {
	// Unsigned transaction for direct execution by the owner. Present when gas_sponsorship=false.
	Transaction optionalnullable.OptionalNullable[UnsignedTransaction] `json:"transaction,omitzero"`
	// EIP-712 typed data for gas-sponsored execution. Present when gas_sponsorship=true. Owner must sign and submit to /gas_sponsorship/prepare.
	Eip712 optionalnullable.OptionalNullable[BatchedSafeOperationsResponseOutput] `json:"eip_712,omitzero"`
	// Number of individual transactions bundled in this execution.
	ActionsCount int64 `json:"actions_count"`
}

func (*V2BundleResponse) GetActionsCount

func (v *V2BundleResponse) GetActionsCount() int64

func (*V2BundleResponse) GetTransaction

func (V2BundleResponse) MarshalJSON

func (v V2BundleResponse) MarshalJSON() ([]byte, error)

func (*V2BundleResponse) UnmarshalJSON

func (v *V2BundleResponse) UnmarshalJSON(data []byte) error

type V2UserOperation

type V2UserOperation struct {
	Body V2UserOperationBody `json:"body"`
}

V2UserOperation - A single operation in a V2 bundle.

func (*V2UserOperation) GetBody

func (v *V2UserOperation) GetBody() V2UserOperationBody

func (*V2UserOperation) GetBodyV2Manage

func (v *V2UserOperation) GetBodyV2Manage() *EarnManageParams

func (*V2UserOperation) GetBodyV2Swap

func (v *V2UserOperation) GetBodyV2Swap() *EarnSwapParams

func (*V2UserOperation) GetBodyV2TransferFromEoa

func (v *V2UserOperation) GetBodyV2TransferFromEoa() *EarnTransferFromEOAParams

func (*V2UserOperation) GetBodyV2TransferToAddress

func (v *V2UserOperation) GetBodyV2TransferToAddress() *EarnTransferToAddressParams

func (*V2UserOperation) GetBodyV2TransferToEoa

func (v *V2UserOperation) GetBodyV2TransferToEoa() *EarnTransferToEOAParams

type V2UserOperationBody

type V2UserOperationBody struct {
	EarnSwapParams              *EarnSwapParams              `queryParam:"inline" union:"member"`
	EarnManageParams            *EarnManageParams            `queryParam:"inline" union:"member"`
	EarnTransferFromEOAParams   *EarnTransferFromEOAParams   `queryParam:"inline" union:"member"`
	EarnTransferToEOAParams     *EarnTransferToEOAParams     `queryParam:"inline" union:"member"`
	EarnTransferToAddressParams *EarnTransferToAddressParams `queryParam:"inline" union:"member"`

	Type V2UserOperationBodyType
}

func CreateV2UserOperationBodyV2Manage

func CreateV2UserOperationBodyV2Manage(v2Manage EarnManageParams) V2UserOperationBody

func CreateV2UserOperationBodyV2Swap

func CreateV2UserOperationBodyV2Swap(v2Swap EarnSwapParams) V2UserOperationBody

func CreateV2UserOperationBodyV2TransferFromEoa

func CreateV2UserOperationBodyV2TransferFromEoa(v2TransferFromEoa EarnTransferFromEOAParams) V2UserOperationBody

func CreateV2UserOperationBodyV2TransferToAddress

func CreateV2UserOperationBodyV2TransferToAddress(v2TransferToAddress EarnTransferToAddressParams) V2UserOperationBody

func CreateV2UserOperationBodyV2TransferToEoa

func CreateV2UserOperationBodyV2TransferToEoa(v2TransferToEoa EarnTransferToEOAParams) V2UserOperationBody

func (V2UserOperationBody) MarshalJSON

func (u V2UserOperationBody) MarshalJSON() ([]byte, error)

func (*V2UserOperationBody) UnmarshalJSON

func (u *V2UserOperationBody) UnmarshalJSON(data []byte) (err error)

type V2UserOperationBodyType

type V2UserOperationBodyType string
const (
	V2UserOperationBodyTypeV2Manage            V2UserOperationBodyType = "V2_MANAGE"
	V2UserOperationBodyTypeV2Swap              V2UserOperationBodyType = "V2_SWAP"
	V2UserOperationBodyTypeV2TransferFromEoa   V2UserOperationBodyType = "V2_TRANSFER_FROM_EOA"
	V2UserOperationBodyTypeV2TransferToAddress V2UserOperationBodyType = "V2_TRANSFER_TO_ADDRESS"
	V2UserOperationBodyTypeV2TransferToEoa     V2UserOperationBodyType = "V2_TRANSFER_TO_EOA"
)

type ValidationError

type ValidationError struct {
	Loc  []Loc  `json:"loc"`
	Msg  string `json:"msg"`
	Type string `json:"type"`
}

func (*ValidationError) GetLoc

func (v *ValidationError) GetLoc() []Loc

func (*ValidationError) GetMsg

func (v *ValidationError) GetMsg() string

func (*ValidationError) GetType

func (v *ValidationError) GetType() string

type VaultInfo

type VaultInfo struct {
	// The vault contract address.
	VaultAddress string `json:"vault_address"`
	// Blockchain name (e.g., 'ethereum', 'base').
	Chain string `json:"chain"`
	// Lending protocol backing this vault. 'MORPHO' for Morpho vaults, 'EULER' for Euler V2 (EVK) vaults. Both are ERC-4626 and are deposited into / withdrawn from the same way (by `vault_address`, via the Earn `VAULT` venue).
	Protocol *Protocol `json:"protocol,omitzero"`
	// The name of the vault.
	Name optionalnullable.OptionalNullable[string] `json:"name,omitzero"`
	// The vault share token symbol.
	Symbol optionalnullable.OptionalNullable[string] `json:"symbol,omitzero"`
	// The vault owner address. For Morpho vaults this is the vault curator/owner. Euler V2 (EVK) vaults have no Morpho-style owner, so this is the zero-address sentinel (0x0 + 40 zeros). Always a string, never null, for backward compatibility.
	Owner string `json:"owner"`
	// The underlying asset contract address.
	Asset string `json:"asset"`
	// The name of the underlying asset.
	AssetName optionalnullable.OptionalNullable[string] `json:"asset_name,omitzero"`
	// The symbol of the underlying asset (e.g., 'USDC').
	AssetSymbol optionalnullable.OptionalNullable[string] `json:"asset_symbol,omitzero"`
	// Morpho factory version this vault was created from. 'v1.0' / 'v1.1' = MetaMorpho v1 (single-asset, Morpho Blue markets only). 'v2' = Morpho Vaults v2 (adapter framework, can route to non-Morpho-Blue venues). Null only on legacy rows that pre-date factory tracking.
	FactoryVersion optionalnullable.OptionalNullable[string] `json:"factory_version,omitzero"`
	// Total Value Locked in USD. Represents the total assets deposited in the vault.
	TvlUsd optionalnullable.OptionalNullable[string] `json:"tvl_usd,omitzero"`
	// Available liquidity in USD. The amount that can be withdrawn right now, accounting for idle funds and borrowable supply across the vault's markets. Always <= tvl_usd.
	LiquidityUsd optionalnullable.OptionalNullable[string] `json:"liquidity_usd,omitzero"`
	// Maximum additional amount that can be deposited into the vault, in human-readable token units (e.g., 1000.5 USDC). Derived from the ERC4626 maxDeposit function. A value of 0 means the vault is paused or full.
	DepositCap optionalnullable.OptionalNullable[string] `json:"deposit_cap,omitzero"`
	// Maximum additional depositable amount converted to USD.
	DepositCapUsd optionalnullable.OptionalNullable[string] `json:"deposit_cap_usd,omitzero"`
	// 7-day APY as a percentage (e.g., 5.25 = 5.25%).
	Apy7d optionalnullable.OptionalNullable[string] `json:"apy_7d,omitzero"`
	// 30-day APY as a percentage.
	Apy30d optionalnullable.OptionalNullable[string] `json:"apy_30d,omitzero"`
	// 90-day APY as a percentage.
	Apy90d optionalnullable.OptionalNullable[string] `json:"apy_90d,omitzero"`
	// Morpho Blue markets in this vault's supply queue, ordered by queue index. Shows how the vault's capital is split across lending markets with different collateral types and risk parameters.
	Markets []MarketAllocation `json:"markets,omitzero"`
}

VaultInfo - Information about a single ERC-4626 vault from the database.

func (*VaultInfo) GetApy7d

func (*VaultInfo) GetApy30d

func (*VaultInfo) GetApy90d

func (*VaultInfo) GetAsset

func (v *VaultInfo) GetAsset() string

func (*VaultInfo) GetAssetName

func (*VaultInfo) GetAssetSymbol

func (v *VaultInfo) GetAssetSymbol() optionalnullable.OptionalNullable[string]

func (*VaultInfo) GetChain

func (v *VaultInfo) GetChain() string

func (*VaultInfo) GetDepositCap

func (v *VaultInfo) GetDepositCap() optionalnullable.OptionalNullable[string]

func (*VaultInfo) GetDepositCapUsd

func (v *VaultInfo) GetDepositCapUsd() optionalnullable.OptionalNullable[string]

func (*VaultInfo) GetFactoryVersion

func (v *VaultInfo) GetFactoryVersion() optionalnullable.OptionalNullable[string]

func (*VaultInfo) GetLiquidityUsd

func (v *VaultInfo) GetLiquidityUsd() optionalnullable.OptionalNullable[string]

func (*VaultInfo) GetMarkets

func (v *VaultInfo) GetMarkets() []MarketAllocation

func (*VaultInfo) GetName

func (*VaultInfo) GetOwner

func (v *VaultInfo) GetOwner() string

func (*VaultInfo) GetProtocol added in v0.1.31

func (v *VaultInfo) GetProtocol() *Protocol

func (*VaultInfo) GetSymbol

func (*VaultInfo) GetTvlUsd

func (*VaultInfo) GetVaultAddress

func (v *VaultInfo) GetVaultAddress() string

func (VaultInfo) MarshalJSON

func (v VaultInfo) MarshalJSON() ([]byte, error)

func (*VaultInfo) UnmarshalJSON

func (v *VaultInfo) UnmarshalJSON(data []byte) error

type VaultVenue

type VaultVenue struct {

	// The vault address you are interacting with for this action.
	VaultAddress string `json:"vault_address"`
	// contains filtered or unexported fields
}

func (*VaultVenue) GetType

func (v *VaultVenue) GetType() string

func (*VaultVenue) GetVaultAddress

func (v *VaultVenue) GetVaultAddress() string

func (VaultVenue) MarshalJSON

func (v VaultVenue) MarshalJSON() ([]byte, error)

func (*VaultVenue) UnmarshalJSON

func (v *VaultVenue) UnmarshalJSON(data []byte) error

type VaultsResponse

type VaultsResponse struct {
	Total  int64 `json:"total"`
	Offset int64 `json:"offset"`
	Limit  int64 `json:"limit"`
	// A list of vault information objects.
	Vaults []VaultInfo `json:"vaults"`
}

VaultsResponse - Response model for a paginated list of ERC-4626 vaults.

func (*VaultsResponse) GetLimit

func (v *VaultsResponse) GetLimit() int64

func (*VaultsResponse) GetOffset

func (v *VaultsResponse) GetOffset() int64

func (*VaultsResponse) GetTotal

func (v *VaultsResponse) GetTotal() int64

func (*VaultsResponse) GetVaults

func (v *VaultsResponse) GetVaults() []VaultInfo

type WisdomTreeCredentials added in v0.1.56

type WisdomTreeCredentials struct {
	// WisdomTree Connect client id for your organization.
	ClientID string `json:"client_id"`
	// WisdomTree Connect client secret for your organization.
	ClientSecret string `json:"client_secret"`
	// WisdomTree Connect username for your organization's account.
	Username string `json:"username"`
	// WisdomTree Connect password for your organization's account.
	Password string `json:"password"`
}

WisdomTreeCredentials - Per-organization WisdomTree Connect API credentials.

Supplied per request rather than configured on the service: each organization has its own WisdomTree account, whitelisted wallets and KYC, so there is no single service-level credential that could serve every caller. The secret is a “SecretStr“ so it cannot be printed by accident, and the error logger masks it in request bodies.

func (*WisdomTreeCredentials) GetClientID added in v0.1.56

func (w *WisdomTreeCredentials) GetClientID() string

func (*WisdomTreeCredentials) GetClientSecret added in v0.1.56

func (w *WisdomTreeCredentials) GetClientSecret() string

func (*WisdomTreeCredentials) GetPassword added in v0.1.56

func (w *WisdomTreeCredentials) GetPassword() string

func (*WisdomTreeCredentials) GetUsername added in v0.1.56

func (w *WisdomTreeCredentials) GetUsername() string

type WithdrawAmount

type WithdrawAmount struct {
	Number *float64 `queryParam:"inline" union:"member"`
	Str    *string  `queryParam:"inline" union:"member"`

	Type WithdrawAmountType
}

WithdrawAmount - Amount of collateral to withdraw (in token units, not wei). Omit together with withdraw_token for repay-only mode.

func CreateWithdrawAmountNumber

func CreateWithdrawAmountNumber(number float64) WithdrawAmount

func CreateWithdrawAmountStr

func CreateWithdrawAmountStr(str string) WithdrawAmount

func (WithdrawAmount) MarshalJSON

func (u WithdrawAmount) MarshalJSON() ([]byte, error)

func (*WithdrawAmount) UnmarshalJSON

func (u *WithdrawAmount) UnmarshalJSON(data []byte) (err error)

type WithdrawAmountType

type WithdrawAmountType string
const (
	WithdrawAmountTypeNumber WithdrawAmountType = "number"
	WithdrawAmountTypeStr    WithdrawAmountType = "str"
)

type WithdrawalEvent

type WithdrawalEvent struct {
	// Block number when withdrawal occurred
	BlockNumber int64 `json:"block_number"`
	// Timestamp when withdrawal occurred
	BlockTimestamp time.Time `json:"block_timestamp"`
	// Transaction hash of the withdrawal
	TransactionHash string `json:"transaction_hash"`
	// Units withdrawn (shares, aTokens, PT)
	InputAmount string `json:"input_amount"`
	// Symbol of units withdrawn
	InputSymbol string `json:"input_symbol"`
	// Amount received (underlying or token)
	OutputAmount string `json:"output_amount"`
	// Symbol of token received
	OutputSymbol string `json:"output_symbol"`
	// Profit/loss: output value - cost basis consumed
	RealizedPnl string `json:"realized_pnl"`
}

WithdrawalEvent - Historical withdrawal event with realized PnL.

Uses generic input/output format: - Vault: input=shares, output=underlying - Aave: input=aTokens, output=underlying - Pendle: input=PT, output=token (varies)

func (*WithdrawalEvent) GetBlockNumber

func (w *WithdrawalEvent) GetBlockNumber() int64

func (*WithdrawalEvent) GetBlockTimestamp

func (w *WithdrawalEvent) GetBlockTimestamp() time.Time

func (*WithdrawalEvent) GetInputAmount

func (w *WithdrawalEvent) GetInputAmount() string

func (*WithdrawalEvent) GetInputSymbol

func (w *WithdrawalEvent) GetInputSymbol() string

func (*WithdrawalEvent) GetOutputAmount

func (w *WithdrawalEvent) GetOutputAmount() string

func (*WithdrawalEvent) GetOutputSymbol

func (w *WithdrawalEvent) GetOutputSymbol() string

func (*WithdrawalEvent) GetRealizedPnl

func (w *WithdrawalEvent) GetRealizedPnl() string

func (*WithdrawalEvent) GetTransactionHash

func (w *WithdrawalEvent) GetTransactionHash() string

func (WithdrawalEvent) MarshalJSON

func (w WithdrawalEvent) MarshalJSON() ([]byte, error)

func (*WithdrawalEvent) UnmarshalJSON

func (w *WithdrawalEvent) UnmarshalJSON(data []byte) error

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL