Fund operations
deposit
Deposits funds into a specific agent, or splits the amount across all eligible agents.
- If
agentIdis omitted: splits the amount equally across all eligible agents for the active chain and asset. - If
agentIdis provided: deposits into the specified agent.
Requires wallet connection: Yes
- Signature
- Example
- Example Output
deposit(
params: DepositOptions
): Promise<OwneyDepositResult | OwneyMultiDepositResult>
// Deposit 100 USDC split across all eligible agents on Base.
const depositResults = await owney.deposit({
amount: "100000000", // 100 USDC with 6 decimals
asset: "USDC",
});
{
"agentResults": {
"zyfai": {
"txHash": "0x...",
"smartWallet": "0x...",
"amount": "100000000"
}
}
}
Parameters
params: DepositOptions- Deposit parameters (SeeDepositOptionsfor details):
Returns
Promise<OwneyMultiDepositResult>ifagentIdis omitted. ContainsagentResultskeyed by agent ID.Promise<OwneyDepositResult>ifagentIdis provided.
See OwneyDepositResult and OwneyMultiDepositResult for details.
withdraw
Withdraws funds from an agent.
- If
agentIdis omitted: withdraws from all eligible agents on the active chain. - If
agentIdis provided: withdraws from the specified agent. - If
amountis omitted: withdraws the full balance (from one or all agents, depending onagentId). - If
amountis provided andagentIdis 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
- Signature
- Example
- Example Output
withdraw(
params: WithdrawOptions
): Promise<OwneyWithdrawResult | AgentWithdrawResult>
// Withdraw full USDC balance across all eligible agents.
const withdrawAll = await owney.withdraw({
asset: "USDC",
});
{
"agentResult": {
"zyfai": {
"txHash": "0x...",
"type": "full",
"amount": "50000000"
}
},
"totalWithdrawn": "50000000"
}
Parameters
params: WithdrawOptions- Withdraw parameters (SeeWithdrawOptionsfor details):asset: Asset- The asset to withdraw (SeeAssetfor details).amount?: string- Optional amount to withdraw in the token's smallest unit. If omitted, withdraws the full balance.agentId?: AgentId- Optional agent ID (SeeAgentIdfor details). If omitted, withdraws from all eligible agents for the active chain and asset.
Returns
Promise<OwneyWithdrawResult>ifagentIdis omitted. ContainsagentResultkeyed by agent ID plustotalWithdrawn.Promise<AgentWithdrawResult>ifagentIdis provided.
See OwneyWithdrawResult and AgentWithdrawResult for details.