@owney/sdk 0.7.27-beta.1 → 0.7.27-beta.3

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
@@ -224,7 +224,7 @@ type SwapOrderStatus = "pending" | "executed" | "expired" | "cancelled" | "refun
224
224
  */
225
225
  type SwapStage = "withdrawing" | "withdrawn"
226
226
  /** Withdrawal incomplete or unconfirmed; no swap was submitted. */
227
- | "withdrawal-incomplete" | "quoting" | "wrapping" | "wrapped" | "approving" | "building" | "signing" | "swapping" | "swapped" | "depositing" | "refunding" | "refunded";
227
+ | "withdrawal-incomplete" | "swap-unknown" | "swap-partial" | "swap-not-started" | "quoting" | "wrapping" | "wrapped" | "approving" | "building" | "signing" | "swapping" | "swapped" | "depositing" | "refunding" | "refunded";
228
228
  /**
229
229
  * Which way the funds travel, which decides what each side may be.
230
230
  *
@@ -386,7 +386,9 @@ interface IAgent {
386
386
  */
387
387
  applyOrgPolicy?(state: ConnectionState, chainId: number, policy: OrgAgentConfig): Promise<void>;
388
388
  deposit(state: ConnectionState, chainId: number, amount: string, asset: OwneySupportedTokens, depositCallback?: DepositCallback, onProgress?: FundingProgress, onBeforeSubmission?: (evidence: FundingEvidence) => void | Promise<void>): Promise<OwneyDepositResult>;
389
- withdraw(state: ConnectionState, chainId: number, token: OwneySupportedTokens, amount?: string, onProgress?: FundingProgress, gasMode?: "auto" | "sponsored" | "paid", onBeforeSubmission?: FundingProgress): Promise<AgentWithdrawResult>;
389
+ withdraw(state: ConnectionState, chainId: number, token: OwneySupportedTokens, amount?: string, onProgress?: FundingProgress, gasMode?: "auto" | "sponsored" | "paid", onBeforeSubmission?: FundingProgress, assertCurrent?: () => void): Promise<AgentWithdrawResult>;
390
+ /** Read-only MAX proof at the owner payout block; never sends another withdrawal. */
391
+ verifyWithdrawalCompletion?(state: ConnectionState, evidence: FundingEvidence): Promise<WithdrawalCompletion>;
390
392
  /** A newly observed pool allocation invalidates this asset's portfolio cache only. */
391
393
  invalidateAllocationRead?(state: ConnectionState, chainId: number, asset: OwneySupportedTokens): void;
392
394
  /** Invalidate only the confirmed asset. This hook must not sign or submit transactions. */
@@ -500,6 +502,9 @@ type HistoryOptions = {
500
502
  filters?: HistoryFilters;
501
503
  };
