Skip to main content

Types

A glossary of public types in the Owney SDK.

General​

AgentId​

type AgentId = "zyfai";

Asset​

type Asset = string;

DailyApyDays​

type DailyApyDays = "7D" | "14D" | "30D";

OwneySupportedChainId​

type OwneySupportedChainId = 8453 | 42161 | 1;

OwneySupportedChains​

type OwneySupportedChains = "BASE" | "ARBITRUM" | "ETHEREUM";

OwneySupportedTokens​

type OwneySupportedTokens = "USDC" | "WETH";

AgentSupportedAsset​

type AgentSupportedAsset = {
readonly symbol: string;
readonly minDepositAmount: string;
};

AgentSupportedAssets​

type AgentSupportedAssets = {
readonly chainId: number;
readonly chain?: string;
readonly assets: readonly AgentSupportedAsset[];
};

ConnectionState​

interface ConnectionState {
provider: any;
walletAddress: `0x${string}`;
chainId: number | null;
}

OwneySDKConfig​

interface OwneySDKConfig {
apiKey: string;
}

Input Options​

DepositOptions​

type DepositOptions = {
amount: string;
asset: Asset;
depositCallback?: DepositCallback;
agentId?: AgentId;
};

WithdrawOptions​

type WithdrawOptions = {
asset: Asset;
amount?: string;
agentId?: AgentId;
};

AccountApyOptions​

type AccountApyOptions = {
agentId?: AgentId;
days: DailyApyDays;
/** Scope the APY to a single asset on the active chain, e.g. "USDC" or "WETH". */
tokenSymbol?: string;
};

AllocationApyOptions​

type AllocationApyOptions = {
agentId?: AgentId;
};

AgentsApyOptions​

type AgentsApyOptions = {
agentId?: AgentId;
days: DailyApyDays;
tokenSymbol?: string;
chainId?: number;
};

HistoryFilters​

type HistoryFilters = {
fromDate?: string;
toDate?: string;
/** Max entries returned per call. Defaults to 10. */
limit?: number;
/** Opaque cursor returned by a previous getHistory call. */
cursor?: string;
/** Asset symbol (e.g. "USDC", "WETH") to scope the history to one asset. */
tokenSymbol?: string;
};

HistoryOptions​

type HistoryOptions = {
agentId?: AgentId;
filters?: HistoryFilters;
};

Swapping​

See Swapping for method signatures and examples.

SwapRail​

type SwapRail = "classic" | "fusion" | "fusion-plus";

SwapDirection​

type SwapDirection = "deposit" | "withdraw";

SwapTokenInfo​

type SwapTokenInfo = {
readonly symbol: string;
readonly address: string;
readonly decimals: number;
readonly isNative?: true;
};

SwapChainTokens​

type SwapChainTokens = {
readonly chainId: number;
readonly sources: readonly SwapTokenInfo[];
readonly depositTargets: readonly SwapTokenInfo[];
readonly searchableSources?: number;
};

SwapTokenSearchResult​

type SwapTokenSearchResult = SwapTokenInfo & {
readonly chainId: number;
readonly name?: string;
readonly logoURI?: string;
readonly providers?: readonly string[];
readonly isFoT?: boolean;
readonly rating?: string;
};

SwapQuoteParams​

type SwapQuoteParams = {
from: { chainId: number; symbol: string; amount: string };
to: { chainId: number; symbol: string };
direction?: SwapDirection;
};

SwapQuote​

type SwapQuote = {
rail: SwapRail;
src: { chainId: number; symbol: string; address: string; amount: string };
dst: { chainId: number; symbol: string; address: string; amount: string };
dstAmountMin: string;
timeLocks?: Record<string, number>;
secretsCount?: number;
spender?: string;
permitSupported?: boolean;
requiresOnchainOrder: boolean;
wrappedNative?: { symbol: string; address: string; decimals: number };
feeInfo?: {
integratorFee?: { receiver: string; bps: number; share: number };
resolverFee?: { receiver: string; bps: number };
};
integratorFeeBps?: number;
};

SwapStage​

