@owney/sdk 0.7.32-beta.1 → 0.7.32-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.cts CHANGED
@@ -275,6 +275,13 @@ type FundingOperationLeg = {
275
275
  * "definitely not booked".
276
276
  */
277
277
  providerBookedAt: string | null;
278
+ /** The provider's own id for this leg (e.g. a withdrawal or deposit id), as stored; null when none. */
279
+ providerRef: string | null;
280
+ /**
281
+ * The server stopped checking this in-flight leg (no outcome was proven).
282
+ * Present only when true; a new fact reported for the leg reopens it.
283
+ */
284
+ closed?: true;
278
285
  };
279
286
  /** One ledger operation, as the API returns it. */
280
287
  type FundingOperationRow = {
@@ -356,6 +363,15 @@ interface OwneySDKConfig {
356
363
  * already-deployed app: set `globalThis.__OWNEY_DEBUG__ = true` in devtools.
357
364
  */
358
365
  debug?: boolean;
366
+ /**
367
+ * When true, the organization's pool policy is NOT applied on connect, so a
368
+ * user's own deposit-time pool selection (ROUT-569) is never overwritten by
369
+ * the org-level one on their next reconnect. Splitting and the rest of the
370
+ * org policy still apply. Turn this on in apps that expose the deposit-time
371
+ * Pools step (the spread flow); leave it off where the partner dashboard's
372
+ * pool customization is the source of truth.
373
+ */
374
+ userPoolCustomization?: boolean;
359
375
  /**
360
376
  * Absolute URL of an ERC-7677 paymaster service. When set, deposits go out as
361
377
  * an EIP-5792 `wallet_sendCalls` with `capabilities.paymasterService`, so a
@@ -380,11 +396,45 @@ interface OwneySDKConfig {
380
396
  * `OWNEY_WITHDRAWAL_RESERVATION_DISABLED=1` in the environment acts as `"off"`.
381
397
  */
382
398
  withdrawalReservation?: "fail-open" | "fail-closed" | "off";
399
+ /**
400
+ * Hand Zyfai withdrawals and deposit registrations, with the user's Zyfai
401
+ * session, to the Owney routing API, which then sends them itself (default
402
+ * off). Only `true`, or a function that returns `true`, opts in.
403
+ *
404
+ * A function is called for each operation, at the moment it would first
405
+ * hand a withdrawal or a registration off, so an app can turn the handoff on
406
+ * or off in open tabs without a reload. A function that throws counts as
407
+ * off.
408
+ *
409
+ * Off, the SDK hands no new operation off, never sends the Zyfai session to
410
+ * Owney for it, and behaves as before. Turning it off never makes the
411
+ * browser send what the server may already hold: an operation this SDK
412
+ * instance already handed off keeps going through the server (its nudges,
413
+ * re-runs, retries and registration recovery). Recovery of a deposit handed
414
+ * off by an earlier page waits until it is on again.
415
+ */
416
+ zyfaiServerTasks?: boolean | (() => boolean);
417
+ /**
418
+ * Hand each signed cross-chain (Fusion+) order's secrets to the Owney
419
+ * routing API, which publishes them once 1inch is ready, so the swap
420
+ * completes even if the tab closes (default false). Only `true` opts in.
421
+ * Off, the secrets never leave the browser and swaps behave as before. On,
422
+ * the browser still publishes them too.
423
+ */
424
+ fusionSecretHandoff?: boolean;
383
425
  }
384
426
  interface ConnectionState {
385
427
  provider: any;
386
428
  walletAddress: `0x${string}`;
387
429
  chainId: number | null;
430
+ /**
431
+ * Reads under this state use a saved sign-in only: an agent never opens a
432
+ * wallet prompt for them and fails instead. Set by the whole-portfolio reads
433
+ * of an agent that is not active on the connection chain, and by every read
434
+ * of an agent that did not sign in this session (it failed while another
435
+ * agent signed in, or the user cancelled its sign-in).
436
+ */
437
+ promptless?: boolean;
388
438
  }
389
439
  declare const SUPPORTED_TOKENS: readonly ["USDC", "WETH"];
390
440
  declare const SUPPORTED_CHAIN_IDS: readonly [8453, 42161, 1];
@@ -393,6 +443,44 @@ type OwneySupportedChainId = (typeof SUPPORTED_CHAIN_IDS)[number];
393
443
  type OwneySupportedChains = (typeof SUPPORTED_CHAINS)[number];
394
444
  type OwneySupportedTokens = (typeof SUPPORTED_TOKENS)[number];
395
445
 
446
+ /** Capability flag: this SDK can hand Zyfai withdrawals and deposit
447
+ * registrations to the server, and marks such legs with evidence `serverTask`.
448
+ * Older builds do not export this. */
449
+ declare const ZYFAI_SERVER_TASKS: 1;
450
+ /** A `zyfai_withdrawal` task that failed with one of these codes never sent
451
+ * the withdrawal to Zyfai. */
452
+ declare const ZYFAI_WITHDRAWAL_NOT_SENT_CODES: ReadonlySet<string>;
453
+ /** A `zyfai_deposit_registration` task that failed with one of these codes
454
+ * never registered the deposit with Zyfai, so the browser may register it. */
455
+ declare const ZYFAI_REGISTRATION_NOT_SENT_CODES: ReadonlySet<string>;
456
+ type ZyfaiTaskResult = {
457
+ providerWithdrawalId?: string;
458
+ providerDepositId?: string;
459
+ txHash?: string;
460
+ asyncPending?: true;
461
+ handedOff?: "reconciler";
462
+ lifecycle?: "failed";
463
+ };
464
+ /**
465
+ * - accepted: the server has a task for this leg (its state and code);
466
+ * - declined: the server proved no task was created (a 200 decline, or a 400,
467
+ * 401, 403, 404, 409 or 429; or `ZYFAI_SERVER_TASKS_OFF_CODE` without the
468
+ * opt-in);
469
+ * - unknown: anything else. The server may have a task.
470
+ */
471
+ type ZyfaiHandoffAnswer = {
472
+ type: "accepted";
473
+ taskId: string;
474
+ state: string;
475
+ code?: string;
476
+ result: ZyfaiTaskResult;
477
+ } | {
478
+ type: "declined";
479
+ code: string;
480
+ } | {
481
+ type: "unknown";
482
+ };
483
+
396
484
  /**
397
485
  * One protocol's pool selection on one chain. `pools` holds Zyfai pool NAMES
398
486
  * verbatim — matched case-sensitively by customizeBatch, and an unrecognised
@@ -426,6 +514,119 @@ type OrgAgentConfig = {
426
514
  poolPolicy?: OrgPoolPolicy | null;
427
515
  };
428
516
 
517
+ /**
518
+ * Pool policy: Owney's org-level protocol/pool policy -> Zyfai's two mismatched
519
+ * write shapes.
520
+ *
521
+ * Zyfai splits "which protocols and pools may this user's funds sit in" across
522
+ * two calls that do not share an axis:
523
+ *
524
+ * updateUserProfile({ protocols }) per ASSET, chain-agnostic
525
+ * customizeBatch([{ protocolId, per (PROTOCOL, CHAIN), asset-agnostic
526
+ * chainId, pools, autoselect }])
527
+ *
528
+ * `protocols` is an explicit ALLOW-LIST: a protocol left out of it is disabled
529
+ * for that asset, on every chain, immediately. `customizeBatch` is the opposite
530
+ * shape — one record per (protocol, chain) pair, asset-agnostic, and per
531
+ * docs.zyf.ai it "creates or updates a record for the (user, protocol, chain)
532
+ * combination"; "previous customizations for the same combination are
533
+ * overwritten".
534
+ *
535
+ * That second property is the reason this file exists rather than a single
536
+ * flat translation: customizeBatch overwrites only the combinations it is
537
+ * GIVEN. The partner's stored policy (`OrgPoolPolicy.selections`) is sparse —
538
+ * only the protocols they actually narrowed appear — but the payload we send
539
+ * must be EXHAUSTIVE over every (protocol, chain) pair Zyfai offers this user.
540
+ * If we only sent the narrowed pairs, a partner who restricts Morpho, saves,
541
+ * then later re-ticks every pool box would never be able to undo it: nothing
542
+ * in the (sparse) policy would tell us to send a record clearing it, and the
543
+ * old restrictive record would stay live on the user's profile forever.
544
+ *
545
+ * Pure functions, kept out of the agent so the mapping is testable without a
546
+ * Zyfai client. See splitting.ts for the same pattern on the other lever.
547
+ */
548
+
549
+ /** One selectable pool, with the figures the deposit-time Pools step shows. */
550
+ type AvailablePool = {
551
+ chainId: number;
552
+ token: string;
553
+ name: string;
554
+ /** combined_apy (pool + rewards), already a percent. null when absent. */
555
+ apy: number | null;
556
+ /** TVL in USD. null when absent. See ZyfCustomizationPoolInfo: `tvl` is in
557
+ * the pool's own token, `tvlUsd` is the dollar figure — only the latter is
558
+ * safe to show with a currency symbol. */
559
+ tvlUsd: number | null;
560
+ /** Per-pool deep link (e.g. the Morpho vault page). null when absent. */
561
+ link: string | null;
562
+ /**
563
+ * The pool's on-chain vault address. Yieldseeker identifies its pools by it.
564
+ * Zyfai identifies its pools by name and sends no address, so for Zyfai it is
565
+ * read from the pool's link where that names a vault (Morpho and Euler
566
+ * vaults) and is unset otherwise. It is how the same vault offered by two
567
+ * agents is recognised.
568
+ */
569
+ address?: string;
570
+ };
571
+ /** Public Zyfai strategies used by deposit-time pool customization. */
572
+ type PoolSelectionStrategy = "aggressive" | "yieldmaxxing";
573
+ /** One asset's explicit choice for a protocol on one chain. */
574
+ type UserPoolSelection = {
575
+ asset: "USDC" | "WETH";
576
+ protocolId: string;
577
+ chainId: number;
578
+ /**
579
+ * Names enabled by the user for this asset/protocol/chain. Empty, with
580
+ * `availablePools` not empty, means the user chose none of them.
581
+ */
582
+ pools: string[];
583
+ /** Every name shown for this asset/protocol/chain in the superset catalog. */
584
+ availablePools: string[];
585
+ };
586
+ /**
587
+ * The complete saved draft for the asset/chain legs selected in the deposit.
588
+ *
589
+ * Every agent keeps at least one pool (2026-11-11): a request whose every
590
+ * entry for an asset and chain has empty `pools` (with pools shown) is
591
+ * refused with POOL_SELECTION_REQUIRED before anything is written, unless
592
+ * (Zyfai) a protocol the request does not touch keeps a pool there. A "none
593
+ * chosen" saved before that rule is still read back as none. Entries that
594
+ * showed nothing (`availablePools` empty) change nothing.
595
+ */
596
+ type UserPoolSelectionRequest = {
597
+ strategies: Array<{
598
+ asset: "USDC" | "WETH";
599
+ strategy: PoolSelectionStrategy;
600
+ }>;
601
+ selections: UserPoolSelection[];
602
+ };
603
+ /**
604
+ * What a user's account currently has saved (ROUT-650): each asset's strategy,
605
+ * plus the pool list of every protocol/chain pair frozen by an earlier Save.
606
+ * Pairs Zyfai still autoselects are left out, so "no entry" means "default"
607
+ * (nothing saved). A pair that is present with empty `pools` means none
608
+ * chosen: the user picked none of that pair's pools.
609
+ */
610
+ type SavedPoolSelection = {
611
+ strategies: Array<{
612
+ asset: "USDC" | "WETH";
613
+ strategy: string;
614
+ }>;
615
+ pairs: Array<{
616
+ protocolId: string;
617
+ chainId: number;
618
+ pools: string[];
619
+ }>;
620
+ };
621
+ /** One protocol with its pools for the deposit asset — what the Pools step
622
+ * renders: a protocol row that opens to a list of selectable pools. */
623
+ type PoolCatalogProtocol = {
624
+ protocolId: string;
625
+ name: string;
626
+ logo: string | null;
627
+ pools: AvailablePool[];
628
+ };
629
+
429
630
  type DepositCallback = (smartWalletAddress: string, chainId: number, amount: string) => Promise<`0x${string}`> | `0x${string}`;
430
631
  /**
431
632
  * Read access to the funding ledger, given to agents by the client so they can
@@ -449,6 +650,23 @@ type AgentFundingLedgerAccess = {
449
650
  before: Date;
450
651
  }): Promise<ProviderSnapshotSample | null>;
451
652
  };
653
+ /**
654
+ * What an agent did with a confirmed-deposit notice (`IAgent.depositConfirmed`).
655
+ * `attempts` counts the provider calls made. `allocated` is set when the agent
656
+ * checked whether the deposit was put to work; `allocatesAfter` (ISO) is when
657
+ * the provider will act on it at the earliest, when it said so.
658
+ */
659
+ type DepositNotice = {
660
+ notified: true;
661
+ attempts?: number;
662
+ allocated?: boolean;
663
+ reason?: string;
664
+ allocatesAfter?: string;
665
+ } | {
666
+ notified: false;
667
+ reason: string;
668
+ attempts?: number;
669
+ };
452
670
  interface IAgent {
453
671
  readonly id: string;
454
672
  readonly supportedChainIds: readonly OwneySupportedChainId[];
@@ -466,8 +684,48 @@ interface IAgent {
466
684
  * rejected wallet request cannot happen after another leg has committed.
467
685
  */
468
686
  readonly withdrawalRequiresWalletApproval?: boolean;
687
+ /**
688
+ * Settles this agent's own wallet prompts (a login, a session key) so that a
689
+ * following `withdraw` needs none. A multi-agent withdrawal calls it before a
690
+ * wallet-approval agent's owner signature, so two prompts never overlap and
691
+ * this agent can start as soon as that signature was accepted. Never submits
692
+ * a withdrawal. A rejected prompt throws; other failures are left to `withdraw`.
693
+ */
694
+ prepareWithdrawal?(state: ConnectionState, chainId: number, token: OwneySupportedTokens): Promise<void>;
695
+ /**
696
+ * The adapter can hand its withdrawal to our server (part 4, Zyfai). Only
697
+ * such agents get the plan-time handoff and a `planned` withdraw context;
698
+ * every other agent keeps today's calls.
699
+ */
700
+ readonly supportsServerTasks?: true;
701
+ /**
702
+ * Hands a planned withdrawal leg to our server before an earlier
703
+ * wallet-approval leg is signed (`after`: those legs' keys). The server sends
704
+ * it once those legs are accepted. Never throws; never withdraws locally.
705
+ * `amount` is the leg's planned share, or "MAX". `beforeRequest` runs right
706
+ * before the request leaves (never when none is sent), so the caller can
707
+ * save the leg's server mark first.
708
+ */
709
+ handOffPlannedWithdrawal?(state: ConnectionState, chainId: number, token: OwneySupportedTokens, amount: string, ctx: {
710
+ operationId: string;
711
+ after: string[];
712
+ beforeRequest?: () => void;
713
+ }): Promise<ZyfaiHandoffAnswer>;
469
714
  disconnect(): Promise<void>;
715
+ /**
716
+ * Ready the user's account for every asset the agent supports on `chainId`,
717
+ * `asset` first. A failure the provider says will not go away (the user can
718
+ * never have this agent) carries `details.permanent: true`, and the client
719
+ * then refuses the whole connect (`AGENT_ACTIVATION_BLOCKED`).
720
+ */
470
721
  activateAgent(state: ConnectionState, chainId: number, asset?: OwneySupportedTokens): Promise<void>;
722
+ /**
723
+ * True when the provider reported this session that the user cannot have an
724
+ * agent for this chain and asset (Yieldseeker's active-agent limit). Callers
725
+ * leave the slot out of deposits. Optional: an agent without such a limit
726
+ * omits it.
727
+ */
728
+ isSlotUnavailable?(state: ConnectionState, chainId: number, asset: OwneySupportedTokens): boolean;
471
729
  /**
472
730
  * Apply the organization's agent policy to this user's account.
473
731
  *
@@ -481,12 +739,72 @@ interface IAgent {
481
739
  * unchanged rather than break the connect.
482
740
  */
483
741
  applyOrgPolicy?(state: ConnectionState, chainId: number, policy: OrgAgentConfig): Promise<void>;
484
- deposit(state: ConnectionState, chainId: number, amount: string, asset: OwneySupportedTokens, depositCallback?: DepositCallback, onProgress?: FundingProgress, onBeforeSubmission?: (evidence: FundingEvidence) => void | Promise<void>): Promise<OwneyDepositResult>;
485
- withdraw(state: ConnectionState, chainId: number, token: OwneySupportedTokens, amount?: string, onProgress?: FundingProgress, gasMode?: "auto" | "sponsored" | "paid", onBeforeSubmission?: FundingProgress, assertCurrent?: () => void): Promise<AgentWithdrawResult>;
742
+ /**
743
+ * The deposit-time pool catalogue for one asset and strategy: protocols with
744
+ * their selectable pools and figures. Optional — an agent with no pool
745
+ * customization omits it. (ROUT-569)
746
+ */
747
+ getPoolCatalog?(params: {
748
+ asset: string;
749
+ strategy: "conservative" | "aggressive" | "yieldmaxxing";
750
+ }): Promise<PoolCatalogProtocol[]>;
751
+ /**
752
+ * Apply a user's own pool selection to their account, driven by the
753
+ * deposit-time Pools step. Optional. A failure throws, and the caller
754
+ * must not start the deposit. A save must also reach money already
755
+ * invested: Zyfai rebalances on its own, Yieldseeker is told with
756
+ * `deposit-made`. Every agent keeps at least one pool: a selection that
757
+ * would leave the agent with no pool for an asset on a chain it offers pools
758
+ * for throws POOL_SELECTION_REQUIRED before anything is written.
759
+ * `state` is the client's connection, or undefined when there is none; an
760
+ * agent that signs in per call (Yieldseeker) needs it, and one that is
761
+ * already connected (Zyfai) ignores it. (ROUT-569)
762
+ */
763
+ setPoolSelection?(selection: UserPoolSelectionRequest, state?: ConnectionState): Promise<void>;
764
+ /**
765
+ * Read back what `setPoolSelection` saved, for the pairs and assets given,
766
+ * so the Pools step can open on the user's own choices. Optional. (ROUT-650)
767
+ */
768
+ getPoolSelection?(state: ConnectionState, chainId: number, params: {
769
+ pairs: Array<{
770
+ protocolId: string;
771
+ chainId: number;
772
+ }>;
773
+ assets: Array<"USDC" | "WETH">;
774
+ }): Promise<SavedPoolSelection>;
775
+ deposit(state: ConnectionState, chainId: number, amount: string, asset: OwneySupportedTokens, depositCallback?: DepositCallback, onProgress?: FundingProgress, onBeforeSubmission?: (evidence: FundingEvidence) => void | Promise<void>,
776
+ /** `operationId`: the funding ledger operation. Zyfai hands the deposit's
777
+ * registration to the server with it (only agents with
778
+ * `supportsServerTasks` get it; every other agent keeps today's call). */
779
+ context?: {
780
+ operationId?: string;
781
+ }): Promise<OwneyDepositResult>;
782
+ withdraw(state: ConnectionState, chainId: number, token: OwneySupportedTokens, amount?: string, onProgress?: FundingProgress, gasMode?: "auto" | "sponsored" | "paid", onBeforeSubmission?: FundingProgress, assertCurrent?: () => void,
783
+ /** `operationId`: the funding ledger operation (Yieldseeker opts in to the
784
+ * server-owned send of its sponsored userOp with it; Zyfai hands its
785
+ * withdrawal to the server with it). `planned`: the leg was handed to the
786
+ * server at plan time, so this call nudges that task (only for agents with
787
+ * `supportsServerTasks`). */
788
+ context?: {
789
+ operationId?: string;
790
+ planned?: true;
791
+ }): Promise<AgentWithdrawResult>;
486
792
  /** Read-only MAX proof at the owner payout block; never sends another withdrawal. */
487
793
  verifyWithdrawalCompletion?(state: ConnectionState, evidence: FundingEvidence): Promise<WithdrawalCompletion>;
488
794
  /** A newly observed pool allocation invalidates this asset's portfolio cache only. */
489
795
  invalidateAllocationRead?(state: ConnectionState, chainId: number, asset: OwneySupportedTokens): void;
796
+ /**
797
+ * A deposit into this agent just confirmed on-chain. An agent whose provider
798
+ * can act on a deposit at once tells it here (Yieldseeker then allocates it
799
+ * instead of waiting for its next scheduled check). The client calls it once
800
+ * per confirmed transfer, in the background: it must never prompt the wallet
801
+ * and never throw. Agents without it rely on their provider's own discovery.
802
+ * An agent that calls its provider more than once, or checks the outcome,
803
+ * reports each call through `onNotice` and resolves with the final outcome.
804
+ */
805
+ depositConfirmed?(state: ConnectionState, chainId: number, evidence: FundingEvidence, onNotice?: (notice: DepositNotice & {
806
+ attempt: number;
807
+ }) => void): Promise<DepositNotice>;
490
808
  /** Invalidate only the confirmed asset. This hook must not sign or submit transactions. */
491
809
  invalidateFundingRead?(state: ConnectionState, chainId: number, asset: OwneySupportedTokens, refreshUntil?: number, txHash?: string): void;
492
810
  /** End accelerated balance reads only for the exact snapshot the caller displayed. */
@@ -504,9 +822,30 @@ interface IAgent {
504
822
  /** Optional positive proof for a repeat deposit; unknown must fall back to portfolio validation. */
505
823
  hasExistingDepositFunds?(state: ConnectionState, chainId: number, asset: OwneySupportedTokens): Promise<true | undefined>;
506
824
  getBalances(state: ConnectionState, chainId: number, asset?: OwneySupportedTokens): Promise<AgentBalance>;
825
+ /**
826
+ * Whether this wallet can be read on `chainId` from a saved sign-in, with no
827
+ * wallet prompt. Lets the whole-portfolio reads include an agent that does
828
+ * not run on the connection chain (Yieldseeker on Base while the wallet is
829
+ * on Arbitrum); agents without it are read only while active.
830
+ */
831
+ hasReadSession?(state: ConnectionState, chainId: number): boolean;
507
832
  getEarnings(state: ConnectionState, chainId: number): Promise<AgentEarnings>;
508
833
  /** Funding-ledger read access for earnings holds. Optional; without it an agent behaves as before. */
509
834
  setFundingLedgerAccess?(access: AgentFundingLedgerAccess | undefined): void;
835
+ /**
836
+ * Called each time the agent maps a provider refusal for a wallet whose
837
+ * account was not created through Owney (AGENT_ACCOUNT_NOT_OWNEY). Optional.
838
+ */
839
+ setAccountRefusedListener?(listener: (() => void) | undefined): void;
840
+ /**
841
+ * May this wallet's account use Owney with this agent? Run at connect for
842
+ * every agent about to activate, before any agent activates or is read.
843
+ * Throws a permanent OwneyError (`details.permanent: true`) when it never
844
+ * can, any other error when it cannot tell now. It may sign in; it must not
845
+ * create agents or read balances. Optional; without it the agent is not
846
+ * checked.
847
+ */
848
+ checkAccount?(state: ConnectionState, chainId: number): Promise<void>;
510
849
  /**
511
850
  * A small, never-prompting read of the provider's earnings bookkeeping for a
512
851
  * `provider.sample` ledger event (Zyfai). Null when unavailable; never throws.
@@ -522,7 +861,14 @@ interface IAgent {
522
861
  * Optional asset symbol ("USDC" / "WETH") scoping the daily series to a
523
862
  * single asset on the chain. Agents without per-asset positions ignore it.
524
863
  */
525
- tokenSymbol?: string): Promise<AccountAgentApy>;
864
+ tokenSymbol?: string,
865
+ /**
866
+ * Chain the series is scoped to, when that differs from the chain the
867
+ * connection is on. `null` spans every chain the wallet held (ROUT-479);
868
+ * omitted means `chainId`. Kept apart from `chainId` because that one
869
+ * still resolves the wallet and must stay a real, connected chain.
870
+ */
871
+ scopeChainId?: number | null): Promise<AccountAgentApy>;
526
872
  /**
527
873
  * Daily cumulative earnings in token units, scoped to a chain/asset, using
528
874
  * the provider's earnings basis. Include an opening snapshot when available
@@ -569,11 +915,29 @@ type AvailableAgent = {
569
915
  supportedChainIds: readonly number[];
570
916
  supportedAssets: readonly AgentSupportedAssets[];
571
917
  };
918
+ type ActivateAgentOptions = {
919
+ /** Limits agent setup to what this asset needs. Omit for every asset. */
920
+ asset?: OwneySupportedTokens;
921
+ /**
922
+ * Called once the chain and agents are registered and every agent's account
923
+ * check has passed (an agent's check may sign it in), before any agent runs
924
+ * its setup. Not called when a check fails. From then on reads such as
925
+ * `getBalances` are safe to start: each agent's reads wait on that agent's
926
+ * own sign-in, so they share the activation's one wallet prompt instead of
927
+ * waiting for all of setup.
928
+ */
929
+ onAgentsSelected?: () => void;
930
+ };
572
931
  type AvailableAgentsOptions = {
573
932
  chainId?: number;
574
933
  asset?: Asset;
575
- /** Disabled agents are omitted by default because they cannot accept funds. */
934
+ /** Disabled agents are omitted by default because they cannot accept funds.
935
+ * Listing them also lists unavailable agents: both may still hold funds. */
576
936
  includeDisabled?: boolean;
937
+ /** Agents unavailable on `chainId` and `asset` this session are omitted by
938
+ * default because they get no deposits: their provider has no agent for the
939
+ * slot. See `OwneySDK.getUnavailableAgentIds`. */
940
+ includeUnavailable?: boolean;
577
941
  };
578
942
  /**
579
943
  * A lookback window for any "last N days" read — the APY series, the daily
@@ -604,6 +968,15 @@ type HistoryOptions = {
604
968
  chainId?: number;
605
969
  agentId?: AgentId;
606
970
  filters?: HistoryFilters;
971
+ /**
972
+ * Chains to read, instead of the one `activateAgent` last set (ROUT-479).
973
+ *
974
+ * Each chain pages independently and the results merge into one
975
+ * chronological list, with every entry stamped with the chain it came from.
976
+ * Omit for the single-chain behaviour, which stays the default: fanning out
977
+ * by default would multiply every existing caller's request count.
978
+ */
979
+ chainIds?: OwneySupportedChainId[];
607
980
  };
