@owney/sdk 0.7.25-beta.0 → 0.7.25-beta.10

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.
package/dist/index.d.ts CHANGED
@@ -1,168 +1,34 @@
1
+ import { Hex } from 'viem';
1
2
  import { SIWXConfig } from '@reown/appkit-controllers';
2
3
 
3
- /**
4
- * Swap-to-yield types (ROUT-242).
5
- *
6
- * The SDK never talks to 1inch directly — the API key is a paid credential and
7
- * lives in the routing API. Everything here describes the routing API's
8
- * `/api/v1/swap/*` contract.
9
- */
10
- /**
11
- * Which rail a swap rides, decided server-side from the chains.
12
- *
13
- * `classic` — same chain. One atomic transaction: it either completes or
14
- * nothing moved.
15
- *
16
- * `fusion-plus` — crossing chains. The user's funds sit in an escrow while a
17
- * resolver fills the other side, so the order has a lifecycle and can end in
18
- * `expired` → `refunding` → `refunded` without ever depositing.
19
- */
20
- type SwapRail = "classic" | "fusion-plus";
21
- type SwapTokenInfo = {
22
- readonly symbol: string;
23
- readonly address: string;
24
- readonly decimals: number;
25
- /** Native asset (ETH). A swap SOURCE only — never a deposit target. */
26
- readonly isNative?: true;
27
- };
28
- type SwapChainTokens = {
29
- readonly chainId: number;
30
- /** What the user may pay with. */
31
- readonly sources: readonly SwapTokenInfo[];
32
- /** What a swap may resolve into — what Owney actually deposits. */
33
- readonly depositTargets: readonly SwapTokenInfo[];
34
- };
35
- type SwapQuote = {
36
- rail: SwapRail;
37
- src: {
38
- chainId: number;
39
- symbol: string;
40
- address: string;
41
- amount: string;
42
- };
43
- dst: {
44
- chainId: number;
45
- symbol: string;
46
- address: string;
47
- amount: string;
48
- };
49
- /**
50
- * Worst-case output once the Dutch auction has fully decayed. Gate minimum
51
- * deposit checks on THIS, not `dst.amount` — a fill at auction end that lands
52
- * under the agent's floor would leave the user swapped but not deposited.
53
- */
54
- dstAmountMin: string;
55
- /** Cross-chain only. Per-order escrow schedule in seconds, set by 1inch. */
56
- timeLocks?: Record<string, number>;
57
- /**
58
- * Cross-chain only. How many preimages to mint before building an order.
59
- * Building with the wrong number produces escrows the user's secrets cannot
60
- * unlock, stranding the swap until its cancellation timelock.
61
- */
62
- secretsCount?: number;
63
- /**
64
- * Cross-chain only. The contract the source token must be approved to (the
65
- * 1inch Limit Order Protocol) before a resolver can fill the order.
66
- *
67
- * Absent on the classic rail, where the router address arrives with the swap
68
- * calldata instead.
69
- */
70
- spender?: string;
71
- /**
72
- * True only for a cross-chain swap FROM native ETH, which needs an on-chain
73
- * order creation carrying the full amount as msg.value. The user's funds
74
- * leave the wallet before any fill, so the UI must say so. ERC-20 sources are
75
- * signature-only after their one-time approval.
76
- */
77
- requiresOnchainOrder: boolean;
78
- /**
79
- * What the swap costs, as the provider reports it on this quote.
80
- *
81
- * Surfaced rather than derived: a fee the UI computes from its own constant
82
- * drifts from the one actually charged the moment the two disagree, and they
83
- * did — the integrator fee was configured on our side for days while the
84
- * provider had it switched off, so the real charge was zero.
85
- *
86
- * Cross-chain only. The classic rail reports no breakdown.
87
- */
88
- feeInfo?: {
89
- /** Owney's cut. Absent until a fee receiver is configured. */
90
- integratorFee?: {
91
- receiver: string;
92
- bps: number;
93
- share: number;
94
- };
95
- /** The filler's cut, charged either way. */
96
- resolverFee?: {
97
- receiver: string;
98
- bps: number;
99
- };
100
- };
101
- /**
102
- * Owney's cut in basis points, for display.
103
- *
104
- * Distinct from `feeInfo`, which is what the provider measured on this
105
- * quote. When the provider applies the fee at settlement it reports nothing
106
- * here, and this carries the agreed figure instead so the UI can still name
107
- * one. Stated, not verified.
108
- */
109
- integratorFeeBps?: number;
110
- };
111
- /**
112
- * Terminal states are `executed`, `expired`, `cancelled` and `refunded`.
113
- * `refunding` is the window the returning-funds screen renders: the order has
114
- * failed and the money is on its way back, but is not back yet.
115
- */
116
- type SwapOrderStatus = "pending" | "executed" | "expired" | "cancelled" | "refunding" | "refunded" | "unpublished";
117
- /**
118
- * Stage reported to the UI while a swap runs, in either direction.
119
- *
120
- * `withdrawing` and `withdrawn` belong to the withdrawal path only: the
121
- * withdrawal is acknowledged by the agent long before the tokens appear in the
122
- * wallet, and the swap cannot start until they have. That wait is a visible
123
- * stage rather than dead time inside "quoting", because it is the longest part
124
- * of the flow and the one place a user would otherwise think nothing is
125
- * happening.
126
- */
127
- type SwapStage = "withdrawing" | "withdrawn" | "quoting" | "approving" | "signing" | "swapping" | "swapped" | "depositing" | "refunding" | "refunded";
128
- /**
129
- * Which way the funds travel, which decides what each side may be.
130
- *
131
- * On a `deposit` the source is any wallet asset and the destination must be
132
- * depositable. On a `withdraw` that reverses, and the destination widens to
133
- * anything the wallet can receive — native ETH and USDT included. The routing
134
- * API enforces both, so this has to be stated rather than inferred.
135
- */
136
- type SwapDirection = "deposit" | "withdraw";
137
- type SwapQuoteParams = {
138
- /** Asset being spent: a wallet asset on a deposit, an Owney asset on a withdrawal. */
139
- from: {
140
- chainId: number;
141
- symbol: string;
142
- amount: string;
143
- };
144
- /** Asset being received: a deposit target on a deposit, any wallet asset on a withdrawal. */
145
- to: {
146
- chainId: number;
147
- symbol: string;
148
- };
149
- /** Defaults to `deposit`. */
150
- direction?: SwapDirection;
151
- };
152
-
153
- type ZyfaiRpcUrlsConfig = Partial<Record<(typeof SUPPORTED_CHAIN_IDS)[number], string>>;
4
+ type RpcUrlsConfig = Partial<Record<(typeof SUPPORTED_CHAIN_IDS)[number], string>>;
5
+ /** @deprecated Use RpcUrlsConfig. */
6
+ type ZyfaiRpcUrlsConfig = RpcUrlsConfig;
154
7
  interface OwneySDKConfig {
155
8
  apiKey: string;
9
+ /**
10
+ * Optional per-chain RPC overrides used for application-owned reads and
11
+ * transaction receipt polling. Missing chains use the Owney routing API's
12
+ * read-only RPC proxy. No upstream RPC credentials are included in the SDK.
13
+ * Wallet providers remain responsible for account access, chain switching,
14
+ * signatures, and transaction submission.
15
+ */
16
+ rpcUrls?: RpcUrlsConfig;
156
17
  /**
157
18
  * Optional per-chain RPC overrides for Zyfai SDK network calls.
158
19
  * Example: { 8453: "https://...", 42161: "https://..." }
20
+ * @deprecated Use rpcUrls so every agent shares the same read transport.
159
21
  */
160
22
  zyfaiRpcUrls?: ZyfaiRpcUrlsConfig;
23
+ /** Optional Owney Yieldseeker proxy base URL override for integration tests. */
24
+ yieldseekerApiBaseUrl?: string;
25
+ /** Optional SIWE origin override. Defaults to the requesting browser origin. */
26
+ yieldseekerSiweOrigin?: string;
161
27
  /**
162
28
  * Optional override for the Owney routing API base URL used by all routing
163
- * calls (defaults to the OWNEY_ROUTING_API_BASE_URL env var, then the
164
- * production URL). Set this to point at a local/staging routing API,
165
- * e.g. "http://localhost:3000", when testing sponsor changes.
29
+ * calls. RPC proxy requests use OWNEY_ROUTING_API_BASE_URL when this is
30
+ * omitted; without either value, all rpcUrls must be configured.
31
+ * Set this to a local/staging routing API when testing sponsor changes.
166
32
  */
167
33
  routingApiBaseUrl?: string;
168
34
  /**
@@ -204,148 +70,6 @@ type OwneySupportedChainId = (typeof SUPPORTED_CHAIN_IDS)[number];
204
70
  type OwneySupportedChains = (typeof SUPPORTED_CHAINS)[number];
205
71
  type OwneySupportedTokens = (typeof SUPPORTED_TOKENS)[number];
206
72
 
207
- type AgentId = "zyfai";
208
- type Asset = string;
209
- type AgentSupportedAsset = {
210
- readonly symbol: string;
211
- readonly minDepositAmount: string;
212
- };
213
- type AgentSupportedAssets = {
214
- readonly chainId: number;
215
- readonly chain?: string;
216
- readonly assets: readonly AgentSupportedAsset[];
217
- };
218
- type AvailableAgent = {
219
- id: AgentId;
220
- isEnabled: boolean;
221
- supportedChainIds: readonly number[];
222
- supportedAssets: readonly AgentSupportedAssets[];
223
- };
224
- type AvailableAgentsOptions = {
225
- chainId?: number;
226
- asset?: Asset;
227
- /** Disabled agents are omitted by default because they cannot accept funds. */
228
- includeDisabled?: boolean;
229
- };
230
- /**
231
- * A lookback window for any "last N days" read — the APY series, the daily
232
- * earnings series. Named for the window itself, so nothing borrows the APY's
233
- * name to ask for something else.
234
- */
235
- type LookbackDays = "7D" | "14D" | "30D";
236
- /** Kept so existing callers keep compiling. Prefer `LookbackDays`. */
237
- type DailyApyDays = LookbackDays;
238
- type HistoryFilters = {
239
- fromDate?: string;
240
- toDate?: string;
241
- /** Max entries returned per call. Defaults to 10. */
242
- limit?: number;
243
- /** Opaque cursor returned by a previous getHistory call. */
244
- cursor?: string;
245
- /**
246
- * Optional asset symbol (e.g. "USDC", "WETH") to scope the history to a
247
- * single asset. Without it the page blends every asset on the chain, so a
248
- * consumer showing one asset at a time has to filter client-side — and a
249
- * page whose entries all belong to the *other* asset then renders empty
250
- * even though matching entries exist further back. Agents whose backends
251
- * cannot filter by asset ignore this and return the whole chain's history.
252
- */
253
- tokenSymbol?: string;
254
- };
255
- type HistoryOptions = {
256
- agentId?: AgentId;
257
- filters?: HistoryFilters;
258
- };
259
- type WithdrawOptions = {
260
- asset: Asset;
261
- amount?: string;
262
- agentId?: AgentId;
263
- };
264
- type AccountApyOptions = {
265
- agentId?: AgentId;
266
- days: LookbackDays;
267
- /**
268
- * Optional asset symbol (e.g. "USDC", "WETH") to scope the daily APY series
269
- * to a specific asset on the active chain. Without it the series blends every
270
- * position on the chain, so two assets sharing a chain (USDC and WETH on
271
- * Base/Arbitrum) would render one merged line. Agents whose backends do not
272
- * expose per-asset positions ignore this. (ROUT-186)
273
- */
274
- tokenSymbol?: string;
275
- };
276
- /**
277
- * Options for the daily earnings series. Same shape as `AccountApyOptions` and
278
- * deliberately its own type: the two reads answer different questions and are
279
- * free to diverge.
280
- */
281
- type DailyEarningsOptions = {
282
- agentId?: AgentId;
283
- days: LookbackDays;
284
- /**
285
- * Optional asset symbol (e.g. "USDC", "WETH") scoping the series to one
286
- * asset on the active chain.
287
- */
288
- tokenSymbol?: string;
289
- };
290
- type AllocationApyOptions = {
291
- agentId?: AgentId;
292
- };
293
- type AgentsApyOptions = {
294
- agentId?: AgentId;
295
- days: DailyApyDays;
296
- /**
297
- * Optional asset symbol (e.g. "USDC", "WETH") to scope the APY to a
298
- * specific asset+chain. Ignored by agents whose backends do not yet
299
- * support per-asset APY.
300
- */
301
- tokenSymbol?: string;
302
- /**
303
- * Optional chain id for per-asset APY lookups. Typically paired with
304
- * `tokenSymbol`.
305
- */
306
- chainId?: number;
307
- };
308
- type DepositOptions = {
309
- amount: string;
310
- asset: Asset;
311
- depositCallback?: DepositCallback;
312
- agentId?: AgentId;
313
- onApproved?: () => void;
314
- };
315
-
316
- /**
317
- * One protocol's pool selection on one chain. `pools` holds Zyfai pool NAMES
318
- * verbatim — matched case-sensitively by customizeBatch, and an unrecognised
319
- * name makes Zyfai's rebalance engine skip the whole protocol, so these strings
320
- * must not be normalised anywhere.
321
- *
322
- * An empty array means "no usable pools on this chain".
323
- */
324
- type OrgPoolSelection = {
325
- protocolId: string;
326
- chainId: number;
327
- pools: string[];
328
- };
329
- /**
330
- * The partner's protocol/pool policy (ROUT-224). Sparse — only protocols they
331
- * narrowed appear. Optional so an older routing API, which does not return the
332
- * field, still parses; undefined and null both mean "change nothing".
333
- */
334
- type OrgPoolPolicy = {
335
- autoApproveProtocols: boolean;
336
- autoApprovePools: boolean;
337
- selections: OrgPoolSelection[];
338
- };
339
- /**
340
- * The organization's agent execution policy, or null when the partner has never
341
- * configured one — in which case the agents leave the user's profile alone.
342
- */
343
- type OrgAgentConfig = {
344
- splittingMode: "none" | "automatic" | "force";
345
- minSplits: number | null;
346
- poolPolicy?: OrgPoolPolicy | null;
347
- };
348
-
349
73
  interface OwneyDepositResult {
350
74
  txHash: string;
351
75
  smartWallet: string;
@@ -382,6 +106,10 @@ interface OwneyPosition {
382
106
  pool?: string;
383
107
  asset: string;
384
108
  amount: string;
109
+ /** Provider-native raw quantity; may represent vault shares, not the underlying asset. */
110
+ amountRaw?: string;
111
+ /** Withdrawable underlying asset amount in that asset's smallest units. */
112
+ withdrawableAmountRaw?: string;
385
113
  apy?: number;
386
114
  tvl?: number;
387
115
  /** Pool liquidity. Prepared slot — Zyfai will add this to its portfolio
@@ -412,10 +140,19 @@ interface OwneyPendingAllocation {
412
140
  since?: string;
413
141
  }
414
142
  interface AgentBalance {
143
+ /** Authoritative native balances per asset/network, including idle and invested funds. */
144
+ assetBalances?: OwneyToken[];
415
145
  smartWallet?: `0x${string}`;
416
146
  totalBalance: string;
417
147
  /** Asset that `totalBalance` is denominated in. Currently always `"usdc"`. */
418
148
  totalBalanceAsset: string;
149
+ /**
150
+ * Describes whether `tokens` already includes deployed `positions`.
151
+ * Consumers must add matching positions only for `tokens-plus-positions`;
152
+ * doing so for Zyfai would double-count, while omitting it for Yieldseeker
153
+ * makes its balance disappear as soon as idle funds enter a vault.
154
+ */
155
+ balanceComposition?: "tokens-include-positions" | "tokens-plus-positions";
419
156
  tokens: OwneyToken[];
420
157
  /**
421
158
  * Per-protocol/pool positions when the agent's portfolio payload includes
@@ -430,10 +167,14 @@ interface OwneyBalances {
430
167
  /** Asset that `totalBalance` is denominated in. Currently always `"usdc"`. */
431
168
  totalBalanceAsset: string;
432
169
  agentBalances: Record<AgentId, AgentBalance>;
433
- /** Omitted agents failed to load; they must not be interpreted as zero. */
434
- agentErrors?: Record<AgentId, string>;
170
+ /**
171
+ * Per-agent read failures when an aggregate balance request returned only a
172
+ * partial result. Callers may display the successful balances, but funding
173
+ * operations must not interpret a missing agent as having a zero balance.
174
+ */
175
+ agentErrors?: Partial<Record<AgentId, string>>;
435
176
  /** Absolute provider cooldown deadlines (Unix milliseconds). */
436
- agentRetryAt?: Record<AgentId, number>;
177
+ agentRetryAt?: Partial<Record<AgentId, number>>;
437
178
  }
438
179
  interface AgentEarnings {
439
180
  smartWallet: `0x${string}`;
@@ -443,6 +184,10 @@ interface AgentEarnings {
443
184
  interface OwneyEarnings {
444
185
  totalEarnings: string;
445
186
  agentEarnings: Record<AgentId, AgentEarnings>;
187
+ /** Per-agent failures when an aggregate read returned a partial result. */
188
+ agentErrors?: Partial<Record<AgentId, string>>;
189
+ /** Absolute provider cooldown deadlines (Unix milliseconds). */
190
+ agentRetryAt?: Partial<Record<AgentId, number>>;
446
191
  }
447
192
  type ApyByChainAndAsset = Partial<Record<OwneySupportedChainId, Partial<Record<OwneySupportedTokens, number>>>>;
448
193
  /** A single day's net APY for the connected account, as a percentage number. */
@@ -601,13 +346,170 @@ interface AccountDailyEarnings {
601
346
  assets: AssetDailyEarnings[];
602
347
  }
603
348
 
349
+ type AgentId = "zyfai" | "yieldseeker";
350
+ type Asset = string;
351
+ type AgentSupportedAsset = {
352
+ readonly symbol: string;
353
+ readonly minDepositAmount: string;
354
+ };
355
+ type AgentSupportedAssets = {
356
+ readonly chainId: number;
357
+ readonly chain?: string;
358
+ readonly assets: readonly AgentSupportedAsset[];
359
+ };
360
+ type AvailableAgent = {
361
+ id: AgentId;
362
+ isEnabled: boolean;
363
+ supportedChainIds: readonly number[];
364
+ supportedAssets: readonly AgentSupportedAssets[];
365
+ };
366
+ type AvailableAgentsOptions = {
367
+ chainId?: number;
368
+ asset?: Asset;
369
+ /** Disabled agents are omitted by default because they cannot accept funds. */
370
+ includeDisabled?: boolean;
371
+ };
372
+ /**
373
+ * A lookback window for any "last N days" read — the APY series, the daily
374
+ * earnings series. Named for the window itself, so nothing borrows the APY's
375
+ * name to ask for something else.
376
+ */
377
+ type LookbackDays = "7D" | "14D" | "30D";
378
+ /** Kept so existing callers keep compiling. Prefer `LookbackDays`. */
379
+ type DailyApyDays = LookbackDays;
380
+ type HistoryFilters = {
381
+ fromDate?: string;
382
+ toDate?: string;
383
+ /** Max entries returned per call. Defaults to 10. */
384
+ limit?: number;
385
+ /** Opaque cursor returned by a previous getHistory call. */
386
+ cursor?: string;
387
+ /**
388
+ * Optional asset symbol (e.g. "USDC", "WETH") to scope the history to a
389
+ * single asset. Without it the page blends every asset on the chain, so a
390
+ * consumer showing one asset at a time has to filter client-side — and a
391
+ * page whose entries all belong to the *other* asset then renders empty
392
+ * even though matching entries exist further back. Agents whose backends
393
+ * cannot filter by asset ignore this and return the whole chain's history.
394
+ */
395
+ tokenSymbol?: string;
396
+ };
397
+ type HistoryOptions = {
398
+ agentId?: AgentId;
399
+ filters?: HistoryFilters;
400
+ };
401
+ type WithdrawOptions = {
402
+ asset: Asset;
403
+ amount?: string;
404
+ agentId?: AgentId;
405
+ /** Called after each agent returns; callback failures never change a financial result. */
406
+ onAgentResult?: (agentId: AgentId, result: AgentWithdrawResult) => void;
407
+ };
408
+ type AccountApyOptions = {
409
+ agentId?: AgentId;
410
+ days: LookbackDays;
411
+ /**
412
+ * Optional asset symbol (e.g. "USDC", "WETH") to scope the daily APY series
413
+ * to a specific asset on the active chain. Without it the series blends every
414
+ * position on the chain, so two assets sharing a chain (USDC and WETH on
415
+ * Base/Arbitrum) would render one merged line. Agents whose backends do not
416
+ * expose per-asset positions ignore this. (ROUT-186)
417
+ */
418
+ tokenSymbol?: string;
419
+ };
420
+ /**
421
+ * Options for the daily earnings series. Same shape as `AccountApyOptions` and
422
+ * deliberately its own type: the two reads answer different questions and are
423
+ * free to diverge.
424
+ */
425
+ type DailyEarningsOptions = {
426
+ agentId?: AgentId;
427
+ days: LookbackDays;
428
+ /**
429
+ * Optional asset symbol (e.g. "USDC", "WETH") scoping the series to one
430
+ * asset on the active chain.
431
+ */
432
+ tokenSymbol?: string;
433
+ };
434
+ type AllocationApyOptions = {
435
+ agentId?: AgentId;
436
+ };
437
+ type AgentsApyOptions = {
438
+ agentId?: AgentId;
439
+ days: DailyApyDays;
440
+ /**
441
+ * Optional asset symbol (e.g. "USDC", "WETH") to scope the APY to a
442
+ * specific asset+chain. Ignored by agents whose backends do not yet
443
+ * support per-asset APY.
444
+ */
445
+ tokenSymbol?: string;
446
+ /**
447
+ * Optional chain id for per-asset APY lookups. Typically paired with
448
+ * `tokenSymbol`.
449
+ */
450
+ chainId?: number;
451
+ };
452
+ type DepositOptions = {
453
+ amount: string;
454
+ asset: Asset;
455
+ depositCallback?: DepositCallback;
456
+ agentId?: AgentId;
457
+ onApproved?: () => void;
458
+ };
459
+
460
+ /**
461
+ * One protocol's pool selection on one chain. `pools` holds Zyfai pool NAMES
462
+ * verbatim — matched case-sensitively by customizeBatch, and an unrecognised
463
+ * name makes Zyfai's rebalance engine skip the whole protocol, so these strings
464
+ * must not be normalised anywhere.
465
+ *
466
+ * An empty array means "no usable pools on this chain".
467
+ */
468
+ type OrgPoolSelection = {
469
+ protocolId: string;
470
+ chainId: number;
471
+ pools: string[];
472
+ };
473
+ /**
474
+ * The partner's protocol/pool policy (ROUT-224). Sparse — only protocols they
475
+ * narrowed appear. Optional so an older routing API, which does not return the
476
+ * field, still parses; undefined and null both mean "change nothing".
477
+ */
478
+ type OrgPoolPolicy = {
479
+ autoApproveProtocols: boolean;
480
+ autoApprovePools: boolean;
481
+ selections: OrgPoolSelection[];
482
+ };
483
+ /**
484
+ * The organization's agent execution policy, or null when the partner has never
485
+ * configured one — in which case the agents leave the user's profile alone.
486
+ */
487
+ type OrgAgentConfig = {
488
+ splittingMode: "none" | "automatic" | "force";
489
+ minSplits: number | null;
490
+ poolPolicy?: OrgPoolPolicy | null;
491
+ };
492
+
604
493
  type DepositCallback = (smartWalletAddress: string, chainId: number, amount: string) => Promise<`0x${string}`> | `0x${string}`;
605
494
  interface IAgent {
606
495
  readonly id: string;
607
496
  readonly supportedChainIds: readonly OwneySupportedChainId[];
608
497
  readonly supportedAssets: readonly AgentSupportedAssets[];
498
+ /**
499
+ * Describes how `AgentBalance.tokens` relates to `positions`.
500
+ * Most adapters expose token totals that already include deployed positions.
501
+ * Providers such as Yieldseeker expose idle wallet tokens separately, so
502
+ * withdrawal planning must add matching position amounts.
503
+ */
504
+ readonly balanceComposition?: "tokens-include-positions" | "tokens-plus-positions";
505
+ /**
506
+ * Whether a withdrawal requires an owner-approved wallet transaction.
507
+ * Aggregate withdrawals run these agents before relayer-only agents so a
508
+ * rejected wallet request cannot happen after another leg has committed.
509
+ */
510
+ readonly withdrawalRequiresWalletApproval?: boolean;
609
511
  disconnect(): Promise<void>;
610
- activateAgent(state: ConnectionState, chainId: number): Promise<void>;
512
+ activateAgent(state: ConnectionState, chainId: number, asset?: OwneySupportedTokens): Promise<void>;
611
513
  /**
612
514
  * Apply the organization's agent policy to this user's account.
613
515
  *
@@ -677,7 +579,10 @@ declare class OwneySDK {
677
579
  private apiKey;
678
580
  private orgAgentConfig;
679
581
  private orgAgentConfigPromise;
582
+ private rpcUrls?;
680
583
  private zyfaiRpcUrls?;
584
+ private yieldseekerApiBaseUrl?;
585
+ private yieldseekerSiweOrigin?;
681
586
  private routingApiBaseUrl?;
682
587
  private referralSource?;
683
588
  private cachedSponsoredCallback;
@@ -714,25 +619,16 @@ declare class OwneySDK {
714
619
  private requireState;
715
620
  private requireChainId;
716
621
  private requireConnectedProvider;
717
- /**
718
- * Lazily builds (and caches) the default EIP-3009 sponsored deposit callback
719
- * used when the caller omits `depositCallback`. Wraps the connected EIP-1193
720
- * provider with viem `custom(provider)` to read token meta and sign the
721
- * `TransferWithAuthorization`, then POSTs to the sponsor API.
722
- */
622
+ private getPaidRpcClient;
623
+ /** Builds the default USDC batch callback for the connected wallet. */
723
624
  private getDefaultSponsoredCallback;
724
- /**
725
- * Lazily builds (and caches) the default Permit2 sponsored WETH deposit
726
- * callback used when the caller omits `depositCallback` for a WETH
727
- * deposit. Mirrors `getDefaultSponsoredCallback()` but signs a Permit2
728
- * `PermitTransferFrom` instead of an EIP-3009 authorization.
729
- */
625
+ /** Builds the wallet-native sponsored calls callback for compatible paymasters. */
730
626
  private getDefaultSponsoredCallsCallback;
731
627
  /**
732
628
  * Lazily builds (and caches) the default Permit2 sponsored WETH deposit
733
629
  * callback used when the caller omits `depositCallback` for a WETH deposit.
734
630
  * Mirrors `getDefaultSponsoredCallback()` but signs a Permit2
735
- * `PermitTransferFrom` instead of an EIP-3009 authorization.
631
+ * single-use batch authorization instead of an EIP-3009 authorization.
736
632
  */
737
633
  private getDefaultWethSponsoredCallback;
738
634
  private getAgent;
@@ -768,7 +664,8 @@ declare class OwneySDK {
768
664
  * If provided, ALL specified agents must support the chainId or the call
769
665
  * throws before activating any agent.
770
666
  */
771
- activateAgent(chainId: number, agentId?: AgentId[]): Promise<void>;
667
+ activateAgent(chainId: number, agentId?: AgentId[], asset?: OwneySupportedTokens): Promise<void>;
668
+ private assertActivationSession;
772
669
  /**
773
670
  * Activate agents ONE AT A TIME, each followed by its org policy.
774
671
  *
@@ -782,10 +679,9 @@ declare class OwneySDK {
782
679
  * Serializing costs no real wall-clock: the user can only approve one prompt
783
680
  * at a time anyway.
784
681
  *
785
- * Every agent is attempted even if an earlier one fails, so one declined
786
- * signature can't deny the remaining agents their turn. The first failure is
787
- * rethrown (matching the previous `Promise.all` rejection) once all agents
788
- * have had a chance to activate.
682
+ * Stop at the first failure so a canceled sign-in does not open another
683
+ * agent's wallet prompt. Report any earlier successes for diagnostics; the
684
+ * app discards the session when the complete sign-in does not succeed.
789
685
  */
790
686
  private activateAgentsInTurn;
791
687
  /**
@@ -796,7 +692,8 @@ declare class OwneySDK {
796
692
  * @param options.asset - Asset symbol to deposit (e.g. "USDC")
797
693
  * @param options.depositCallback - Callback that performs the token transfer and returns a tx hash.
798
694
  * When agentId is omitted, this callback is invoked once per eligible agent with that agent's
799
- * split amount and smart wallet address — expect multiple wallet prompts.
695
+ * split amount and smart wallet address. Default sponsored deposits batch
696
+ * all shares into one signature; custom callbacks still run once per agent.
800
697
  * @param options.agentId - Optional explicit target. Otherwise split equally,
801
698
  * or fund remaining agents when a recovery deposit cannot meet every minimum.
802
699
  * @returns {OwneyDepositResult} for a single agent, or {OwneyMultiDepositResult} with per-agent results
@@ -806,10 +703,12 @@ declare class OwneySDK {
806
703
  * Invokes `agent.deposit` with the resolved sponsored callback, composing
807
704
  * two independent auto-recovery mechanisms:
808
705
  *
809
- * 1. Missing Permit2 allowance: when the app did not supply its own
810
- * callback and the attempt fails with `PERMIT2_APPROVAL_REQUIRED` on a
811
- * WETH deposit, this is the wallet's first gasless WETH deposit. We send
812
- * the one-time (user-paid) Permit2 approval via `approvePermit2()` and
706
+ * 1. Missing Permit2 allowance outside the atomic Base-USDC path: when the
707
+ * app did not supply its own callback and the attempt fails with
708
+ * `PERMIT2_APPROVAL_REQUIRED`, this is the wallet's first Permit2 deposit
709
+ * for that token. Base USDC bundles a gasless ERC-2612 approval inside
710
+ * its sponsored deposit and never reaches this branch. Other tokens send
711
+ * the one-time user-paid Permit2 approval via `approvePermit2()` and
813
712
  * retry the SAME sponsored attempt once. Bounded to one approval attempt
814
713
  * per call so a wallet/agent that keeps reporting the allowance as
815
714
  * missing can't loop forever. If `approvePermit2()` itself throws (e.g.
@@ -830,6 +729,7 @@ declare class OwneySDK {
830
729
  private depositWithFallback;
831
730
  private getMinDepositAmount;
832
731
  private splitDepositAmount;
732
+ private formatAgentName;
833
733
  private validateMinDepositAmount;
834
734
  /**
835
735
  * Whether the user already holds a non-zero balance with `agent` for the
@@ -840,137 +740,13 @@ declare class OwneySDK {
840
740
  private hasExistingBalance;
841
741
  private validateAssetSupport;
842
742
  private getEligibleAgents;
843
- /** Lazily built so an app that never swaps pays nothing for it. */
844
- private swapApiClient?;
845
- private swapApi;
846
743
  /**
847
- * Put the wallet on `chainId`, or fail with something actionable.
848
- *
849
- * Reuses the same guard the deposit rail uses, which re-reads the chain after
850
- * switching — some wallets resolve wallet_switchEthereumChain before the
851
- * network has actually changed.
744
+ * Run owner-approved withdrawals before relayer-only withdrawals. Wallet
745
+ * approval is the only point at which the user can cancel the aggregate
746
+ * operation, so no relayer leg should commit before it has completed.
852
747
  */
853
- private ensureSwapChain;
854
- /**
855
- * Binds the executor's abstract deps to this client's wallet.
856
- *
857
- * Kept as a builder rather than baked into the executor so the whole swap
858
- * flow stays testable without a provider — the executor never imports viem.
859
- */
860
- private buildSwapDeps;
861
- /**
862
- * Assets the user may pay with, and what each chain deposits into.
863
- *
864
- * The source list is deliberately wider than the deposit list: it includes
865
- * native ETH and USDT, which Owney never holds but users often do.
866
- */
867
- getSwapTokens(): Promise<{
868
- chains: SwapChainTokens[];
869
- }>;
870
- /**
871
- * Price a swap without committing to it.
872
- *
873
- * `dstAmountMin` is the number to validate against a deposit minimum —
874
- * `dst.amount` is an estimate that a decaying auction or slippage can undercut,
875
- * and a swap landing below the floor leaves the user swapped but not
876
- * deposited.
877
- */
878
- getSwapQuote(params: SwapQuoteParams): Promise<SwapQuote>;
879
- /**
880
- * Swap an asset the user holds into a deposit asset, then deposit it.
881
- *
882
- * Kept separate from `deposit()` rather than bolted on as an option: the
883
- * return shape differs, the staging callback is meaningless on the plain
884
- * path, and integrators who never swap should not have to reason about any
885
- * of it.
886
- *
887
- * The deposit runs on the MEASURED arrival, not the quote. A quote is an
888
- * estimate, so depositing the quoted figure would either strand dust or try
889
- * to move funds that never came.
890
- *
891
- * Failure modes differ in a way callers must respect. A same-chain swap is
892
- * atomic — if it fails, nothing moved. A cross-chain swap escrows the user's
893
- * funds first, so SWAP_ORDER_EXPIRED / REFUNDED / CANCELLED all mean the
894
- * money left the wallet. Only the former can honestly say "nothing has left
895
- * your wallet".
896
- */
897
- swapAndDeposit(options: {
898
- from: {
899
- chainId: number;
900
- symbol: string;
901
- amount: string;
902
- };
903
- /** Deposit target. Defaults to the active chain's asset when omitted. */
904
- to: {
905
- chainId: number;
906
- symbol: string;
907
- };
908
- agentId?: AgentId;
909
- /** Percent, classic rail only. Fusion+ prices through its auction. */
910
- slippage?: number;
911
- onSwapProgress?: (stage: SwapStage) => void;
912
- }): Promise<{
913
- swap: {
914
- received: string;
915
- orderHash?: string;
916
- txHash?: string;
917
- };
918
- deposit: OwneyDepositResult | OwneyMultiDepositResult;
919
- }>;
920
- /**
921
- * Withdraw from an agent and swap the proceeds into whatever the user wants
922
- * to hold, delivered to their own wallet.
923
- *
924
- * The mirror of `swapAndDeposit()`, with one structural difference that
925
- * drives the whole implementation: a deposit swap starts from funds already
926
- * sitting in the wallet, but a withdrawal has to wait for them. The agent's
927
- * provider acknowledges a withdrawal and *then* queues the on-chain transfer
928
- * to the EOA, so `withdraw()` resolving means "accepted", not "arrived".
929
- * Quoting before the tokens land would size the swap against a balance that
930
- * is not there yet.
931
- *
932
- * The swap is therefore sized from the MEASURED arrival, exactly as the
933
- * deposit path sizes its deposit from the measured swap output. On a full
934
- * withdrawal there is no other number available — "MAX" has no figure until
935
- * the agent picks one.
936
- *
937
- * **Failure here is not symmetrical with the deposit path.** A failed
938
- * deposit-swap leaves the user holding what they started with. A failed
939
- * withdrawal-swap leaves them holding the AGENT'S asset in their own wallet:
940
- * the money is out, safe, and in the wrong denomination. Both
941
- * `WITHDRAW_ARRIVAL_TIMEOUT` and `WITHDRAW_SWAP_FAILED` carry `withdrawn` for
942
- * that reason — the UI has to tell the user where their money actually is,
943
- * and must never present either as a lost withdrawal.
944
- */
945
- withdrawAndSwap(options: {
946
- /** The agent's asset. Must be on the active chain. */
947
- from: {
948
- chainId: number;
949
- symbol: string;
950
- };
951
- /** What to deliver to the wallet. Any swappable asset, including native ETH. */
952
- to: {
953
- chainId: number;
954
- symbol: string;
955
- };
956
- /** Human units ("10.5"). Omit to withdraw the full agent balance. */
957
- amount?: string;
958
- agentId?: AgentId;
959
- /** Percent, classic rail only. Fusion+ prices through its auction. */
960
- slippage?: number;
961
- onSwapProgress?: (stage: SwapStage) => void;
962
- /** How long to wait for the withdrawal to land before giving up on the swap. */
963
- arrivalTimeoutMs?: number;
964
- }): Promise<{
965
- withdraw: OwneyWithdrawResult | AgentWithdrawResult;
966
- /** What actually arrived in the wallet, smallest unit of the agent's asset. */
967
- withdrawn: string;
968
- swap: {
969
- received: string;
970
- orderHash?: string;
971
- txHash?: string;
972
- };
973
- }>;
748
+ private orderAgentsForWithdrawal;
749
+ private isUserRejectedWithdrawal;
974
750
  /**
975
751
  * Withdraw funds from a specific agent, or all agents that support the active chain+asset if agentId is omitted.
976
752
  * Validates that the asset is supported by the target agent(s) on the active chain.
@@ -998,6 +774,7 @@ declare class OwneySDK {
998
774
  * Agents without a refresh capability fall back to their current snapshot.
999
775
  */
1000
776
  refreshEarnings(agentId?: AgentId): Promise<OwneyEarnings | AgentEarnings>;
777
+ private aggregateEarnings;
1001
778
  /**
1002
779
  * Get the weighted APY for the user's account over a time period.
1003
780
  * When querying all agents, the total APY is a balance-weighted average.
@@ -1052,14 +829,17 @@ declare class OwneySDK {
1052
829
  */
1053
830
  ensureAutoSelectProtocols(asset: "USDC" | "WETH", agentId?: AgentId): Promise<boolean>;
1054
831
  /**
1055
- * One-time, user-paid approval of Permit2 on the sponsored WETH token for
1056
- * the active chain. Required once per wallet per chain before gasless WETH
1057
- * deposits; afterwards deposit() is signature-only. Resolves only after the
1058
- * approval transaction is mined (1 confirmation), so a subsequent deposit()
1059
- * will see the new allowance; throws if the transaction reverted.
832
+ * User-paid approval of Permit2 on the selected token for the active chain.
833
+ * Grants the maximum ERC20 allowance so later deposits do not require another
834
+ * approval. Resolves after one confirmation so the subsequent deposit attempt
835
+ * sees the new allowance. Deposit retries pass their captured chain id so a
836
+ * concurrent activation cannot redirect the approval to another network.
837
+ *
838
+ * @param requiredAmount Raw base-unit amount the pending deposit must cover.
839
+ * @param expectedChainId Chain captured by the deposit that requested approval.
1060
840
  * @returns the approval transaction hash.
1061
841
  */
1062
- approvePermit2(asset?: "WETH"): Promise<`0x${string}`>;
842
+ approvePermit2(asset?: OwneySupportedTokens, requiredAmount?: bigint, expectedChainId?: OwneySupportedChainId): Promise<`0x${string}`>;
1063
843
  /**
1064
844
  * Get the agent's average APY performance over a time period. Does not require a wallet connection.
1065
845
  * @param options - Contains agentId (optional) and days ("7D", "14D", or "30D")
@@ -1083,7 +863,128 @@ declare class OwneySDK {
1083
863
  getAllocationApy({ agentId, }?: AllocationApyOptions): Promise<OwneyAllocationApy>;
1084
864
  }
1085
865
 
1086
- type OwneyErrorCode = "NOT_CONNECTED" | "NO_ACTIVE_CHAIN" | "WALLET_NO_ACCOUNTS" | "WALLET_ADDRESS_REQUIRED" | "WALLET_NOT_DEPLOYED" | "AGENT_NOT_FOUND" | "AGENT_CHAIN_INCOMPATIBLE" | "AGENT_EMPTY_LIST" | "AGENT_DISABLED" | "CHAIN_UNSUPPORTED" | "CHAIN_NO_COMPATIBLE_AGENTS" | "CHAIN_MISMATCH" | "ASSET_UNSUPPORTED" | "ASSET_NO_COMPATIBLE_AGENTS" | "DEPOSIT_BALANCE_UNAVAILABLE" | "DEPOSIT_PARTIAL_FAILURE" | "DEPOSIT_AMOUNT_BELOW_MINIMUM" | "DEPOSIT_CALLBACK_REQUIRED" | "DEPOSIT_CALLBACK_INVALID" | "DEPOSIT_NO_PERMITTED_TOKENS" | "DEPOSIT_INSUFFICIENT_BALANCE" | "WITHDRAW_NO_PERMITTED_TOKENS" | "WITHDRAW_INSUFFICIENT_BALANCE" | "WITHDRAW_ALL_FAILED" | "WITHDRAW_PARTIAL_FAILURE" | "WITHDRAW_FAILED" | "AGENT_RATE_LIMITED" | "API_ROUTING_ERROR" | "API_ROUTING_FAILED" | "API_NO_AGENTS" | "SPONSOR_REQUEST_FAILED" | "PERMIT2_APPROVAL_REQUIRED" | "SPONSORED_CALLS_UNSUPPORTED" | "SPONSORED_CALLS_NO_ID" | "SPONSORED_CALLS_NO_RECEIPT" | "SWAP_DISABLED" | "SWAP_RATE_LIMITED" | "SWAP_REQUEST_FAILED" | "SWAP_QUOTE_FAILED" | "SWAP_UNSUPPORTED_PAIR" | "SWAP_APPROVAL_REQUIRED" | "SWAP_BELOW_DEPOSIT_MINIMUM" | "SWAP_ORDER_EXPIRED" | "SWAP_ORDER_REFUNDED" | "SWAP_ORDER_CANCELLED" | "WITHDRAW_ARRIVAL_TIMEOUT" | "WITHDRAW_SWAP_FAILED" | "BALANCE_ALL_FAILED" | "ALLOCATION_ALL_FAILED" | "VALIDATION_INVALID_DAYS";
866
+ type YieldseekerAuthDependencies = {
867
+ origin?: string;
868
+ now?: () => Date;
869
+ nonce?: () => string;
870
+ };
871
+
872
+ type YieldseekerFetch = typeof fetch;
873
+
874
+ type YieldseekerTransaction = {
875
+ from: `0x${string}`;
876
+ to: `0x${string}`;
877
+ data: `0x${string}`;
878
+ value: string;
879
+ chainId: number;
880
+ };
881
+
882
+ type YieldseekerAgentOptions = {
883
+ baseUrl?: string;
884
+ fetchFn?: YieldseekerFetch;
885
+ auth?: YieldseekerAuthDependencies;
886
+ /** Dedicated read transport; Base is used for receipt polling. */
887
+ rpcUrls?: RpcUrlsConfig;
888
+ /** Test seam for the wallet-submission/receipt boundary. */
889
+ transactionExecutor?: (state: ConnectionState, chainId: number, transaction: YieldseekerTransaction) => Promise<Hex>;
890
+ /** Test seam for transactions submitted outside transactionExecutor. */
891
+ unwindReceiptWaiter?: (state: ConnectionState, chainId: number, transactionHash: Hex) => Promise<void>;
892
+ };
893
+ declare class YieldseekerAgent implements IAgent {
894
+ readonly id = "yieldseeker";
895
+ readonly balanceComposition: "tokens-plus-positions";
896
+ readonly withdrawalRequiresWalletApproval = true;
897
+ readonly supportedChainIds: readonly [8453];
898
+ readonly supportedAssets: readonly [{
899
+ readonly chainId: 8453;
900
+ readonly chain: "BASE";
901
+ readonly assets: readonly [{
902
+ readonly symbol: "USDC";
903
+ readonly minDepositAmount: "10000000";
904
+ }, {
905
+ readonly symbol: "WETH";
906
+ readonly minDepositAmount: "1";
907
+ }];
908
+ }];
909
+ private readonly api;
910
+ private readonly auth;
911
+ private readonly rpcUrls?;
912
+ private receiptClient?;
913
+ private readonly transactionExecutor?;
914
+ private readonly unwindReceiptWaiter?;
915
+ private readonly agentContexts;
916
+ private readonly users;
917
+ private readonly pendingAgents;
918
+ private readonly pendingWalletContexts;
919
+ private readonly readCache;
920
+ private readonly pendingReads;
921
+ private readGeneration;
922
+ private readonly portfolioVersions;
923
+ private readonly snapshotFailures;
924
+ private readonly standardReadFailures;
925
+ private readonly reconcileUntil;
926
+ private readonly activityRefreshUntil;
927
+ private readonly snapshotMovements;
928
+ private readonly movementEpochs;
929
+ private readonly yieldOptions;
930
+ private readonly pendingYieldOptions;
931
+ constructor(owneyApiKey: string, options?: YieldseekerAgentOptions);
932
+ private getReceiptClient;
933
+ disconnect(): Promise<void>;
934
+ activateAgent(state: ConnectionState, chainId: number, asset?: OwneySupportedTokens): Promise<void>;
935
+ deposit(state: ConnectionState, chainId: number, amount: string, asset: OwneySupportedTokens, depositCallback?: DepositCallback): Promise<OwneyDepositResult>;
936
+ withdraw(state: ConnectionState, chainId: number, asset: OwneySupportedTokens, amount?: string): Promise<AgentWithdrawResult>;
937
+ getBalances(state: ConnectionState, chainId: number): Promise<AgentBalance>;
938
+ getEarnings(state: ConnectionState, chainId: number): Promise<AgentEarnings>;
939
+ getAccountApy(state: ConnectionState, chainId: number, days: DailyApyDays, tokenSymbol?: string): Promise<AccountAgentApy>;
940
+ getHistory(state: ConnectionState, chainId: number, options?: HistoryFilters): Promise<OwneyAgentHistory>;
941
+ getUserProfile(state: ConnectionState, chainId: number): Promise<AgentUserProfile>;
942
+ getAgentApy(days: DailyApyDays, options?: AgentApyOptions): Promise<AgentApy>;
943
+ private loadYieldOptions;
944
+ private userKey;
945
+ private contextKey;
946
+ private assertSession;
947
+ private cachedRead;
948
+ private agentListKey;
949
+ private listAgents;
950
+ private contextForAgent;
951
+ private resolveUser;
952
+ private forgetUser;
953
+ private ensureAgent;
954
+ private findAgent;
955
+ private resolveAgent;
956
+ private loadPortfolio;
957
+ private loadActivityPortfolio;
958
+ private resolvePortfolioContexts;
959
+ private portfolioVersion;
960
+ private portfolioCacheMs;
961
+ private snapshotMovement;
962
+ private advancePortfolioVersion;
963
+ private requestPortfolioSnapshot;
964
+ private portfolioSnapshot;
965
+ private loadPortfolioContext;
966
+ private loadActivityContext;
967
+ private loadPortfolioParts;
968
+ private deployAgent;
969
+ private refreshSnapshotAfterMovement;
970
+ private agentPath;
971
+ private walletRequest;
972
+ private providerRequest;
973
+ private mapApiError;
974
+ private submitTransaction;
975
+ private waitForReceipt;
976
+ private assertTransaction;
977
+ private assertAgent;
978
+ private isOwneyAgent;
979
+ private assetForAgent;
980
+ private isTransactionHash;
981
+ private assertChain;
982
+ private assertOptionalChain;
983
+ private assertAsset;
984
+ private invalidResponse;
985
+ }
986
+
987
+ type OwneyErrorCode = "NOT_CONNECTED" | "NO_ACTIVE_CHAIN" | "WALLET_NO_ACCOUNTS" | "WALLET_ADDRESS_REQUIRED" | "WALLET_NOT_DEPLOYED" | "AGENT_NOT_FOUND" | "AGENT_CHAIN_INCOMPATIBLE" | "AGENT_EMPTY_LIST" | "AGENT_DISABLED" | "AGENT_ACTIVATION_PARTIAL_FAILURE" | "CHAIN_UNSUPPORTED" | "CHAIN_NO_COMPATIBLE_AGENTS" | "CHAIN_MISMATCH" | "ASSET_UNSUPPORTED" | "ASSET_NO_COMPATIBLE_AGENTS" | "DEPOSIT_BALANCE_UNAVAILABLE" | "DEPOSIT_PARTIAL_FAILURE" | "DEPOSIT_AMOUNT_BELOW_MINIMUM" | "DEPOSIT_CALLBACK_REQUIRED" | "DEPOSIT_CALLBACK_INVALID" | "DEPOSIT_NO_PERMITTED_TOKENS" | "DEPOSIT_INSUFFICIENT_BALANCE" | "WITHDRAW_NO_PERMITTED_TOKENS" | "WITHDRAW_BALANCE_UNAVAILABLE" | "WITHDRAW_INSUFFICIENT_BALANCE" | "WITHDRAW_ALL_FAILED" | "WITHDRAW_PARTIAL_FAILURE" | "WITHDRAW_FAILED" | "AGENT_RATE_LIMITED" | "API_ROUTING_ERROR" | "API_ROUTING_FAILED" | "API_NO_AGENTS" | "AGENT_API_ERROR" | "AGENT_AUTH_FAILED" | "AGENT_INVALID_RESPONSE" | "AGENT_TIMEOUT" | "AGENT_TRANSACTION_REVERTED" | "SPONSOR_REQUEST_FAILED" | "PERMIT2_APPROVAL_REQUIRED" | "SPONSORED_CALLS_UNSUPPORTED" | "SPONSORED_CALLS_NO_ID" | "SPONSORED_CALLS_NO_RECEIPT" | "BALANCE_ALL_FAILED" | "EARNINGS_ALL_FAILED" | "ALLOCATION_ALL_FAILED" | "VALIDATION_INVALID_DAYS";
1087
988
  declare class OwneyError extends Error {
1088
989
  readonly code: OwneyErrorCode;
1089
990
  readonly details?: Record<string, unknown>;
@@ -1149,40 +1050,4 @@ type OwneySIWXConfig = {
1149
1050
  */
1150
1051
  declare function createOwneySIWX(config: OwneySIWXConfig): SIWXConfig;
1151
1052
 
1152
- /**
1153
- * Persists cross-chain swap secrets so an in-flight order survives a reload.
1154
- *
1155
- * This is not a convenience. A Fusion+ order is only completable by whoever
1156
- * holds the secret preimages: the resolver deploys escrows, then waits for the
1157
- * secret before it can claim and release funds to the user. Lose the secrets
1158
- * mid-order and the swap cannot complete — the user waits out the cancellation
1159
- * timelock for a refund instead.
1160
- *
1161
- * That matters here because the UI explicitly tells the user "you can safely
1162
- * close this window", so surviving a reload is a requirement, not a nicety.
1163
- *
1164
- * Trade-off: the same one `zyfai.auth-cache` makes. Secrets in `localStorage`
1165
- * are exposed to XSS, but they are single-use, worthless once the order
1166
- * settles, and only ever unlock funds back to the user's own wallet.
1167
- */
1168
- type StoredOrder = {
1169
- orderHash: string;
1170
- /** Preimages, one per fill. Index matters — fill N needs secret N. */
1171
- secrets: string[];
1172
- /** Chain the funds left from, so a resumed session can report it. */
1173
- srcChainId: number;
1174
- /** For the resumed UI: what the user was paying with and expecting. */
1175
- srcSymbol: string;
1176
- dstSymbol: string;
1177
- dstChainId: number;
1178
- amount: string;
1179
- /** Epoch ms. Used to drop orders far past any plausible timelock. */
1180
- createdAt: number;
1181
- };
1182
- /**
1183
- * Every stored order, newest first, dropping anything past MAX_AGE_MS.
1184
- * Used on mount to resume orders the user left in flight.
1185
- */
1186
- declare function listOrders(now?: number): StoredOrder[];
1187
-
1188
- export { type AccountAgentApy, type AccountApyOptions, type AccountDailyEarnings, type AgentApy, type AgentApyDetails, type AgentBalance, AgentChainIncompatibleError, type AgentEarnings, type AgentHistoryEntry, type AgentHistoryPosition, type AgentId, AgentNotFoundError, type AgentSupportedAsset, type AgentSupportedAssets, type AgentUserProfile, type AgentWithdrawResult, type AgentsApyOptions, type AllocationAgentApy, type AllocationApyOptions, type ApyByChainAndAsset, type ApyHistoryPoint, type Asset, type AssetDailyEarnings, type AvailableAgent, type AvailableAgentsOptions, type ConnectionState, type DailyApyDays, type DailyEarningsOptions, type DailyEarningsPoint, type DepositCallback, type DepositOptions, type HistoryAction, type HistoryFilters, type HistoryOptions, type HistoryTransaction, type IAgent, InvalidHistoryCursorError, type LookbackDays, NotConnectedError, type OwneyAccountApy, type OwneyAgentApy, type OwneyAgentHistory, type OwneyAllocationApy, type OwneyBalances, type OwneyDepositResult, type OwneyEarnings, OwneyError, type OwneyErrorCode, type OwneyMultiDepositResult, type OwneyPosition, OwneySDK, type OwneySDKConfig, type OwneySIWXConfig, type OwneySupportedChainId, type OwneySupportedChains, type OwneySupportedTokens, type OwneyToken, type OwneyUserProfile, type OwneyWithdrawResult, type RebalanceLog, type SwapChainTokens, type SwapDirection, type SwapOrderStatus, type SwapQuote, type SwapQuoteParams, type SwapRail, type SwapStage, type SwapTokenInfo, type WithdrawOptions, createOwneySIWX, listOrders as listPendingSwaps, setOwneyDebug };
1053
+ export { type AccountAgentApy, type AccountApyOptions, type AccountDailyEarnings, type AgentApy, type AgentApyDetails, type AgentBalance, AgentChainIncompatibleError, type AgentEarnings, type AgentHistoryEntry, type AgentHistoryPosition, type AgentId, AgentNotFoundError, type AgentSupportedAsset, type AgentSupportedAssets, type AgentUserProfile, type AgentWithdrawResult, type AgentsApyOptions, type AllocationAgentApy, type AllocationApyOptions, type ApyByChainAndAsset, type ApyHistoryPoint, type Asset, type AssetDailyEarnings, type AvailableAgent, type AvailableAgentsOptions, type ConnectionState, type DailyApyDays, type DailyEarningsOptions, type DailyEarningsPoint, type DepositCallback, type DepositOptions, type HistoryAction, type HistoryFilters, type HistoryOptions, type HistoryTransaction, type IAgent, InvalidHistoryCursorError, type LookbackDays, NotConnectedError, type OwneyAccountApy, type OwneyAgentApy, type OwneyAgentHistory, type OwneyAllocationApy, type OwneyBalances, type OwneyDepositResult, type OwneyEarnings, OwneyError, type OwneyErrorCode, type OwneyMultiDepositResult, type OwneyPosition, OwneySDK, type OwneySDKConfig, type OwneySIWXConfig, type OwneySupportedChainId, type OwneySupportedChains, type OwneySupportedTokens, type OwneyToken, type OwneyUserProfile, type OwneyWithdrawResult, type RebalanceLog, type RpcUrlsConfig, type WithdrawOptions, YieldseekerAgent, type ZyfaiRpcUrlsConfig, createOwneySIWX, setOwneyDebug };