@owney/sdk 0.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,322 @@
1
+ interface OwneySDKConfig {
2
+ apiKey: string;
3
+ }
4
+ interface ConnectionState {
5
+ provider: any;
6
+ walletAddress: `0x${string}`;
7
+ chainId: number | null;
8
+ }
9
+ declare const SUPPORTED_TOKENS: readonly ["USDC", "USDT"];
10
+ declare const SUPPORTED_CHAIN_IDS: readonly [8453, 42161];
11
+ declare const SUPPORTED_CHAINS: readonly ["BASE", "ARBITRUM"];
12
+ type OwneySupportedChainId = (typeof SUPPORTED_CHAIN_IDS)[number];
13
+ type OwneySupportedChains = (typeof SUPPORTED_CHAINS)[number];
14
+ type OwneySupportedTokens = (typeof SUPPORTED_TOKENS)[number];
15
+
16
+ type DepositCallback = (smartWalletAddress: string, chainId: number, amount: string) => Promise<`0x${string}`> | `0x${string}`;
17
+ interface IAgent {
18
+ readonly id: string;
19
+ readonly supportedChainIds: readonly OwneySupportedChainId[];
20
+ readonly supportedAssets: readonly AgentSupportedAssets[];
21
+ disconnect(): Promise<void>;
22
+ activateAgent(state: ConnectionState, chainId: number): Promise<void>;
23
+ deposit(state: ConnectionState, chainId: number, amount: string, depositCallback?: DepositCallback): Promise<OwneyDepositResult>;
24
+ withdraw(state: ConnectionState, chainId: number, amount?: string): Promise<AgentWithdrawResult>;
25
+ getBalances(state: ConnectionState, chainId: number): Promise<AgentBalance>;
26
+ getEarnings(state: ConnectionState, chainId: number): Promise<AgentEarnings>;
27
+ getAccountApy(state: ConnectionState, chainId: number, days: DailyApyDays): Promise<AccountAgentApy>;
28
+ getHistory(state: ConnectionState, chainId: number, options?: HistoryFilters): Promise<OwneyAgentHistory>;
29
+ pause(state: ConnectionState, chainId: number): Promise<OwneyAgentStatus>;
30
+ resume(state: ConnectionState, chainId: number): Promise<OwneyAgentStatus>;
31
+ getUserProfile(state: ConnectionState, chainId: number): Promise<AgentUserProfile>;
32
+ getAgentApy(days: DailyApyDays): Promise<AgentApy>;
33
+ }
34
+
35
+ type AgentId = "zyfai" | "sail";
36
+ type Asset = string;
37
+ type AgentSupportedAssets = {
38
+ readonly chainId: number;
39
+ readonly chain?: string;
40
+ readonly assets: readonly string[];
41
+ };
42
+ type DailyApyDays = "7D" | "14D" | "30D";
43
+ type HistoryFilters = {
44
+ fromDate?: string;
45
+ toDate?: string;
46
+ };
47
+ type HistoryOptions = {
48
+ agentId?: AgentId;
49
+ filters?: HistoryFilters;
50
+ };
51
+ type WithdrawOptions = {
52
+ asset: Asset;
53
+ amount?: string;
54
+ agentId?: AgentId;
55
+ };
56
+ type AccountApyOptions = {
57
+ agentId?: AgentId;
58
+ days: DailyApyDays;
59
+ };
60
+ type AgentsApyOptions = {
61
+ agentId?: AgentId;
62
+ days: DailyApyDays;
63
+ };
64
+ type DepositOptions = {
65
+ amount: string;
66
+ asset: Asset;
67
+ depositCallback: DepositCallback;
68
+ agentId?: AgentId;
69
+ };
70
+
71
+ interface OwneyDepositResult {
72
+ txHash: string;
73
+ smartWallet: string;
74
+ amount: string;
75
+ }
76
+ interface OwneyMultiDepositResult {
77
+ agentResults: Record<string, OwneyDepositResult>;
78
+ }
79
+ interface AgentWithdrawResult {
80
+ txHash?: string;
81
+ type: "full" | "partial";
82
+ amount: string;
83
+ }
84
+ interface OwneyWithdrawResult {
85
+ agentResult: Record<AgentId, AgentWithdrawResult>;
86
+ }
87
+ interface OwneyToken {
88
+ chain: OwneySupportedChains;
89
+ chainId: OwneySupportedChainId;
90
+ asset: OwneySupportedTokens;
91
+ amount: string;
92
+ }
93
+ interface AgentBalance {
94
+ smartWallet?: `0x${string}`;
95
+ totalBalance: string;
96
+ tokens: OwneyToken[];
97
+ }
98
+ interface OwneyBalances {
99
+ totalBalance: string;
100
+ agentBalances: Record<AgentId, AgentBalance>;
101
+ }
102
+ interface AgentEarnings {
103
+ smartWallet: `0x${string}`;
104
+ lifetimeEarnings: number;
105
+ }
106
+ interface OwneyEarnings {
107
+ totalEarnings: string;
108
+ agentEarnings: Record<AgentId, AgentEarnings>;
109
+ }
110
+ interface AccountAgentApy {
111
+ walletAddress: string;
112
+ weightedApyAfterFee?: number;
113
+ }
114
+ interface OwneyAccountApy {
115
+ totalApy: string;
116
+ agentApy: Record<AgentId, AccountAgentApy>;
117
+ }
118
+ type HistoryAction = "Rebalance" | "Deposit" | "Top up" | "Withdraw" | "Earned";
119
+ interface HistoryTransaction {
120
+ txHashes: string[];
121
+ chainId?: number;
122
+ tokenSymbol?: string;
123
+ amount?: string;
124
+ }
125
+ interface RebalanceLog {
126
+ fromProtocol: string;
127
+ toProtocol: string;
128
+ tokenSymbol: string;
129
+ amount: string;
130
+ status: "success" | "failed";
131
+ }
132
+ interface AgentHistoryEntry {
133
+ agent: AgentId;
134
+ action: HistoryAction;
135
+ date: string;
136
+ oldApy: string | null;
137
+ newApy: string | null;
138
+ transactions: HistoryTransaction[];
139
+ rebalanceLog: RebalanceLog[];
140
+ }
141
+ interface OwneyAgentHistory {
142
+ data: AgentHistoryEntry[];
143
+ total: number;
144
+ }
145
+ interface OwneyAgentStatus {
146
+ success: boolean;
147
+ strategy?: string;
148
+ protocols?: string[];
149
+ }
150
+ interface AgentUserProfile {
151
+ address: string;
152
+ smartWallet: string;
153
+ chains: number[];
154
+ strategy?: string;
155
+ hasActiveSessionKey: boolean;
156
+ protocols: string[];
157
+ }
158
+ interface OwneyUserProfile {
159
+ agentUserProfile: Record<AgentId, AgentUserProfile>;
160
+ }
161
+ interface AgentApy {
162
+ averageApy: number;
163
+ }
164
+ interface OwneyAgentApy {
165
+ agentApy: Record<AgentId, AgentApy>;
166
+ }
167
+ interface OwneyRouteResponse {
168
+ agent: AgentId;
169
+ chainId: number;
170
+ }
171
+ interface OwneyAgentAllocation {
172
+ agentAllocation: Record<AgentId, number>;
173
+ }
174
+
175
+ declare class OwneySDK {
176
+ private agents;
177
+ private activeAgents;
178
+ private state;
179
+ private apiKey;
180
+ constructor(config: OwneySDKConfig);
181
+ /**
182
+ * Establish connection state for all subsequent SDK calls.
183
+ * Must be called once before any agent operation that requires a wallet.
184
+ * @param provider - EIP-1193 wallet provider
185
+ */
186
+ connect(provider: any): Promise<void>;
187
+ /**
188
+ * Disconnect from all agents and clear connection state.
189
+ * After calling this, `connect()` must be called again before using agent methods.
190
+ */
191
+ disconnect(): Promise<void>;
192
+ /**
193
+ * Check if the SDK has an active connection state.
194
+ * @returns `true` if `connect()` has been called and `disconnect()` has not
195
+ */
196
+ isConnected(): boolean;
197
+ /**
198
+ * Get the currently active chain ID, set by `activateAgent`.
199
+ * @returns The active chain ID, or `null` if `activateAgent` has not been called
200
+ */
201
+ getActiveChainId(): number | null;
202
+ private requireState;
203
+ private requireChainId;
204
+ private getAgent;
205
+ private getActiveAgents;
206
+ /**
207
+ * Activate the user's smart wallet for the specified agents, or all chain-compatible agents if omitted.
208
+ * Deploys the Safe contract and creates a session key if not already set up.
209
+ * Saves the chainId for use by all subsequent SDK calls.
210
+ * @param chainId - Target chain ID (e.g. 8453 for Base, 42161 for Arbitrum)
211
+ * @param agentId - Optional. One or more agent IDs to activate. Omit to activate all agents
212
+ * that support the given chainId (incompatible agents are silently skipped).
213
+ * If provided, ALL specified agents must support the chainId or the call
214
+ * throws before activating any agent.
215
+ */
216
+ activateAgent(chainId: number, agentId?: AgentId[]): Promise<void>;
217
+ /**
218
+ * Deposit funds into a specific agent, or split equally across all agents if agentId is omitted.
219
+ * Validates that the asset is supported by the target agent(s) on the active chain.
220
+ * @param options - Deposit parameters
221
+ * @param options.amount - Amount to deposit in smallest unit (e.g. "100000000" for 100 USDC)
222
+ * @param options.asset - Asset symbol to deposit (e.g. "USDC")
223
+ * @param options.depositCallback - Callback that performs the token transfer and returns a tx hash.
224
+ * When agentId is omitted, this callback is invoked once per eligible agent with that agent's
225
+ * split amount and smart wallet address — expect multiple wallet prompts.
226
+ * @param options.agentId - Optional. Target agent. Omit to split equally across all agents.
227
+ * @returns {OwneyDepositResult} for a single agent, or {OwneyMultiDepositResult} with per-agent results
228
+ */
229
+ deposit(options: DepositOptions): Promise<OwneyDepositResult | OwneyMultiDepositResult>;
230
+ private validateAssetSupport;
231
+ private getEligibleAgents;
232
+ /**
233
+ * Withdraw funds from a specific agent, or all agents that support the active chain+asset if agentId is omitted.
234
+ * Validates that the asset is supported by the target agent(s) on the active chain.
235
+ * @param options - Withdraw parameters
236
+ * @param options.asset - Asset symbol (e.g. "USDC")
237
+ * @param options.amount - Optional. Amount to withdraw. Omit for full withdrawal.
238
+ * @param options.agentId - Optional. Target agent. Omit to withdraw from all agents.
239
+ * @returns {AgentWithdrawResult} for a single agent, or {OwneyWithdrawResult} with per-agent results
240
+ */
241
+ withdraw(options: WithdrawOptions): Promise<OwneyWithdrawResult | AgentWithdrawResult>;
242
+ /**
243
+ * Get the user's balances for a specific agent, or aggregated across all agents.
244
+ * @param agentId - Optional. Agent to query. Omit for aggregated balances.
245
+ * @returns {AgentBalance} for a single agent, or {OwneyBalances} with totalBalance and per-agent breakdown
246
+ */
247
+ getBalances(agentId?: AgentId): Promise<OwneyBalances | AgentBalance>;
248
+ /**
249
+ * Get the user's on-chain earnings for a specific agent, or aggregated across all agents.
250
+ * @param agentId - Optional. Agent to query. Omit for aggregated earnings.
251
+ * @returns {AgentEarnings} for a single agent, or {OwneyEarnings} with totalEarnings and per-agent breakdown
252
+ */
253
+ getEarnings(agentId?: AgentId): Promise<OwneyEarnings | AgentEarnings>;
254
+ /**
255
+ * Get the weighted APY for the user's account over a time period.
256
+ * When querying all agents, the total APY is a balance-weighted average.
257
+ * @param options - Contains agentId (optional) and days ("7D", "14D", or "30D")
258
+ * @param options.agentId - Optional. Agent to query. Omit for balance-weighted total APY.
259
+ * @param options.days - Lookback period: "7D", "14D", or "30D"
260
+ * @returns {AccountAgentApy} for a single agent, or {OwneyAccountApy} with totalApy and per-agent breakdown
261
+ */
262
+ getAccountApy({ agentId, days, }: AccountApyOptions): Promise<OwneyAccountApy | AccountAgentApy>;
263
+ /**
264
+ * Get transaction history for a specific agent, or all agents.
265
+ * @param params - Optional. Contains agentId and filters.
266
+ * @param params.agentId - Optional. Agent to query. Omit for all agents.
267
+ * @param params.filters - Optional. Pagination and date filters (fromDate, toDate)
268
+ * @returns {OwneyAgentHistory} with per-agent history
269
+ */
270
+ getHistory(params?: HistoryOptions): Promise<OwneyAgentHistory>;
271
+ /**
272
+ * Pause an agent's automated operations. The agent will stop rebalancing until resumed.
273
+ * @param agentId - The agent to pause (e.g. "zyfai")
274
+ * @returns OwneyAgentStatus with success flag
275
+ */
276
+ pauseAgent(agentId: AgentId): Promise<OwneyAgentStatus>;
277
+ /**
278
+ * Resume an agent's automated operations.
279
+ * @param agentId - The agent to resume (e.g. "zyfai")
280
+ * @returns OwneyAgentStatus with success flag
281
+ */
282
+ resumeAgent(agentId: AgentId): Promise<OwneyAgentStatus>;
283
+ /**
284
+ * Get the user's profile for a specific agent, or all agents.
285
+ * @param agentId - Optional. Agent to query. Omit for all agents.
286
+ * @returns {AgentUserProfile} for a single agent, or {OwneyUserProfile} with per-agent profiles
287
+ */
288
+ getUserProfile(agentId?: AgentId): Promise<OwneyUserProfile | AgentUserProfile>;
289
+ /**
290
+ * Get the agent's average APY performance over a time period. Does not require a wallet connection.
291
+ * @param options - Contains agentId (optional) and days ("7D", "14D", or "30D")
292
+ * @param options.agentId - Optional. Agent to query. Omit for all agents.
293
+ * @param options.days - Lookback period: "7D", "14D", or "30D"
294
+ * @returns {AgentApy} for a single agent, or {OwneyAgentApy} with per-agent APY
295
+ */
296
+ getAgentApy({ agentId, days, }: AgentsApyOptions): Promise<OwneyAgentApy | AgentApy>;
297
+ /**
298
+ * Get the current fund allocation percentages across agents.
299
+ * @returns Object with agent names as keys and allocation percentages as values
300
+ */
301
+ getAgentAllocation(): Promise<OwneyAgentAllocation>;
302
+ }
303
+
304
+ declare class AgentNotFoundError extends Error {
305
+ constructor(agentId: string, available: string[]);
306
+ }
307
+ declare class NotConnectedError extends Error {
308
+ constructor();
309
+ }
310
+ declare class AgentChainIncompatibleError extends Error {
311
+ readonly incompatibleAgents: Array<{
312
+ agentId: string;
313
+ supportedChainIds: readonly number[];
314
+ }>;
315
+ readonly connectedChainId: number;
316
+ constructor(incompatibleAgents: Array<{
317
+ agentId: string;
318
+ supportedChainIds: readonly number[];
319
+ }>, connectedChainId: number);
320
+ }
321
+
322
+ export { AccountAgentApy, AccountApyOptions, AgentApy, AgentBalance, AgentChainIncompatibleError, AgentEarnings, AgentHistoryEntry, AgentId, AgentNotFoundError, AgentSupportedAssets, AgentUserProfile, AgentWithdrawResult, AgentsApyOptions, Asset, ConnectionState, DailyApyDays, DepositCallback, DepositOptions, HistoryAction, HistoryFilters, HistoryOptions, HistoryTransaction, IAgent, NotConnectedError, OwneyAccountApy, OwneyAgentAllocation, OwneyAgentApy, OwneyAgentHistory, OwneyAgentStatus, OwneyBalances, OwneyDepositResult, OwneyEarnings, OwneyMultiDepositResult, OwneyRouteResponse, OwneySDK, OwneySDKConfig, OwneyToken, OwneyUserProfile, OwneyWithdrawResult, RebalanceLog, WithdrawOptions };
@@ -0,0 +1,322 @@
1
+ interface OwneySDKConfig {
2
+ apiKey: string;
3
+ }
4
+ interface ConnectionState {
5
+ provider: any;
6
+ walletAddress: `0x${string}`;
7
+ chainId: number | null;
8
+ }
9
+ declare const SUPPORTED_TOKENS: readonly ["USDC", "USDT"];
10
+ declare const SUPPORTED_CHAIN_IDS: readonly [8453, 42161];
11
+ declare const SUPPORTED_CHAINS: readonly ["BASE", "ARBITRUM"];
12
+ type OwneySupportedChainId = (typeof SUPPORTED_CHAIN_IDS)[number];
13
+ type OwneySupportedChains = (typeof SUPPORTED_CHAINS)[number];
14
+ type OwneySupportedTokens = (typeof SUPPORTED_TOKENS)[number];
15
+
16
+ type DepositCallback = (smartWalletAddress: string, chainId: number, amount: string) => Promise<`0x${string}`> | `0x${string}`;
17
+ interface IAgent {
18
+ readonly id: string;
19
+ readonly supportedChainIds: readonly OwneySupportedChainId[];
20
+ readonly supportedAssets: readonly AgentSupportedAssets[];
21
+ disconnect(): Promise<void>;
22
+ activateAgent(state: ConnectionState, chainId: number): Promise<void>;
23
+ deposit(state: ConnectionState, chainId: number, amount: string, depositCallback?: DepositCallback): Promise<OwneyDepositResult>;
24
+ withdraw(state: ConnectionState, chainId: number, amount?: string): Promise<AgentWithdrawResult>;
25
+ getBalances(state: ConnectionState, chainId: number): Promise<AgentBalance>;
26
+ getEarnings(state: ConnectionState, chainId: number): Promise<AgentEarnings>;
27
+ getAccountApy(state: ConnectionState, chainId: number, days: DailyApyDays): Promise<AccountAgentApy>;
28
+ getHistory(state: ConnectionState, chainId: number, options?: HistoryFilters): Promise<OwneyAgentHistory>;
29
+ pause(state: ConnectionState, chainId: number): Promise<OwneyAgentStatus>;
30
+ resume(state: ConnectionState, chainId: number): Promise<OwneyAgentStatus>;
31
+ getUserProfile(state: ConnectionState, chainId: number): Promise<AgentUserProfile>;
32
+ getAgentApy(days: DailyApyDays): Promise<AgentApy>;
33
+ }
34
+
35
+ type AgentId = "zyfai" | "sail";
36
+ type Asset = string;
37
+ type AgentSupportedAssets = {
38
+ readonly chainId: number;
39
+ readonly chain?: string;
40
+ readonly assets: readonly string[];
41
+ };
42
+ type DailyApyDays = "7D" | "14D" | "30D";
43
+ type HistoryFilters = {
44
+ fromDate?: string;
45
+ toDate?: string;
46
+ };
47
+ type HistoryOptions = {
48
+ agentId?: AgentId;
49
+ filters?: HistoryFilters;
50
+ };
51
+ type WithdrawOptions = {
52
+ asset: Asset;
53
+ amount?: string;
54
+ agentId?: AgentId;
55
+ };
56
+ type AccountApyOptions = {
57
+ agentId?: AgentId;
58
+ days: DailyApyDays;
59
+ };
60
+ type AgentsApyOptions = {
61
+ agentId?: AgentId;
62
+ days: DailyApyDays;
63
+ };
64
+ type DepositOptions = {
65
+ amount: string;
66
+ asset: Asset;
67
+ depositCallback: DepositCallback;
68
+ agentId?: AgentId;
69
+ };
70
+
71
+ interface OwneyDepositResult {
72
+ txHash: string;
73
+ smartWallet: string;
74
+ amount: string;
75
+ }
76
+ interface OwneyMultiDepositResult {
77
+ agentResults: Record<string, OwneyDepositResult>;
78
+ }
79
+ interface AgentWithdrawResult {
80
+ txHash?: string;
81
+ type: "full" | "partial";
82
+ amount: string;
83
+ }
84
+ interface OwneyWithdrawResult {
85
+ agentResult: Record<AgentId, AgentWithdrawResult>;
86
+ }
87
+ interface OwneyToken {
88
+ chain: OwneySupportedChains;
89
+ chainId: OwneySupportedChainId;
90
+ asset: OwneySupportedTokens;
91
+ amount: string;
92
+ }
93
+ interface AgentBalance {
94
+ smartWallet?: `0x${string}`;
95
+ totalBalance: string;
96
+ tokens: OwneyToken[];
97
+ }
98
+ interface OwneyBalances {
99
+ totalBalance: string;
100
+ agentBalances: Record<AgentId, AgentBalance>;
101
+ }
102
+ interface AgentEarnings {
103
+ smartWallet: `0x${string}`;
104
+ lifetimeEarnings: number;
105
+ }
106
+ interface OwneyEarnings {
107
+ totalEarnings: string;
108
+ agentEarnings: Record<AgentId, AgentEarnings>;
109
+ }
110
+ interface AccountAgentApy {
111
+ walletAddress: string;
112
+ weightedApyAfterFee?: number;
113
+ }
114
+ interface OwneyAccountApy {
115
+ totalApy: string;
116
+ agentApy: Record<AgentId, AccountAgentApy>;
117
+ }
118
+ type HistoryAction = "Rebalance" | "Deposit" | "Top up" | "Withdraw" | "Earned";
119
+ interface HistoryTransaction {
120
+ txHashes: string[];
121
+ chainId?: number;
122
+ tokenSymbol?: string;
123
+ amount?: string;
124
+ }
125
+ interface RebalanceLog {
126
+ fromProtocol: string;
127
+ toProtocol: string;
128
+ tokenSymbol: string;
129
+ amount: string;
130
+ status: "success" | "failed";
131
+ }
132
+ interface AgentHistoryEntry {
133
+ agent: AgentId;
134
+ action: HistoryAction;
135
+ date: string;
136
+ oldApy: string | null;
137
+ newApy: string | null;
138
+ transactions: HistoryTransaction[];
139
+ rebalanceLog: RebalanceLog[];
140
+ }
141
+ interface OwneyAgentHistory {
142
+ data: AgentHistoryEntry[];
143
+ total: number;
144
+ }
145
+ interface OwneyAgentStatus {
146
+ success: boolean;
147
+ strategy?: string;
148
+ protocols?: string[];
149
+ }
150
+ interface AgentUserProfile {
151
+ address: string;
152
+ smartWallet: string;
153
+ chains: number[];
154
+ strategy?: string;
155
+ hasActiveSessionKey: boolean;
156
+ protocols: string[];
157
+ }
158
+ interface OwneyUserProfile {
159
+ agentUserProfile: Record<AgentId, AgentUserProfile>;
160
+ }
161
+ interface AgentApy {
162
+ averageApy: number;
163
+ }
164
+ interface OwneyAgentApy {
165
+ agentApy: Record<AgentId, AgentApy>;
166
+ }
167
+ interface OwneyRouteResponse {
168
+ agent: AgentId;
169
+ chainId: number;
170
+ }
171
+ interface OwneyAgentAllocation {
172
+ agentAllocation: Record<AgentId, number>;
173
+ }
174
+
175
+ declare class OwneySDK {
176
+ private agents;
177
+ private activeAgents;
178
+ private state;
179
+ private apiKey;
180
+ constructor(config: OwneySDKConfig);
181
+ /**
182
+ * Establish connection state for all subsequent SDK calls.
183
+ * Must be called once before any agent operation that requires a wallet.
184
+ * @param provider - EIP-1193 wallet provider
185
+ */
186
+ connect(provider: any): Promise<void>;
187
+ /**
188
+ * Disconnect from all agents and clear connection state.
189
+ * After calling this, `connect()` must be called again before using agent methods.
190
+ */
191
+ disconnect(): Promise<void>;
192
+ /**
193
+ * Check if the SDK has an active connection state.
194
+ * @returns `true` if `connect()` has been called and `disconnect()` has not
195
+ */
196
+ isConnected(): boolean;
197
+ /**
198
+ * Get the currently active chain ID, set by `activateAgent`.
199
+ * @returns The active chain ID, or `null` if `activateAgent` has not been called
200
+ */
201
+ getActiveChainId(): number | null;
202
+ private requireState;
203
+ private requireChainId;
204
+ private getAgent;
205
+ private getActiveAgents;
206
+ /**
207
+ * Activate the user's smart wallet for the specified agents, or all chain-compatible agents if omitted.
208
+ * Deploys the Safe contract and creates a session key if not already set up.
209
+ * Saves the chainId for use by all subsequent SDK calls.
210
+ * @param chainId - Target chain ID (e.g. 8453 for Base, 42161 for Arbitrum)
211
+ * @param agentId - Optional. One or more agent IDs to activate. Omit to activate all agents
212
+ * that support the given chainId (incompatible agents are silently skipped).
213
+ * If provided, ALL specified agents must support the chainId or the call
214
+ * throws before activating any agent.
215
+ */
216
+ activateAgent(chainId: number, agentId?: AgentId[]): Promise<void>;
217
+ /**
218
+ * Deposit funds into a specific agent, or split equally across all agents if agentId is omitted.
219
+ * Validates that the asset is supported by the target agent(s) on the active chain.
220
+ * @param options - Deposit parameters
221
+ * @param options.amount - Amount to deposit in smallest unit (e.g. "100000000" for 100 USDC)
222
+ * @param options.asset - Asset symbol to deposit (e.g. "USDC")
223
+ * @param options.depositCallback - Callback that performs the token transfer and returns a tx hash.
224
+ * When agentId is omitted, this callback is invoked once per eligible agent with that agent's
225
+ * split amount and smart wallet address — expect multiple wallet prompts.
226
+ * @param options.agentId - Optional. Target agent. Omit to split equally across all agents.
227
+ * @returns {OwneyDepositResult} for a single agent, or {OwneyMultiDepositResult} with per-agent results
228
+ */
229
+ deposit(options: DepositOptions): Promise<OwneyDepositResult | OwneyMultiDepositResult>;
230
+ private validateAssetSupport;
231
+ private getEligibleAgents;
232
+ /**
233
+ * Withdraw funds from a specific agent, or all agents that support the active chain+asset if agentId is omitted.
234
+ * Validates that the asset is supported by the target agent(s) on the active chain.
235
+ * @param options - Withdraw parameters
236
+ * @param options.asset - Asset symbol (e.g. "USDC")
237
+ * @param options.amount - Optional. Amount to withdraw. Omit for full withdrawal.
238
+ * @param options.agentId - Optional. Target agent. Omit to withdraw from all agents.
239
+ * @returns {AgentWithdrawResult} for a single agent, or {OwneyWithdrawResult} with per-agent results
240
+ */
241
+ withdraw(options: WithdrawOptions): Promise<OwneyWithdrawResult | AgentWithdrawResult>;
242
+ /**
243
+ * Get the user's balances for a specific agent, or aggregated across all agents.
244
+ * @param agentId - Optional. Agent to query. Omit for aggregated balances.
245
+ * @returns {AgentBalance} for a single agent, or {OwneyBalances} with totalBalance and per-agent breakdown
246
+ */
247
+ getBalances(agentId?: AgentId): Promise<OwneyBalances | AgentBalance>;
248
+ /**
249
+ * Get the user's on-chain earnings for a specific agent, or aggregated across all agents.
250
+ * @param agentId - Optional. Agent to query. Omit for aggregated earnings.
251
+ * @returns {AgentEarnings} for a single agent, or {OwneyEarnings} with totalEarnings and per-agent breakdown
252
+ */
253
+ getEarnings(agentId?: AgentId): Promise<OwneyEarnings | AgentEarnings>;
254
+ /**
255
+ * Get the weighted APY for the user's account over a time period.
256
+ * When querying all agents, the total APY is a balance-weighted average.
257
+ * @param options - Contains agentId (optional) and days ("7D", "14D", or "30D")
258
+ * @param options.agentId - Optional. Agent to query. Omit for balance-weighted total APY.
259
+ * @param options.days - Lookback period: "7D", "14D", or "30D"
260
+ * @returns {AccountAgentApy} for a single agent, or {OwneyAccountApy} with totalApy and per-agent breakdown
261
+ */
262
+ getAccountApy({ agentId, days, }: AccountApyOptions): Promise<OwneyAccountApy | AccountAgentApy>;
263
+ /**
264
+ * Get transaction history for a specific agent, or all agents.
265
+ * @param params - Optional. Contains agentId and filters.
266
+ * @param params.agentId - Optional. Agent to query. Omit for all agents.
267
+ * @param params.filters - Optional. Pagination and date filters (fromDate, toDate)
268
+ * @returns {OwneyAgentHistory} with per-agent history
269
+ */
270
+ getHistory(params?: HistoryOptions): Promise<OwneyAgentHistory>;
271
+ /**
272
+ * Pause an agent's automated operations. The agent will stop rebalancing until resumed.
273
+ * @param agentId - The agent to pause (e.g. "zyfai")
274
+ * @returns OwneyAgentStatus with success flag
275
+ */
276
+ pauseAgent(agentId: AgentId): Promise<OwneyAgentStatus>;
277
+ /**
278
+ * Resume an agent's automated operations.
279
+ * @param agentId - The agent to resume (e.g. "zyfai")
280
+ * @returns OwneyAgentStatus with success flag
281
+ */
282
+ resumeAgent(agentId: AgentId): Promise<OwneyAgentStatus>;
283
+ /**
284
+ * Get the user's profile for a specific agent, or all agents.
285
+ * @param agentId - Optional. Agent to query. Omit for all agents.
286
+ * @returns {AgentUserProfile} for a single agent, or {OwneyUserProfile} with per-agent profiles
287
+ */
288
+ getUserProfile(agentId?: AgentId): Promise<OwneyUserProfile | AgentUserProfile>;
289
+ /**
290
+ * Get the agent's average APY performance over a time period. Does not require a wallet connection.
291
+ * @param options - Contains agentId (optional) and days ("7D", "14D", or "30D")
292
+ * @param options.agentId - Optional. Agent to query. Omit for all agents.
293
+ * @param options.days - Lookback period: "7D", "14D", or "30D"
294
+ * @returns {AgentApy} for a single agent, or {OwneyAgentApy} with per-agent APY
295
+ */
296
+ getAgentApy({ agentId, days, }: AgentsApyOptions): Promise<OwneyAgentApy | AgentApy>;
297
+ /**
298
+ * Get the current fund allocation percentages across agents.
299
+ * @returns Object with agent names as keys and allocation percentages as values
300
+ */
301
+ getAgentAllocation(): Promise<OwneyAgentAllocation>;
302
+ }
303
+
304
+ declare class AgentNotFoundError extends Error {
305
+ constructor(agentId: string, available: string[]);
306
+ }
307
+ declare class NotConnectedError extends Error {
308
+ constructor();
309
+ }
310
+ declare class AgentChainIncompatibleError extends Error {
311
+ readonly incompatibleAgents: Array<{
312
+ agentId: string;
313
+ supportedChainIds: readonly number[];
314
+ }>;
315
+ readonly connectedChainId: number;
316
+ constructor(incompatibleAgents: Array<{
317
+ agentId: string;
318
+ supportedChainIds: readonly number[];
319
+ }>, connectedChainId: number);
320
+ }
321
+
322
+ export { AccountAgentApy, AccountApyOptions, AgentApy, AgentBalance, AgentChainIncompatibleError, AgentEarnings, AgentHistoryEntry, AgentId, AgentNotFoundError, AgentSupportedAssets, AgentUserProfile, AgentWithdrawResult, AgentsApyOptions, Asset, ConnectionState, DailyApyDays, DepositCallback, DepositOptions, HistoryAction, HistoryFilters, HistoryOptions, HistoryTransaction, IAgent, NotConnectedError, OwneyAccountApy, OwneyAgentAllocation, OwneyAgentApy, OwneyAgentHistory, OwneyAgentStatus, OwneyBalances, OwneyDepositResult, OwneyEarnings, OwneyMultiDepositResult, OwneyRouteResponse, OwneySDK, OwneySDKConfig, OwneyToken, OwneyUserProfile, OwneyWithdrawResult, RebalanceLog, WithdrawOptions };