@owney/sdk 0.7.25-beta.15 → 0.7.25-beta.17

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
@@ -145,6 +145,14 @@ interface IAgent {
145
145
  endFundingBalanceRefresh?(state: ConnectionState, chainId: number, asset: OwneySupportedTokens, read: AssetReadMetadata): boolean;
146
146
  getFundingHistory?(state: ConnectionState, chainId: number, options?: HistoryFilters): Promise<OwneyAgentHistory>;
147
147
  getFundingWallet?(state: ConnectionState, chainId: number, asset: OwneySupportedTokens): Promise<string>;
148
+ /** Verify the displayed remaining balance after a receipt-confirmed payout.
149
+ * Undefined means unknown; never substitute a failed read with zero. */
150
+ verifyWithdrawalBalance?(state: ConnectionState, evidence: FundingEvidence, balance: AgentBalance): Promise<AssetReadMetadata | undefined>;
151
+ /** Read-only chain proof when indexed withdrawal components are incomplete.
152
+ * Returns raw owner-withdrawable units; unavailable proof must throw.
153
+ * minimumAmount is the raw liquidity required from this agent for a typed
154
+ * plan, so adapters can expand discovery when known positions fall short. */
155
+ getWithdrawableBalance?(state: ConnectionState, chainId: number, asset: OwneySupportedTokens, minimumAmount?: bigint): Promise<bigint>;
148
156
  /** Optional positive proof for a repeat deposit; unknown must fall back to portfolio validation. */
149
157
  hasExistingDepositFunds?(state: ConnectionState, chainId: number, asset: OwneySupportedTokens): Promise<true | undefined>;
150
158
  getBalances(state: ConnectionState, chainId: number, asset?: OwneySupportedTokens): Promise<AgentBalance>;
@@ -355,7 +363,9 @@ interface FundingEvidence {
355
363
  method?: "GET" | "POST";
356
364
  path?: "/users/withdraw" | "/users/partial-withdraw";
357
365
  elapsedMs?: number;
358
- failure?: "network" | "unauthorized" | "forbidden" | "rate-limited" | "insufficient-balance" | "session-key-missing" | "other";
366
+ /** Actual response status captured before the vendor replaces the HTTP error. */
367
+ httpStatus?: number;
368
+ failure?: "network" | "unauthorized" | "forbidden" | "rate-limited" | "insufficient-balance" | "session-key-missing" | "withdrawal-in-progress" | "other";
359
369
  };
360
370
  transfer: FundingStage;
361
371
  registration: FundingStage;
@@ -374,6 +384,12 @@ interface AssetReadMetadata {
374
384
  snapshotId?: string;
375
385
  blockNumber?: string;
376
386
  netDepositsRaw?: string;
387
+ /** Display-only agreement with a post-payout read. Does not prove that
388
+ * provider accounting, history or allocations include the transaction. */
389
+ withdrawalCheck?: {
390
+ txHash: string;
391
+ blockNumber: string;
392
+ };
377
393
  positionsStatus: "available" | "unavailable";
378
394
  }
379
395
  interface OwneyDepositResult {
@@ -393,6 +409,13 @@ interface AgentWithdrawResult {
393
409
  completion?: "unverified";
394
410
  /** Smallest-unit amount, or a provider sentinel such as "all" for a full request. */
395
411
  amount: string;
412
+ /** Yieldseeker typed withdrawal fulfilled after an exactly verified fee
413
+ * deduction. Amount remains the confirmed net owner payout, and the gross
414
+ * amount must equal that payout plus the fee, all in token base units. */
415
+ feeAdjustment?: {
416
+ grossAmount: string;
417
+ feeAmount: string;
418
+ };
396
419
  }
397
420
  interface OwneyWithdrawResult {
398
421
  agentResult: Record<AgentId, AgentWithdrawResult>;
@@ -695,6 +718,7 @@ declare class OwneySDK {
695
718
  private cachedSponsoredCallsCallbacks;
696
719
  private readonly agentReads;
697
720
  private readonly recoveredFundingReads;
721
+ private fundingBalanceChecks;
698
722
  private readonly activationChecks;
699
723
  private readAgent;
700
724
  private initializingAgentsPromise;
@@ -868,6 +892,9 @@ declare class OwneySDK {
868
892
  /** Whether a foreground deposit can resume the same signed batch, never a
869
893
  * fresh authorization. The batch rail independently rechecks the exact plan. */
870
894
  canResumePendingDeposit(evidences: FundingEvidence[], amount: string): Promise<boolean>;
895
+ /** Optional post-payout display proof; receipt verification and the provider
896
+ * adapter must agree before attaching it to this exact balance object. */
897
+ verifyWithdrawalBalance(evidence: FundingEvidence, balance: AgentBalance): Promise<AgentBalance>;
871
898
  /** A display acknowledgement controls polling only; it never confirms a financial outcome. */
872
899
  endFundingBalanceRefresh(evidence: FundingEvidence, read: AssetReadMetadata): boolean;
873
900
  /** History lookup for receipt recovery; adapters may not authenticate or sign here. */
@@ -904,6 +931,8 @@ declare class OwneySDK {
904
931
  chainId?: number;
905
932
  asset?: OwneySupportedTokens;
906
933
  }): Promise<OwneyBalances | AgentBalance>;
934
+ /** Preserve failure objects for withdrawal recovery without changing public balance results. */
935
+ private readAggregatedBalances;
907
936
  /**
908
937
  * Get the user's on-chain earnings for a specific agent, or aggregated across all agents.
909
938
  * @param agentId - Optional. Agent to query. Omit for aggregated earnings.
@@ -1070,6 +1099,8 @@ declare class YieldseekerAgent implements IAgent {
1070
1099
  private readonly transactionExecutor?;
1071
1100
  private readonly unwindReceiptWaiter?;
1072
1101
  private readonly agentContexts;
1102
+ private readonly balanceContexts;
1103
+ private readonly balanceVaults;
1073
1104
  private readonly users;
1074
1105
  private readonly pendingAgents;
1075
1106
  private readonly pendingWalletContexts;
@@ -1100,7 +1131,15 @@ declare class YieldseekerAgent implements IAgent {
1100
1131
  deposit(state: ConnectionState, chainId: number, amount: string, asset: OwneySupportedTokens, depositCallback?: DepositCallback, onProgress?: FundingProgress): Promise<OwneyDepositResult>;
1101
1132
  withdraw(state: ConnectionState, chainId: number, asset: OwneySupportedTokens, amount?: string, onProgress?: FundingProgress, gasMode?: "auto" | "sponsored" | "paid", onBeforeSubmission?: FundingProgress): Promise<AgentWithdrawResult>;
1102
1133
  private withdrawInternal;
1134
+ /** A withdrawal-only liquidity floor; display snapshots never authorize it. */
1135
+ getWithdrawableBalance(state: ConnectionState, chainId: number, asset: OwneySupportedTokens, minimumAmount?: bigint): Promise<bigint>;
1136
+ private readVaultLiquidity;
1137
+ private validateWithdrawalPositions;
1138
+ private withdrawalVaultHints;
1139
+ private readWithdrawalPositions;
1140
+ private resolveWithdrawalLiquidity;
1103
1141
  getBalances(state: ConnectionState, chainId: number, asset?: OwneySupportedTokens): Promise<AgentBalance>;
1142
+ verifyWithdrawalBalance(state: ConnectionState, evidence: FundingEvidence, balance: AgentBalance): Promise<AssetReadMetadata | undefined>;
1104
1143
  invalidateFundingRead(state: ConnectionState, chainId: number, asset: OwneySupportedTokens, refreshUntil?: number): void;
1105
1144
  endFundingBalanceRefresh(state: ConnectionState, chainId: number, asset: OwneySupportedTokens, read: AssetReadMetadata): boolean;
1106
1145
  getFundingWallet(state: ConnectionState, chainId: number, asset: OwneySupportedTokens): Promise<string>;
package/dist/index.d.ts CHANGED
@@ -145,6 +145,14 @@ interface IAgent {
145
145
  endFundingBalanceRefresh?(state: ConnectionState, chainId: number, asset: OwneySupportedTokens, read: AssetReadMetadata): boolean;
146
146
  getFundingHistory?(state: ConnectionState, chainId: number, options?: HistoryFilters): Promise<OwneyAgentHistory>;
147
147
  getFundingWallet?(state: ConnectionState, chainId: number, asset: OwneySupportedTokens): Promise<string>;
148
+ /** Verify the displayed remaining balance after a receipt-confirmed payout.
149
+ * Undefined means unknown; never substitute a failed read with zero. */
150
+ verifyWithdrawalBalance?(state: ConnectionState, evidence: FundingEvidence, balance: AgentBalance): Promise<AssetReadMetadata | undefined>;
151
+ /** Read-only chain proof when indexed withdrawal components are incomplete.
152
+ * Returns raw owner-withdrawable units; unavailable proof must throw.
153
+ * minimumAmount is the raw liquidity required from this agent for a typed
154
+ * plan, so adapters can expand discovery when known positions fall short. */
155
+ getWithdrawableBalance?(state: ConnectionState, chainId: number, asset: OwneySupportedTokens, minimumAmount?: bigint): Promise<bigint>;
148
156
  /** Optional positive proof for a repeat deposit; unknown must fall back to portfolio validation. */
149
157
  hasExistingDepositFunds?(state: ConnectionState, chainId: number, asset: OwneySupportedTokens): Promise<true | undefined>;
150
158
  getBalances(state: ConnectionState, chainId: number, asset?: OwneySupportedTokens): Promise<AgentBalance>;
@@ -355,7 +363,9 @@ interface FundingEvidence {
355
363
  method?: "GET" | "POST";
356
364
  path?: "/users/withdraw" | "/users/partial-withdraw";
357
365
  elapsedMs?: number;
358
- failure?: "network" | "unauthorized" | "forbidden" | "rate-limited" | "insufficient-balance" | "session-key-missing" | "other";
366
+ /** Actual response status captured before the vendor replaces the HTTP error. */
367
+ httpStatus?: number;
368
+ failure?: "network" | "unauthorized" | "forbidden" | "rate-limited" | "insufficient-balance" | "session-key-missing" | "withdrawal-in-progress" | "other";
359
369
  };
360
370
  transfer: FundingStage;
361
371
  registration: FundingStage;
@@ -374,6 +384,12 @@ interface AssetReadMetadata {
374
384
  snapshotId?: string;
375
385
  blockNumber?: string;
376
386
  netDepositsRaw?: string;
387
+ /** Display-only agreement with a post-payout read. Does not prove that
388
+ * provider accounting, history or allocations include the transaction. */
389
+ withdrawalCheck?: {
390
+ txHash: string;
391
+ blockNumber: string;
392
+ };
377
393
  positionsStatus: "available" | "unavailable";
378
394
  }
379
395
  interface OwneyDepositResult {
@@ -393,6 +409,13 @@ interface AgentWithdrawResult {
393
409
  completion?: "unverified";
394
410
  /** Smallest-unit amount, or a provider sentinel such as "all" for a full request. */
395
411
  amount: string;
412
+ /** Yieldseeker typed withdrawal fulfilled after an exactly verified fee
413
+ * deduction. Amount remains the confirmed net owner payout, and the gross
414
+ * amount must equal that payout plus the fee, all in token base units. */
415
+ feeAdjustment?: {
416
+ grossAmount: string;
417
+ feeAmount: string;
418
+ };
396
419
  }
397
420
  interface OwneyWithdrawResult {
398
421
  agentResult: Record<AgentId, AgentWithdrawResult>;
@@ -695,6 +718,7 @@ declare class OwneySDK {
695
718
  private cachedSponsoredCallsCallbacks;
696
719
  private readonly agentReads;
697
720
  private readonly recoveredFundingReads;
721
+ private fundingBalanceChecks;
698
722
  private readonly activationChecks;
699
723
  private readAgent;
700
724
  private initializingAgentsPromise;
@@ -868,6 +892,9 @@ declare class OwneySDK {
868
892
  /** Whether a foreground deposit can resume the same signed batch, never a
869
893
  * fresh authorization. The batch rail independently rechecks the exact plan. */
870
894
  canResumePendingDeposit(evidences: FundingEvidence[], amount: string): Promise<boolean>;
895
+ /** Optional post-payout display proof; receipt verification and the provider
896
+ * adapter must agree before attaching it to this exact balance object. */
897
+ verifyWithdrawalBalance(evidence: FundingEvidence, balance: AgentBalance): Promise<AgentBalance>;
871
898
  /** A display acknowledgement controls polling only; it never confirms a financial outcome. */
872
899
  endFundingBalanceRefresh(evidence: FundingEvidence, read: AssetReadMetadata): boolean;
873
900
  /** History lookup for receipt recovery; adapters may not authenticate or sign here. */
@@ -904,6 +931,8 @@ declare class OwneySDK {
904
931
  chainId?: number;
905
932
  asset?: OwneySupportedTokens;
906
933
  }): Promise<OwneyBalances | AgentBalance>;
934
+ /** Preserve failure objects for withdrawal recovery without changing public balance results. */
935
+ private readAggregatedBalances;
907
936
  /**
908
937
  * Get the user's on-chain earnings for a specific agent, or aggregated across all agents.
909
938
  * @param agentId - Optional. Agent to query. Omit for aggregated earnings.
@@ -1070,6 +1099,8 @@ declare class YieldseekerAgent implements IAgent {
1070
1099
  private readonly transactionExecutor?;
1071
1100
  private readonly unwindReceiptWaiter?;
1072
1101
  private readonly agentContexts;
1102
+ private readonly balanceContexts;
1103
+ private readonly balanceVaults;
1073
1104
  private readonly users;
1074
1105
  private readonly pendingAgents;
1075
1106
  private readonly pendingWalletContexts;
@@ -1100,7 +1131,15 @@ declare class YieldseekerAgent implements IAgent {
1100
1131
  deposit(state: ConnectionState, chainId: number, amount: string, asset: OwneySupportedTokens, depositCallback?: DepositCallback, onProgress?: FundingProgress): Promise<OwneyDepositResult>;
1101
1132
  withdraw(state: ConnectionState, chainId: number, asset: OwneySupportedTokens, amount?: string, onProgress?: FundingProgress, gasMode?: "auto" | "sponsored" | "paid", onBeforeSubmission?: FundingProgress): Promise<AgentWithdrawResult>;
1102
1133
  private withdrawInternal;
1134
+ /** A withdrawal-only liquidity floor; display snapshots never authorize it. */
1135
+ getWithdrawableBalance(state: ConnectionState, chainId: number, asset: OwneySupportedTokens, minimumAmount?: bigint): Promise<bigint>;
1136
+ private readVaultLiquidity;
1137
+ private validateWithdrawalPositions;
1138
+ private withdrawalVaultHints;
1139
+ private readWithdrawalPositions;
1140
+ private resolveWithdrawalLiquidity;
1103
1141
  getBalances(state: ConnectionState, chainId: number, asset?: OwneySupportedTokens): Promise<AgentBalance>;
1142
+ verifyWithdrawalBalance(state: ConnectionState, evidence: FundingEvidence, balance: AgentBalance): Promise<AssetReadMetadata | undefined>;
1104
1143
  invalidateFundingRead(state: ConnectionState, chainId: number, asset: OwneySupportedTokens, refreshUntil?: number): void;
1105
1144
  endFundingBalanceRefresh(state: ConnectionState, chainId: number, asset: OwneySupportedTokens, read: AssetReadMetadata): boolean;
1106
1145
  getFundingWallet(state: ConnectionState, chainId: number, asset: OwneySupportedTokens): Promise<string>;