@owney/sdk 0.7.27-beta.2 → 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
@@ -566,6 +566,9 @@ type AgentsApyOptions = {
566
566
  chainId?: number;
567
567
  };
568
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;
569
572
  /** Resume only these already signed relayer bytes; never create a new authorization. */
570
573
  resumeTxHash?: `0x${string}`;
571
574
  onProgress?: FundingProgress;
@@ -605,6 +608,15 @@ type UnsignedUserOperationEvidence = {
605
608
  maxPriorityFeePerGas: string;
606
609
  paymasterAndData: string;
607
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
+ };
608
620
  /** Evidence about one provider leg. Amounts are token base units, never USD. */
609
621
  interface FundingEvidence {
610
622
  agentId: AgentId;
@@ -629,6 +641,7 @@ interface FundingEvidence {
629
641
  callsId?: string;
630
642
  /** Deposit execution was attempted, rather than only prepared. Not confirmation. */
631
643
  depositSubmission?: "started";
644
+ depositAuthorization?: DepositAuthorizationReference;
632
645
  blockNumber?: string;
633
646
  logIndexes?: number[];
634
647
  transferLogs?: {
@@ -1139,6 +1152,7 @@ declare class OwneySDK {
1139
1152
  private paymasterServiceUrl?;
1140
1153
  private cachedSponsoredCallsCallbacks;
1141
1154
  private readonly agentReads;
1155
+ private readonly depositFamilyReads;
1142
1156
  private readonly recoveredFundingReads;
1143
1157
  private fundingBalanceChecks;
1144
1158
  private readonly activationChecks;
@@ -1319,6 +1333,8 @@ declare class OwneySDK {
1319
1333
  /** Whether a foreground deposit can resume the same signed batch, never a
1320
1334
  * fresh authorization. The batch rail independently rechecks the exact plan. */
1321
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>;
1322
1338
  /** Optional post-payout display proof; receipt verification and the provider
1323
1339
  * adapter must agree before attaching it to this exact balance object. */
1324
1340
  verifyWithdrawalBalance(evidence: FundingEvidence, balance: AgentBalance): Promise<AgentBalance>;
@@ -1586,6 +1602,12 @@ declare class OwneySDK {
1586
1602
  /** Percent, classic rail only. Fusion+ prices through its auction. */
1587
1603
  slippage?: number;
1588
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;
1589
1611
  }): Promise<{
1590
1612
  swap: {
1591
1613
  received: string;
@@ -1802,7 +1824,7 @@ declare class OwneySDK {
1802
1824
  * @param expectedChainId Chain captured by the deposit that requested approval.
1803
1825
  * @returns the approval transaction hash.
1804
1826
  */
1805
- approvePermit2(asset?: OwneySupportedTokens, requiredAmount?: bigint, expectedChainId?: OwneySupportedChainId): Promise<`0x${string}`>;
1827
+ approvePermit2(asset?: OwneySupportedTokens, requiredAmount?: bigint, expectedChainId?: OwneySupportedChainId, assertCurrent?: () => void): Promise<`0x${string}`>;
1806
1828
  /**
1807
1829
  * Get the agent's average APY performance over a time period. Does not require a wallet connection.
1808
1830
  * @param options - Contains agentId (optional) and days ("7D", "14D", or "30D")
@@ -1889,6 +1911,7 @@ declare class YieldseekerAgent implements IAgent {
1889
1911
  private readonly routingApiBaseUrl?;
1890
1912
  private receiptClient?;
1891
1913
  private readonly withdrawalVersionCache;
1914
+ private readonly pendingWalletStatus;
1892
1915
  private readonly pendingUpgrades;
1893
1916
  private readonly transactionExecutor?;
1894
1917
  private readonly unwindReceiptWaiter?;
@@ -1905,11 +1928,13 @@ declare class YieldseekerAgent implements IAgent {
1905
1928
  private readonly liquidityVersions;
1906
1929
  private readonly snapshotFailures;
1907
1930
  private readonly standardReadFailures;
1931
+ private readonly endpointReadFailures;
1908
1932
  private readonly reconcileUntil;
1909
1933
  private readonly allocationRefresh;
1910
1934
  private readonly activityRefreshUntil;
1911
1935
  private readonly snapshotMovements;
1912
1936
  private readonly movementEpochs;
1937
+ private readonly settlementChecks;
1913
1938
  private readonly vaultOptions;
1914
1939
  private readonly pendingVaultOptions;
1915
1940
  constructor(owneyApiKey: string, options?: YieldseekerAgentOptions);
@@ -1966,7 +1991,13 @@ declare class YieldseekerAgent implements IAgent {
1966
1991
  private loadActivityPortfolio;
1967
1992
  private resolvePortfolioContexts;
1968
1993
  private portfolioVersion;
1994
+ /** Snapshot cache lifetime: the settlement backoff while a movement is being
1995
+ * checked, otherwise the routine non-forced cadence. */
1969
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;
1970
2001
  private snapshotMovement;
1971
2002
  private advancePortfolioVersion;
1972
2003
  private requestPortfolioSnapshot;
@@ -2071,4 +2102,4 @@ type StoredOrder = {
2071
2102
  */
2072
2103
  declare function listOrders(_now?: number): StoredOrder[];
2073
2104
 
2074
- 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, type WithdrawalCompletion, type WithdrawalCompletionContext, type WithdrawalSwapRecovery, 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 };
package/dist/index.d.ts CHANGED
@@ -566,6 +566,9 @@ type AgentsApyOptions = {
566
566
  chainId?: number;
567
567
  };
568
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;
569
572
  /** Resume only these already signed relayer bytes; never create a new authorization. */
570
573
  resumeTxHash?: `0x${string}`;
571
574
  onProgress?: FundingProgress;
@@ -605,6 +608,15 @@ type UnsignedUserOperationEvidence = {
605
608
  maxPriorityFeePerGas: string;
606
609
  paymasterAndData: string;
607
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
+ };
608
620
  /** Evidence about one provider leg. Amounts are token base units, never USD. */
609
621
  interface FundingEvidence {
610
622
  agentId: AgentId;
@@ -629,6 +641,7 @@ interface FundingEvidence {
629
641
  callsId?: string;
630
642
  /** Deposit execution was attempted, rather than only prepared. Not confirmation. */
631
643
  depositSubmission?: "started";
644
+ depositAuthorization?: DepositAuthorizationReference;
632
645
  blockNumber?: string;
633
646
  logIndexes?: number[];
634
647
  transferLogs?: {
@@ -1139,6 +1152,7 @@ declare class OwneySDK {
1139
1152
  private paymasterServiceUrl?;
1140
1153
  private cachedSponsoredCallsCallbacks;
1141
1154
  private readonly agentReads;
1155
+ private readonly depositFamilyReads;
1142
1156
  private readonly recoveredFundingReads;
1143
1157
  private fundingBalanceChecks;
1144
1158
  private readonly activationChecks;
@@ -1319,6 +1333,8 @@ declare class OwneySDK {
1319
1333
  /** Whether a foreground deposit can resume the same signed batch, never a
1320
1334
  * fresh authorization. The batch rail independently rechecks the exact plan. */
1321
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>;
1322
1338
  /** Optional post-payout display proof; receipt verification and the provider
1323
1339
  * adapter must agree before attaching it to this exact balance object. */
1324
1340
  verifyWithdrawalBalance(evidence: FundingEvidence, balance: AgentBalance): Promise<AgentBalance>;
@@ -1586,6 +1602,12 @@ declare class OwneySDK {
1586
1602
  /** Percent, classic rail only. Fusion+ prices through its auction. */
1587
1603
  slippage?: number;
1588
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;
1589
1611
  }): Promise<{
1590
1612
  swap: {
1591
1613
  received: string;
@@ -1802,7 +1824,7 @@ declare class OwneySDK {
1802
1824
  * @param expectedChainId Chain captured by the deposit that requested approval.
1803
1825
  * @returns the approval transaction hash.
1804
1826
  */
1805
- approvePermit2(asset?: OwneySupportedTokens, requiredAmount?: bigint, expectedChainId?: OwneySupportedChainId): Promise<`0x${string}`>;
1827
+ approvePermit2(asset?: OwneySupportedTokens, requiredAmount?: bigint, expectedChainId?: OwneySupportedChainId, assertCurrent?: () => void): Promise<`0x${string}`>;
1806
1828
  /**
1807
1829
  * Get the agent's average APY performance over a time period. Does not require a wallet connection.
1808
1830
  * @param options - Contains agentId (optional) and days ("7D", "14D", or "30D")
@@ -1889,6 +1911,7 @@ declare class YieldseekerAgent implements IAgent {
1889
1911
  private readonly routingApiBaseUrl?;
1890
1912
  private receiptClient?;
1891
1913
  private readonly withdrawalVersionCache;
1914
+ private readonly pendingWalletStatus;
1892
1915
  private readonly pendingUpgrades;
1893
1916
  private readonly transactionExecutor?;
1894
1917
  private readonly unwindReceiptWaiter?;
@@ -1905,11 +1928,13 @@ declare class YieldseekerAgent implements IAgent {
1905
1928
  private readonly liquidityVersions;
1906
1929
  private readonly snapshotFailures;
1907
1930
  private readonly standardReadFailures;
1931
+ private readonly endpointReadFailures;
1908
1932
  private readonly reconcileUntil;
1909
1933
  private readonly allocationRefresh;
1910
1934
  private readonly activityRefreshUntil;
1911
1935
  private readonly snapshotMovements;
1912
1936
  private readonly movementEpochs;
1937
+ private readonly settlementChecks;
1913
1938
  private readonly vaultOptions;
1914
1939
  private readonly pendingVaultOptions;
1915
1940
  constructor(owneyApiKey: string, options?: YieldseekerAgentOptions);
@@ -1966,7 +1991,13 @@ declare class YieldseekerAgent implements IAgent {
1966
1991
  private loadActivityPortfolio;
1967
1992
  private resolvePortfolioContexts;
1968
1993
  private portfolioVersion;
1994
+ /** Snapshot cache lifetime: the settlement backoff while a movement is being
1995
+ * checked, otherwise the routine non-forced cadence. */
1969
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;
1970
2001
  private snapshotMovement;
1971
2002
  private advancePortfolioVersion;
1972
2003
  private requestPortfolioSnapshot;
@@ -2071,4 +2102,4 @@ type StoredOrder = {
2071
2102
  */
2072
2103
  declare function listOrders(_now?: number): StoredOrder[];
2073
2104
 
2074
- 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, type WithdrawalCompletion, type WithdrawalCompletionContext, type WithdrawalSwapRecovery, 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 };