Skip to main content

Fund operations

deposit

Deposits funds into an agent. By default, funds will be distributed across agents to diversify both risks and returns.

  • If agentId is omitted: deposits the funds across agents.
  • If agentId is provided: deposits into the specified agent.
  • Only agents that support the active chain and asset are used when agentId is omitted.

Requires wallet connection: Yes

deposit(
params: DepositOptions
): Promise<OwneyDepositResult | OwneyMultiDepositResult>

Parameters

  • params: DepositOptions — Deposit parameters (See DepositOptions for details):
    • amount: string — Deposit amount in the token’s smallest unit (e.g. "100000000" for 100 USDC with 6 decimals).
    • asset: Asset — The asset to deposit (See Asset for details).
    • depositCallback: DepositCallback — Callback that performs the token transfer and returns a tx hash (See DepositCallback for details). If agentId is omitted, this callback is called once per eligible agent split.
    • agentId?: AgentId — Optional agent ID (See AgentId for details). If omitted, distributes equally across all eligible agents.

Returns

  • Promise<OwneyMultiDepositResult> if agentId is omitted. Contains agentResults keyed by agent ID.
  • Promise<OwneyDepositResult> if agentId is provided.

See OwneyDepositResult and OwneyMultiDepositResult for details.


withdraw

Withdraws funds from an agent.

  • If agentId is omitted: withdraws from all eligible agents on the active chain.
  • If agentId is provided: withdraws from the specified agent.
  • If amount is omitted: withdraws the full balance (from one or all agents, depending on agentId).
  • If amount is provided and agentId is omitted: splits the requested amount proportionally across eligible agents based on their per-asset balances.
  • If an agent withdrawal fails during a proportional split, its share is redistributed to the remaining not-yet-attempted agents where possible.

Requires wallet connection: Yes

withdraw(
params: WithdrawOptions
): Promise<OwneyWithdrawResult | AgentWithdrawResult>

Parameters

  • params: WithdrawOptions — Withdraw parameters (See WithdrawOptions for details):
    • asset: Asset — The asset to withdraw (See Asset for details).
    • amount?: string — Optional amount to withdraw in the token’s smallest unit. If omitted, withdraws the full balance.
    • agentId?: AgentId — Optional agent ID (See AgentId for details). If omitted, withdraws from all eligible agents.

Returns

  • Promise<OwneyWithdrawResult> if agentId is omitted. Contains agentResult keyed by agent ID.
  • Promise<AgentWithdrawResult> if agentId is provided.

See OwneyWithdrawResult and AgentWithdrawResult for details.