608
981
  type WithdrawOptions = {
609
982
  /** Internal orchestration observation deadline; never retries a send. */
@@ -628,6 +1001,12 @@ type WithdrawOptions = {
628
1001
  * their own so the app record and the ledger share one reference. It is also
629
1002
  * the withdrawal reservation's operationId. */
630
1003
  operationId?: string;
1004
+ /**
1005
+ * Groups this withdrawal with the others started by one user action (a
1006
+ * "withdraw all" sends one per asset). A UUID, recorded on the funding
1007
+ * ledger's operation; a value that is not a UUID is ignored.
1008
+ */
1009
+ batchId?: string;
631
1010
  /**
632
1011
  * Cross-device withdrawal reservation options.
633
1012
  * - `override`: the `reference` from an overridable `RESERVED_ELSEWHERE`
@@ -637,6 +1016,11 @@ type WithdrawOptions = {
637
1016
  * this SDK still has that operation's holder token; otherwise ignored.
638
1017
  */
639
1018
  reservation?: WithdrawalReservationOptions;
1019
+ /**
1020
+ * Chain to withdraw from. Defaults to the chain `activateAgent` last set.
1021
+ * See `DepositOptions.chainId` — the same rules apply.
1022
+ */
1023
+ chainId?: number;
640
1024
  };
641
1025
  /** `WithdrawOptions.reservation`: see there. */
642
1026
  type WithdrawalReservationOptions = {
@@ -646,6 +1030,18 @@ type WithdrawalReservationOptions = {
646
1030
  type AccountApyOptions = {
647
1031
  agentId?: AgentId;
648
1032
  days: LookbackDays;
1033
+ /**
1034
+ * Chain to scope the daily series to, instead of the one `activateAgent`
1035
+ * last set (ROUT-479).
1036
+ *
1037
+ * `"all"` blends every chain the wallet held that day, which is what the
1038
+ * chart's "All chains" filter asks for. Unlike the history and earnings
1039
+ * reads this needs no fan-out: the provider's daily-APY payload is already
1040
+ * wallet-wide and names each position's chain, so the scope is a filter over
1041
+ * one response rather than several calls. Omit for the active chain, which
1042
+ * stays the default.
1043
+ */
1044
+ chainId?: OwneySupportedChainId | "all";
649
1045
  /**
650
1046
  * Optional asset symbol (e.g. "USDC", "WETH") to scope the daily APY series
651
1047
  * to a specific asset on the active chain. Without it the series blends every
@@ -663,6 +1059,14 @@ type AccountApyOptions = {
663
1059
  type DailyEarningsOptions = {
664
1060
  agentId?: AgentId;
665
1061
  days: LookbackDays;
1062
+ /**
1063
+ * Chains to read, instead of the one `activateAgent` last set (ROUT-479).
1064
+ *
1065
+ * The same asset is summed across them — USDC on Base and USDC on Arbitrum
1066
+ * are the same unit. Different assets stay apart, as they already do within
1067
+ * one chain. Omit for the single-chain behaviour, which stays the default.
1068
+ */
1069
+ chainIds?: OwneySupportedChainId[];
666
1070
  /**
667
1071
  * Optional asset symbol (e.g. "USDC", "WETH") scoping the series to one
668
1072
  * asset on the active chain.
@@ -693,6 +1097,10 @@ type DepositOptions = {
693
1097
  assertSubmissionCurrent?: () => void;
694
1098
  /** Resume only these already signed relayer bytes; never create a new authorization. */
695
1099
  resumeTxHash?: `0x${string}`;
1100
+ /** Resume only the saved signed batch of a deposit the server may be sending
1101
+ * (its prepare got no answer, so no transaction hash is known); never create
1102
+ * a new authorization. Check it first with `canResumePendingDeposit`. */
1103
+ resumeSavedBatch?: true;
696
1104
  onProgress?: FundingProgress;
697
1105
  /** Awaited immediately before dispatch. Throwing prevents submission.
698
1106
  * All legs of an atomic batch are checkpointed together. */
@@ -701,10 +1109,39 @@ type DepositOptions = {
701
1109
  asset: Asset;
702
1110
  depositCallback?: DepositCallback;
703
1111
  agentId?: AgentId;
1112
+ /**
1113
+ * Agents that must receive nothing from this deposit. The rest split the
1114
+ * whole amount, and only their minimums apply; an excluded agent is not read,
1115
+ * not prioritized as unfunded and not reported on.
1116
+ *
1117
+ * Throws `ALL_AGENTS_EXCLUDED` (before anything is read or sent) when no
1118
+ * agent is left, or when `agentId` itself is listed. Unknown ids are ignored.
1119
+ * Ignored by `resumeTxHash` and `resumeSavedBatch`: a signed batch is already
1120
+ * committed to its wallets and must be finished as signed.
1121
+ */
1122
+ excludeAgentIds?: AgentId[];
704
1123
  onApproved?: () => void;
705
1124
  /** Funding ledger reference (a UUID). Defaults to a new random UUID; apps pass
706
1125
  * their own so the app record and the ledger share one reference. */
707
1126
  operationId?: string;
1127
+ /**
1128
+ * Groups this deposit with the others started by one user action (a spread
1129
+ * deposit sends one per position). A UUID, recorded on the funding ledger's
1130
+ * operation; a value that is not a UUID is ignored.
1131
+ */
1132
+ batchId?: string;
1133
+ /**
1134
+ * Chain to deposit on. Defaults to the chain `activateAgent` last set, so
1135
+ * omitting it behaves exactly as before.
1136
+ *
1137
+ * Pass it to fund several chains in a row without re-activating between
1138
+ * them (ROUT-245's spread strategies). It selects the target; it does not
1139
+ * replace activation, which is what populates `activeAgents`, and it does
1140
+ * not remove the wallet's network switch — the default deposit callbacks
1141
+ * still put the wallet on this chain before signing, since a deposit
1142
+ * signature is EIP-712 with the chain in its domain.
1143
+ */
1144
+ chainId?: number;
708
1145
  };
709
1146
 
710
1147
  type FundingStage = "pending" | "confirmed" | "unknown" | "failed" | "not-applicable";
@@ -752,21 +1189,68 @@ interface FundingEvidence {
752
1189
  maxCompletion?: WithdrawalCompletionContext;
753
1190
  maxCompletionCheck?: WithdrawalCompletion;
754
1191
  intendedAmount: string;
1192
+ /** A multi-agent withdrawal recorded this leg's planned amount (`intendedAmount`:
1193
+ * the leg's share, or "MAX") before any agent was dispatched. A plan, not a
1194
+ * submission: it never says the leg was sent. */
1195
+ planned?: true;
1196
+ /** The owner-authorized call of a wallet-approval withdrawal was accepted: the
1197
+ * bundler accepted the signed userOp (`userOpHash`), the wallet returned a
1198
+ * calls ID (`callsId`), or `eth_sendTransaction` returned a hash (`txHash`).
1199
+ * Not confirmation: the call can still revert. */
1200
+ ownerAuthorization?: "accepted";
755
1201
  confirmedAmount?: string;
756
1202
  /** Receipt delivery and fulfillment of a typed requested amount are separate facts. */
757
1203
  amountCompletion?: "complete" | "shortfall";
758
1204
  /** Verified difference between the typed request and the actual owner payout. */
759
1205
  shortfallAmount?: string;
760
1206
  txHash?: string;
1207
+ /** Zyfai's id for this deposit, from its registration (1-128 chars); reads its placement status. */
1208
+ providerDepositId?: string;
761
1209
  /** Persisted before a sponsored EOA operation is sent. */
762
1210
  userOpHash?: string;
763
1211
  /** Lets recovery verify a consumed nonce even if a bundler forgets the operation. */
764
1212
  userOperation?: UnsignedUserOperationEvidence;
765
1213
  /** Base Account calls ID used to recover an uncertain wallet submission. */
766
1214
  callsId?: string;
1215
+ /** The server owns this sponsored Yieldseeker userOp's send (true), or may
1216
+ * own it ("unknown": the opted-in send got no definitive answer). Either way
1217
+ * the leg is never "not sent". Not acceptance, not confirmation. Never sent
1218
+ * to the ledger. */
1219
+ serverSubmit?: true | "unknown";
1220
+ /** Zyfai server tasks. On a withdrawal leg: the server sends this withdrawal
1221
+ * (true), or may send it ("unknown": the handoff got no definitive answer),
1222
+ * so the browser never sends it. `false`: the server proved it has no task
1223
+ * for this leg, so the browser sends it; it clears an earlier mark (a
1224
+ * handoff checkpoint), and a merge must let it win over true and "unknown".
1225
+ * On a deposit leg: the server registers this deposit. Not acceptance, not
1226
+ * confirmation. Never sent to the ledger. */
1227
+ serverTask?: true | "unknown" | false;
1228
+ /** With `serverTask` on a Zyfai deposit leg: the client operation id of the
1229
+ * server's registration task, so registration recovery can nudge that task
1230
+ * after a reload. Not a secret. Never sent to the ledger. */
1231
+ serverTaskOperationId?: string;
1232
+ /** With `serverTask: "unknown"` on a Zyfai deposit leg: what the server
1233
+ * answered to the registration handoff. "lost": no answer (the server may
1234
+ * or may not have a task), so a later proof of no task lets the browser
1235
+ * register it. "declined": the server declined it with a code that does not
1236
+ * prove no task (e.g. ALREADY_REGISTERED), so the browser never registers
1237
+ * it. Local only: never sent to the ledger. */
1238
+ serverTaskCreate?: "declined" | "lost";
767
1239
  /** Deposit execution was attempted, rather than only prepared. Not confirmation. */
768
1240
  depositSubmission?: "started";
769
1241
  depositAuthorization?: DepositAuthorizationReference;
1242
+ /** The server accepted this sponsored deposit and sends it itself if the
1243
+ * browser does not (true), or may have accepted it ("unknown": the prepare
1244
+ * got no definitive answer, no hash is known yet). Either way it is never
1245
+ * "not sent". Not confirmation. */
1246
+ serverBroadcast?: true | "unknown";
1247
+ /** With `serverBroadcast: "unknown"`: the deposit authorization's Permit2
1248
+ * deadline (unix seconds). After it no deposit of that authorization can
1249
+ * execute. */
1250
+ authorizationDeadline?: number;
1251
+ /** With `serverBroadcast`: the deposit authorization's Permit2 nonce
1252
+ * (decimal); see `checkDepositAuthorization`. */
1253
+ permit2Nonce?: string;
770
1254
  blockNumber?: string;
771
1255
  logIndexes?: number[];
772
1256
  transferLogs?: {
@@ -777,13 +1261,16 @@ interface FundingEvidence {
777
1261
  withdrawalRequest?: {
778
1262
  attempted: boolean;
779
1263
  method?: "GET" | "POST";
780
- path?: "/users/withdraw" | "/users/partial-withdraw";
1264
+ /** The route that answered. v1 paths appear only in evidence saved before @zyfai/sdk 0.10.0. */
1265
+ path?: "/users/withdraw" | "/users/partial-withdraw" | "/users/withdraw/v2" | "/users/partial-withdraw/v2";
781
1266
  elapsedMs?: number;
782
1267
  /** Actual response status captured before the vendor replaces the HTTP error. */
783
1268
  httpStatus?: number;
784
1269
  failure?: "network" | "unauthorized" | "forbidden" | "rate-limited" | "insufficient-balance" | "session-key-missing" | "withdrawal-in-progress" | "other";
785
1270
  /** When the provider accepted the request without a hash (ms since epoch). */
786
1271
  acceptedAt?: number;
1272
+ /** Zyfai's v2 withdrawal id, for the lifecycle lookup (1-128 chars). */
1273
+ providerWithdrawalId?: string;
787
1274
  };
788
1275
  /** Where an on-chain payout search may start, for a hashless acceptance.
789
1276
  * `fromBlock` is the chain head read just before the request (decimal string). */
@@ -795,6 +1282,34 @@ interface FundingEvidence {
795
1282
  delivery: FundingStage;
796
1283
  }
797
1284
  type FundingProgress = (evidence: FundingEvidence) => void;
1285
+ /** The part of Zyfai's withdrawal lifecycle (`GET /users/withdrawals/{id}`) that Owney acts on. */
1286
+ type ZyfaiWithdrawalLifecycle = {
1287
+ status: string;
1288
+ /** The synchronous payout leg has settled. */
1289
+ syncSettled: boolean;
1290
+ /** Hash of the synchronous payout transaction; present only when well formed. */
1291
+ syncTxHash?: `0x${string}`;
1292
+ /** Delayed (protocol-cooldown) redemption legs; empty when none or unreadable. */
1293
+ asyncLegs: {
1294
+ id: string;
1295
+ status: string;
1296
+ estimatedClaimAt?: string;
1297
+ claimTxHash?: `0x${string}`;
1298
+ }[];
1299
+ /** Ids of delayed legs Zyfai reports as failed. */
1300
+ failedAsyncIds: string[];
1301
+ /** When the delayed part is expected to arrive; present only when a valid date. */
1302
+ estimatedClaimAt?: string;
1303
+ /** Zyfai recorded an error for this withdrawal. Its text is never carried. */
1304
+ hasError: boolean;
1305
+ };
1306
+ /** The part of Zyfai's deposit status (`GET /users/deposits/{id}/v2`) that Owney acts on. */
1307
+ type ZyfaiDepositPlacement = {
1308
+ /** `handover_pending | credited | position_pending | positioned | recovered_to_eoa`. */
1309
+ status: string;
1310
+ /** `pending | positioned | skipped | failed`. */
1311
+ positionOutcome?: string;
1312
+ };
798
1313
  interface AssetReadMetadata {
799
1314
  chainId: number;
800
1315
  asset: string;
@@ -906,6 +1421,19 @@ interface OwneyPendingAllocation {
906
1421
  /** ISO timestamp from Zyfai's `updatedAt`, when the payload carries one. */
907
1422
  since?: string;
908
1423
  }
1424
+ /**
1425
+ * A Zyfai delayed redemption in flight (`REQUESTED` or `CLAIMABLE`). Its funds
1426
+ * are in neither `positions` nor `tokens`; display-only, never added to a total.
1427
+ */
1428
+ interface OwneyPendingWithdrawal {
1429
+ id: string;
1430
+ status: string;
1431
+ chainId: number;
1432
+ /** Token symbol as Zyfai reports it. */
1433
+ asset: string;
1434
+ /** Redeemed amount in least units, as a decimal string. */
1435
+ amountRaw: string;
1436
+ }
909
1437
  interface AgentBalance {
910
1438
  readMetadata?: AssetReadMetadata[];
911
1439
  /** Authoritative native balances per asset/network, including idle and invested funds. */
@@ -929,6 +1457,41 @@ interface AgentBalance {
929
1457
  positions?: OwneyPosition[];
930
1458
  /** Funds received but not yet deployed. Omitted when nothing is pending. */
931
1459
  pendingAllocations?: OwneyPendingAllocation[];
1460
+ /** Zyfai only: delayed redemptions still in flight. Omitted when none. Never part of a total. */
1461
+ pendingWithdrawals?: OwneyPendingWithdrawal[];
1462
+ /**
1463
+ * Zyfai only: every delayed redemption Zyfai lists except FAILED, recently
1464
+ * CLAIMED ones included (Zyfai keeps them about a day). Present, possibly
1465
+ * empty, whenever Zyfai sent the list; absent when it did not. Empty means no
1466
+ * older delayed payout can be landing now. Never part of a total.
1467
+ */
1468
+ recentAsyncWithdrawals?: OwneyRecentAsyncWithdrawal[];
1469
+ }
1470
+ /** A delayed Zyfai redemption by status, for telling a new payout from an older remainder. */
1471
+ type OwneyRecentAsyncWithdrawal = {
1472
+ id: string;
1473
+ status: string;
1474
+ chainId: number;
1475
+ asset: string;
1476
+ };
1477
+ /**
1478
+ * One position drained by `withdrawAll()` — a chain and asset pair.
1479
+ *
1480
+ * Carries either a result or an error, never both: a leg that failed while
1481
+ * others succeeded is the normal case, not an exception, and the caller needs
1482
+ * to name the ones that did not arrive.
1483
+ */
1484
+ interface OwneyWithdrawAllLeg {
1485
+ chainId: OwneySupportedChainId;
1486
+ asset: OwneySupportedTokens;
1487
+ /** What the position held when the sweep started. */
1488
+ amount: string;
1489
+ result?: OwneyWithdrawResult | AgentWithdrawResult;
1490
+ error?: string;
1491
+ }
1492
+ interface OwneyWithdrawAllResult {
1493
+ /** Every position attempted, in the order it was attempted. */
1494
+ legs: OwneyWithdrawAllLeg[];
932
1495
  }
933
1496
  interface OwneyBalances {
934
1497
  totalBalance: string;
@@ -958,17 +1521,61 @@ interface OwneyEarnings {
958
1521
  agentRetryAt?: Partial<Record<AgentId, number>>;
959
1522
  }
960
1523
  type ApyByChainAndAsset = Partial<Record<OwneySupportedChainId, Partial<Record<OwneySupportedTokens, number>>>>;
1524
+ /** One external reward program contributing percentage points to a day. */
1525
+ interface ApyIncentive {
1526
+ source: "merkl";
1527
+ agentId: AgentId;
1528
+ opportunityId: string;
1529
+ /** All on-chain campaigns represented by the opportunity APR that day. */
1530
+ campaignIds: string[];
1531
+ /** Source APR before portfolio weighting, expressed as a percentage. */
1532
+ apr: number;
1533
+ /** Percentage points to add to this point's native/provider `apy`. */
1534
+ apyContribution: number;
1535
+ }
961
1536
  /** A single day's net APY for the connected account, as a percentage number. */
962
1537
  interface ApyHistoryPoint {
963
1538
  /** ISO date string for the day, e.g. "2026-06-20". */
964
1539
  date: string;
965
- /** Net (after-fee) weighted APY for that day, summed across tokens. */
1540
+ /** Native/provider net APY. External incentives are deliberately excluded. */
966
1541
  apy: number;
967
1542
  /** Balance on this date, in the explicitly named unit; never today's balance. */
968
1543
  historicalBalance?: {
969
1544
  amount: number;
970
1545
  unit: string;
971
1546
  };
1547
+ /** Best-effort external rewards. Absent when none apply or cannot be read. */
1548
+ incentives?: ApyIncentive[];
1549
+ }
1550
+ /**
1551
+ * What the APY chart's chain/asset menus are allowed to offer, and how far
1552
+ * back each option reaches (ROUT-479).
1553
+ *
1554
+ * An option only earns a place if some day in the window held a real position
1555
+ * on it — a balance and a rate. Listing anything else would offer a filter
1556
+ * that draws a blank chart. `days` is what the menu prints beside each row,
1557
+ * and the legs genuinely differ: a wallet can hold USDC for a fortnight and
1558
+ * WETH for three days.
1559
+ */
1560
+ interface ApyCoverage {
1561
+ chains: {
1562
+ chainId: number;
1563
+ days: number;
1564
+ }[];
1565
+ /** Legs whose `tokenSymbol` the provider left unset are absent — they cannot
1566
+ * be named, so they cannot be picked. Their chain still counts. */
1567
+ assets: {
1568
+ asset: string;
1569
+ days: number;
1570
+ }[];
1571
+ /** Each asset on each chain, for a menu that offers the two together
1572
+ * (ROUT-647). The lists above cannot say this: USDC on Base and WETH on
1573
+ * Arbitrum put both chains and both assets in them, and no WETH on Base. */
1574
+ pairs: {
1575
+ chainId: number;
1576
+ asset: string;
1577
+ days: number;
1578
+ }[];
972
1579
  }
973
1580
  interface AccountAgentApy {
974
1581
  walletAddress: string;
@@ -980,6 +1587,8 @@ interface AccountAgentApy {
980
1587
  * date. Empty when the provider returns no daily history.
981
1588
  */
982
1589
  history?: ApyHistoryPoint[];
1590
+ /** Which chains/assets this history can be filtered down to. */
1591
+ coverage?: ApyCoverage;
983
1592
  }
984
1593
  interface OwneyAccountApy {
985
1594
  totalApy: string;
@@ -1039,19 +1648,42 @@ interface AgentHistoryPosition {
1039
1648
  protocol: string;
1040
1649
  pool?: string;
1041
1650
  tokenSymbol?: string;
1651
+ /** The position balance after the action (decimal string, token units). */
1042
1652
  amount?: string;
1653
+ /**
1654
+ * The amount the action actually moved (decimal string, token units), as
1655
+ * opposed to `amount`, the resulting position balance. Present only when the
1656
+ * provider reports it; withheld on withdrawals.
1657
+ */
1658
+ deltaAmount?: string;
1043
1659
  }
1044
1660
  interface AgentHistoryEntry {
1045
1661
  /** Stable provider/transfer identity, independent of row order. */
1046
1662
  id?: string;
1047
1663
  agent: AgentId;
1048
1664
  action: HistoryAction;
1665
+ /**
1666
+ * Chain this entry came from, stamped by the history fan-out (ROUT-479).
1667
+ *
1668
+ * Absent on a single-chain read, where the caller already knows the chain.
1669
+ * The entry has no chain of its own otherwise: `transactions[].chainId` is
1670
+ * optional and missing whenever the indexer has not attached the transfer,
1671
+ * so a row cannot be labelled from it reliably.
1672
+ */
1673
+ chainId?: OwneySupportedChainId;
1049
1674
  date: string;
1050
1675
  oldApy: string | null;
1051
1676
  newApy: string | null;
1052
1677
  transactions: HistoryTransaction[];
1053
1678
  rebalanceLog: RebalanceLog[];
1054
1679
  positions?: AgentHistoryPosition[];
1680
+ /**
1681
+ * Set on a `Withdraw` that was only requested from an async vault
1682
+ * (ROUT-624). The vault pays out in batches later, so the funds have not
1683
+ * reached the wallet yet and `transactions[0].amount` is the amount
1684
+ * requested.
1685
+ */
1686
+ asyncRequest?: true;
1055
1687
  }
1056
1688
  interface OwneyAgentHistory {
1057
1689
  agentErrors?: Partial<Record<AgentId, string>>;
@@ -1168,9 +1800,12 @@ type WithdrawalPayoutScan = {
1168
1800
  candidates: WithdrawalPayoutCandidate[];
1169
1801
  /** Last block scanned (inclusive, decimal). Pass it back as the next `cursor`. */
1170
1802
  scannedTo: string;
1803
+ /** False when the call stopped at its request limit before the scan end (the
1804
+ * head minus the reorg margin), so more blocks are already waiting. */
1805
+ caughtUp: boolean;
1171
1806
  };
1172
1807
 
1173
- 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" | "YIELDSEEKER_AGENT_MISSING" | "YIELDSEEKER_WALLET_UNVERIFIED" | "CHAIN_UNSUPPORTED" | "CHAIN_NO_COMPATIBLE_AGENTS" | "CHAIN_MISMATCH" | "ASSET_UNSUPPORTED" | "ASSET_NO_COMPATIBLE_AGENTS" | "DEPOSIT_BALANCE_UNAVAILABLE" | "DEPOSIT_PARTIAL_FAILURE" | "DEPOSIT_IN_PROGRESS" | "DEPOSIT_CHECKPOINT_FAILED" | "DEPOSIT_AMOUNT_BELOW_MINIMUM" | "DEPOSIT_INVALID_AMOUNT" | "DEPOSIT_CALLBACK_REQUIRED" | "DEPOSIT_CALLBACK_INVALID" | "DEPOSIT_NO_PERMITTED_TOKENS" | "DEPOSIT_INSUFFICIENT_BALANCE" | "WITHDRAW_IN_PROGRESS" | "WITHDRAW_NO_PERMITTED_TOKENS" | "WITHDRAW_BALANCE_UNAVAILABLE" | "WITHDRAW_INSUFFICIENT_BALANCE" | "WITHDRAW_ALL_FAILED" | "WITHDRAW_UNCONFIRMED" | "WITHDRAW_PARTIAL_FAILURE" | "WITHDRAW_SWAP_INCOMPLETE" | "WITHDRAW_FAILED" | "WITHDRAW_INVALID_AMOUNT" | "WITHDRAW_RESERVATION_UNAVAILABLE" | "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" | "AGENT_APY_PERIOD_UNSUPPORTED" | "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_DEPOSIT_PENDING" | "SWAP_WALLET_PROMPT_TIMEOUT" | "SWAP_INSUFFICIENT_GAS" | "SWAP_NATIVE_UNSUPPORTED" | "SWAP_ORDER_EXPIRED" | "SWAP_ORDER_REFUNDED" | "SWAP_ORDER_CANCELLED" | "WITHDRAW_ARRIVAL_TIMEOUT" | "WITHDRAW_SWAP_FAILED" | "BALANCE_ALL_FAILED" | "EARNINGS_ALL_FAILED" | "ALLOCATION_ALL_FAILED" | "VALIDATION_INVALID_DAYS";
1808
+ 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" | "AGENT_ACTIVATION_BLOCKED" | "AGENT_ACCOUNT_NOT_OWNEY" | "YIELDSEEKER_AGENT_MISSING" | "YIELDSEEKER_AGENT_CLOSED" | "YIELDSEEKER_SLOT_UNAVAILABLE" | "YIELDSEEKER_WALLET_UNVERIFIED" | "CHAIN_UNSUPPORTED" | "CHAIN_NO_COMPATIBLE_AGENTS" | "CHAIN_MISMATCH" | "ASSET_UNSUPPORTED" | "ASSET_NO_COMPATIBLE_AGENTS" | "DEPOSIT_BALANCE_UNAVAILABLE" | "DEPOSIT_PARTIAL_FAILURE" | "DEPOSIT_IN_PROGRESS" | "DEPOSIT_CHECKPOINT_FAILED" | "DEPOSIT_AMOUNT_BELOW_MINIMUM" | "DEPOSIT_INVALID_AMOUNT" | "DEPOSIT_CALLBACK_REQUIRED" | "DEPOSIT_CALLBACK_INVALID" | "DEPOSIT_NO_PERMITTED_TOKENS" | "DEPOSIT_INSUFFICIENT_BALANCE" | "ALL_AGENTS_EXCLUDED" | "WITHDRAW_IN_PROGRESS" | "WITHDRAW_NO_PERMITTED_TOKENS" | "WITHDRAW_BALANCE_UNAVAILABLE" | "WITHDRAW_INSUFFICIENT_BALANCE" | "WITHDRAW_ALL_FAILED" | "WITHDRAW_UNCONFIRMED" | "WITHDRAW_NOTHING_TO_WITHDRAW" | "WITHDRAW_PARTIAL_FAILURE" | "WITHDRAW_SWAP_INCOMPLETE" | "WITHDRAW_FAILED" | "WITHDRAW_INVALID_AMOUNT" | "WITHDRAW_RESERVATION_UNAVAILABLE" | "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" | "AGENT_APY_PERIOD_UNSUPPORTED" | "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_DEPOSIT_PENDING" | "SWAP_WALLET_PROMPT_TIMEOUT" | "SWAP_INSUFFICIENT_GAS" | "SWAP_NATIVE_UNSUPPORTED" | "SWAP_ORDER_EXPIRED" | "SWAP_ORDER_REFUNDED" | "SWAP_ORDER_CANCELLED" | "SWAP_ORDER_NOT_FOUND" | "WITHDRAW_ARRIVAL_TIMEOUT" | "WITHDRAW_SWAP_FAILED" | "BALANCE_ALL_FAILED" | "EARNINGS_ALL_FAILED" | "ALLOCATION_ALL_FAILED" | "POOL_CATALOG_UNSUPPORTED" | "POOL_SELECTION_UNSUPPORTED" | "POOL_SELECTION_NOT_APPLIED" | "POOL_SELECTION_RULE_LIMIT" | "POOL_SELECTION_REQUIRED" | "VALIDATION_INVALID_DAYS";
1174
1809
  declare class OwneyError extends Error {
1175
1810
  readonly code: OwneyErrorCode;
1176
1811
  readonly details?: Record<string, unknown>;
@@ -1223,6 +1858,12 @@ type WithdrawSwapRecord = {
1223
1858
  * is continued or rechecked. Absent on records written by an older SDK.
1224
1859
  */
1225
1860
  operationId?: string;
1861
+ /**
1862
+ * The batch this withdrawal belongs to (see `WithdrawOptions.batchId`), kept
1863
+ * so a continuation or recheck reports into the same batch. Absent when the
1864
+ * withdrawal was not part of one.
1865
+ */
1866
+ batchId?: string;
1226
1867
  recovery?: WithdrawalSwapRecovery;
1227
1868
  spent?: string;
1228
1869
  dismissed?: boolean;
@@ -1317,6 +1958,11 @@ type PendingDeposit = {
1317
1958
  * it. Absent on records written by an older SDK.
1318
1959
  */
1319
1960
  operationId?: string;
1961
+ /**
1962
+ * The user action's batch (see `DepositOptions.batchId`), so finishing the
1963
+ * deposit later reports under it. Absent when the swap had none.
1964
+ */
1965
+ batchId?: string;
1320
1966
  };
1321
1967
  /** Every record, dismissed ones included, newest first. Sweeps as it goes. */
1322
1968
  declare function listPendingDeposits(now?: number): PendingDeposit[];
@@ -1330,6 +1976,15 @@ declare class OwneySDK {
1330
1976
  * withdraw, but they are excluded from new deposits / activations.
1331
1977
  */
1332
1978
  private disabledAgents;
1979
+ private readonly accountRefusedListeners;
1980
+ /**
1981
+ * Agents whose sign-in the user cancelled this session (the wallet rejected
1982
+ * the prompt), keyed by chain. Until the app ends the session they are read
1983
+ * from a saved sign-in only (`readStateFor`), so no read reopens the prompt
1984
+ * the user cancelled. A later successful activation of the agent removes
1985
+ * it, and `disconnect()` or a different wallet's `connect()` clears the map.
1986
+ */
1987
+ private declinedSignIns;
1333
1988
  private state;
1334
1989
  private connectionRevision;
1335
1990
  private disconnectingAgents;
@@ -1340,18 +1995,29 @@ declare class OwneySDK {
1340
1995
  private zyfaiRpcUrls?;
1341
1996
  private yieldseekerApiBaseUrl?;
1342
1997
  private yieldseekerSiweOrigin?;
1998
+ private userPoolCustomization;
1343
1999
  private routingApiBaseUrl?;
1344
2000
  private referralSource?;
1345
2001
  private readonly ledger;
1346
2002
  private readonly reservationMode;
1347
2003
  private readonly reservationTransport;
2004
+ /** The caller's Zyfai server tasks opt-in: `true`, a function read each
2005
+ * time a handoff would start (F-I2(iii)), or undefined (off). */
2006
+ private readonly zyfaiServerTasks;
2007
+ /** The caller opted in to the Fusion+ secret handoff (`fusionSecretHandoff: true`). */
2008
+ private readonly fusionSecretHandoff;
1348
2009
  private cachedSponsoredCallback;
1349
2010
  private cachedWethSponsoredCallback;
1350
2011
  private paymasterServiceUrl?;
1351
2012
  private cachedSponsoredCallsCallbacks;
1352
2013
  private readonly agentReads;
1353
2014
  private readonly depositFamilyReads;
2015
+ /** Movements (owner, chain, agent, token, tx hash) whose balance refresh this
2016
+ * session started: true when it armed the refresh, false when its deadline
2017
+ * had passed (it only dropped the cache and forced one snapshot read). */
1354
2018
  private readonly recoveredFundingReads;
2019
+ /** Confirmed deposits already announced to their agent (`depositConfirmed`), bounded. */
2020
+ private readonly announcedDeposits;
1355
2021
  private fundingBalanceChecks;
1356
2022
  private readonly activationChecks;
1357
2023
  private readonly withdrawalSubmissions;
@@ -1383,8 +2049,16 @@ declare class OwneySDK {
1383
2049
  /** Starts a swap's operation and opens it to the swap's inner deposit or
1384
2050
  * withdrawal. Never throws: reporting never blocks a swap. */
1385
2051
  private openSwapLedger;
2052
+ /**
2053
+ * Part 5: the swap's ledger identity, for the executor's Fusion+ secret
2054
+ * handoff. Only with the `fusionSecretHandoff` opt-in and an open operation;
2055
+ * otherwise undefined, and the executor sends nothing. Owner and token are
2056
+ * lowercased, as the ledger reports them.
2057
+ */
2058
+ private secretHandoffFor;
1386
2059
  private closeSwapLedger;
1387
- /** Reports one agent's withdrawal evidence as its leg. Never throws. */
2060
+ /** Reports one agent's withdrawal evidence as its leg (with `errorCode`, when
2061
+ * given). Never throws. */
1388
2062
  private ledgerWithdrawalLeg;
1389
2063
  /** Operation/leg/tx keys whose provider samples are already scheduled. */
1390
2064
  private readonly providerSampleKeys;
@@ -1396,6 +2070,14 @@ declare class OwneySDK {
1396
2070
  * a later sample is skipped once the wallet disconnects or changes.
1397
2071
  */
1398
2072
  private ledgerProviderSamples;
2073
+ /**
2074
+ * Listens for an agent refusing the connected wallet because its provider
2075
+ * account was not created through Owney (`AGENT_ACCOUNT_NOT_OWNEY`). Fires
2076
+ * each time an agent maps such a refusal. Returns the unsubscribe function.
2077
+ */
2078
+ onAccountRefused(listener: (agentId: AgentId) => void): () => void;
2079
+ /** Wires the optional hooks the SDK offers an agent. */
2080
+ private attachAgentHooks;
1399
2081
  /**
1400
2082
  * Funding-ledger read access handed to agents for earnings holds. Reads only
1401
2083
  * for the connected owner; null otherwise and on any failure.
@@ -1419,6 +2101,33 @@ declare class OwneySDK {
1419
2101
  private clearConnectionState;
1420
2102
  private disconnectAgents;
1421
2103
  private isAgentDisabled;
2104
+ /**
2105
+ * True when `id` takes no new deposits on this chain and asset this
2106
+ * session: its adapter reports no agent for the slot.
2107
+ */
2108
+ private isAgentUnavailable;
2109
+ /**
2110
+ * The agents that take no new deposits on this chain and asset this
2111
+ * session, so the app can show them as unavailable: each agent whose
2112
+ * provider has no agent for this slot. They stay withdrawable.
2113
+ */
2114
+ getUnavailableAgentIds(chainId: number, asset?: string): AgentId[];
2115
+ /**
2116
+ * The adapter reports no agent for this chain and asset this session (see
2117
+ * `IAgent.isSlotUnavailable`): there is nothing there to withdraw, so a
2118
+ * withdrawal without an explicit agent leaves it out instead of failing its
2119
+ * leg.
2120
+ */
2121
+ private hasNoAgentForSlot;
2122
+ /**
2123
+ * The state an agent's reads use. An agent whose sign-in the user cancelled
2124
+ * on the connection chain this session is read from a saved sign-in only,
2125
+ * as `offChainPortfolioAgents` reads: a read that would need a wallet
2126
+ * prompt fails for that agent instead of reopening the prompt the user
2127
+ * cancelled. A later successful activation of the agent, or `disconnect()`,
2128
+ * lifts it.
2129
+ */
2130
+ private readStateFor;
1422
2131
  /**
1423
2132
  * Check if the SDK has an active connection state.
1424
2133
  * @returns `true` if `connect()` has been called and `disconnect()` has not
@@ -1463,6 +2172,18 @@ declare class OwneySDK {
1463
2172
  private getAgent;
1464
2173
  getActiveAgentIds(): AgentId[];
1465
2174
  private getActiveAgents;
2175
+ /**
2176
+ * Agents that do not run on the connection chain but can be read on their
2177
+ * own from a saved sign-in: Yieldseeker, Base-only, while the wallet sits on
2178
+ * Arbitrum or Ethereum. The whole-portfolio reads (ROUT-479) add them, under
2179
+ * a promptless state; with no saved sign-in they are left out, as before.
2180
+ */
2181
+ private offChainPortfolioAgents;
2182
+ /** Every agent a whole-portfolio read covers: the active ones on the
2183
+ * connection chain, then the off-chain ones on their own chain. */
2184
+ private portfolioReads;
2185
+ /** The active agents, each with the state its reads use (`readStateFor`). */
2186
+ private activeReads;
1466
2187
  /**
1467
2188
  * Read the org's agent policy once and reuse it. fetchOrgAgentConfig never
1468
2189
  * throws — it degrades to null — so this cannot break activation.
@@ -1493,8 +2214,18 @@ declare class OwneySDK {
1493
2214
  * that support the given chainId (incompatible agents are silently skipped).
1494
2215
  * If provided, ALL specified agents must support the chainId or the call
1495
2216
  * throws before activating any agent.
1496
- */
1497
- activateAgent(chainId: number, agentId?: AgentId[], asset?: OwneySupportedTokens): Promise<void>;
2217
+ * @param options - Optional. `asset` limits setup to that asset;
2218
+ * `onAgentsSelected` fires once reads can start: after every agent's
2219
+ * account check (`checkAccount`) passed, before any agent activates.
2220
+ * @throws Activation stops at the first agent that fails, and the caller
2221
+ * should end the session. `AGENT_ACTIVATION_PARTIAL_FAILURE` when an
2222
+ * earlier agent activated; `walletRejected` in its details means the user
2223
+ * rejected a signature. `AGENT_ACTIVATION_BLOCKED` when the agent can
2224
+ * never be readied (`details.permanent`). Otherwise the agent's own error
2225
+ * is thrown as is. Until it signs in, an agent whose signature the user
2226
+ * rejected is read from a saved sign-in only and opens no prompt.
2227
+ */
2228
+ activateAgent(chainId: number, agentId?: AgentId[], options?: ActivateAgentOptions): Promise<void>;
1498
2229
  private assertActivationSession;
1499
2230
  /**
1500
2231
  * Activate agents ONE AT A TIME, each followed by its org policy.
@@ -1509,9 +2240,19 @@ declare class OwneySDK {
1509
2240
  * Serializing costs no real wall-clock: the user can only approve one prompt
1510
2241
  * at a time anyway.
1511
2242
  *
1512
- * Stop at the first failure so a canceled sign-in does not open another
1513
- * agent's wallet prompt. Report any earlier successes for diagnostics; the
1514
- * app discards the session when the complete sign-in does not succeed.
2243
+ * Stop at the first failure (2026-11-06): a connect needs every agent, so
2244
+ * no later agent's wallet prompt opens for a sign-in that already failed.
2245
+ * When an earlier agent activated, the partial failure reports it, and
2246
+ * `walletRejected` tells the app the user canceled; the app ends the
2247
+ * session either way. When none activated, the agent's own error is thrown.
2248
+ * A failure the provider marks `permanent` is thrown as
2249
+ * `AGENT_ACTIVATION_BLOCKED`.
2250
+ *
2251
+ * Account check first (2026-11-13): every agent's `checkAccount` runs, in
2252
+ * turn, before `onAgentsSelected` and before any agent activates, so a
2253
+ * wallet one agent can never serve signs in nowhere else, gets nothing
2254
+ * created and is not read. A failed check stops the connect like a failed
2255
+ * activation, with nothing activated.
1515
2256
  */
1516
2257
  private activateAgentsInTurn;
1517
2258
  /**
@@ -1526,6 +2267,10 @@ declare class OwneySDK {
1526
2267
  * all shares into one signature; custom callbacks still run once per agent.
1527
2268
  * @param options.agentId - Optional explicit target. Otherwise split equally,
1528
2269
  * or fund remaining agents when a recovery deposit cannot meet every minimum.
2270
+ * @param options.excludeAgentIds - Agents that must receive nothing. The rest
2271
+ * split the whole amount under their own minimums. Throws
2272
+ * `ALL_AGENTS_EXCLUDED` when none is left or `agentId` is listed. Ignored
2273
+ * when resuming a signed batch.
1529
2274
  * @returns {OwneyDepositResult} for a single agent, or {OwneyMultiDepositResult} with per-agent results
1530
2275
  */
1531
2276
  deposit(options: DepositOptions): Promise<OwneyDepositResult | OwneyMultiDepositResult>;
@@ -1557,6 +2302,13 @@ declare class OwneySDK {
1557
2302
  * doesn't force a retry of sibling agents in a multi-agent split.
1558
2303
  */
1559
2304
  private depositWithFallback;
2305
+ /**
2306
+ * Refuses a new deposit that `excludeAgentIds` leaves with nobody to fund:
2307
+ * the explicit `agentId` is listed, or every agent that can take this asset
2308
+ * on this chain (and is not disabled) is. A no-op without a list, so a deposit
2309
+ * without exclusions is exactly as it was. Reads no provider.
2310
+ */
2311
+ private assertDepositAgentsRemain;
1560
2312
  private getMinDepositAmount;
1561
2313
  private splitDepositAmount;
1562
2314
  private formatAgentName;
@@ -1568,7 +2320,30 @@ declare class OwneySDK {
1568
2320
  * false, so the minimum is enforced as today.
1569
2321
  */
1570
2322
  private hasExistingBalance;
2323
+ /**
2324
+ * Guard an explicitly requested chain against one agent's own list.
2325
+ *
2326
+ * Only reachable when the caller passes `chainId` — the activated chain has
2327
+ * already been checked by `activateAgent`. Kept separate from
2328
+ * `validateAssetSupport` so "this agent is not on Ethereum" does not arrive
2329
+ * worded as "this agent does not support USDC".
2330
+ */
2331
+ private validateChainSupport;
2332
+ /**
2333
+ * Guard an explicitly requested chain before a fan-out.
2334
+ *
2335
+ * Without this the split simply produces no agents, and the caller is told
2336
+ * their amount "cannot activate every eligible agent" against a combined
2337
+ * minimum of 0 — an error about the amount when the chain is at fault.
2338
+ */
2339
+ private validateChainHasAgents;
1571
2340
  private validateAssetSupport;
2341
+ /**
2342
+ * The agents that support this asset on this chain. `excludeDisabled` is for
2343
+ * new deposits: it also leaves out the agents unavailable for this slot this
2344
+ * session (see `getUnavailableAgentIds`). Without it, withdrawals and deposit
2345
+ * recovery still see every agent that may hold funds.
2346
+ */
1572
2347
  private getEligibleAgents;
1573
2348
  /**
1574
2349
  * Run owner-approved withdrawals before relayer-only withdrawals. Wallet
@@ -1576,6 +2351,11 @@ declare class OwneySDK {
1576
2351
  * operation, so no relayer leg should commit before it has completed.
1577
2352
  */
1578
2353
  private orderAgentsForWithdrawal;
2354
+ /**
2355
+ * The user cancelled a wallet prompt, for any agent: see isWalletRejection.
2356
+ * That includes an agent error that kept the rejection only as text in
2357
+ * `details.cause`.
2358
+ */
1579
2359
  private isUserRejectedWithdrawal;
1580
2360
  private captureReadScope;
1581
2361
  /** Revalidate a saved transfer against the authenticated account and actual receipt. */
@@ -1584,6 +2364,37 @@ declare class OwneySDK {
1584
2364
  refreshBalance?: boolean;
1585
2365
  requireAmountMatch?: boolean;
1586
2366
  }): Promise<FundingEvidence>;
2367
+ /**
2368
+ * Tells the agent, once per confirmed deposit transfer, that its deposit
2369
+ * landed (`IAgent.depositConfirmed`), and records the outcome on the
2370
+ * deposit's ledger operation when there is one. In the background: never
2371
+ * throws and never delays the deposit. A missed notice only leaves the
2372
+ * provider on its own schedule.
2373
+ *
2374
+ * An agent that reports its provider calls (`onNotice`) gets one
2375
+ * `provider.deposit_notified` event per call and a final
2376
+ * `provider.deposit_allocation` with the outcome (allocated or why not).
2377
+ * Otherwise the outcome is the one `provider.deposit_notified`.
2378
+ */
2379
+ private announceDepositConfirmed;
2380
+ private noteFundingRefresh;
2381
+ /**
2382
+ * Re-arms an agent's balance refresh after a confirmed deposit or withdrawal
2383
+ * the caller already verified (e.g. after a page reload, which loses the
2384
+ * refresh the SDK started in memory). Same refresh as receipt recovery
2385
+ * (`inspectFunding`), without a receipt read, and shared with it: once per
2386
+ * movement (`txHash`) in this SDK session, unless that recovery came after
2387
+ * its own deadline and so armed nothing. `until` bounds it (the agent caps
2388
+ * it further). Returns false when the agent has no such refresh or `until`
2389
+ * has passed; throws when not connected or on another chain. Never prompts.
2390
+ */
2391
+ refreshAgentBalanceAfterMovement(input: {
2392
+ agentId: AgentId;
2393
+ chainId: number;
2394
+ token: OwneySupportedTokens;
2395
+ txHash?: string;
2396
+ until: number;
2397
+ }): boolean;
1587
2398
  /**
1588
2399
  * Lists on-chain payout candidates for a withdrawal the provider accepted
1589
2400
  * without a hash: ERC-20 `Transfer` logs on the evidence's token that reach
@@ -1611,6 +2422,26 @@ declare class OwneySDK {
1611
2422
  /** Whether a foreground deposit can resume the same signed batch, never a
1612
2423
  * fresh authorization. The batch rail independently rechecks the exact plan. */
1613
2424
  canResumePendingDeposit(evidences: FundingEvidence[], amount: string): Promise<boolean>;
2425
+ /** Whether a Permit2 deposit authorization can still execute and whether it
2426
+ * did: `expired` when the finalized block is more than 300 s past
2427
+ * `deadline` (chain time), `used` when the owner's Permit2 nonce bit is set
2428
+ * at that block. Null when anything cannot be read. Never throws. */
2429
+ checkDepositAuthorization(input: {
2430
+ chainId: number;
2431
+ owner: string;
2432
+ token?: string;
2433
+ permit2Nonce: string;
2434
+ deadline: number;
2435
+ }): Promise<{
2436
+ expired: boolean;
2437
+ used: boolean;
2438
+ } | null>;
2439
+ /** Drops the saved signed body of a hashless deposit the server may have
2440
+ * been sending (`serverBroadcast` 'unknown'/true, no hash) once the app has
2441
+ * settled it another way: by the ledger's hash or its expired deadline.
2442
+ * Only the body with this Permit2 deadline and these exact shares is
2443
+ * dropped, so it never resumes or blocks a different deposit. Never throws. */
2444
+ discardSavedDepositBatch(evidences: FundingEvidence[]): Promise<boolean>;
1614
2445
  /** Validate signed journal membership, never just a caller-supplied family ID. */
1615
2446
  validateDepositReplacement(previous: FundingEvidence[], next: FundingEvidence[]): Promise<DepositReplacementValidation | undefined>;
1616
2447
  /** Optional post-payout display proof; receipt verification and the provider
@@ -1621,6 +2452,12 @@ declare class OwneySDK {
1621
2452
  /** History lookup for receipt recovery; adapters may not authenticate or sign here. */
1622
2453
  getFundingHistory(evidence: FundingEvidence, fromDate: string, options?: Pick<HistoryFilters, "cursor" | "toDate">): Promise<OwneyAgentHistory>;
1623
2454
  recoverDepositRegistration(evidence: FundingEvidence): Promise<FundingEvidence>;
2455
+ /** A Zyfai withdrawal's lifecycle by the id recorded on its evidence. Never signs,
2456
+ * prompts or authenticates; `null` when unavailable or not this wallet's Zyfai withdrawal. */
2457
+ getZyfaiWithdrawal(evidence: FundingEvidence): Promise<ZyfaiWithdrawalLifecycle | null>;
2458
+ /** A Zyfai deposit's placement status by the id recorded on its evidence. Never signs,
2459
+ * prompts or authenticates; `null` when unavailable or not this wallet's Zyfai deposit. */
2460
+ getZyfaiDeposit(evidence: FundingEvidence): Promise<ZyfaiDepositPlacement | null>;
1624
2461
  /** On-chain version and ownership status for this owner's Yieldseeker agent. */
1625
2462
  getYieldseekerWalletStatus(asset: OwneySupportedTokens): Promise<YieldseekerWalletStatus | null>;
1626
2463
  /** Deployment gate; an unavailable response keeps the current paid path. */
@@ -1676,6 +2513,18 @@ declare class OwneySDK {
1676
2513
  * would strand funds we might have been able to move.
1677
2514
  */
1678
2515
  /** ERC20 balance of the connected wallet, read through the wallet's own node. */
2516
+ /**
2517
+ * A read client pinned to `chainId`, over HTTP rather than the wallet.
2518
+ *
2519
+ * The swap rail has read this way from the start, and the reason is written
2520
+ * out at `buildSwapDeps`: a provider-backed client reads from whatever chain
2521
+ * the WALLET is on, which after a cross-chain swap is the source chain, not
2522
+ * the one the funds landed on. The deposit's own reads did not, so a Permit2
2523
+ * check for WETH on Arbitrum went to Base — where that address is not a
2524
+ * contract at all, so viem got "0x" back and threw "The contract function
2525
+ * 'allowance' returned no data".
2526
+ */
2527
+ private chainReader;
1679
2528
  private readTokenBalance;
1680
2529
  /** How much of `token` the wallet has already approved Permit2 to move. */
1681
2530
  private readTokenPermit2Allowance;
@@ -1687,12 +2536,36 @@ declare class OwneySDK {
1687
2536
  * wallet calls also cover approval without spending the received tokens.
1688
2537
  */
1689
2538
  private settleSwapDepositAmount;
2539
+ /**
2540
+ * Deposit a swap's output, retrying once at the balance the deposit saw.
2541
+ *
2542
+ * `settleSwapDepositAmount` approves and THEN reads, but the read and the
2543
+ * deposit's own pre-check can disagree: the approval is confirmed through
2544
+ * the wallet's node, the read goes to a pinned RPC, and gas paid in WETH
2545
+ * (MetaMask offers this to a wallet with no ETH) can land after either.
2546
+ * ROUT-618 failed that way with the settle step in place.
2547
+ *
2548
+ * The pre-check reports the balance it saw, and that is the authority, so
2549
+ * a shortfall is retried once at that figure. Only a small one: a node that
2550
+ * has not caught up can read near zero, and depositing that would leave the
2551
+ * rest of the swap stranded behind a "success".
2552
+ */
2553
+ private depositSwapOutput;
1690
2554
  private walletSeesBalance;
1691
2555
  /**
1692
2556
  * Runs a quoted swap. A named seam rather than an inline `executeSwap` call
1693
2557
  * so the deposit half of `swapAndDeposit` can be exercised on its own.
1694
2558
  */
1695
2559
  private runSwap;
2560
+ /**
2561
+ * Throws SWAP_INSUFFICIENT_GAS when the wallet cannot pay for this swap.
2562
+ *
2563
+ * Only the classic rail is ever refused: it is the one where the user sends
2564
+ * the transactions. Call it on a preview quote to warn BEFORE a withdrawal
2565
+ * moves anything — `withdrawAndSwap` repeats it on its own quote, but by
2566
+ * then the funds have already left the agent (ROUT-622).
2567
+ */
2568
+ checkSwapGas(quote: SwapQuote): Promise<void>;
1696
2569
  /**
1697
2570
  * The half of the swap deps that only ever talks to the routing API.
1698
2571
  *
@@ -1739,8 +2612,19 @@ declare class OwneySDK {
1739
2612
  * second half of `swapAndDeposit` on its own. Cleared only once the deposit
1740
2613
  * has actually gone through — a failure here leaves the record in place so it
1741
2614
  * can be offered again rather than silently dropped.
2615
+ *
2616
+ * The record does not remember `excludeAgentIds`, on purpose: the caller must
2617
+ * pass the CURRENT list, because the user's choice may have changed since the
2618
+ * swap (a deposit reads it fresh each time). Without it, a record with no
2619
+ * `agentId` splits across every eligible agent. When the list leaves nobody to
2620
+ * fund (or names the record's own agent) it throws `ALL_AGENTS_EXCLUDED`
2621
+ * before the wallet is touched and keeps the record.
2622
+ *
2623
+ * @param options.excludeAgentIds - See `DepositOptions.excludeAgentIds`.
1742
2624
  */
1743
- completePendingDeposit(id: string): Promise<OwneyDepositResult | OwneyMultiDepositResult>;
2625
+ completePendingDeposit(id: string, options?: {
2626
+ excludeAgentIds?: AgentId[];
2627
+ }): Promise<OwneyDepositResult | OwneyMultiDepositResult>;
1744
2628
  /**
1745
2629
  * Pick up cross-chain swaps a previous session left in flight.
1746
2630
  *
@@ -1877,6 +2761,13 @@ declare class OwneySDK {
1877
2761
  symbol: string;
1878
2762
  };
1879
2763
  agentId?: AgentId;
2764
+ /**
2765
+ * Agents the deposit must not fund (see `DepositOptions.excludeAgentIds`).
2766
+ * Checked before the quote, so a swap that could not end in a deposit never
2767
+ * starts. Not stored on a pending deposit: whoever finishes one later
2768
+ * passes the then-current list to `completePendingDeposit(id, options)`.
2769
+ */
2770
+ excludeAgentIds?: AgentId[];
1880
2771
  /** Percent, classic rail only. Fusion+ prices through its auction. */
1881
2772
  slippage?: number;
1882
2773
  onSwapProgress?: (stage: SwapStage) => void;
@@ -1888,6 +2779,9 @@ declare class OwneySDK {
1888
2779
  assertCurrent?: () => void;
1889
2780
  /** Funding-ledger reference for this swap and its deposit. Generated when omitted. */
1890
2781
  operationId?: string;
2782
+ /** Groups this swap and deposit with the others started by one user action
2783
+ * (see `DepositOptions.batchId`). Saved on the pending deposit record. */
2784
+ batchId?: string;
1891
2785
  }): Promise<{
1892
2786
  swap: {
1893
2787
  received: string;
@@ -2003,6 +2897,12 @@ declare class OwneySDK {
2003
2897
  * omitted; a continuation reuses the one saved on its record.
2004
2898
  */
2005
2899
  operationId?: string;
2900
+ /**
2901
+ * Groups this withdrawal with the others started by one user action (see
2902
+ * `WithdrawOptions.batchId`). Saved on the record, so a continuation
2903
+ * reports into the same batch.
2904
+ */
2905
+ batchId?: string;
2006
2906
  }): Promise<{
2007
2907
  withdraw: OwneyWithdrawResult | AgentWithdrawResult;
2008
2908
  /** What actually arrived in the wallet, smallest unit of the agent's asset. */
@@ -2057,6 +2957,13 @@ declare class OwneySDK {
2057
2957
  * hold this SDK does not know about is left to the server's expiry.
2058
2958
  */
2059
2959
  releaseWithdrawalReservation(operationId: string, reason: ReservationReleaseReason, agents?: ReservationAgent[]): Promise<void>;
2960
+ /**
2961
+ * Reports a withdrawal step the app closed as never sent (a reload before its
2962
+ * request was saved) as a failed ledger leg with `NOT_SUBMITTED`, so other
2963
+ * devices and later recovery stop treating it as in flight. Refuses any step
2964
+ * with a hash or a saved request. Never touches the hold; never throws.
2965
+ */
2966
+ reportWithdrawalNotSubmitted(operationId: string, evidence: FundingEvidence): Promise<void>;
2060
2967
  /**
2061
2968
  * Reports a withdrawal leg that was proven after its call ended (a hashless
2062
2969
  * Zyfai payout found on chain or in history) to the funding ledger, then
@@ -2067,6 +2974,15 @@ declare class OwneySDK {
2067
2974
  * the server re-verifies the hash. Never throws.
2068
2975
  */
2069
2976
  reportWithdrawalRecovery(operationId: string, evidence: FundingEvidence): Promise<void>;
2977
+ /**
2978
+ * Reports a deposit leg that the app's recovery verified on chain after its
2979
+ * call ended to the funding ledger. Only evidence whose transfer is confirmed
2980
+ * with a transaction hash is reported; anything else is ignored. The ledger
2981
+ * PATCHes the existing operation (creating it only on a 404) and the server
2982
+ * re-verifies the hash. Deposits hold no reservation, so nothing is released.
2983
+ * Never throws.
2984
+ */
2985
+ reportDepositRecovery(operationId: string, evidence: FundingEvidence): Promise<void>;
2070
2986
  private withdrawFromAgents;
2071
2987
  /** Read-only invalidation after new pool-deposit activity. Does not restart
2072
2988
  * funding reconciliation, bypass cooldowns, or authorize a transaction. */
@@ -2076,10 +2992,24 @@ declare class OwneySDK {
2076
2992
  * @param agentId - Optional. Agent to query. Omit for aggregated balances.
2077
2993
  * @returns {AgentBalance} for a single agent, or {OwneyBalances} with totalBalance and per-agent breakdown
2078
2994
  */
2995
+ /**
2996
+ * Withdraw every position the wallet holds, across chains and assets.
2997
+ *
2998
+ * `withdraw()` drains one asset on one chain, so this is N of those. It
2999
+ * deliberately does not stop at the first failure: the funds in the other
3000
+ * positions are just as withdrawable, and someone who asked for everything
3001
+ * is better served by three of four than by none. Each leg reports its own
3002
+ * outcome so the caller can name the ones that did not arrive; only a total
3003
+ * failure throws.
3004
+ *
3005
+ * @returns {OwneyWithdrawAllResult} one leg per position attempted.
3006
+ */
3007
+ withdrawAll(): Promise<OwneyWithdrawAllResult>;
2079
3008
  getBalances(agentId?: AgentId, options?: {
2080
3009
  chainId?: number;
2081
3010
  asset?: OwneySupportedTokens;
2082
3011
  }): Promise<OwneyBalances | AgentBalance>;
3012
+ private readBalances;
2083
3013
  /** Preserve failure objects for withdrawal recovery without changing public balance results. */
2084
3014
  private readAggregatedBalances;
2085
3015
  /**
@@ -2111,8 +3041,47 @@ declare class OwneySDK {
2111
3041
  * subtract from the total. Without an agentId the series is the sum of the
2112
3042
  * agents that answered.
2113
3043
  */
2114
- getDailyEarnings({ agentId, days, tokenSymbol, }: DailyEarningsOptions): Promise<AccountDailyEarnings>;
2115
- getAccountApy({ agentId, days, tokenSymbol, }: AccountApyOptions): Promise<OwneyAccountApy | AccountAgentApy>;
3044
+ getDailyEarnings({ agentId, days, tokenSymbol, chainIds, }: DailyEarningsOptions): Promise<AccountDailyEarnings>;
3045
+ /**
3046
+ * The deposit-time pool catalogue (ROUT-569): every protocol with its
3047
+ * selectable pools (name, APY, TVL, link) for `asset` under `strategy`.
3048
+ * Defaults to the zyfai agent, the only one with pool customization today.
3049
+ */
3050
+ getPoolCatalog(params: {
3051
+ asset: OwneySupportedTokens;
3052
+ strategy: "conservative" | "aggressive" | "yieldmaxxing";
3053
+ agentId?: AgentId;
3054
+ }): Promise<PoolCatalogProtocol[]>;
3055
+ /**
3056
+ * Apply a user's deposit-time pool selection to their account (ROUT-569).
3057
+ * The request carries explicit pool choices plus the resulting strategy for
3058
+ * each asset reviewed in the deposit flow.
3059
+ */
3060
+ setPoolSelection(params: {
3061
+ selection: UserPoolSelectionRequest;
3062
+ agentId?: AgentId;
3063
+ }): Promise<void>;
3064
+ /**
3065
+ * The pool selection saved on the user's account (ROUT-650), so the Pools
3066
+ * step can show what applies now rather than the defaults. `pairs` and
3067
+ * `assets` say which protocol/chain lists and strategies to read.
3068
+ */
3069
+ getPoolSelection(params: {
3070
+ pairs: Array<{
3071
+ protocolId: string;
3072
+ chainId: number;
3073
+ }>;
3074
+ assets: Array<"USDC" | "WETH">;
3075
+ agentId?: AgentId;
3076
+ }): Promise<SavedPoolSelection>;
3077
+ /**
3078
+ * The agents a person can customize pools for: registered, enabled, and
3079
+ * able to list a pool catalogue. Waits for agent initialization, so an agent
3080
+ * the organization disabled is known and left out.
3081
+ */
3082
+ getPoolCustomizationAgents(): Promise<AgentId[]>;
3083
+ getAccountApy({ agentId, days, tokenSymbol, chainId: scope, }: AccountApyOptions): Promise<OwneyAccountApy | AccountAgentApy>;
3084
+ private enrichApyHistory;
2116
3085
  /**
2117
3086
  * Get transaction history for a specific agent, or all agents.
2118
3087
  *
@@ -2256,8 +3225,14 @@ declare class YieldseekerAgent implements IAgent {
2256
3225
  private readonly agentContexts;
2257
3226
  private readonly walletContexts;
2258
3227
  private readonly agentAccountReads;
3228
+ private readonly sessionAgents;
2259
3229
  private readonly reportedAccounts;
2260
3230
  private readonly missingSlots;
3231
+ private readonly rethrownSlotFailures;
3232
+ private readonly closedSlots;
3233
+ private readonly pendingReopens;
3234
+ private readonly unavailableSlots;
3235
+ private readonly pendingReactivates;
2261
3236
  private readonly freshListReads;
2262
3237
  private readonly knownContextKeys;
2263
3238
  private readonly pendingSlotInvalidations;
@@ -2276,11 +3251,15 @@ declare class YieldseekerAgent implements IAgent {
2276
3251
  private readonly endpointReadFailures;
2277
3252
  private readonly reconcileUntil;
2278
3253
  private readonly allocationRefresh;
3254
+ /** Contexts whose next permitted snapshot read is forced once: a funding
3255
+ * invalidation with a tx hash (receipt recovery, a re-armed refresh). */
3256
+ private readonly forceNextSnapshot;
2279
3257
  private readonly activityRefreshUntil;
2280
3258
  private readonly snapshotMovements;
2281
3259
  private readonly movementEpochs;
2282
3260
  private readonly settlementChecks;
2283
3261
  private ledgerAccess?;
3262
+ private accountRefusedListener?;
2284
3263
  private readonly ledgerReads;
2285
3264
  /** contextKey -> movements this instance started settling (by tx hash) and how they refresh:
2286
3265
  * awaiting the ledger, refreshed when ready (ledger), or on the timed backoff (legacy). */
@@ -2299,6 +3278,7 @@ declare class YieldseekerAgent implements IAgent {
2299
3278
  private ledgerBudgetMs;
2300
3279
  /** slotKey -> the last successful ledger rows and when they arrived. */
2301
3280
  private readonly lastLedgerRows;
3281
+ /** Keyed by `vaultOptionsKey`: each asset's usable list and its full list are cached apart. */
2302
3282
  private readonly vaultOptions;
2303
3283
  private readonly pendingVaultOptions;
2304
3284
  private readonly assetApyStats;
@@ -2309,6 +3289,33 @@ declare class YieldseekerAgent implements IAgent {
2309
3289
  getWalletStatus(state: ConnectionState, chainId: number, asset: OwneySupportedTokens, useCachedV2?: boolean): Promise<YieldseekerWalletStatus | null>;
2310
3290
  /** Reads (or reuses the 15-minute verified V2 hint for) this exact context's wallet. */
2311
3291
  private readWalletStatus;
3292
+ /**
3293
+ * Deposits go only to an agent Yieldseeker still has open. The session caches
3294
+ * the selected agent, so a tab left open can hold one Yieldseeker has since
3295
+ * closed (deactivated). This reads the agent wallet fresh from Yieldseeker,
3296
+ * bypassing the cached wallet contexts, and:
3297
+ * - open, same wallet address: returns the context to deposit with;
3298
+ * - closed (`deactivatedDate` set): reactivates it, re-reads the wallet, and
3299
+ * continues only when it is now open with the same address. Only the
3300
+ * verified record's agent is reopened: any other closed agent (a
3301
+ * superseded-wallet match, or the agent this session created or adopted
3302
+ * before its record exists, also when the accounts could not be read)
3303
+ * refuses without a request;
3304
+ * - anything else refuses with nothing sent, before any progress event,
3305
+ * signature or callback. Every refusal carries `notSubmitted` and
3306
+ * `safeToFallback: false`, so no paid fallback runs.
3307
+ * A slot recorded unavailable (the active-agent limit) refuses at once with
3308
+ * no request. The reactivate goes through reactivateSlot, which shares one
3309
+ * request per slot and remembers a failure for the list-cache window, so
3310
+ * repeated deposits do not repeat it. A failed wallet read fails closed
3311
+ * (YIELDSEEKER_WALLET_UNVERIFIED, reason UNAVAILABLE), like the on-chain
3312
+ * gate. A reactivate that fails keeps its error code
3313
+ * (YIELDSEEKER_AGENT_CLOSED, or the mapped API error for a transient
3314
+ * failure). At the limit the slot is also recorded unavailable for the
3315
+ * session (see isSlotUnavailable). Session changes keep their own
3316
+ * NOT_CONNECTED error.
3317
+ */
3318
+ private assertAgentOpen;
2312
3319
  /**
2313
3320
  * Deposits go only to a wallet whose identity is verified on chain (factory
2314
3321
  * mapping, owner, base asset, FACTORY). The API key is public, so the wallet
@@ -2325,9 +3332,34 @@ declare class YieldseekerAgent implements IAgent {
2325
3332
  status: YieldseekerWalletStatus;
2326
3333
  }>;
2327
3334
  disconnect(): Promise<void>;
3335
+ /**
3336
+ * The connect's account check (2026-11-13), run before any agent activates:
3337
+ * sign in (a saved sign-in, else login-with-wallet, else POST /users for a
3338
+ * wallet with no account, which is Owney's by definition), then ask Owney's
3339
+ * routing whether the account was created through Owney. Refused:
3340
+ * AGENT_ACCOUNT_NOT_OWNEY, permanent, and the listener is told. Cannot tell
3341
+ * yet: the Retry-After is waited once when it is 30 s or less, otherwise a
3342
+ * temporary failure. Lists, creates and reads no agent.
3343
+ */
3344
+ checkAccount(state: ConnectionState, chainId: number): Promise<void>;
3345
+ /**
3346
+ * Ready every asset's agent, `asset` first: a missing one is created and a
3347
+ * closed one reopened (2026-11-06). A slot Yieldseeker will never let the
3348
+ * user have (the agent limit, closed for good, missing with no way to
3349
+ * reopen) is rethrown with `details.permanent`, which refuses the connect.
3350
+ * A temporary failure (an API error or timeout) on another asset does not:
3351
+ * that slot answers again where it is needed. On the selected asset every
3352
+ * failure is thrown as before, without readying the rest, so a failed
3353
+ * sign-in never opens a second prompt.
3354
+ */
2328
3355
  activateAgent(state: ConnectionState, chainId: number, asset?: OwneySupportedTokens): Promise<void>;
3356
+ /** The same failure, marked as one that will not go away this session. */
3357
+ private permanentFailure;
3358
+ isSlotUnavailable(state: ConnectionState, chainId: number, asset: OwneySupportedTokens): boolean;
2329
3359
  deposit(state: ConnectionState, chainId: number, amount: string, asset: OwneySupportedTokens, depositCallback?: DepositCallback, onProgress?: FundingProgress, onBeforeSubmission?: (evidence: FundingEvidence) => void | Promise<void>): Promise<OwneyDepositResult>;
2330
- withdraw(state: ConnectionState, chainId: number, asset: OwneySupportedTokens, amount?: string, onProgress?: FundingProgress, gasMode?: "auto" | "sponsored" | "paid", onBeforeSubmission?: FundingProgress, assertOperation?: () => void): Promise<AgentWithdrawResult>;
3360
+ withdraw(state: ConnectionState, chainId: number, asset: OwneySupportedTokens, amount?: string, onProgress?: FundingProgress, gasMode?: "auto" | "sponsored" | "paid", onBeforeSubmission?: FundingProgress, assertOperation?: () => void, submission?: {
3361
+ operationId?: string;
3362
+ }): Promise<AgentWithdrawResult>;
2331
3363
  private withdrawInternal;
2332
3364
  /** Fresh position amounts for withdrawal planning, net of reserved fees. */
2333
3365
  getWithdrawableBalance(state: ConnectionState, chainId: number, asset: OwneySupportedTokens, minimumAmount?: bigint): Promise<bigint>;
@@ -2344,22 +3376,164 @@ declare class YieldseekerAgent implements IAgent {
2344
3376
  private withdrawalVaultHints;
2345
3377
  private readWithdrawalPositions;
2346
3378
  private resolveWithdrawalLiquidity;
3379
+ hasReadSession(state: ConnectionState, chainId: number): boolean;
2347
3380
  getBalances(state: ConnectionState, chainId: number, asset?: OwneySupportedTokens): Promise<AgentBalance>;
2348
3381
  verifyWithdrawalBalance(state: ConnectionState, evidence: FundingEvidence, balance: AgentBalance): Promise<AssetReadMetadata | undefined>;
2349
3382
  invalidateAllocationRead(state: ConnectionState, chainId: number, asset: OwneySupportedTokens): void;
2350
3383
  invalidateFundingRead(state: ConnectionState, chainId: number, asset: OwneySupportedTokens, refreshUntil?: number, txHash?: string): void;
2351
3384
  endFundingBalanceRefresh(state: ConnectionState, chainId: number, asset: OwneySupportedTokens, read: AssetReadMetadata): boolean;
3385
+ /**
3386
+ * Tells Yieldseeker a deposit landed (`deposit-made`), so the agent allocates
3387
+ * it now instead of on its next 30-minute check, and confirms it did.
3388
+ * Yieldseeker decides whether anything moves (the funding minimum, a
3389
+ * deployed agent, no manual withdrawal in the last hour), and its answer
3390
+ * (`{}`) does not say, so a minute after each notice the agent reads its
3391
+ * wallet: the deposit has gone into a vault when less than its amount is
3392
+ * left idle. While it has not, Yieldseeker is told again, up to
3393
+ * DEPOSIT_NOTICE_ATTEMPTS calls in all; a failed call (network, server, rate
3394
+ * limit) is sent again after a wait. Within an hour of a withdrawal it is
3395
+ * told once, since nothing can move yet. Uses the agent this session already
3396
+ * knows for the asset and the saved sign-in only: never prompts, never
3397
+ * throws. Each call is reported through `onNotice`.
3398
+ */
3399
+ depositConfirmed(state: ConnectionState, chainId: number, evidence: FundingEvidence, onNotice?: (notice: DepositNotice & {
3400
+ attempt: number;
3401
+ }) => void): Promise<DepositNotice>;
3402
+ /** One `deposit-made` call. A failure that may pass on its own carries the wait before the next try. */
3403
+ private sendDepositNotice;
3404
+ /**
3405
+ * Tells Yieldseeker (`deposit-made`) after a pool save, so the agent runs
3406
+ * now and rebalances money already in a vault the list no longer allows.
3407
+ * Up to DEPOSIT_NOTICE_ATTEMPTS calls in all, waiting between them only
3408
+ * after a failure that may pass; stops when the session ends. Never throws.
3409
+ */
3410
+ private rebalanceAfterPoolSave;
3411
+ /**
3412
+ * When Yieldseeker may move funds again after this agent wallet's last
3413
+ * confirmed withdrawal, if that is still ahead; null when there was none in
3414
+ * the last hour or the ledger cannot say.
3415
+ */
3416
+ private withdrawalCooldownEnd;
3417
+ /**
3418
+ * The agent wallet's base-asset balance and the platform fee Yieldseeker has
3419
+ * not collected from it, read at one block for a balance read. Cached
3420
+ * briefly per agent wallet and dropped by funding and allocation
3421
+ * invalidations. Null when any read fails or is slow: the snapshot's
3422
+ * amounts are used instead.
3423
+ */
3424
+ private readLiveWallet;
3425
+ private readWalletFunds;
3426
+ /** The agent wallet's idle base asset; null when the read fails. */
3427
+ private readIdleBalance;
2352
3428
  getFundingWallet(state: ConnectionState, chainId: number, asset: OwneySupportedTokens): Promise<string>;
2353
3429
  hasExistingDepositFunds(state: ConnectionState, chainId: number, asset: OwneySupportedTokens): Promise<true | undefined>;
2354
3430
  getEarnings(state: ConnectionState, chainId: number): Promise<AgentEarnings>;
2355
- getAccountApy(state: ConnectionState, chainId: number, days: DailyApyDays, tokenSymbol?: string): Promise<AccountAgentApy>;
3431
+ getAccountApy(state: ConnectionState, chainId: number, days: DailyApyDays, tokenSymbol?: string,
3432
+ /** The chart's chain filter (ROUT-479); null is every chain. */
3433
+ scopeChainId?: number | null): Promise<AccountAgentApy>;
2356
3434
  getDailyEarnings(state: ConnectionState, chainId: number, days: LookbackDays, tokenSymbol?: string): Promise<AccountDailyEarnings>;
2357
3435
  getHistory(state: ConnectionState, chainId: number, options?: HistoryFilters): Promise<OwneyAgentHistory>;
2358
3436
  getUserProfile(state: ConnectionState, chainId: number): Promise<AgentUserProfile>;
2359
3437
  getAgentApy(days: DailyApyDays, options?: AgentApyOptions): Promise<AgentApy>;
2360
3438
  supportsAgentApyPeriod(days: DailyApyDays): boolean;
2361
3439
  private loadAssetApyStats;
3440
+ /**
3441
+ * The deposit-time Pools step's catalogue: every vault Yieldseeker lists
3442
+ * for a new agent on `asset` on Base, grouped by provider (the provider is
3443
+ * both `protocolId` and `name`). Nothing is filtered on our side, on
3444
+ * liquidity, size or provider. `strategy` is accepted for the IAgent
3445
+ * contract and ignored.
3446
+ */
3447
+ getPoolCatalog(params: {
3448
+ asset: string;
3449
+ strategy?: "conservative" | "aggressive" | "yieldmaxxing";
3450
+ }): Promise<PoolCatalogProtocol[]>;
3451
+ /**
3452
+ * The asset's vaults on Base. By default only those a new agent can use:
3453
+ * Yieldseeker leaves out the ones it has disabled (40acres and Moonwell
3454
+ * among them), gated or can't use, so the picker follows its list
3455
+ * (2026-11-04). `includeUnavailable` adds those back, for anything about
3456
+ * money an agent may still hold in one: withdrawals and activity.
3457
+ */
2362
3458
  private loadVaultOptions;
3459
+ /**
3460
+ * Save the user's Yieldseeker picks as the agent's managed vault list, then
3461
+ * read the rules back before any money moves. Each asset has its own agent,
3462
+ * so each is saved on its own. `pools` and `availablePools` hold vault
3463
+ * addresses.
3464
+ *
3465
+ * - Only Base entries are ours. An asset with no picks whose entries showed
3466
+ * no vault is skipped and nothing is sent.
3467
+ * - None picked (vaults shown) for any asset: every agent keeps at least one
3468
+ * pool (2026-11-11), so the whole save throws POOL_SELECTION_REQUIRED
3469
+ * before anything is written, for any asset.
3470
+ * - Some vaults picked: the managed list names them. Saving it again
3471
+ * replaces it, so there is only ever one.
3472
+ * - Every vault picked: the managed list is deleted, and no allow-list may
3473
+ * remain, so vaults Yieldseeker adds later are allowed too.
3474
+ * - A free-text allow-list we saved before the managed list existed is
3475
+ * deleted once the new state is written. A failed delete does not fail the
3476
+ * save; it is debug-logged, and the read-back decides.
3477
+ * - A read-back that differs puts the previous managed list back (or deletes
3478
+ * the one just created) and throws POOL_SELECTION_NOT_APPLIED. If putting
3479
+ * it back fails too, that is still the error thrown. An old free-text list
3480
+ * already deleted is not put back.
3481
+ * - An agent already holding the most active memories, none of them ours,
3482
+ * throws POOL_SELECTION_RULE_LIMIT before anything is written.
3483
+ *
3484
+ * Always Base, whichever chain the wallet is connected on.
3485
+ */
3486
+ setPoolSelection(selection: UserPoolSelectionRequest, state?: ConnectionState): Promise<void>;
3487
+ private savePoolPicks;
3488
+ /**
3489
+ * Delete the free-text allow-lists we saved before the managed list existed.
3490
+ * Never throws: a list left behind is caught by the read-back. Logs no
3491
+ * sign-in token.
3492
+ */
3493
+ private deleteLegacyPoolMemories;
3494
+ /**
3495
+ * `<address> (<name>)` for each pick, under the prefix. An unnamed address
3496
+ * has no brackets. There is always at least one pick (setPoolSelection
3497
+ * refuses a save with none).
3498
+ */
3499
+ private poolMemoryContent;
3500
+ /** Undo a failed save of the managed list. Never throws: the caller reports the save's own failure. */
3501
+ private restorePoolMemory;
3502
+ /**
3503
+ * What the user's Yieldseeker agents currently allow, as `SavedPoolSelection`
3504
+ * pairs: the allowed vault addresses under the provider each belongs to, for
3505
+ * the vaults a new agent can use. An agent with no allow-list adds nothing,
3506
+ * and no pairs at all means every shown vault is on. Reads never create an
3507
+ * agent, and always read Base. A read that fails throws, because "no
3508
+ * allow-list" would wrongly mean "everything".
3509
+ *
3510
+ * An allow-list naming none of the listed vaults (the saved "none", or vaults
3511
+ * Yieldseeker has since stopped listing) leaves the agent nowhere to go, so
3512
+ * it reports none chosen for its asset: a pair with empty `pools` for every
3513
+ * provider listing vaults for it. With no vault listed at all there is
3514
+ * nothing to name that by, and it throws: the rules still restrict the agent.
3515
+ *
3516
+ * `pairs` is accepted for the contract but does not trim the answer: cutting
3517
+ * a real allow-list down to the pairs asked about could leave none, and none
3518
+ * reads as every vault on.
3519
+ */
3520
+ getPoolSelection(state: ConnectionState, _chainId: number, params: {
3521
+ pairs: Array<{
3522
+ protocolId: string;
3523
+ chainId: number;
3524
+ }>;
3525
+ assets: Array<"USDC" | "WETH">;
3526
+ }): Promise<SavedPoolSelection>;
3527
+ /**
3528
+ * The allow-list in the agent's rules: every `allowedVaultAddresses` on an
3529
+ * `ignored_vault` user rule. Undefined when no rule has one, which allows
3530
+ * every vault; an empty list allows none. A response that does not have the
3531
+ * expected shape throws rather than reading as no allow-list.
3532
+ */
3533
+ private readAllowList;
3534
+ private listMemories;
3535
+ /** A memory call for an agent, on Base whichever chain the wallet is on. */
3536
+ private memoryRequest;
2363
3537
  private userKey;
2364
3538
  /** One deposit/withdraw slot: owner, chain and asset. */
2365
3539
  private slotKey;
@@ -2387,8 +3561,9 @@ declare class YieldseekerAgent implements IAgent {
2387
3561
  private listAgents;
2388
3562
  /**
2389
3563
  * The routing API's stored accounts for owner+chain, read once per session.
2390
- * Resolves null when unavailable (callers keep name matching) and never
2391
- * rejects. A failure is retried after a short window.
3564
+ * Resolves null when unavailable and never rejects; callers then refuse
3565
+ * (AGENT_ACCOUNTS_UNAVAILABLE) and create nothing. A failure is not kept:
3566
+ * concurrent callers share the in-flight read, and the next call reads again.
2392
3567
  */
2393
3568
  private agentAccounts;
2394
3569
  /** Yieldseeker accounts for one slot (returned addresses are compared lowercase). */
@@ -2399,25 +3574,87 @@ declare class YieldseekerAgent implements IAgent {
2399
3574
  * highest-priority set of `priorities` (index 0 first). Hinted agentIds are
2400
3575
  * resolved first and a hinted top-priority match ends the search; then other
2401
3576
  * listed agents, at most YIELDSEEKER_WALLET_MATCH_LIMIT wallets in total.
3577
+ * A candidate whose wallet shows it closed (deactivated) never ranks, and its
3578
+ * agentId is added to `closed`.
2402
3579
  */
2403
3580
  private agentWithWallet;
2404
3581
  /**
2405
3582
  * chooseAgent, re-reading a cached list once (bypassing its cache) when the
2406
- * verified agent is missing. A slot still missing after that re-read is
2407
- * remembered for the list cache window, so later reads fail from the cached
2408
- * list without another re-read.
3583
+ * verified agent is missing. Still missing, Yieldseeker may have closed
3584
+ * (deactivated) it: the verified record's agent is reactivated and selected
3585
+ * from a fresh list, by the verified wallet only (never created). A slot
3586
+ * that still fails is remembered with its error for the list cache window,
3587
+ * so later reads fail without another re-read or reactivate. A slot
3588
+ * Yieldseeker will not reopen because of its active-agent limit throws
3589
+ * YIELDSEEKER_SLOT_UNAVAILABLE, here and for the rest of the session, with
3590
+ * no request.
2409
3591
  */
2410
3592
  private chooseAgentRefreshing;
2411
- private isSlotMissing;
3593
+ private throwIfSlotUnavailable;
3594
+ /**
3595
+ * Rethrow the error a slot's lookup failed with while the slot is still
3596
+ * marked, or for the session when Yieldseeker will never reopen its agent.
3597
+ * A remembered rate limit is rethrown with the time left on its marker as
3598
+ * its retry delay (`retryAfterSeconds`): no new attempt is made before then,
3599
+ * so a caller that waits it out retries once instead of every few seconds.
3600
+ */
3601
+ private throwIfSlotMissing;
3602
+ /**
3603
+ * Remember a slot's failed lookup or reactivate for the list-cache window.
3604
+ * A sign-in failure is not remembered (the wallet's rejection,
3605
+ * AGENT_AUTH_FAILED, NOT_CONNECTED): it says nothing about the slot, and
3606
+ * remembered it would refuse the next sign-in, even one the user starts,
3607
+ * with no request for the whole window.
3608
+ */
3609
+ private rememberMissingSlot;
3610
+ /**
3611
+ * Reactivate the slot's verified agent, then read the list bypassing its
3612
+ * cache, with a read sent after the reactivate answered. Concurrent lookups
3613
+ * of one slot share one reopen. Resolves to the fresh list. At the
3614
+ * active-agent limit the slot is recorded unavailable and this throws
3615
+ * YIELDSEEKER_SLOT_UNAVAILABLE.
3616
+ */
3617
+ private reopenAgent;
3618
+ /**
3619
+ * The one way to reactivate a slot's agent, for the slot lookup (reopenAgent)
3620
+ * and the pre-deposit check (assertAgentOpen), so a slot costs at most one
3621
+ * reactivate per list-cache window:
3622
+ * - a slot recorded unavailable (the limit) answers "limit" with no request;
3623
+ * - concurrent callers share one request;
3624
+ * - a failed reactivate (closed code, rate limit, timeout, 5xx...) is
3625
+ * remembered as the slot's failure for the list-cache window (missingSlots)
3626
+ * and rethrown to later callers with no request; a closed code
3627
+ * (closedSlots) for the session; a sign-in failure is not remembered;
3628
+ * - the limit is recorded in unavailableSlots only while the session is
3629
+ * unchanged, so a disconnect during the request is not undone by its late
3630
+ * answer.
3631
+ */
3632
+ private reactivateSlot;
3633
+ /**
3634
+ * Ask Yieldseeker to reopen a closed (deactivated) agent, with the user's
3635
+ * Yieldseeker sign-in. AGENT_NOT_DEACTIVATED (already open, e.g. reopened
3636
+ * by another tab) counts as reopened; the active-agent limit is an outcome,
3637
+ * not an error. An agent that cannot come back throws
3638
+ * YIELDSEEKER_AGENT_CLOSED; any other failure (rate limit, timeout, network,
3639
+ * 5xx, an unknown code) throws the mapped API error.
3640
+ */
3641
+ private reactivateAgent;
3642
+ /** Drop the cached and in-flight wallet contexts of one agent, in every slot. */
3643
+ private forgetAgentWallet;
2412
3644
  /**
2413
3645
  * The agent that serves deposits and withdrawals for a slot (Ruling 23):
2414
3646
  * 1. the listed fitting agent whose wallet is the verified account's wallet,
2415
3647
  * whatever its name; the stored agentId is only a hint;
2416
3648
  * 2. else a listed fitting agent whose wallet is a superseded account's wallet;
2417
- * 3. else the fitting agent named "owney" (first use, migration, or a
2418
- * verified wallet that is not a fitting listed agent);
2419
- * 4. else, with a verified account, throw YIELDSEEKER_AGENT_MISSING (never
2420
- * create); without one, undefined (the caller may create).
3649
+ * 3. else, with a verified account, throw YIELDSEEKER_AGENT_MISSING (never
3650
+ * create);
3651
+ * 4. else, with no record at all, the listed agent this session created or
3652
+ * adopted for the slot (sessionAgents); without one, undefined (the
3653
+ * caller creates an agent named "owney"). An agent is never picked by
3654
+ * its name: only our records, and this session's own create, say which
3655
+ * agents are Owney's.
3656
+ * Without the account records (`null`: the read failed) nothing can be
3657
+ * known, so the call is refused and nothing is created.
2421
3658
  * Steps 1 and 2 share one search of at most YIELDSEEKER_WALLET_MATCH_LIMIT
2422
3659
  * wallet reads. The account report then records the selected wallet; the
2423
3660
  * server marks it superseded when it differs from the verified wallet.
@@ -2425,6 +3662,19 @@ declare class YieldseekerAgent implements IAgent {
2425
3662
  private chooseAgent;
2426
3663
  private isAgentMissing;
2427
3664
  private agentMissing;
3665
+ private slotUnavailable;
3666
+ /** The slot has no usable agent: missing, at Yieldseeker's agent limit, or closed for good. */
3667
+ private isSlotEmpty;
3668
+ /**
3669
+ * The slot's lookup failed through the missing-agent / reopen path and was
3670
+ * remembered with this very error, even a transient one (429, 5xx, timeout),
3671
+ * or with the copy of it a remembered rate limit is rethrown as. Compares
3672
+ * the remembered error, not its expiry, so it holds however long the rest
3673
+ * of the read takes.
3674
+ */
3675
+ private isMarkedSlotFailure;
3676
+ /** providerCode is absent when Yieldseeker named none (the agent stayed closed after a reopen). */
3677
+ private agentClosed;
2428
3678
  /**
2429
3679
  * Fire-and-forget: record which agent serves this slot. Never awaited on the
2430
3680
  * funds path and never throws; once per agent wallet and deployment state
@@ -2437,7 +3687,12 @@ declare class YieldseekerAgent implements IAgent {
2437
3687
  private ensureAgent;
2438
3688
  private findAgent;
2439
3689
  private resolveAgent;
2440
- /** Create the slot's agent. Only reached when no stored or named agent matched. */
3690
+ /**
3691
+ * Create the slot's agent, named "owney". Only reached when the slot has no
3692
+ * account record and no agent this session made; the created agent is
3693
+ * remembered for the session (sessionAgents) so reads select it before its
3694
+ * record exists.
3695
+ */
2441
3696
  private createAgent;
2442
3697
  /**
2443
3698
  * The routing create lock refused the create: another tab or app owns or is
@@ -2464,11 +3719,16 @@ declare class YieldseekerAgent implements IAgent {
2464
3719
  private snapshotMovement;
2465
3720
  private advancePortfolioVersion;
2466
3721
  private requestPortfolioSnapshot;
3722
+ private snapshotPath;
3723
+ /** True while `walletRequest` would refuse a read of `path`: this user's
3724
+ * rate-limit cooldown or that endpoint's outage cooldown. */
3725
+ private readCoolingDown;
2467
3726
  private portfolioSnapshot;
2468
3727
  private loadPortfolioContext;
2469
3728
  private loadActivityContext;
2470
3729
  private loadPortfolioParts;
2471
3730
  private deployAgent;
3731
+ setAccountRefusedListener(listener: (() => void) | undefined): void;
2472
3732
  setFundingLedgerAccess(access: AgentFundingLedgerAccess | undefined): void;
2473
3733
  private historyKey;
2474
3734
  /** Funding-ledger rows for this slot, cached 15 s. Never throws: null on any failure. */
@@ -2525,12 +3785,19 @@ declare class YieldseekerAgent implements IAgent {
2525
3785
  private agentPath;
2526
3786
  private walletRequest;
2527
3787
  private providerRequest;
3788
+ /**
3789
+ * mapApiError for a request that may have opened the Yieldseeker sign-in
3790
+ * prompt (providerRequest signs when no sign-in is saved, and again when
3791
+ * Yieldseeker refuses one). The wallet's rejection, the user cancelling that
3792
+ * prompt, is returned unchanged: the client and the app must see the user's
3793
+ * cancel (no further prompt, no retry), never a provider failure.
3794
+ */
3795
+ private mapRequestFailure;
2528
3796
  private mapApiError;
2529
3797
  private submitTransaction;
2530
3798
  private waitForReceipt;
2531
3799
  private assertTransaction;
2532
3800
  private assertAgent;
2533
- private isOwneyAgent;
2534
3801
  private assetForAgent;
2535
3802
  private isTransactionHash;
2536
3803
  private assertChain;
@@ -2580,6 +3847,23 @@ type OwneySIWXConfig = {
2580
3847
  */
2581
3848
  declare function createOwneySIWX(config: OwneySIWXConfig): SIWXConfig;
2582
3849
 
3850
+ /**
3851
+ * Ask the wallet ITSELF to switch networks, over WalletConnect.
3852
+ *
3853
+ * WalletConnect's provider answers `wallet_switchEthereumChain` locally when
3854
+ * the chain was approved at connect time: it moves its own default chain and
3855
+ * reports success without telling the wallet. MetaMask mobile then stays on
3856
+ * its network, keeps reporting it, and every guard downstream fails with
3857
+ * CHAIN_MISMATCH — after a swap, with the user's funds already moved (ROUT-727).
3858
+ * Sending the request through the session client reaches the wallet, which
3859
+ * shows a real "switch network" prompt; the client also deep-links the wallet
3860
+ * app open on mobile.
3861
+ *
3862
+ * Returns false when `provider` is not a WalletConnect session, so the caller
3863
+ * can fall back to an ordinary switch.
3864
+ */
3865
+ declare function switchWalletConnectChain(provider: unknown, chainId: number, timeoutMs?: number): Promise<boolean>;
3866
+
2583
3867
  /**
2584
3868
  * Persists cross-chain swap secrets so an in-flight order survives a reload.
2585
3869
  *
@@ -2610,6 +3894,26 @@ type StoredOrder = {
2610
3894
  amount: string;
2611
3895
  /** Epoch ms, for ordering recovery records. */
2612
3896
  createdAt: number;
3897
+ /**
3898
+ * A swap-deposit's deposit half, so a resume that finishes the swap can
3899
+ * record it (ROUT-625). `received` is the quote's guaranteed minimum. Absent
3900
+ * on plain swaps and on records written by an older SDK.
3901
+ */
3902
+ pendingDeposit?: {
3903
+ received: string;
3904
+ symbol: string;
3905
+ chainId: number;
3906
+ agentId?: string;
3907
+ operationId?: string;
3908
+ /** The user action's batch (see `DepositOptions.batchId`), carried to the recorded pending deposit. */
3909
+ batchId?: string;
3910
+ };
3911
+ /**
3912
+ * Our routing API accepted these secrets (part 5's opt-in handoff) and
3913
+ * publishes them itself once 1inch is ready. Informational: this browser
3914
+ * still publishes and resumes as before. Absent when no handoff was accepted.
3915
+ */
3916
+ serverSecrets?: true;
2613
3917
  };
2614
3918
  /**
2615
3919
  * Every unresolved stored order, newest first.
@@ -2617,6 +3921,13 @@ type StoredOrder = {
2617
3921
  */
2618
3922
  declare function listOrders(_now?: number): StoredOrder[];
2619
3923
 
3924
+ /**
3925
+ * Capability flag (part 5): this SDK can hand a signed Fusion+ order's secrets
3926
+ * to the routing API (`handoffSecrets`), which then publishes each one when
3927
+ * 1inch is ready, even if this tab is gone. Older builds do not export this.
3928
+ */
3929
+ declare const FUSION_SECRET_SERVER_PUBLISH: 1;
3930
+
2620
3931
  /**
2621
3932
  * Non-blocking funding ledger reporter.
2622
3933
  *
@@ -2642,6 +3953,8 @@ type LedgerLegReport = {
2642
3953
  userOpHash?: string;
2643
3954
  callsId?: string;
2644
3955
  orderHash?: string;
3956
+ /** The provider's own id for this leg's request (Zyfai's v2 withdrawal id). */
3957
+ providerRef?: string;
2645
3958
  confirmedAmountRaw?: string;
2646
3959
  blockNumber?: string;
2647
3960
  errorCode?: string;
@@ -2660,4 +3973,26 @@ type LedgerLegReport = {
2660
3973
  };
2661
3974
  };
2662
3975
 
2663
- export { type AccountAgentApy, type AccountApyOptions, type AccountDailyEarnings, type AgentApy, type AgentApyDetails, type AgentBalance, AgentChainIncompatibleError, type AgentEarnings, type AgentFundingLedgerAccess, 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 AssetReadMetadata, type AvailableAgent, type AvailableAgentsOptions, type ConnectionState, type DailyApyDays, type DailyEarningsOptions, type DailyEarningsPoint, type DepositAuthorizationReference, type DepositCallback, type DepositOptions, type DepositReplacementValidation, type FundingEvidence, type FundingOperationKind, type FundingOperationLeg, type FundingOperationRow, type FundingProgress, type FundingStage, type HistoryAction, type HistoryFilters, type HistoryOptions, type HistoryTransaction, type IAgent, InvalidHistoryCursorError, type LedgerLegReport, 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 PendingDeposit, type ProviderSnapshotSample, type RebalanceLog, type ReservationAgent, type ReservationReleaseReason, type RpcUrlsConfig, SDK_VERSION, type SwapChainTokens, type SwapDirection, type SwapOrderStatus, type SwapQuote, type SwapQuoteParams, type SwapRail, type SwapStage, type SwapTokenInfo, type SwapTokenSearchResult, type UnsignedUserOperationEvidence, type WithdrawOptions, type WithdrawSwapRecord, type WithdrawSwapStatus, type WithdrawalCompletion, type WithdrawalCompletionContext, type WithdrawalPayoutCandidate, type WithdrawalPayoutScan, type WithdrawalReservationConflict, type WithdrawalReservationMode, type WithdrawalReservationOptions, type WithdrawalSwapRecovery, YieldseekerAgent, type YieldseekerWalletStatus, type ZyfaiRpcUrlsConfig, clearWithdrawSwap, createOwneySIWX, listPendingDeposits, listOrders as listPendingSwaps, listWithdrawSwaps, saveWithdrawSwap, setOwneyDebug, subscribeWithdrawSwaps, updateWithdrawSwap };
3976
+ /** This SDK hands every Zyfai withdrawal request to the caller's
3977
+ * `onBeforeSubmission` before sending it, and a failed checkpoint stops it.
3978
+ * A caller that persisted nothing for a dead run can therefore conclude the
3979
+ * request was never sent. Older builds do not export this. */
3980
+ declare const ZYFAI_WITHDRAW_DISPATCH_CHECKPOINT: 1;
3981
+
3982
+ /** Capability flag: this SDK opts in to the server sending an accepted
3983
+ * sponsored deposit itself (prepare `serverBroadcast: true`) and reports such a
3984
+ * deposit as pending, never "not sent". Older builds do not export this. */
3985
+ declare const SPONSORED_DEPOSIT_SERVER_BROADCAST: 1;
3986
+
3987
+ /** Capability flag: this SDK opts in to the server sending its signed sponsored
3988
+ * Yieldseeker withdrawal userOp itself (`serverSubmit=1` on its own
3989
+ * `eth_sendUserOperation`) and reports such a leg as pending, never "not sent".
3990
+ * Older builds do not export this. */
3991
+ declare const YIELDSEEKER_WITHDRAW_SERVER_SUBMIT: 1;
3992
+
3993
+ /** Capability flag: this SDK has `reportDepositRecovery`, which reports a
3994
+ * deposit leg the app's recovery verified on chain to the funding ledger.
3995
+ * Older builds do not export this. */
3996
+ declare const FUNDING_DEPOSIT_RECOVERY_REPORT: 1;
3997
+
3998
+ export { type AccountAgentApy, type AccountApyOptions, type AccountDailyEarnings, type ActivateAgentOptions, type AgentApy, type AgentApyDetails, type AgentBalance, AgentChainIncompatibleError, type AgentEarnings, type AgentFundingLedgerAccess, type AgentHistoryEntry, type AgentHistoryPosition, type AgentId, AgentNotFoundError, type AgentSupportedAsset, type AgentSupportedAssets, type AgentUserProfile, type AgentWithdrawResult, type AgentsApyOptions, type AllocationAgentApy, type AllocationApyOptions, type ApyByChainAndAsset, type ApyCoverage, type ApyHistoryPoint, type ApyIncentive, type Asset, type AssetDailyEarnings, type AssetReadMetadata, type AvailableAgent, type AvailableAgentsOptions, type AvailablePool, type ConnectionState, type DailyApyDays, type DailyEarningsOptions, type DailyEarningsPoint, type DepositAuthorizationReference, type DepositCallback, type DepositOptions, type DepositReplacementValidation, FUNDING_DEPOSIT_RECOVERY_REPORT, FUSION_SECRET_SERVER_PUBLISH, type FundingEvidence, type FundingOperationKind, type FundingOperationLeg, type FundingOperationRow, type FundingProgress, type FundingStage, type HistoryAction, type HistoryFilters, type HistoryOptions, type HistoryTransaction, type IAgent, InvalidHistoryCursorError, type LedgerLegReport, type LookbackDays, NotConnectedError, type OrgPoolPolicy, type OrgPoolSelection, 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 OwneyWithdrawAllLeg, type OwneyWithdrawAllResult, type OwneyWithdrawResult, type PendingDeposit, type PoolCatalogProtocol, type PoolSelectionStrategy, type ProviderSnapshotSample, type RebalanceLog, type ReservationAgent, type ReservationReleaseReason, type RpcUrlsConfig, SDK_VERSION, SPONSORED_DEPOSIT_SERVER_BROADCAST, type SavedPoolSelection, type SwapChainTokens, type SwapDirection, type SwapOrderStatus, type SwapQuote, type SwapQuoteParams, type SwapRail, type SwapStage, type SwapTokenInfo, type SwapTokenSearchResult, type UnsignedUserOperationEvidence, type UserPoolSelection, type UserPoolSelectionRequest, type WithdrawOptions, type WithdrawSwapRecord, type WithdrawSwapStatus, type WithdrawalCompletion, type WithdrawalCompletionContext, type WithdrawalPayoutCandidate, type WithdrawalPayoutScan, type WithdrawalReservationConflict, type WithdrawalReservationMode, type WithdrawalReservationOptions, type WithdrawalSwapRecovery, YIELDSEEKER_WITHDRAW_SERVER_SUBMIT, YieldseekerAgent, type YieldseekerWalletStatus, ZYFAI_REGISTRATION_NOT_SENT_CODES, ZYFAI_SERVER_TASKS, ZYFAI_WITHDRAWAL_NOT_SENT_CODES, ZYFAI_WITHDRAW_DISPATCH_CHECKPOINT, type ZyfaiDepositPlacement, type ZyfaiRpcUrlsConfig, type ZyfaiWithdrawalLifecycle, clearWithdrawSwap, createOwneySIWX, listPendingDeposits, listOrders as listPendingSwaps, listWithdrawSwaps, saveWithdrawSwap, setOwneyDebug, subscribeWithdrawSwaps, switchWalletConnectChain, updateWithdrawSwap };