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;
};

If depositCallback is omitted, the SDK uses its built-in sponsored (gasless) deposit flow: an EIP-3009 TransferWithAuthorization for USDC, or a Permit2 PermitTransferFrom for WETH. See Gasless deposits.

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;
};

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;
}

AgentBalance​

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

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 AccountAgentApy {
walletAddress: string;
weightedApyAfterFee?: number;
weightedApyAfterFeeDetails?: AgentApyDetails;
apyByChainAndAsset?: ApyByChainAndAsset;
}

OwneyAccountApy​

interface OwneyAccountApy {
totalApy: string;
agentApy: Record<AgentId, AccountAgentApy>;
apyByChainAndAsset: ApyByChainAndAsset;
}

AllocationAgentApy​

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

OwneyAllocationApy​

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

HistoryAction​

type HistoryAction = "Rebalance" | "Deposit" | "Top up" | "Withdraw" | "Earned";

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>;
}