@owney/sdk 0.7.32-beta.11 → 0.7.32-beta.13

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
@@ -429,10 +429,9 @@ interface ConnectionState {
429
429
  chainId: number | null;
430
430
  /**
431
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).
432
+ * wallet prompt for them and fails instead. The client sets it on every
433
+ * read (balances, earnings, history...). Connect/activation and user actions
434
+ * (deposit, withdraw) run without it, so they may still ask for a sign-in.
436
435
  */
437
436
  promptless?: boolean;
438
437
  }
@@ -653,15 +652,13 @@ type AgentFundingLedgerAccess = {
653
652
  /**
654
653
  * What an agent did with a confirmed-deposit notice (`IAgent.depositConfirmed`).
655
654
  * `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.
655
+ * checked whether the deposit was put to work.
658
656
  */
659
657
  type DepositNotice = {
660
658
  notified: true;
661
659
  attempts?: number;
662
660
  allocated?: boolean;
663
661
  reason?: string;
664
- allocatesAfter?: string;
665
662
  } | {
666
663
  notified: false;
667
664
  reason: string;
@@ -711,7 +708,7 @@ interface IAgent {
711
708
  after: string[];
712
709
  beforeRequest?: () => void;
713
710
  }): Promise<ZyfaiHandoffAnswer>;
714
- disconnect(): Promise<void>;
711
+ disconnect(options?: DisconnectOptions): Promise<void>;
715
712
  /**
716
713
  * Ready the user's account for every asset the agent supports on `chainId`,
717
714
  * `asset` first. A failure the provider says will not go away (the user can
@@ -837,6 +834,12 @@ interface IAgent {
837
834
  * account was not created through Owney (AGENT_ACCOUNT_NOT_OWNEY). Optional.
838
835
  */
839
836
  setAccountRefusedListener?(listener: (() => void) | undefined): void;
837
+ /**
838
+ * Called each time the agent drops a saved sign-in its server refused,
839
+ * outside connect (a read or a withdrawal). Not called where the sign-in is
840
+ * renewed (connect, deposit). Optional.
841
+ */
842
+ setSignInRefusedListener?(listener: (() => void) | undefined): void;
840
843
  /**
841
844
  * May this wallet's account use Owney with this agent? Run at connect for
842
845
  * every agent about to activate, before any agent activates or is read.
@@ -906,6 +909,15 @@ type AgentApyOptions = {
906
909
  chainId?: number;
907
910
  };
908
911
 
912
+ /** Options for `OwneySDK.disconnect` and `IAgent.disconnect`. */
913
+ type DisconnectOptions = {
914
+ /**
915
+ * Keep each agent's saved sign-ins (browser storage) so a later connect for
916
+ * the same wallet needs no new signature. Everything held in memory is
917
+ * still dropped. Default false: saved sign-ins are deleted.
918
+ */
919
+ keepSignIns?: boolean;
920
+ };
909
921
  type AgentId = "zyfai" | "yieldseeker";
910
922
  type Asset = string;
911
923
  type AgentSupportedAsset = {
@@ -2002,15 +2014,8 @@ declare class OwneySDK {
2002
2014
  */
2003
2015
  private disabledAgents;
2004
2016
  private readonly accountRefusedListeners;
2017
+ private readonly signInRefusedListeners;
2005
2018
  private readonly signInProgressListeners;
2006
- /**
2007
- * Agents whose sign-in the user cancelled this session (the wallet rejected
2008
- * the prompt), keyed by chain. Until the app ends the session they are read
2009
- * from a saved sign-in only (`readStateFor`), so no read reopens the prompt
2010
- * the user cancelled. A later successful activation of the agent removes
2011
- * it, and `disconnect()` or a different wallet's `connect()` clears the map.
2012
- */
2013
- private declinedSignIns;
2014
2019
  private state;
2015
2020
  private connectionRevision;
2016
2021
  private disconnectingAgents;
@@ -2102,6 +2107,14 @@ declare class OwneySDK {
2102
2107
  * each time an agent maps such a refusal. Returns the unsubscribe function.
2103
2108
  */
2104
2109
  onAccountRefused(listener: (agentId: AgentId) => void): () => void;
2110
+ /**
2111
+ * Listens for an agent dropping a saved sign-in its server refused, outside
2112
+ * connect (a read or a withdrawal found it refused). The agent will not
2113
+ * sign in again by itself; the next sign-in is the user's. Not fired where a
2114
+ * refused sign-in is renewed (connect, deposit). Returns the unsubscribe
2115
+ * function.
2116
+ */
2117
+ onSignInRefused(listener: (agentId: AgentId) => void): () => void;
2105
2118
  /**
2106
2119
  * Listens for the sign-ins a connect asks for (`SignInProgress`): which
2107
2120
  * agents will ask the wallet to sign in, and each one as it starts and ends,
@@ -2110,6 +2123,14 @@ declare class OwneySDK {
2110
2123
  * function.
2111
2124
  */
2112
2125
  onSignInProgress(listener: (progress: SignInProgress) => void): () => void;
2126
+ /**
2127
+ * The agents that would ask the wallet to sign in on `chainId` right now:
2128
+ * enabled agents on that chain whose `needsSignIn` says yes. One with no
2129
+ * such check counts as no; one that throws counts as yes, so an unknown
2130
+ * answer never lets the app retry quietly into a prompt. Never prompts and
2131
+ * never calls the network. Empty before connect.
2132
+ */
2133
+ signInsNeeded(chainId: number): AgentId[];
2113
2134
  /**
2114
2135
  * The sign-ins this connect asks for: the agents whose `needsSignIn` says
2115
2136
  * yes now (one that throws counts as no). Each is announced at its first
@@ -2138,7 +2159,7 @@ declare class OwneySDK {
2138
2159
  * Disconnect from all agents and clear connection state.
2139
2160
  * After calling this, `connect()` must be called again before using agent methods.
2140
2161
  */
2141
- disconnect(): Promise<void>;
2162
+ disconnect(options?: DisconnectOptions): Promise<void>;
2142
2163
  private clearConnectionState;
2143
2164
  private disconnectAgents;
2144
2165
  private isAgentDisabled;
@@ -2161,12 +2182,11 @@ declare class OwneySDK {
2161
2182
  */
2162
2183
  private hasNoAgentForSlot;
2163
2184
  /**
2164
- * The state an agent's reads use. An agent whose sign-in the user cancelled
2165
- * on the connection chain this session is read from a saved sign-in only,
2166
- * as `offChainPortfolioAgents` reads: a read that would need a wallet
2167
- * prompt fails for that agent instead of reopening the prompt the user
2168
- * cancelled. A later successful activation of the agent, or `disconnect()`,
2169
- * lifts it.
2185
+ * The state every agent read uses: promptless, so a read uses a saved
2186
+ * sign-in only and never opens a wallet prompt. A read that would need one
2187
+ * fails for that agent instead; the app keeps the last known value and
2188
+ * retries later. Only connect/activation and user actions (deposit,
2189
+ * withdraw) may ask the wallet to sign in, and they use the plain state.
2170
2190
  */
2171
2191
  private readStateFor;
2172
2192
  /**
@@ -3281,6 +3301,15 @@ declare class YieldseekerAgent implements IAgent {
3281
3301
  private readonly balanceContexts;
3282
3302
  private readonly balanceVaults;
3283
3303
  private readonly users;
3304
+ /**
3305
+ * Agent wallets (lowercase) this page started releasing vault funds from for
3306
+ * a withdrawal, and when. Until the payout is done the released money sits
3307
+ * in the agent wallet, so no deposit notice may go out (it would be
3308
+ * reinvested). The ledger shows the same once it lists the withdrawal.
3309
+ */
3310
+ private readonly releasingWallets;
3311
+ /** One login (and, for a new wallet, one create) per wallet and chain at a time. */
3312
+ private readonly pendingUsers;
3284
3313
  private readonly pendingAgents;
3285
3314
  private readonly pendingWalletContexts;
3286
3315
  private readonly readCache;
@@ -3302,6 +3331,7 @@ declare class YieldseekerAgent implements IAgent {
3302
3331
  private readonly settlementChecks;
3303
3332
  private ledgerAccess?;
3304
3333
  private accountRefusedListener?;
3334
+ private signInRefusedListener?;
3305
3335
  private readonly ledgerReads;
3306
3336
  /** contextKey -> movements this instance started settling (by tx hash) and how they refresh:
3307
3337
  * awaiting the ledger, refreshed when ready (ledger), or on the timed backoff (legacy). */
@@ -3373,7 +3403,7 @@ declare class YieldseekerAgent implements IAgent {
3373
3403
  txHash: Hex;
3374
3404
  status: YieldseekerWalletStatus;
3375
3405
  }>;
3376
- disconnect(): Promise<void>;
3406
+ disconnect(options?: DisconnectOptions): Promise<void>;
3377
3407
  /**
3378
3408
  * Whether connecting now would ask the wallet to sign in: no reusable saved
3379
3409
  * sign-in for this wallet and chain. Never prompts; reads only what is saved.
@@ -3439,7 +3469,9 @@ declare class YieldseekerAgent implements IAgent {
3439
3469
  * left idle. While it has not, Yieldseeker is told again, up to
3440
3470
  * DEPOSIT_NOTICE_ATTEMPTS calls in all; a failed call (network, server, rate
3441
3471
  * limit) is sent again after a wait. Within an hour of a withdrawal it is
3442
- * told once, since nothing can move yet. Uses the agent this session already
3472
+ * told once, since nothing can move yet. While a withdrawal from the agent
3473
+ * wallet is under way it is not told at all: its released funds wait in that
3474
+ * wallet for the payout, and a notice would reinvest them (ROUT-790). Uses the agent this session already
3443
3475
  * knows for the asset and the saved sign-in only: never prompts, never
3444
3476
  * throws. Each call is reported through `onNotice`.
3445
3477
  */
@@ -3456,11 +3488,12 @@ declare class YieldseekerAgent implements IAgent {
3456
3488
  */
3457
3489
  private rebalanceAfterPoolSave;
3458
3490
  /**
3459
- * When Yieldseeker may move funds again after this agent wallet's last
3460
- * confirmed withdrawal, if that is still ahead; null when there was none in
3461
- * the last hour or the ledger cannot say.
3491
+ * A withdrawal from this agent wallet that has started but not finished,
3492
+ * within the last hour: released by this page, or listed on the ledger with
3493
+ * the agent's leg still created, submitted or unknown. Older unfinished rows
3494
+ * do not count, so a stuck record cannot hold deposits back for good.
3462
3495
  */
3463
- private withdrawalCooldownEnd;
3496
+ private withdrawalUnderWay;
3464
3497
  /**
3465
3498
  * The agent wallet's base-asset balance and the platform fee Yieldseeker has
3466
3499
  * not collected from it, read at one block for a balance read. Cached
@@ -3730,6 +3763,13 @@ declare class YieldseekerAgent implements IAgent {
3730
3763
  private reportAccount;
3731
3764
  private contextForAgent;
3732
3765
  private resolveUser;
3766
+ /**
3767
+ * `login-with-wallet`, and `POST /users` for a wallet without an account.
3768
+ * Both draw on Yieldseeker's per-IP sign-in allowance, which all our users
3769
+ * share: while a 429's pause lasts nothing is sent, and a new 429 starts one.
3770
+ */
3771
+ private signInUser;
3772
+ private signInRateLimited;
3733
3773
  private forgetUser;
3734
3774
  private ensureAgent;
3735
3775
  private findAgent;
@@ -3776,6 +3816,7 @@ declare class YieldseekerAgent implements IAgent {
3776
3816
  private loadPortfolioParts;
3777
3817
  private deployAgent;
3778
3818
  setAccountRefusedListener(listener: (() => void) | undefined): void;
3819
+ setSignInRefusedListener(listener: (() => void) | undefined): void;
3779
3820
  setFundingLedgerAccess(access: AgentFundingLedgerAccess | undefined): void;
3780
3821
  private historyKey;
3781
3822
  /** Funding-ledger rows for this slot, cached 15 s. Never throws: null on any failure. */
@@ -4042,4 +4083,4 @@ declare const YIELDSEEKER_WITHDRAW_SERVER_SUBMIT: 1;
4042
4083
  * Older builds do not export this. */
4043
4084
  declare const FUNDING_DEPOSIT_RECOVERY_REPORT: 1;
4044
4085
 
4045
- 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 SignInProgress, 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 };
4086
+ 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, type DisconnectOptions, 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 SignInProgress, 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 };
package/dist/index.d.ts CHANGED
@@ -429,10 +429,9 @@ interface ConnectionState {
429
429
  chainId: number | null;
430
430
  /**
431
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).
432
+ * wallet prompt for them and fails instead. The client sets it on every
433
+ * read (balances, earnings, history...). Connect/activation and user actions
434
+ * (deposit, withdraw) run without it, so they may still ask for a sign-in.
436
435
  */
437
436
  promptless?: boolean;
438
437
  }
@@ -653,15 +652,13 @@ type AgentFundingLedgerAccess = {
653
652
  /**
654
653
  * What an agent did with a confirmed-deposit notice (`IAgent.depositConfirmed`).
655
654
  * `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.
655
+ * checked whether the deposit was put to work.
658
656
  */
659
657
  type DepositNotice = {
660
658
  notified: true;
661
659
  attempts?: number;
662
660
  allocated?: boolean;
663
661
  reason?: string;
664
- allocatesAfter?: string;
665
662
  } | {
666
663
  notified: false;
667
664
  reason: string;
@@ -711,7 +708,7 @@ interface IAgent {
711
708
  after: string[];
712
709
  beforeRequest?: () => void;
713
710
  }): Promise<ZyfaiHandoffAnswer>;
714
- disconnect(): Promise<void>;
711
+ disconnect(options?: DisconnectOptions): Promise<void>;
715
712
  /**
716
713
  * Ready the user's account for every asset the agent supports on `chainId`,
717
714
  * `asset` first. A failure the provider says will not go away (the user can
@@ -837,6 +834,12 @@ interface IAgent {
837
834
  * account was not created through Owney (AGENT_ACCOUNT_NOT_OWNEY). Optional.
838
835
  */
839
836
  setAccountRefusedListener?(listener: (() => void) | undefined): void;
837
+ /**
838
+ * Called each time the agent drops a saved sign-in its server refused,
839
+ * outside connect (a read or a withdrawal). Not called where the sign-in is
840
+ * renewed (connect, deposit). Optional.
841
+ */
842
+ setSignInRefusedListener?(listener: (() => void) | undefined): void;
840
843
  /**
841
844
  * May this wallet's account use Owney with this agent? Run at connect for
842
845
  * every agent about to activate, before any agent activates or is read.
@@ -906,6 +909,15 @@ type AgentApyOptions = {
906
909
  chainId?: number;
907
910
  };
908
911
 
912
+ /** Options for `OwneySDK.disconnect` and `IAgent.disconnect`. */
913
+ type DisconnectOptions = {
914
+ /**
915
+ * Keep each agent's saved sign-ins (browser storage) so a later connect for
916
+ * the same wallet needs no new signature. Everything held in memory is
917
+ * still dropped. Default false: saved sign-ins are deleted.
918
+ */
919
+ keepSignIns?: boolean;
920
+ };
909
921
  type AgentId = "zyfai" | "yieldseeker";
910
922
  type Asset = string;
911
923
  type AgentSupportedAsset = {
@@ -2002,15 +2014,8 @@ declare class OwneySDK {
2002
2014
  */
2003
2015
  private disabledAgents;
2004
2016
  private readonly accountRefusedListeners;
2017
+ private readonly signInRefusedListeners;
2005
2018
  private readonly signInProgressListeners;
2006
- /**
2007
- * Agents whose sign-in the user cancelled this session (the wallet rejected
2008
- * the prompt), keyed by chain. Until the app ends the session they are read
2009
- * from a saved sign-in only (`readStateFor`), so no read reopens the prompt
2010
- * the user cancelled. A later successful activation of the agent removes
2011
- * it, and `disconnect()` or a different wallet's `connect()` clears the map.
2012
- */
2013
- private declinedSignIns;
2014
2019
  private state;
2015
2020
  private connectionRevision;
2016
2021
  private disconnectingAgents;
@@ -2102,6 +2107,14 @@ declare class OwneySDK {
2102
2107
  * each time an agent maps such a refusal. Returns the unsubscribe function.
2103
2108
  */
2104
2109
  onAccountRefused(listener: (agentId: AgentId) => void): () => void;
2110
+ /**
2111
+ * Listens for an agent dropping a saved sign-in its server refused, outside
2112
+ * connect (a read or a withdrawal found it refused). The agent will not
2113
+ * sign in again by itself; the next sign-in is the user's. Not fired where a
2114
+ * refused sign-in is renewed (connect, deposit). Returns the unsubscribe
2115
+ * function.
2116
+ */
2117
+ onSignInRefused(listener: (agentId: AgentId) => void): () => void;
2105
2118
  /**
2106
2119
  * Listens for the sign-ins a connect asks for (`SignInProgress`): which
2107
2120
  * agents will ask the wallet to sign in, and each one as it starts and ends,
@@ -2110,6 +2123,14 @@ declare class OwneySDK {
2110
2123
  * function.
2111
2124
  */
2112
2125
  onSignInProgress(listener: (progress: SignInProgress) => void): () => void;
2126
+ /**
2127
+ * The agents that would ask the wallet to sign in on `chainId` right now:
2128
+ * enabled agents on that chain whose `needsSignIn` says yes. One with no
2129
+ * such check counts as no; one that throws counts as yes, so an unknown
2130
+ * answer never lets the app retry quietly into a prompt. Never prompts and
2131
+ * never calls the network. Empty before connect.
2132
+ */
2133
+ signInsNeeded(chainId: number): AgentId[];
2113
2134
  /**
2114
2135
  * The sign-ins this connect asks for: the agents whose `needsSignIn` says
2115
2136
  * yes now (one that throws counts as no). Each is announced at its first
@@ -2138,7 +2159,7 @@ declare class OwneySDK {
2138
2159
  * Disconnect from all agents and clear connection state.
2139
2160
  * After calling this, `connect()` must be called again before using agent methods.
2140
2161
  */
2141
- disconnect(): Promise<void>;
2162
+ disconnect(options?: DisconnectOptions): Promise<void>;
2142
2163
  private clearConnectionState;
2143
2164
  private disconnectAgents;
2144
2165
  private isAgentDisabled;
@@ -2161,12 +2182,11 @@ declare class OwneySDK {
2161
2182
  */
2162
2183
  private hasNoAgentForSlot;
2163
2184
  /**
2164
- * The state an agent's reads use. An agent whose sign-in the user cancelled
2165
- * on the connection chain this session is read from a saved sign-in only,
2166
- * as `offChainPortfolioAgents` reads: a read that would need a wallet
2167
- * prompt fails for that agent instead of reopening the prompt the user
2168
- * cancelled. A later successful activation of the agent, or `disconnect()`,
2169
- * lifts it.
2185
+ * The state every agent read uses: promptless, so a read uses a saved
2186
+ * sign-in only and never opens a wallet prompt. A read that would need one
2187
+ * fails for that agent instead; the app keeps the last known value and
2188
+ * retries later. Only connect/activation and user actions (deposit,
2189
+ * withdraw) may ask the wallet to sign in, and they use the plain state.
2170
2190
  */
2171
2191
  private readStateFor;
2172
2192
  /**
@@ -3281,6 +3301,15 @@ declare class YieldseekerAgent implements IAgent {
3281
3301
  private readonly balanceContexts;
3282
3302
  private readonly balanceVaults;
3283
3303
  private readonly users;
3304
+ /**
3305
+ * Agent wallets (lowercase) this page started releasing vault funds from for
3306
+ * a withdrawal, and when. Until the payout is done the released money sits
3307
+ * in the agent wallet, so no deposit notice may go out (it would be
3308
+ * reinvested). The ledger shows the same once it lists the withdrawal.
3309
+ */
3310
+ private readonly releasingWallets;
3311
+ /** One login (and, for a new wallet, one create) per wallet and chain at a time. */
3312
+ private readonly pendingUsers;
3284
3313
  private readonly pendingAgents;
3285
3314
  private readonly pendingWalletContexts;
3286
3315
  private readonly readCache;
@@ -3302,6 +3331,7 @@ declare class YieldseekerAgent implements IAgent {
3302
3331
  private readonly settlementChecks;
3303
3332
  private ledgerAccess?;
3304
3333
  private accountRefusedListener?;
3334
+ private signInRefusedListener?;
3305
3335
  private readonly ledgerReads;
3306
3336
  /** contextKey -> movements this instance started settling (by tx hash) and how they refresh:
3307
3337
  * awaiting the ledger, refreshed when ready (ledger), or on the timed backoff (legacy). */
@@ -3373,7 +3403,7 @@ declare class YieldseekerAgent implements IAgent {
3373
3403
  txHash: Hex;
3374
3404
  status: YieldseekerWalletStatus;
3375
3405
  }>;
3376
- disconnect(): Promise<void>;
3406
+ disconnect(options?: DisconnectOptions): Promise<void>;
3377
3407
  /**
3378
3408
  * Whether connecting now would ask the wallet to sign in: no reusable saved
3379
3409
  * sign-in for this wallet and chain. Never prompts; reads only what is saved.
@@ -3439,7 +3469,9 @@ declare class YieldseekerAgent implements IAgent {
3439
3469
  * left idle. While it has not, Yieldseeker is told again, up to
3440
3470
  * DEPOSIT_NOTICE_ATTEMPTS calls in all; a failed call (network, server, rate
3441
3471
  * limit) is sent again after a wait. Within an hour of a withdrawal it is
3442
- * told once, since nothing can move yet. Uses the agent this session already
3472
+ * told once, since nothing can move yet. While a withdrawal from the agent
3473
+ * wallet is under way it is not told at all: its released funds wait in that
3474
+ * wallet for the payout, and a notice would reinvest them (ROUT-790). Uses the agent this session already
3443
3475
  * knows for the asset and the saved sign-in only: never prompts, never
3444
3476
  * throws. Each call is reported through `onNotice`.
3445
3477
  */
@@ -3456,11 +3488,12 @@ declare class YieldseekerAgent implements IAgent {
3456
3488
  */
3457
3489
  private rebalanceAfterPoolSave;
3458
3490
  /**
3459
- * When Yieldseeker may move funds again after this agent wallet's last
3460
- * confirmed withdrawal, if that is still ahead; null when there was none in
3461
- * the last hour or the ledger cannot say.
3491
+ * A withdrawal from this agent wallet that has started but not finished,
3492
+ * within the last hour: released by this page, or listed on the ledger with
3493
+ * the agent's leg still created, submitted or unknown. Older unfinished rows
3494
+ * do not count, so a stuck record cannot hold deposits back for good.
3462
3495
  */
3463
- private withdrawalCooldownEnd;
3496
+ private withdrawalUnderWay;
3464
3497
  /**
3465
3498
  * The agent wallet's base-asset balance and the platform fee Yieldseeker has
3466
3499
  * not collected from it, read at one block for a balance read. Cached
@@ -3730,6 +3763,13 @@ declare class YieldseekerAgent implements IAgent {
3730
3763
  private reportAccount;
3731
3764
  private contextForAgent;
3732
3765
  private resolveUser;
3766
+ /**
3767
+ * `login-with-wallet`, and `POST /users` for a wallet without an account.
3768
+ * Both draw on Yieldseeker's per-IP sign-in allowance, which all our users
3769
+ * share: while a 429's pause lasts nothing is sent, and a new 429 starts one.
3770
+ */
3771
+ private signInUser;
3772
+ private signInRateLimited;
3733
3773
  private forgetUser;
3734
3774
  private ensureAgent;
3735
3775
  private findAgent;
@@ -3776,6 +3816,7 @@ declare class YieldseekerAgent implements IAgent {
3776
3816
  private loadPortfolioParts;
3777
3817
  private deployAgent;
3778
3818
  setAccountRefusedListener(listener: (() => void) | undefined): void;
3819
+ setSignInRefusedListener(listener: (() => void) | undefined): void;
3779
3820
  setFundingLedgerAccess(access: AgentFundingLedgerAccess | undefined): void;
3780
3821
  private historyKey;
3781
3822
  /** Funding-ledger rows for this slot, cached 15 s. Never throws: null on any failure. */
@@ -4042,4 +4083,4 @@ declare const YIELDSEEKER_WITHDRAW_SERVER_SUBMIT: 1;
4042
4083
  * Older builds do not export this. */
4043
4084
  declare const FUNDING_DEPOSIT_RECOVERY_REPORT: 1;
4044
4085
 
4045
- 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 SignInProgress, 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 };
4086
+ 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, type DisconnectOptions, 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 SignInProgress, 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 };