502
504
  type WithdrawOptions = {
505
+ /** Internal orchestration observation deadline; never retries a send. */
506
+ observationDeadline?: number;
507
+ assertCurrent?: () => void;
503
508
  /** Yieldseeker V2 only. "auto" requests sponsorship for a verified V2 wallet. */
504
509
  gasMode?: "auto" | "sponsored" | "paid";
505
510
  /** Exclude unresolved providers from aggregate withdrawals; direct agent requests are unchanged. */
@@ -561,6 +566,9 @@ type AgentsApyOptions = {
561
566
  chainId?: number;
562
567
  };
563
568
  type DepositOptions = {
569
+ /** Optional synchronous foreground ownership fence for the default Permit2 rail.
570
+ * Throw to stop preparation/dispatch and late journal writes after lease/session loss. */
571
+ assertSubmissionCurrent?: () => void;
564
572
  /** Resume only these already signed relayer bytes; never create a new authorization. */
565
573
  resumeTxHash?: `0x${string}`;
566
574
  onProgress?: FundingProgress;
@@ -575,6 +583,18 @@ type DepositOptions = {
575
583
  };
576
584
 
577
585
  type FundingStage = "pending" | "confirmed" | "unknown" | "failed" | "not-applicable";
586
+ /** Vault inventory retained before the MAX payout. No signatures or secrets. */
587
+ type WithdrawalCompletionContext = {
588
+ vaults: string[];
589
+ userId: string;
590
+ agentId: string;
591
+ inventoryComplete: boolean;
592
+ };
593
+ type WithdrawalCompletion = {
594
+ status: "complete" | "remaining" | "unavailable";
595
+ reason?: string;
596
+ checkedVaults?: number;
597
+ };
578
598
  /** Hash-bound v0.6 recovery metadata. Deliberately excludes the owner signature. */
579
599
  type UnsignedUserOperationEvidence = {
580
600
  sender: string;
@@ -588,6 +608,15 @@ type UnsignedUserOperationEvidence = {
588
608
  maxPriorityFeePerGas: string;
589
609
  paymasterAndData: string;
590
610
  };
611
+ type DepositAuthorizationReference = {
612
+ authorizationId: `0x${string}`;
613
+ predecessorTxHash?: `0x${string}`;
614
+ };
615
+ type DepositReplacementValidation = {
616
+ authorizationId: `0x${string}`;
617
+ predecessorTxHash: `0x${string}`;
618
+ replacementTxHash: `0x${string}`;
619
+ };
591
620
  /** Evidence about one provider leg. Amounts are token base units, never USD. */
592
621
  interface FundingEvidence {
593
622
  agentId: AgentId;
@@ -595,6 +624,8 @@ interface FundingEvidence {
595
624
  token: OwneySupportedTokens;
596
625
  walletAddress: string;
597
626
  agentWallet?: string;
627
+ maxCompletion?: WithdrawalCompletionContext;
628
+ maxCompletionCheck?: WithdrawalCompletion;
598
629
  intendedAmount: string;
599
630
  confirmedAmount?: string;
600
631
  /** Receipt delivery and fulfillment of a typed requested amount are separate facts. */
@@ -610,6 +641,7 @@ interface FundingEvidence {
610
641
  callsId?: string;
611
642
  /** Deposit execution was attempted, rather than only prepared. Not confirmation. */
612
643
  depositSubmission?: "started";
644
+ depositAuthorization?: DepositAuthorizationReference;
613
645
  blockNumber?: string;
614
646
  logIndexes?: number[];
615
647
  transferLogs?: {
@@ -980,41 +1012,30 @@ declare class AgentChainIncompatibleError extends OwneyError {
980
1012
  }>, connectedChainId: number);
981
1013
  }
982
1014
 
983
- /**
984
- * Withdrawal swaps the user has walked away from, and how they ended.
985
- *
986
- * The deposit side has `swap.pending-deposit.ts` for the same shape of
987
- * problem, but the two are not symmetrical. A pending deposit is a JOB: the
988
- * money is in the wallet and an ordinary deposit finishes it. This is a
989
- * WATCH — the funds are in escrow, nothing the user does moves them along,
990
- * and the only question is where they ended up.
991
- *
992
- * That is the whole reason this exists. `withdrawAndSwap` used to hold the
993
- * screen for the entire escrow lifecycle, which on a slow mainnet fill is
994
- * minutes of a modal the user cannot leave (ROUT-242). Backgrounding it means
995
- * the outcome arrives after the UI that started it has gone, so the outcome
996
- * has to be written down somewhere the next render can find it.
997
- *
998
- * Only cross-chain swaps are recorded. A same-chain classic swap is one
999
- * transaction and resolves in seconds; a same-chain fusion order has no stored
1000
- * preimages, so there would be nothing for a reloaded session to resume and
1001
- * the record would sit at `swapping` for ever.
1002
- *
1003
- * Kept deliberately separate from the secret store. Secrets are retired the
1004
- * moment an order reaches a verdict — that is a safety property, not a display
1005
- * one — and the record has to outlive them so the user can still be told what
1006
- * happened after they come back.
1007
- */
1008
- /**
1009
- * `swapping` is the only non-terminal state. `unknown` is what a watch that
1010
- * gave up looks like: we stopped polling before the order spoke, so the order
1011
- * may well have filled. It is not a failure, and it must never be shown as
1012
- * one.
1013
- */
1014
- type WithdrawSwapStatus = "swapping" | "landed" | "refunded" | "unknown";
1015
+ /** Durable intent and evidence, including the gap before an order exists. */
1016
+ type WithdrawalSwapRecovery = {
1017
+ attemptId: string;
1018
+ phase: "withdrawing" | "verifying" | "ready" | "submitted" | "incomplete";
1019
+ baseline: string;
1020
+ baselineBlock: string;
1021
+ submittedAt: number;
1022
+ deadline: number;
1023
+ requested?: string;
1024
+ agentId?: AgentId;
1025
+ results?: Record<string, AgentWithdrawResult>;
1026
+ evidence: Record<string, FundingEvidence>;
1027
+ reason?: string;
1028
+ };
1029
+ /** Unknown and partial outcomes remain recoverable until settlement is verified. */
1030
+ type WithdrawSwapStatus = "swapping" | "landed" | "refunded" | "unknown" | "refund-pending" | "partially-filled" | "withdrawal-pending" | "withdrawal-incomplete" | "ready" | "not-swapped";
1015
1031
  type WithdrawSwapRecord = {
1016
1032
  /** Identity. One record per Fusion+ order. */
1017
1033
  orderHash: string;
1034
+ walletAddress?: string;
1035
+ txHash?: string;
1036
+ recovery?: WithdrawalSwapRecovery;
1037
+ spent?: string;
1038
+ dismissed?: boolean;
1018
1039
  status: WithdrawSwapStatus;
1019
1040
  /**
1020
1041
  * What actually left the agent, smallest unit of the SOURCE asset.
@@ -1051,7 +1072,7 @@ declare function subscribeWithdrawSwaps(listener: () => void): () => void;
1051
1072
  * Not after the swap resolves: the point is to survive the gap between submit
1052
1073
  * and settle, which is exactly when the user closes the tab.
1053
1074
  */
1054
- declare function saveWithdrawSwap(record: WithdrawSwapRecord): void;
1075
+ declare function saveWithdrawSwap(record: WithdrawSwapRecord): boolean;
1055
1076
  /**
1056
1077
  * Move a record to its outcome.
1057
1078
  *
@@ -1065,8 +1086,8 @@ declare function saveWithdrawSwap(record: WithdrawSwapRecord): void;
1065
1086
  declare function updateWithdrawSwap(orderHash: string, patch: Partial<Omit<WithdrawSwapRecord, "orderHash">>): void;
1066
1087
  /** The user has read the outcome. Only they do this. */
1067
1088
  declare function clearWithdrawSwap(orderHash: string): void;
1068
- /** Every record, newest first, sweeping anything past MAX_AGE_MS. */
1069
- declare function listWithdrawSwaps(now?: number): WithdrawSwapRecord[];
1089
+ /** Visible records, newest first. Only verified terminal records expire by age. */
1090
+ declare function listWithdrawSwaps(now?: number, includeDismissed?: boolean): WithdrawSwapRecord[];
1070
1091
 
1071
1092
  /**
1072
1093
  * Swaps that landed but were never deposited.
@@ -1131,6 +1152,7 @@ declare class OwneySDK {
1131
1152
  private paymasterServiceUrl?;
1132
1153
  private cachedSponsoredCallsCallbacks;
1133
1154
  private readonly agentReads;
1155
+ private readonly depositFamilyReads;
1134
1156
  private readonly recoveredFundingReads;
1135
1157
  private fundingBalanceChecks;
1136
1158
  private readonly activationChecks;
@@ -1251,10 +1273,10 @@ declare class OwneySDK {
1251
1273
  * Invokes `agent.deposit` with the resolved sponsored callback, composing
1252
1274
  * two independent auto-recovery mechanisms:
1253
1275
  *
1254
- * 1. Missing Permit2 allowance outside the atomic Base-USDC path: when the
1276
+ * 1. Missing Permit2 allowance outside the sponsored ERC-2612 path: when the
1255
1277
  * app did not supply its own callback and the attempt fails with
1256
1278
  * `PERMIT2_APPROVAL_REQUIRED`, this is the wallet's first Permit2 deposit
1257
- * for that token. Base USDC bundles a gasless ERC-2612 approval inside
1279
+ * for that token. Native Base/Arbitrum USDC uses gasless ERC-2612 approval in
1258
1280
  * its sponsored deposit and never reaches this branch. Other tokens send
1259
1281
  * the one-time user-paid Permit2 approval via `approvePermit2()` and
1260
1282
  * retry the SAME sponsored attempt once. Bounded to one approval attempt
@@ -1311,6 +1333,8 @@ declare class OwneySDK {
1311
1333
  /** Whether a foreground deposit can resume the same signed batch, never a
1312
1334
  * fresh authorization. The batch rail independently rechecks the exact plan. */
1313
1335
  canResumePendingDeposit(evidences: FundingEvidence[], amount: string): Promise<boolean>;
1336
+ /** Validate signed journal membership, never just a caller-supplied family ID. */
1337
+ validateDepositReplacement(previous: FundingEvidence[], next: FundingEvidence[]): Promise<DepositReplacementValidation | undefined>;
1314
1338
  /** Optional post-payout display proof; receipt verification and the provider
1315
1339
  * adapter must agree before attaching it to this exact balance object. */
1316
1340
  verifyWithdrawalBalance(evidence: FundingEvidence, balance: AgentBalance): Promise<AgentBalance>;
@@ -1378,29 +1402,11 @@ declare class OwneySDK {
1378
1402
  /** How much of `token` the wallet has already approved Permit2 to move. */
1379
1403
  private readTokenPermit2Allowance;
1380
1404
  /**
1381
- * How much of a landed swap to actually deposit.
1382
- *
1383
- * The swap reports what ARRIVED, and the deposit used to be handed that
1384
- * figure directly. It is the entire arrival, so there is no slack: anything
1385
- * that spends the target asset between the two fails the deposit outright.
1386
- *
1387
- * Something does. A first WETH deposit needs a one-time Permit2 approval,
1388
- * and that approval is a transaction. A wallet holding no native gas token -
1389
- * the normal state of someone who just swapped everything INTO WETH - pays
1390
- * for it out of the WETH. The deposit then asked for ~2e12 wei more than was
1391
- * left and refused with DEPOSIT_INSUFFICIENT_BALANCE, under a wrapper saying
1392
- * the funds were safe but unadded (ROUT-242).
1393
- *
1394
- * So the approval happens here, before the amount is settled, and the amount
1395
- * comes from a read taken after it. Two things this deliberately is not:
1396
- *
1397
- * - It is not a balance sweep. `received` is a DELTA over the pre-swap
1398
- * balance, so a wallet already holding WETH reads far above it; depositing
1399
- * the balance would move funds the user never offered. The arrival is the
1400
- * ceiling and the balance is only ever allowed to lower it.
1401
- * - It does not touch USDC, which moves on signed typed data and so spends
1402
- * nothing of the user's in between, nor a paymaster-configured client,
1403
- * where the sponsor covers the transfer and Permit2 never applies.
1405
+ * Finish any user-paid Permit2 approval before measuring the deposit.
1406
+ * Wallets can charge approval gas in the received token (ROUT-242/544).
1407
+ * Cap the result at the swap arrival to preserve pre-existing wallet funds.
1408
+ * Native Base/Arbitrum USDC uses sponsored ERC-2612; configured paymaster
1409
+ * wallet calls also cover approval without spending the received tokens.
1404
1410
  */
1405
1411
  private settleSwapDepositAmount;
1406
1412
  private walletSeesBalance;
@@ -1473,11 +1479,12 @@ declare class OwneySDK {
1473
1479
  * Every order is attempted even if an earlier one throws: they are unrelated
1474
1480
  * escrows, and one ending badly must not abandon the next one's secrets.
1475
1481
  * `unfinished` is not a verdict — the order may still settle, so unless the
1476
- * chain has said refunded or cancelled its preimages are kept.
1482
+ * provider has confirmed full settlement or refund, its preimages are kept.
1477
1483
  */
1478
1484
  resumePendingSwaps(options?: {
1479
1485
  onStage?: (orderHash: string, stage: SwapStage) => void;
1480
1486
  timeoutMs?: number;
1487
+ orderHash?: string;
1481
1488
  }): Promise<{
1482
1489
  orderHash: string;
1483
1490
  status: "completed" | "unfinished";
@@ -1595,6 +1602,12 @@ declare class OwneySDK {
1595
1602
  /** Percent, classic rail only. Fusion+ prices through its auction. */
1596
1603
  slippage?: number;
1597
1604
  onSwapProgress?: (stage: SwapStage) => void;
1605
+ /** Destination balance baseline, read after the swap and before deposit preparation. */
1606
+ onBeforeDeposit?: () => Promise<void>;
1607
+ onDepositProgress?: FundingProgress;
1608
+ onBeforeDepositSubmission?: DepositOptions["onBeforeSubmission"];
1609
+ /** Stop a stale foreground attempt before it prepares or sends another transaction. */
1610
+ assertCurrent?: () => void;
1598
1611
  }): Promise<{
1599
1612
  swap: {
1600
1613
  received: string;
@@ -1609,6 +1622,20 @@ declare class OwneySDK {
1609
1622
  */
1610
1623
  deposited: string;
1611
1624
  }>;
1625
+ /** Read-only confirmation of a saved pre-swap withdrawal. Never withdraws or swaps. */
1626
+ recheckWithdrawalSwap(id: string): Promise<WithdrawSwapRecord>;
1627
+ /** Explicit foreground continuation: spends verified payouts, never withdraws again. */
1628
+ continueWithdrawalSwap(id: string, callbacks?: Pick<Parameters<OwneySDK["withdrawAndSwap"]>[0], "onSwapProgress" | "onOrderSubmitted" | "onWithdrawalProgress" | "assertCurrent">): Promise<{
1629
+ withdraw: OwneyWithdrawResult | AgentWithdrawResult;
1630
+ /** What actually arrived in the wallet, smallest unit of the agent's asset. */
1631
+ withdrawn: string;
1632
+ swap: {
1633
+ received: string;
1634
+ spent?: string;
1635
+ orderHash?: string;
1636
+ txHash?: string;
1637
+ };
1638
+ }>;
1612
1639
  /**
1613
1640
  * Withdraw from an agent and swap the proceeds into whatever the user wants
1614
1641
  * to hold, delivered to their own wallet.
@@ -1643,6 +1670,7 @@ declare class OwneySDK {
1643
1670
  to: {
1644
1671
  chainId: number;
1645
1672
  symbol: string;
1673
+ decimals?: number;
1646
1674
  };
1647
1675
  /** Human units ("10.5"). Omit to withdraw the full agent balance. */
1648
1676
  amount?: string;
@@ -1677,15 +1705,22 @@ declare class OwneySDK {
1677
1705
  withdrawn: string;
1678
1706
  /** Smallest unit of the destination — the auction's start, not its floor. */
1679
1707
  expected: string;
1708
+ spent?: string;
1709
+ durable?: boolean;
1680
1710
  }) => void;
1681
1711
  /** How long to wait for the withdrawal to land before giving up on the swap. */
1682
1712
  arrivalTimeoutMs?: number;
1713
+ /** UI ownership fence, checked before each financial continuation. */
1714
+ assertCurrent?: () => void;
1715
+ /** Used only by explicit continueWithdrawalSwap; it never sends another withdrawal. */
1716
+ recoveryId?: string;
1683
1717
  }): Promise<{
1684
1718
  withdraw: OwneyWithdrawResult | AgentWithdrawResult;
1685
1719
  /** What actually arrived in the wallet, smallest unit of the agent's asset. */
1686
1720
  withdrawn: string;
1687
1721
  swap: {
1688
1722
  received: string;
1723
+ spent?: string;
1689
1724
  orderHash?: string;
1690
1725
  txHash?: string;
1691
1726
  };
@@ -1789,7 +1824,7 @@ declare class OwneySDK {
1789
1824
  * @param expectedChainId Chain captured by the deposit that requested approval.
1790
1825
  * @returns the approval transaction hash.
1791
1826
  */
1792
- approvePermit2(asset?: OwneySupportedTokens, requiredAmount?: bigint, expectedChainId?: OwneySupportedChainId): Promise<`0x${string}`>;
1827
+ approvePermit2(asset?: OwneySupportedTokens, requiredAmount?: bigint, expectedChainId?: OwneySupportedChainId, assertCurrent?: () => void): Promise<`0x${string}`>;
1793
1828
  /**
1794
1829
  * Get the agent's average APY performance over a time period. Does not require a wallet connection.
1795
1830
  * @param options - Contains agentId (optional) and days ("7D", "14D", or "30D")
@@ -1876,6 +1911,7 @@ declare class YieldseekerAgent implements IAgent {
1876
1911
  private readonly routingApiBaseUrl?;
1877
1912
  private receiptClient?;
1878
1913
  private readonly withdrawalVersionCache;
1914
+ private readonly pendingWalletStatus;
1879
1915
  private readonly pendingUpgrades;
1880
1916
  private readonly transactionExecutor?;
1881
1917
  private readonly unwindReceiptWaiter?;
@@ -1889,15 +1925,18 @@ declare class YieldseekerAgent implements IAgent {
1889
1925
  private readonly pendingReads;
1890
1926
  private readGeneration;
1891
1927
  private readonly portfolioVersions;
1928
+ private readonly liquidityVersions;
1892
1929
  private readonly snapshotFailures;
1893
1930
  private readonly standardReadFailures;
1931
+ private readonly endpointReadFailures;
1894
1932
  private readonly reconcileUntil;
1895
1933
  private readonly allocationRefresh;
1896
1934
  private readonly activityRefreshUntil;
1897
1935
  private readonly snapshotMovements;
1898
1936
  private readonly movementEpochs;
1899
- private readonly yieldOptions;
1900
- private readonly pendingYieldOptions;
1937
+ private readonly settlementChecks;
1938
+ private readonly vaultOptions;
1939
+ private readonly pendingVaultOptions;
1901
1940
  constructor(owneyApiKey: string, options?: YieldseekerAgentOptions);
1902
1941
  private getReceiptClient;
1903
1942
  /** Reads the actual proxy implementation; Yieldseeker's API walletType is not a version check. */
@@ -1911,10 +1950,12 @@ declare class YieldseekerAgent implements IAgent {
1911
1950
  disconnect(): Promise<void>;
1912
1951
  activateAgent(state: ConnectionState, chainId: number, asset?: OwneySupportedTokens): Promise<void>;
1913
1952
  deposit(state: ConnectionState, chainId: number, amount: string, asset: OwneySupportedTokens, depositCallback?: DepositCallback, onProgress?: FundingProgress, onBeforeSubmission?: (evidence: FundingEvidence) => void | Promise<void>): Promise<OwneyDepositResult>;
1914
- withdraw(state: ConnectionState, chainId: number, asset: OwneySupportedTokens, amount?: string, onProgress?: FundingProgress, gasMode?: "auto" | "sponsored" | "paid", onBeforeSubmission?: FundingProgress): Promise<AgentWithdrawResult>;
1953
+ withdraw(state: ConnectionState, chainId: number, asset: OwneySupportedTokens, amount?: string, onProgress?: FundingProgress, gasMode?: "auto" | "sponsored" | "paid", onBeforeSubmission?: FundingProgress, assertOperation?: () => void): Promise<AgentWithdrawResult>;
1915
1954
  private withdrawInternal;
1916
1955
  /** Fresh position amounts for withdrawal planning, net of reserved fees. */
1917
1956
  getWithdrawableBalance(state: ConnectionState, chainId: number, asset: OwneySupportedTokens, minimumAmount?: bigint): Promise<bigint>;
1957
+ /** Recheck MAX without re-unwinding, paying out, or requesting a signature. */
1958
+ verifyWithdrawalCompletion(state: ConnectionState, evidence: FundingEvidence): Promise<WithdrawalCompletion>;
1918
1959
  private readVaultShares;
1919
1960
  private validateWithdrawalPositions;
1920
1961
  private withdrawalVaultHints;
@@ -1933,7 +1974,7 @@ declare class YieldseekerAgent implements IAgent {
1933
1974
  getHistory(state: ConnectionState, chainId: number, options?: HistoryFilters): Promise<OwneyAgentHistory>;
1934
1975
  getUserProfile(state: ConnectionState, chainId: number): Promise<AgentUserProfile>;
1935
1976
  getAgentApy(days: DailyApyDays, options?: AgentApyOptions): Promise<AgentApy>;
1936
- private loadYieldOptions;
1977
+ private loadVaultOptions;
1937
1978
  private userKey;
1938
1979
  private contextKey;
1939
1980
  private assertSession;
@@ -1950,7 +1991,13 @@ declare class YieldseekerAgent implements IAgent {
1950
1991
  private loadActivityPortfolio;
1951
1992
  private resolvePortfolioContexts;
1952
1993
  private portfolioVersion;
1994
+ /** Snapshot cache lifetime: the settlement backoff while a movement is being
1995
+ * checked, otherwise the routine non-forced cadence. */
1953
1996
  private portfolioCacheMs;
1997
+ /** A pending movement inside its ten-minute window forces snapshots. */
1998
+ private settling;
1999
+ /** Start a new forced-check schedule, or keep the active one. */
2000
+ private beginSettlement;
1954
2001
  private snapshotMovement;
1955
2002
  private advancePortfolioVersion;
1956
2003
  private requestPortfolioSnapshot;
@@ -2036,6 +2083,7 @@ declare function createOwneySIWX(config: OwneySIWXConfig): SIWXConfig;
2036
2083
  */
2037
2084
  type StoredOrder = {
2038
2085
  orderHash: string;
2086
+ walletAddress?: string;
2039
2087
  /** Preimages, one per fill. Index matters — fill N needs secret N. */
2040
2088
  secrets: string[];
2041
2089
  /** Chain the funds left from, so a resumed session can report it. */
@@ -2045,13 +2093,13 @@ type StoredOrder = {
2045
2093
  dstSymbol: string;
2046
2094
  dstChainId: number;
2047
2095
  amount: string;
2048
- /** Epoch ms. Used to drop orders far past any plausible timelock. */
2096
+ /** Epoch ms, for ordering recovery records. */
2049
2097
  createdAt: number;
2050
2098
  };
2051
2099
  /**
2052
- * Every stored order, newest first, dropping anything past MAX_AGE_MS.
2100
+ * Every unresolved stored order, newest first.
2053
2101
  * Used on mount to resume orders the user left in flight.
2054
2102
  */
2055
- declare function listOrders(now?: number): StoredOrder[];
2103
+ declare function listOrders(_now?: number): StoredOrder[];
2056
2104
 
2057
- export { type AccountAgentApy, type AccountApyOptions, type AccountDailyEarnings, type AgentApy, type AgentApyDetails, type AgentBalance, AgentChainIncompatibleError, type AgentEarnings, type AgentHistoryEntry, type AgentHistoryPosition, type AgentId, AgentNotFoundError, type AgentSupportedAsset, type AgentSupportedAssets, type AgentUserProfile, type AgentWithdrawResult, type AgentsApyOptions, type AllocationAgentApy, type AllocationApyOptions, type ApyByChainAndAsset, type ApyHistoryPoint, type Asset, type AssetDailyEarnings, type AssetReadMetadata, type AvailableAgent, type AvailableAgentsOptions, type ConnectionState, type DailyApyDays, type DailyEarningsOptions, type DailyEarningsPoint, type DepositCallback, type DepositOptions, type FundingEvidence, type FundingProgress, type FundingStage, type HistoryAction, type HistoryFilters, type HistoryOptions, type HistoryTransaction, type IAgent, InvalidHistoryCursorError, type LookbackDays, NotConnectedError, type OwneyAccountApy, type OwneyAgentApy, type OwneyAgentHistory, type OwneyAllocationApy, type OwneyBalances, type OwneyDepositResult, type OwneyEarnings, OwneyError, type OwneyErrorCode, type OwneyMultiDepositResult, type OwneyPosition, OwneySDK, type OwneySDKConfig, type OwneySIWXConfig, type OwneySupportedChainId, type OwneySupportedChains, type OwneySupportedTokens, type OwneyToken, type OwneyUserProfile, type OwneyWithdrawResult, type PendingDeposit, type RebalanceLog, type RpcUrlsConfig, 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, YieldseekerAgent, type YieldseekerWalletStatus, type ZyfaiRpcUrlsConfig, clearWithdrawSwap, createOwneySIWX, listPendingDeposits, listOrders as listPendingSwaps, listWithdrawSwaps, saveWithdrawSwap, setOwneyDebug, subscribeWithdrawSwaps, updateWithdrawSwap };
2105
+ export { type AccountAgentApy, type AccountApyOptions, type AccountDailyEarnings, type AgentApy, type AgentApyDetails, type AgentBalance, AgentChainIncompatibleError, type AgentEarnings, type AgentHistoryEntry, type AgentHistoryPosition, type AgentId, AgentNotFoundError, type AgentSupportedAsset, type AgentSupportedAssets, type AgentUserProfile, type AgentWithdrawResult, type AgentsApyOptions, type AllocationAgentApy, type AllocationApyOptions, type ApyByChainAndAsset, type ApyHistoryPoint, type Asset, type AssetDailyEarnings, type AssetReadMetadata, type AvailableAgent, type AvailableAgentsOptions, type ConnectionState, type DailyApyDays, type DailyEarningsOptions, type DailyEarningsPoint, type DepositAuthorizationReference, type DepositCallback, type DepositOptions, type DepositReplacementValidation, type FundingEvidence, type FundingProgress, type FundingStage, type HistoryAction, type HistoryFilters, type HistoryOptions, type HistoryTransaction, type IAgent, InvalidHistoryCursorError, type LookbackDays, NotConnectedError, type OwneyAccountApy, type OwneyAgentApy, type OwneyAgentHistory, type OwneyAllocationApy, type OwneyBalances, type OwneyDepositResult, type OwneyEarnings, OwneyError, type OwneyErrorCode, type OwneyMultiDepositResult, type OwneyPosition, OwneySDK, type OwneySDKConfig, type OwneySIWXConfig, type OwneySupportedChainId, type OwneySupportedChains, type OwneySupportedTokens, type OwneyToken, type OwneyUserProfile, type OwneyWithdrawResult, type PendingDeposit, type RebalanceLog, type RpcUrlsConfig, 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 WithdrawalSwapRecovery, YieldseekerAgent, type YieldseekerWalletStatus, type ZyfaiRpcUrlsConfig, clearWithdrawSwap, createOwneySIWX, listPendingDeposits, listOrders as listPendingSwaps, listWithdrawSwaps, saveWithdrawSwap, setOwneyDebug, subscribeWithdrawSwaps, updateWithdrawSwap };