@owney/sdk 0.7.22-beta.1 → 0.7.23

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
@@ -54,7 +54,7 @@ type OwneySupportedChainId = (typeof SUPPORTED_CHAIN_IDS)[number];
54
54
  type OwneySupportedChains = (typeof SUPPORTED_CHAINS)[number];
55
55
  type OwneySupportedTokens = (typeof SUPPORTED_TOKENS)[number];
56
56
 
57
- type AgentId = "zyfai" | "surfliquid";
57
+ type AgentId = "zyfai";
58
58
  type Asset = string;
59
59
  type AgentSupportedAsset = {
60
60
  readonly symbol: string;
@@ -182,12 +182,6 @@ interface OwneyDepositResult {
182
182
  }
183
183
  interface OwneyMultiDepositResult {
184
184
  agentResults: Record<string, OwneyDepositResult>;
185
- /**
186
- * Per-agent failure messages for agents that errored during a diversified
187
- * deposit. Present only when at least one (but not all) agents failed —
188
- * the deposit is partial, not total. Omitted when every agent succeeded.
189
- */
190
- agentErrors?: Record<string, string>;
191
185
  }
192
186
  interface AgentWithdrawResult {
193
187
  txHash?: string;
@@ -401,6 +395,30 @@ interface AgentApy {
401
395
  interface OwneyAgentApy {
402
396
  agentApy: Record<AgentId, AgentApy>;
403
397
  }
398
+ /** One day's cumulative NET earnings for the selected chain/asset. */
399
+ interface DailyEarningsPoint {
400
+ /** ISO date string for the day, e.g. "2026-09-01". */
401
+ date: string;
402
+ /** Cumulative net-of-fee earnings as of this day, in the asset's units. */
403
+ net: number;
404
+ }
405
+ interface AccountDailyEarnings {
406
+ walletAddress: string;
407
+ /**
408
+ * Cumulative net-earnings series for the requested window, ascending by date.
409
+ * Empty when the provider returns no snapshots for this chain/asset.
410
+ */
411
+ points: DailyEarningsPoint[];
412
+ }
413
+ /** Earnings accrued across a window, derived from an AccountDailyEarnings series. */
414
+ interface RecentEarnings {
415
+ /** Net earnings over the window; never negative. */
416
+ amount: number;
417
+ /** Days actually spanned by the series — not necessarily the days requested. */
418
+ spanDays: number;
419
+ /** True when the series is shorter than the requested window. */
420
+ isTruncated: boolean;
421
+ }
404
422
 
405
423
  type DepositCallback = (smartWalletAddress: string, chainId: number, amount: string) => Promise<`0x${string}`> | `0x${string}`;
406
424
  interface IAgent {
@@ -437,6 +455,12 @@ interface IAgent {
437
455
  * single asset on the chain. Agents without per-asset positions ignore it.
438
456
  */
439
457
  tokenSymbol?: string): Promise<AccountAgentApy>;
458
+ /**
459
+ * Daily cumulative NET earnings for the window, scoped to a chain/asset.
460
+ * Backs the "recent earnings" subline, whose figure must reconcile with the
461
+ * balance headline directly above it. (ROUT-452)
462
+ */
463
+ getDailyEarnings?(state: ConnectionState, chainId: number, days: DailyApyDays, tokenSymbol?: string): Promise<AccountDailyEarnings>;
440
464
  getHistory(state: ConnectionState, chainId: number, options?: HistoryFilters): Promise<OwneyAgentHistory>;
441
465
  getUserProfile(state: ConnectionState, chainId: number): Promise<AgentUserProfile>;
442
466
  /**
@@ -635,17 +659,6 @@ declare class OwneySDK {
635
659
  private hasExistingBalance;
636
660
  private validateAssetSupport;
637
661
  private getEligibleAgents;
638
- /**
639
- * Agent ids the routing API provisioned for this org that support the given
640
- * chain + asset, ordered by preference ({@link AGENT_ELIGIBILITY_ORDER},
641
- * surfliquid first). Returns `[]` when the org has no compatible agent — never
642
- * throws on an empty org. Loads agent keys on first call (apiKey only, no
643
- * wallet), so the UI can resolve which agent to use before the user connects.
644
- *
645
- * This is the source of truth for agent availability: an agent appears here
646
- * iff the routing API returned its key. No per-app feature flags.
647
- */
648
- getEligibleAgentIds(chainId: number, asset: string): Promise<AgentId[]>;
649
662
  /**
650
663
  * Withdraw funds from a specific agent, or all agents that support the active chain+asset if agentId is omitted.
651
664
  * Validates that the asset is supported by the target agent(s) on the active chain.
@@ -681,6 +694,18 @@ declare class OwneySDK {
681
694
  * @param options.days - Lookback period: "7D", "14D", or "30D"
682
695
  * @returns {AccountAgentApy} for a single agent, or {OwneyAccountApy} with totalApy and per-agent breakdown
683
696
  */
697
+ /**
698
+ * Daily cumulative NET earnings for the selected chain/asset, backing the
699
+ * "recent earnings" subline. Net is computed as Zyfai's own
700
+ * `lifetime + unrealized + current x 0.9`, so the figure reconciles with the
701
+ * balance headline rather than reading ~11% high. (ROUT-452)
702
+ *
703
+ * Unlike getAccountApy this does NOT blend across agents: earnings are
704
+ * summed, not weighted, and an agent that fails to report must not silently
705
+ * subtract from the total. Without an agentId the series is the sum of the
706
+ * agents that answered.
707
+ */
708
+ getDailyEarnings({ agentId, days, tokenSymbol, }: AccountApyOptions): Promise<AccountDailyEarnings>;
684
709
  getAccountApy({ agentId, days, tokenSymbol, }: AccountApyOptions): Promise<OwneyAccountApy | AccountAgentApy>;
685
710
  /**
686
711
  * Get transaction history for a specific agent, or all agents.
@@ -746,7 +771,7 @@ declare class OwneySDK {
746
771
  getAllocationApy({ agentId, }?: AllocationApyOptions): Promise<OwneyAllocationApy>;
747
772
  }
748
773
 
749
- type OwneyErrorCode = "NOT_CONNECTED" | "NO_ACTIVE_CHAIN" | "WALLET_NO_ACCOUNTS" | "WALLET_ADDRESS_REQUIRED" | "WALLET_NOT_DEPLOYED" | "AGENT_NOT_FOUND" | "AGENT_CHAIN_INCOMPATIBLE" | "AGENT_EMPTY_LIST" | "AGENT_DISABLED" | "CHAIN_UNSUPPORTED" | "CHAIN_NO_COMPATIBLE_AGENTS" | "CHAIN_MISMATCH" | "ASSET_UNSUPPORTED" | "ASSET_NO_COMPATIBLE_AGENTS" | "DEPOSIT_BALANCE_UNAVAILABLE" | "DEPOSIT_PARTIAL_FAILURE" | "DEPOSIT_AMOUNT_BELOW_MINIMUM" | "DEPOSIT_CALLBACK_REQUIRED" | "DEPOSIT_CALLBACK_INVALID" | "DEPOSIT_NO_PERMITTED_TOKENS" | "DEPOSIT_ALL_FAILED" | "DEPOSIT_INSUFFICIENT_BALANCE" | "WITHDRAW_NO_PERMITTED_TOKENS" | "WITHDRAW_INSUFFICIENT_BALANCE" | "WITHDRAW_ALL_FAILED" | "WITHDRAW_PARTIAL_FAILURE" | "WITHDRAW_FAILED" | "AGENT_RATE_LIMITED" | "API_ROUTING_ERROR" | "API_ROUTING_FAILED" | "API_NO_AGENTS" | "SPONSOR_REQUEST_FAILED" | "PERMIT2_APPROVAL_REQUIRED" | "SPONSORED_CALLS_UNSUPPORTED" | "SPONSORED_CALLS_NO_ID" | "SPONSORED_CALLS_NO_RECEIPT" | "SURF_UNAVAILABLE" | "SPONSORSHIP_UNAVAILABLE" | "USER_REJECTED" | "OPERATION_PENDING" | "VAULT_NOT_SPONSORABLE" | "BALANCE_ALL_FAILED" | "ALLOCATION_ALL_FAILED" | "VALIDATION_INVALID_DAYS";
774
+ type OwneyErrorCode = "NOT_CONNECTED" | "NO_ACTIVE_CHAIN" | "WALLET_NO_ACCOUNTS" | "WALLET_ADDRESS_REQUIRED" | "WALLET_NOT_DEPLOYED" | "AGENT_NOT_FOUND" | "AGENT_CHAIN_INCOMPATIBLE" | "AGENT_EMPTY_LIST" | "AGENT_DISABLED" | "CHAIN_UNSUPPORTED" | "CHAIN_NO_COMPATIBLE_AGENTS" | "CHAIN_MISMATCH" | "ASSET_UNSUPPORTED" | "ASSET_NO_COMPATIBLE_AGENTS" | "DEPOSIT_BALANCE_UNAVAILABLE" | "DEPOSIT_PARTIAL_FAILURE" | "DEPOSIT_AMOUNT_BELOW_MINIMUM" | "DEPOSIT_CALLBACK_REQUIRED" | "DEPOSIT_CALLBACK_INVALID" | "DEPOSIT_NO_PERMITTED_TOKENS" | "DEPOSIT_INSUFFICIENT_BALANCE" | "WITHDRAW_NO_PERMITTED_TOKENS" | "WITHDRAW_INSUFFICIENT_BALANCE" | "WITHDRAW_ALL_FAILED" | "WITHDRAW_PARTIAL_FAILURE" | "WITHDRAW_FAILED" | "AGENT_RATE_LIMITED" | "API_ROUTING_ERROR" | "API_ROUTING_FAILED" | "API_NO_AGENTS" | "SPONSOR_REQUEST_FAILED" | "PERMIT2_APPROVAL_REQUIRED" | "SPONSORED_CALLS_UNSUPPORTED" | "SPONSORED_CALLS_NO_ID" | "SPONSORED_CALLS_NO_RECEIPT" | "BALANCE_ALL_FAILED" | "ALLOCATION_ALL_FAILED" | "VALIDATION_INVALID_DAYS";
750
775
  declare class OwneyError extends Error {
751
776
  readonly code: OwneyErrorCode;
752
777
  readonly details?: Record<string, unknown>;
@@ -799,6 +824,21 @@ declare global {
799
824
  /** Enable/disable debug logging programmatically. */
800
825
  declare function setOwneyDebug(enabled: boolean): void;
801
826
 
827
+ /**
828
+ * Earnings accrued across a window, as the difference between the series'
829
+ * endpoints.
830
+ *
831
+ * Differencing endpoints rather than summing `daily_total_delta_by_token`
832
+ * means a missing day in the middle of the window cannot undercount the
833
+ * result — the two endpoints are cumulative totals, so whatever happened in
834
+ * between is already priced in.
835
+ *
836
+ * `requestedDays` is the window the user selected in the APY chart. When the
837
+ * series is shorter than that, the caller relabels ("Since you started")
838
+ * rather than claiming a window we don't have data for.
839
+ */
840
+ declare function recentEarningsFromPoints(points: DailyEarningsPoint[], requestedDays?: number): RecentEarnings | null;
841
+
802
842
  type OwneySIWXConfig = {
803
843
  /** Owney/Zyfai API key — same value passed to `new OwneySDK({ apiKey })`. */
804
844
  apiKey: string;
@@ -812,4 +852,4 @@ type OwneySIWXConfig = {
812
852
  */
813
853
  declare function createOwneySIWX(config: OwneySIWXConfig): SIWXConfig;
814
854
 
815
- export { type AccountAgentApy, type AccountApyOptions, 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 AvailableAgent, type AvailableAgentsOptions, type ConnectionState, type DailyApyDays, type DepositCallback, type DepositOptions, type HistoryAction, type HistoryFilters, type HistoryOptions, type HistoryTransaction, type IAgent, InvalidHistoryCursorError, NotConnectedError, type OwneyAccountApy, type OwneyAgentApy, type OwneyAgentHistory, type OwneyAllocationApy, type OwneyBalances, type OwneyDepositResult, type OwneyEarnings, OwneyError, type OwneyErrorCode, type OwneyMultiDepositResult, type OwneyPosition, OwneySDK, type OwneySDKConfig, type OwneySIWXConfig, type OwneySupportedChainId, type OwneySupportedChains, type OwneySupportedTokens, type OwneyToken, type OwneyUserProfile, type OwneyWithdrawResult, type RebalanceLog, type WithdrawOptions, createOwneySIWX, setOwneyDebug };
855
+ 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 AvailableAgent, type AvailableAgentsOptions, type ConnectionState, type DailyApyDays, type DailyEarningsPoint, type DepositCallback, type DepositOptions, type HistoryAction, type HistoryFilters, type HistoryOptions, type HistoryTransaction, type IAgent, InvalidHistoryCursorError, NotConnectedError, type OwneyAccountApy, type OwneyAgentApy, type OwneyAgentHistory, type OwneyAllocationApy, type OwneyBalances, type OwneyDepositResult, type OwneyEarnings, OwneyError, type OwneyErrorCode, type OwneyMultiDepositResult, type OwneyPosition, OwneySDK, type OwneySDKConfig, type OwneySIWXConfig, type OwneySupportedChainId, type OwneySupportedChains, type OwneySupportedTokens, type OwneyToken, type OwneyUserProfile, type OwneyWithdrawResult, type RebalanceLog, type RecentEarnings, type WithdrawOptions, createOwneySIWX, recentEarningsFromPoints, setOwneyDebug };
package/dist/index.d.ts CHANGED
@@ -54,7 +54,7 @@ type OwneySupportedChainId = (typeof SUPPORTED_CHAIN_IDS)[number];
54
54
  type OwneySupportedChains = (typeof SUPPORTED_CHAINS)[number];
55
55
  type OwneySupportedTokens = (typeof SUPPORTED_TOKENS)[number];
56
56
 
57
- type AgentId = "zyfai" | "surfliquid";
57
+ type AgentId = "zyfai";
58
58
  type Asset = string;
59
59
  type AgentSupportedAsset = {
60
60
  readonly symbol: string;
@@ -182,12 +182,6 @@ interface OwneyDepositResult {
182
182
  }
183
183
  interface OwneyMultiDepositResult {
184
184
  agentResults: Record<string, OwneyDepositResult>;
185
- /**
186
- * Per-agent failure messages for agents that errored during a diversified
187
- * deposit. Present only when at least one (but not all) agents failed —
188
- * the deposit is partial, not total. Omitted when every agent succeeded.
189
- */
190
- agentErrors?: Record<string, string>;
191
185
  }
192
186
  interface AgentWithdrawResult {
193
187
  txHash?: string;
@@ -401,6 +395,30 @@ interface AgentApy {
401
395
  interface OwneyAgentApy {
402
396
  agentApy: Record<AgentId, AgentApy>;
403
397
  }
398
+ /** One day's cumulative NET earnings for the selected chain/asset. */
399
+ interface DailyEarningsPoint {
400
+ /** ISO date string for the day, e.g. "2026-09-01". */
401
+ date: string;
402
+ /** Cumulative net-of-fee earnings as of this day, in the asset's units. */
403
+ net: number;
404
+ }
405
+ interface AccountDailyEarnings {
406
+ walletAddress: string;
407
+ /**
408
+ * Cumulative net-earnings series for the requested window, ascending by date.
409
+ * Empty when the provider returns no snapshots for this chain/asset.
410
+ */
411
+ points: DailyEarningsPoint[];
412
+ }
413
+ /** Earnings accrued across a window, derived from an AccountDailyEarnings series. */
414
+ interface RecentEarnings {
415
+ /** Net earnings over the window; never negative. */
416
+ amount: number;
417
+ /** Days actually spanned by the series — not necessarily the days requested. */
418
+ spanDays: number;
419
+ /** True when the series is shorter than the requested window. */
420
+ isTruncated: boolean;
421
+ }
404
422
 
405
423
  type DepositCallback = (smartWalletAddress: string, chainId: number, amount: string) => Promise<`0x${string}`> | `0x${string}`;
406
424
  interface IAgent {
@@ -437,6 +455,12 @@ interface IAgent {
437
455
  * single asset on the chain. Agents without per-asset positions ignore it.
438
456
  */
439
457
  tokenSymbol?: string): Promise<AccountAgentApy>;
458
+ /**
459
+ * Daily cumulative NET earnings for the window, scoped to a chain/asset.
460
+ * Backs the "recent earnings" subline, whose figure must reconcile with the
461
+ * balance headline directly above it. (ROUT-452)
462
+ */
463
+ getDailyEarnings?(state: ConnectionState, chainId: number, days: DailyApyDays, tokenSymbol?: string): Promise<AccountDailyEarnings>;
440
464
  getHistory(state: ConnectionState, chainId: number, options?: HistoryFilters): Promise<OwneyAgentHistory>;
441
465
  getUserProfile(state: ConnectionState, chainId: number): Promise<AgentUserProfile>;
442
466
  /**
@@ -635,17 +659,6 @@ declare class OwneySDK {
635
659
  private hasExistingBalance;
636
660
  private validateAssetSupport;
637
661
  private getEligibleAgents;
638
- /**
639
- * Agent ids the routing API provisioned for this org that support the given
640
- * chain + asset, ordered by preference ({@link AGENT_ELIGIBILITY_ORDER},
641
- * surfliquid first). Returns `[]` when the org has no compatible agent — never
642
- * throws on an empty org. Loads agent keys on first call (apiKey only, no
643
- * wallet), so the UI can resolve which agent to use before the user connects.
644
- *
645
- * This is the source of truth for agent availability: an agent appears here
646
- * iff the routing API returned its key. No per-app feature flags.
647
- */
648
- getEligibleAgentIds(chainId: number, asset: string): Promise<AgentId[]>;
649
662
  /**
650
663
  * Withdraw funds from a specific agent, or all agents that support the active chain+asset if agentId is omitted.
651
664
  * Validates that the asset is supported by the target agent(s) on the active chain.
@@ -681,6 +694,18 @@ declare class OwneySDK {
681
694
  * @param options.days - Lookback period: "7D", "14D", or "30D"
682
695
  * @returns {AccountAgentApy} for a single agent, or {OwneyAccountApy} with totalApy and per-agent breakdown
683
696
  */
697
+ /**
698
+ * Daily cumulative NET earnings for the selected chain/asset, backing the
699
+ * "recent earnings" subline. Net is computed as Zyfai's own
700
+ * `lifetime + unrealized + current x 0.9`, so the figure reconciles with the
701
+ * balance headline rather than reading ~11% high. (ROUT-452)
702
+ *
703
+ * Unlike getAccountApy this does NOT blend across agents: earnings are
704
+ * summed, not weighted, and an agent that fails to report must not silently
705
+ * subtract from the total. Without an agentId the series is the sum of the
706
+ * agents that answered.
707
+ */
708
+ getDailyEarnings({ agentId, days, tokenSymbol, }: AccountApyOptions): Promise<AccountDailyEarnings>;
684
709
  getAccountApy({ agentId, days, tokenSymbol, }: AccountApyOptions): Promise<OwneyAccountApy | AccountAgentApy>;
685
710
  /**
686
711
  * Get transaction history for a specific agent, or all agents.
@@ -746,7 +771,7 @@ declare class OwneySDK {
746
771
  getAllocationApy({ agentId, }?: AllocationApyOptions): Promise<OwneyAllocationApy>;
747
772
  }
748
773
 
749
- type OwneyErrorCode = "NOT_CONNECTED" | "NO_ACTIVE_CHAIN" | "WALLET_NO_ACCOUNTS" | "WALLET_ADDRESS_REQUIRED" | "WALLET_NOT_DEPLOYED" | "AGENT_NOT_FOUND" | "AGENT_CHAIN_INCOMPATIBLE" | "AGENT_EMPTY_LIST" | "AGENT_DISABLED" | "CHAIN_UNSUPPORTED" | "CHAIN_NO_COMPATIBLE_AGENTS" | "CHAIN_MISMATCH" | "ASSET_UNSUPPORTED" | "ASSET_NO_COMPATIBLE_AGENTS" | "DEPOSIT_BALANCE_UNAVAILABLE" | "DEPOSIT_PARTIAL_FAILURE" | "DEPOSIT_AMOUNT_BELOW_MINIMUM" | "DEPOSIT_CALLBACK_REQUIRED" | "DEPOSIT_CALLBACK_INVALID" | "DEPOSIT_NO_PERMITTED_TOKENS" | "DEPOSIT_ALL_FAILED" | "DEPOSIT_INSUFFICIENT_BALANCE" | "WITHDRAW_NO_PERMITTED_TOKENS" | "WITHDRAW_INSUFFICIENT_BALANCE" | "WITHDRAW_ALL_FAILED" | "WITHDRAW_PARTIAL_FAILURE" | "WITHDRAW_FAILED" | "AGENT_RATE_LIMITED" | "API_ROUTING_ERROR" | "API_ROUTING_FAILED" | "API_NO_AGENTS" | "SPONSOR_REQUEST_FAILED" | "PERMIT2_APPROVAL_REQUIRED" | "SPONSORED_CALLS_UNSUPPORTED" | "SPONSORED_CALLS_NO_ID" | "SPONSORED_CALLS_NO_RECEIPT" | "SURF_UNAVAILABLE" | "SPONSORSHIP_UNAVAILABLE" | "USER_REJECTED" | "OPERATION_PENDING" | "VAULT_NOT_SPONSORABLE" | "BALANCE_ALL_FAILED" | "ALLOCATION_ALL_FAILED" | "VALIDATION_INVALID_DAYS";
774
+ type OwneyErrorCode = "NOT_CONNECTED" | "NO_ACTIVE_CHAIN" | "WALLET_NO_ACCOUNTS" | "WALLET_ADDRESS_REQUIRED" | "WALLET_NOT_DEPLOYED" | "AGENT_NOT_FOUND" | "AGENT_CHAIN_INCOMPATIBLE" | "AGENT_EMPTY_LIST" | "AGENT_DISABLED" | "CHAIN_UNSUPPORTED" | "CHAIN_NO_COMPATIBLE_AGENTS" | "CHAIN_MISMATCH" | "ASSET_UNSUPPORTED" | "ASSET_NO_COMPATIBLE_AGENTS" | "DEPOSIT_BALANCE_UNAVAILABLE" | "DEPOSIT_PARTIAL_FAILURE" | "DEPOSIT_AMOUNT_BELOW_MINIMUM" | "DEPOSIT_CALLBACK_REQUIRED" | "DEPOSIT_CALLBACK_INVALID" | "DEPOSIT_NO_PERMITTED_TOKENS" | "DEPOSIT_INSUFFICIENT_BALANCE" | "WITHDRAW_NO_PERMITTED_TOKENS" | "WITHDRAW_INSUFFICIENT_BALANCE" | "WITHDRAW_ALL_FAILED" | "WITHDRAW_PARTIAL_FAILURE" | "WITHDRAW_FAILED" | "AGENT_RATE_LIMITED" | "API_ROUTING_ERROR" | "API_ROUTING_FAILED" | "API_NO_AGENTS" | "SPONSOR_REQUEST_FAILED" | "PERMIT2_APPROVAL_REQUIRED" | "SPONSORED_CALLS_UNSUPPORTED" | "SPONSORED_CALLS_NO_ID" | "SPONSORED_CALLS_NO_RECEIPT" | "BALANCE_ALL_FAILED" | "ALLOCATION_ALL_FAILED" | "VALIDATION_INVALID_DAYS";
750
775
  declare class OwneyError extends Error {
751
776
  readonly code: OwneyErrorCode;
752
777
  readonly details?: Record<string, unknown>;
@@ -799,6 +824,21 @@ declare global {
799
824
  /** Enable/disable debug logging programmatically. */
800
825
  declare function setOwneyDebug(enabled: boolean): void;
801
826
 
827
+ /**
828
+ * Earnings accrued across a window, as the difference between the series'
829
+ * endpoints.
830
+ *
831
+ * Differencing endpoints rather than summing `daily_total_delta_by_token`
832
+ * means a missing day in the middle of the window cannot undercount the
833
+ * result — the two endpoints are cumulative totals, so whatever happened in
834
+ * between is already priced in.
835
+ *
836
+ * `requestedDays` is the window the user selected in the APY chart. When the
837
+ * series is shorter than that, the caller relabels ("Since you started")
838
+ * rather than claiming a window we don't have data for.
839
+ */
840
+ declare function recentEarningsFromPoints(points: DailyEarningsPoint[], requestedDays?: number): RecentEarnings | null;
841
+
802
842
  type OwneySIWXConfig = {
803
843
  /** Owney/Zyfai API key — same value passed to `new OwneySDK({ apiKey })`. */
804
844
  apiKey: string;
@@ -812,4 +852,4 @@ type OwneySIWXConfig = {
812
852
  */
813
853
  declare function createOwneySIWX(config: OwneySIWXConfig): SIWXConfig;
814
854
 
815
- export { type AccountAgentApy, type AccountApyOptions, 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 AvailableAgent, type AvailableAgentsOptions, type ConnectionState, type DailyApyDays, type DepositCallback, type DepositOptions, type HistoryAction, type HistoryFilters, type HistoryOptions, type HistoryTransaction, type IAgent, InvalidHistoryCursorError, NotConnectedError, type OwneyAccountApy, type OwneyAgentApy, type OwneyAgentHistory, type OwneyAllocationApy, type OwneyBalances, type OwneyDepositResult, type OwneyEarnings, OwneyError, type OwneyErrorCode, type OwneyMultiDepositResult, type OwneyPosition, OwneySDK, type OwneySDKConfig, type OwneySIWXConfig, type OwneySupportedChainId, type OwneySupportedChains, type OwneySupportedTokens, type OwneyToken, type OwneyUserProfile, type OwneyWithdrawResult, type RebalanceLog, type WithdrawOptions, createOwneySIWX, setOwneyDebug };
855
+ 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 AvailableAgent, type AvailableAgentsOptions, type ConnectionState, type DailyApyDays, type DailyEarningsPoint, type DepositCallback, type DepositOptions, type HistoryAction, type HistoryFilters, type HistoryOptions, type HistoryTransaction, type IAgent, InvalidHistoryCursorError, NotConnectedError, type OwneyAccountApy, type OwneyAgentApy, type OwneyAgentHistory, type OwneyAllocationApy, type OwneyBalances, type OwneyDepositResult, type OwneyEarnings, OwneyError, type OwneyErrorCode, type OwneyMultiDepositResult, type OwneyPosition, OwneySDK, type OwneySDKConfig, type OwneySIWXConfig, type OwneySupportedChainId, type OwneySupportedChains, type OwneySupportedTokens, type OwneyToken, type OwneyUserProfile, type OwneyWithdrawResult, type RebalanceLog, type RecentEarnings, type WithdrawOptions, createOwneySIWX, recentEarningsFromPoints, setOwneyDebug };