type SwapStage =
| "withdrawing"
| "withdrawn"
| "withdrawal-incomplete"
| "swap-unknown"
| "swap-partial"
| "swap-not-started"
| "quoting"
| "wrapping"
| "wrapped"
| "approving"
| "building"
| "signing"
| "swapping"
| "swapped"
| "depositing"
| "refunding"
| "refunded";

SwapOrderStatus​

type SwapOrderStatus =
| "pending"
| "executed"
| "expired"
| "cancelled"
| "refunding"
| "refunded"
| "unpublished"
| "filled"
| "partially-filled"
| "false-predicate"
| "not-enough-balance-or-allowance"
| "wrong-permit"
| "invalid-signature";

PendingDeposit​

type PendingDeposit = {
id: string;
received: string;
symbol: string;
chainId: number;
agentId?: string;
createdAt: number;
operationId?: string;
batchId?: string;
};

WithdrawSwapRecord​

type WithdrawSwapStatus =
| "swapping"
| "landed"
| "refunded"
| "unknown"
| "refund-pending"
| "partially-filled"
| "withdrawal-pending"
| "withdrawal-incomplete"
| "ready"
| "not-swapped";

type WithdrawSwapRecord = {
orderHash: string;
status: WithdrawSwapStatus;
withdrawn: string;
srcSymbol: string;
srcChainId: number;
srcDecimals: number;
expected: string;
dstSymbol: string;
dstChainId: number;
dstDecimals: number;
received?: string;
createdAt: number;
settledAt?: number;
recovery?: WithdrawalSwapRecovery;
};

WithdrawalSwapRecovery contains the withdrawal evidence needed by recheckWithdrawalSwap and continueWithdrawalSwap.

Pool customization​

AvailablePool​

type AvailablePool = {
chainId: number;
token: string;
name: string;
apy: number | null;
tvlUsd: number | null;
link: string | null;
address?: string;
};

PoolCatalogProtocol​

type PoolCatalogProtocol = {
protocolId: string;
name: string;
logo: string | null;
pools: AvailablePool[];
};

PoolSelectionStrategy​

type PoolSelectionStrategy = "aggressive" | "yieldmaxxing";

UserPoolSelection​

type UserPoolSelection = {
asset: "USDC" | "WETH";
protocolId: string;
chainId: number;
pools: string[];
availablePools: string[];
};

UserPoolSelectionRequest​

type UserPoolSelectionRequest = {
strategies: Array<{
asset: "USDC" | "WETH";
strategy: PoolSelectionStrategy;
}>;
selections: UserPoolSelection[];
};

SavedPoolSelection​

type SavedPoolSelection = {
strategies: Array<{
asset: "USDC" | "WETH";
strategy: string;
}>;
pairs: Array<{
protocolId: string;
chainId: number;
pools: string[];
}>;
};

Callbacks​

DepositCallback​

type DepositCallback = (
smartWalletAddress: string,
chainId: number,
amount: string,
) => Promise<`0x${string}`> | `0x${string}`;

Responses​

OwneyDepositResult​

interface OwneyDepositResult {
txHash: string;
smartWallet: string;
amount: string;
}

OwneyMultiDepositResult​

interface OwneyMultiDepositResult {
agentResults: Record<string, OwneyDepositResult>;
}

AgentWithdrawResult​

interface AgentWithdrawResult {
txHash?: string;
type: "full" | "partial";
amount: string;
}

OwneyWithdrawResult​

interface OwneyWithdrawResult {
agentResult: Record<AgentId, AgentWithdrawResult>;
totalWithdrawn: string;
}

OwneyToken​

interface OwneyToken {
chain: OwneySupportedChains;
chainId: OwneySupportedChainId;
asset: OwneySupportedTokens;
amount: string;
}

OwneyPosition​

interface OwneyPosition {
chain: string;
protocol: string;
protocolId?: string;
pool?: string;
asset: string;
amount: string;
amountRaw?: string;
withdrawableAmountRaw?: string;
/** Fee-net APY in percentage points, when supplied by the agent. */
apy?: number;
tvl?: number;
liquidity?: number;
}

AgentBalance​

interface AgentBalance {
smartWallet?: `0x${string}`;
totalBalance: string;
totalBalanceAsset: string; // unit of totalBalance, currently always "usdc"
tokens: OwneyToken[];
positions?: OwneyPosition[];
}

OwneyBalances​

interface OwneyBalances {
totalBalance: string;
totalBalanceAsset: string; // unit of totalBalance, currently always "usdc"
agentBalances: Record<AgentId, AgentBalance>;
}

AgentEarnings​

interface AgentEarnings {
smartWallet: `0x${string}`;
lifetimeEarnings: number;
tokens: OwneyToken[];
}

OwneyEarnings​

interface OwneyEarnings {
totalEarnings: string;
agentEarnings: Record<AgentId, AgentEarnings>;
}

ApyByChainAndAsset​

type ApyByChainAndAsset = Partial<
Record<OwneySupportedChainId, Partial<Record<OwneySupportedTokens, number>>>
>;

AccountAgentApy​

interface ApyIncentive {
source: "merkl";
agentId: AgentId;
opportunityId: string;
campaignIds: string[];
apr: number;
apyContribution: number;
}

interface ApyHistoryPoint {
date: string;
apy: number;
historicalBalance?: { amount: number; unit: string };
incentives?: ApyIncentive[];
}

interface AccountAgentApy {
walletAddress: string;
weightedApyAfterFee?: number;
weightedApyAfterFeeDetails?: AgentApyDetails;
apyByChainAndAsset?: ApyByChainAndAsset;
history?: ApyHistoryPoint[];
}

OwneyAccountApy​

interface OwneyAccountApy {
totalApy: string;
agentApy: Record<AgentId, AccountAgentApy>;
apyByChainAndAsset: ApyByChainAndAsset;
history?: ApyHistoryPoint[];
}

AllocationAgentApy​

interface AllocationAgentApy {
totalApy: string;
apyByChainAndAsset: ApyByChainAndAsset;
}

OwneyAllocationApy​

interface OwneyAllocationApy {
totalApy: string;
apyByChainAndAsset: ApyByChainAndAsset;
agentApy: Record<AgentId, AllocationAgentApy>;
}

HistoryAction​

type HistoryAction =
| "Rebalance"
| "Allocate"
| "ExitPosition"
| "Deposit"
| "Withdraw"
| "Earned";
ActionMeaning
DepositFunds moved from the user's wallet into the agent's smart wallet.
AllocateFunds moved from the smart wallet into a pool.
ExitPositionFunds moved from a pool back to the smart wallet.
RebalanceFunds moved from one pool to another.
WithdrawFunds moved out of the agent to the user's wallet.
EarnedYield accrued.

HistoryTransaction​

interface HistoryTransaction {
txHashes: string[];
chainId?: number;
tokenSymbol?: string;
amount?: string;
}

RebalanceLog​

interface RebalanceLog {
fromProtocol: string;
toProtocol: string;
tokenSymbol: string;
amount: string;
status: "success" | "failed";
}

AgentHistoryEntry​

interface AgentHistoryEntry {
agent: AgentId;
action: HistoryAction;
date: string;
oldApy: string | null;
newApy: string | null;
transactions: HistoryTransaction[];
rebalanceLog: RebalanceLog[];
}

OwneyAgentHistory​

interface OwneyAgentHistory {
data: AgentHistoryEntry[];
hasMore: boolean;
nextCursor?: string;
}

OwneyAgentStatus​

interface OwneyAgentStatus {
success: boolean;
strategy?: string;
protocols?: string[];
}

AgentUserProfile​

interface AgentUserProfile {
address: string;
smartWallet: string;
chains: number[];
strategy?: string;
hasActiveSessionKey: boolean;
protocols: string[];
}

OwneyUserProfile​

interface OwneyUserProfile {
agentUserProfile: Record<AgentId, AgentUserProfile>;
}

AgentApyDetails​

interface AgentApyDetails {
apyPerAsset: Partial<
Record<OwneySupportedChainId, Partial<Record<OwneySupportedTokens, number>>>
>;
}

AgentApy​

interface AgentApy {
averageApy: number;
detailedApys?: AgentApyDetails;
}

OwneyAgentApy​

interface OwneyAgentApy {
agentApy: Record<AgentId, AgentApy>;
}