@owney/sdk 0.7.25-beta.14 → 0.7.25-beta.16
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.cjs +1853 -567
- package/dist/index.d.cts +64 -6
- package/dist/index.d.ts +64 -6
- package/dist/index.js +1784 -494
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -138,13 +138,20 @@ interface IAgent {
|
|
|
138
138
|
*/
|
|
139
139
|
applyOrgPolicy?(state: ConnectionState, chainId: number, policy: OrgAgentConfig): Promise<void>;
|
|
140
140
|
deposit(state: ConnectionState, chainId: number, amount: string, asset: OwneySupportedTokens, depositCallback?: DepositCallback, onProgress?: FundingProgress): Promise<OwneyDepositResult>;
|
|
141
|
-
withdraw(state: ConnectionState, chainId: number, token: OwneySupportedTokens, amount?: string, onProgress?: FundingProgress, gasMode?: "auto" | "sponsored" | "paid"): Promise<AgentWithdrawResult>;
|
|
141
|
+
withdraw(state: ConnectionState, chainId: number, token: OwneySupportedTokens, amount?: string, onProgress?: FundingProgress, gasMode?: "auto" | "sponsored" | "paid", onBeforeSubmission?: FundingProgress): Promise<AgentWithdrawResult>;
|
|
142
142
|
/** Invalidate only the confirmed asset. This hook must not sign or submit transactions. */
|
|
143
143
|
invalidateFundingRead?(state: ConnectionState, chainId: number, asset: OwneySupportedTokens, refreshUntil?: number): void;
|
|
144
144
|
/** End accelerated balance reads only for the exact snapshot the caller displayed. */
|
|
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
|
+
/** Read-only chain proof when indexed withdrawal components are incomplete.
|
|
149
|
+
* Returns raw owner-withdrawable units; unavailable proof must throw.
|
|
150
|
+
* minimumAmount is the raw liquidity required from this agent for a typed
|
|
151
|
+
* plan, so adapters can expand discovery when known positions fall short. */
|
|
152
|
+
getWithdrawableBalance?(state: ConnectionState, chainId: number, asset: OwneySupportedTokens, minimumAmount?: bigint): Promise<bigint>;
|
|
153
|
+
/** Optional positive proof for a repeat deposit; unknown must fall back to portfolio validation. */
|
|
154
|
+
hasExistingDepositFunds?(state: ConnectionState, chainId: number, asset: OwneySupportedTokens): Promise<true | undefined>;
|
|
148
155
|
getBalances(state: ConnectionState, chainId: number, asset?: OwneySupportedTokens): Promise<AgentBalance>;
|
|
149
156
|
getEarnings(state: ConnectionState, chainId: number): Promise<AgentEarnings>;
|
|
150
157
|
/**
|
|
@@ -245,6 +252,11 @@ type WithdrawOptions = {
|
|
|
245
252
|
/** Exclude unresolved providers from aggregate withdrawals; direct agent requests are unchanged. */
|
|
246
253
|
excludeAgentIds?: AgentId[];
|
|
247
254
|
onProgress?: FundingProgress;
|
|
255
|
+
/**
|
|
256
|
+
* Durable pre-dispatch checkpoint for adapters with a recoverable operation ID.
|
|
257
|
+
* Rejection prevents submission; progress observers remain non-fatal.
|
|
258
|
+
*/
|
|
259
|
+
onBeforeSubmission?: FundingProgress;
|
|
248
260
|
asset: Asset;
|
|
249
261
|
amount?: string;
|
|
250
262
|
agentId?: AgentId;
|
|
@@ -296,6 +308,8 @@ type AgentsApyOptions = {
|
|
|
296
308
|
chainId?: number;
|
|
297
309
|
};
|
|
298
310
|
type DepositOptions = {
|
|
311
|
+
/** Resume only these already signed relayer bytes; never create a new authorization. */
|
|
312
|
+
resumeTxHash?: `0x${string}`;
|
|
299
313
|
onProgress?: FundingProgress;
|
|
300
314
|
amount: string;
|
|
301
315
|
asset: Asset;
|
|
@@ -305,6 +319,19 @@ type DepositOptions = {
|
|
|
305
319
|
};
|
|
306
320
|
|
|
307
321
|
type FundingStage = "pending" | "confirmed" | "unknown" | "failed" | "not-applicable";
|
|
322
|
+
/** Hash-bound v0.6 recovery metadata. Deliberately excludes the owner signature. */
|
|
323
|
+
type UnsignedUserOperationEvidence = {
|
|
324
|
+
sender: string;
|
|
325
|
+
nonce: string;
|
|
326
|
+
initCode: string;
|
|
327
|
+
callData: string;
|
|
328
|
+
callGasLimit: string;
|
|
329
|
+
verificationGasLimit: string;
|
|
330
|
+
preVerificationGas: string;
|
|
331
|
+
maxFeePerGas: string;
|
|
332
|
+
maxPriorityFeePerGas: string;
|
|
333
|
+
paymasterAndData: string;
|
|
334
|
+
};
|
|
308
335
|
/** Evidence about one provider leg. Amounts are token base units, never USD. */
|
|
309
336
|
interface FundingEvidence {
|
|
310
337
|
agentId: AgentId;
|
|
@@ -317,6 +344,8 @@ interface FundingEvidence {
|
|
|
317
344
|
txHash?: string;
|
|
318
345
|
/** Persisted before a sponsored EOA operation is sent. */
|
|
319
346
|
userOpHash?: string;
|
|
347
|
+
/** Lets recovery verify a consumed nonce even if a bundler forgets the operation. */
|
|
348
|
+
userOperation?: UnsignedUserOperationEvidence;
|
|
320
349
|
/** Base Account calls ID used to recover an uncertain wallet submission. */
|
|
321
350
|
callsId?: string;
|
|
322
351
|
blockNumber?: string;
|
|
@@ -331,7 +360,9 @@ interface FundingEvidence {
|
|
|
331
360
|
method?: "GET" | "POST";
|
|
332
361
|
path?: "/users/withdraw" | "/users/partial-withdraw";
|
|
333
362
|
elapsedMs?: number;
|
|
334
|
-
|
|
363
|
+
/** Actual response status captured before the vendor replaces the HTTP error. */
|
|
364
|
+
httpStatus?: number;
|
|
365
|
+
failure?: "network" | "unauthorized" | "forbidden" | "rate-limited" | "insufficient-balance" | "session-key-missing" | "withdrawal-in-progress" | "other";
|
|
335
366
|
};
|
|
336
367
|
transfer: FundingStage;
|
|
337
368
|
registration: FundingStage;
|
|
@@ -365,8 +396,17 @@ interface AgentWithdrawResult {
|
|
|
365
396
|
evidence?: FundingEvidence;
|
|
366
397
|
txHash?: string;
|
|
367
398
|
type: "full" | "partial";
|
|
399
|
+
/** Owner payout is confirmed, but clearing all MAX positions still needs verification. */
|
|
400
|
+
completion?: "unverified";
|
|
368
401
|
/** Smallest-unit amount, or a provider sentinel such as "all" for a full request. */
|
|
369
402
|
amount: string;
|
|
403
|
+
/** Yieldseeker typed withdrawal fulfilled after an exactly verified fee
|
|
404
|
+
* deduction. Amount remains the confirmed net owner payout, and the gross
|
|
405
|
+
* amount must equal that payout plus the fee, all in token base units. */
|
|
406
|
+
feeAdjustment?: {
|
|
407
|
+
grossAmount: string;
|
|
408
|
+
feeAmount: string;
|
|
409
|
+
};
|
|
370
410
|
}
|
|
371
411
|
interface OwneyWithdrawResult {
|
|
372
412
|
agentResult: Record<AgentId, AgentWithdrawResult>;
|
|
@@ -834,7 +874,14 @@ declare class OwneySDK {
|
|
|
834
874
|
refreshBalance?: boolean;
|
|
835
875
|
}): Promise<FundingEvidence>;
|
|
836
876
|
/** Resolve a saved sponsored-withdrawal ID without opening a wallet prompt. */
|
|
837
|
-
resolveSponsoredWithdrawalEvidence(evidence: FundingEvidence
|
|
877
|
+
resolveSponsoredWithdrawalEvidence(evidence: FundingEvidence, options?: {
|
|
878
|
+
submittedAt?: number;
|
|
879
|
+
}): Promise<FundingEvidence>;
|
|
880
|
+
/** Recover an EIP-5792 deposit or payout using this account's exact batch ID. */
|
|
881
|
+
resolveWalletCallsFundingEvidence(evidence: FundingEvidence, direction: "deposit" | "withdraw"): Promise<FundingEvidence>;
|
|
882
|
+
/** Whether a foreground deposit can resume the same signed batch, never a
|
|
883
|
+
* fresh authorization. The batch rail independently rechecks the exact plan. */
|
|
884
|
+
canResumePendingDeposit(evidences: FundingEvidence[], amount: string): Promise<boolean>;
|
|
838
885
|
/** A display acknowledgement controls polling only; it never confirms a financial outcome. */
|
|
839
886
|
endFundingBalanceRefresh(evidence: FundingEvidence, read: AssetReadMetadata): boolean;
|
|
840
887
|
/** History lookup for receipt recovery; adapters may not authenticate or sign here. */
|
|
@@ -871,6 +918,8 @@ declare class OwneySDK {
|
|
|
871
918
|
chainId?: number;
|
|
872
919
|
asset?: OwneySupportedTokens;
|
|
873
920
|
}): Promise<OwneyBalances | AgentBalance>;
|
|
921
|
+
/** Preserve failure objects for withdrawal recovery without changing public balance results. */
|
|
922
|
+
private readAggregatedBalances;
|
|
874
923
|
/**
|
|
875
924
|
* Get the user's on-chain earnings for a specific agent, or aggregated across all agents.
|
|
876
925
|
* @param agentId - Optional. Agent to query. Omit for aggregated earnings.
|
|
@@ -1056,6 +1105,7 @@ declare class YieldseekerAgent implements IAgent {
|
|
|
1056
1105
|
private getReceiptClient;
|
|
1057
1106
|
/** Reads the actual proxy implementation; Yieldseeker's API walletType is not a version check. */
|
|
1058
1107
|
getWalletStatus(state: ConnectionState, chainId: number, asset: OwneySupportedTokens, useCachedV2?: boolean): Promise<YieldseekerWalletStatus | null>;
|
|
1108
|
+
private rememberWalletStatus;
|
|
1059
1109
|
/** Explicit owner action. This never runs as a side effect of withdrawal. */
|
|
1060
1110
|
upgradeWallet(state: ConnectionState, chainId: number, asset: OwneySupportedTokens, gasMode?: "paid" | "sponsored"): Promise<{
|
|
1061
1111
|
txHash: Hex;
|
|
@@ -1064,12 +1114,20 @@ declare class YieldseekerAgent implements IAgent {
|
|
|
1064
1114
|
disconnect(): Promise<void>;
|
|
1065
1115
|
activateAgent(state: ConnectionState, chainId: number, asset?: OwneySupportedTokens): Promise<void>;
|
|
1066
1116
|
deposit(state: ConnectionState, chainId: number, amount: string, asset: OwneySupportedTokens, depositCallback?: DepositCallback, onProgress?: FundingProgress): Promise<OwneyDepositResult>;
|
|
1067
|
-
withdraw(state: ConnectionState, chainId: number, asset: OwneySupportedTokens, amount?: string, onProgress?: FundingProgress, gasMode?: "auto" | "sponsored" | "paid"): Promise<AgentWithdrawResult>;
|
|
1117
|
+
withdraw(state: ConnectionState, chainId: number, asset: OwneySupportedTokens, amount?: string, onProgress?: FundingProgress, gasMode?: "auto" | "sponsored" | "paid", onBeforeSubmission?: FundingProgress): Promise<AgentWithdrawResult>;
|
|
1068
1118
|
private withdrawInternal;
|
|
1119
|
+
/** A withdrawal-only liquidity floor; display snapshots never authorize it. */
|
|
1120
|
+
getWithdrawableBalance(state: ConnectionState, chainId: number, asset: OwneySupportedTokens, minimumAmount?: bigint): Promise<bigint>;
|
|
1121
|
+
private readVaultLiquidity;
|
|
1122
|
+
private validateWithdrawalPositions;
|
|
1123
|
+
private withdrawalVaultHints;
|
|
1124
|
+
private readWithdrawalPositions;
|
|
1125
|
+
private resolveWithdrawalLiquidity;
|
|
1069
1126
|
getBalances(state: ConnectionState, chainId: number, asset?: OwneySupportedTokens): Promise<AgentBalance>;
|
|
1070
1127
|
invalidateFundingRead(state: ConnectionState, chainId: number, asset: OwneySupportedTokens, refreshUntil?: number): void;
|
|
1071
1128
|
endFundingBalanceRefresh(state: ConnectionState, chainId: number, asset: OwneySupportedTokens, read: AssetReadMetadata): boolean;
|
|
1072
1129
|
getFundingWallet(state: ConnectionState, chainId: number, asset: OwneySupportedTokens): Promise<string>;
|
|
1130
|
+
hasExistingDepositFunds(state: ConnectionState, chainId: number, asset: OwneySupportedTokens): Promise<true | undefined>;
|
|
1073
1131
|
getEarnings(state: ConnectionState, chainId: number): Promise<AgentEarnings>;
|
|
1074
1132
|
getAccountApy(state: ConnectionState, chainId: number, days: DailyApyDays, tokenSymbol?: string): Promise<AccountAgentApy>;
|
|
1075
1133
|
getHistory(state: ConnectionState, chainId: number, options?: HistoryFilters): Promise<OwneyAgentHistory>;
|
|
@@ -1119,7 +1177,7 @@ declare class YieldseekerAgent implements IAgent {
|
|
|
1119
1177
|
private invalidResponse;
|
|
1120
1178
|
}
|
|
1121
1179
|
|
|
1122
|
-
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" | "AGENT_ACTIVATION_PARTIAL_FAILURE" | "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_BALANCE_UNAVAILABLE" | "WITHDRAW_INSUFFICIENT_BALANCE" | "WITHDRAW_ALL_FAILED" | "WITHDRAW_PARTIAL_FAILURE" | "WITHDRAW_FAILED" | "AGENT_RATE_LIMITED" | "API_ROUTING_ERROR" | "API_ROUTING_FAILED" | "API_NO_AGENTS" | "AGENT_API_ERROR" | "AGENT_AUTH_FAILED" | "AGENT_INVALID_RESPONSE" | "AGENT_TIMEOUT" | "AGENT_TRANSACTION_REVERTED" | "SPONSOR_REQUEST_FAILED" | "PERMIT2_APPROVAL_REQUIRED" | "SPONSORED_CALLS_UNSUPPORTED" | "SPONSORED_CALLS_NO_ID" | "SPONSORED_CALLS_NO_RECEIPT" | "BALANCE_ALL_FAILED" | "EARNINGS_ALL_FAILED" | "ALLOCATION_ALL_FAILED" | "VALIDATION_INVALID_DAYS";
|
|
1180
|
+
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" | "AGENT_ACTIVATION_PARTIAL_FAILURE" | "CHAIN_UNSUPPORTED" | "CHAIN_NO_COMPATIBLE_AGENTS" | "CHAIN_MISMATCH" | "ASSET_UNSUPPORTED" | "ASSET_NO_COMPATIBLE_AGENTS" | "DEPOSIT_BALANCE_UNAVAILABLE" | "DEPOSIT_PARTIAL_FAILURE" | "DEPOSIT_IN_PROGRESS" | "DEPOSIT_AMOUNT_BELOW_MINIMUM" | "DEPOSIT_CALLBACK_REQUIRED" | "DEPOSIT_CALLBACK_INVALID" | "DEPOSIT_NO_PERMITTED_TOKENS" | "DEPOSIT_INSUFFICIENT_BALANCE" | "WITHDRAW_NO_PERMITTED_TOKENS" | "WITHDRAW_BALANCE_UNAVAILABLE" | "WITHDRAW_INSUFFICIENT_BALANCE" | "WITHDRAW_ALL_FAILED" | "WITHDRAW_PARTIAL_FAILURE" | "WITHDRAW_FAILED" | "AGENT_RATE_LIMITED" | "API_ROUTING_ERROR" | "API_ROUTING_FAILED" | "API_NO_AGENTS" | "AGENT_API_ERROR" | "AGENT_AUTH_FAILED" | "AGENT_INVALID_RESPONSE" | "AGENT_TIMEOUT" | "AGENT_TRANSACTION_REVERTED" | "SPONSOR_REQUEST_FAILED" | "PERMIT2_APPROVAL_REQUIRED" | "SPONSORED_CALLS_UNSUPPORTED" | "SPONSORED_CALLS_NO_ID" | "SPONSORED_CALLS_NO_RECEIPT" | "BALANCE_ALL_FAILED" | "EARNINGS_ALL_FAILED" | "ALLOCATION_ALL_FAILED" | "VALIDATION_INVALID_DAYS";
|
|
1123
1181
|
declare class OwneyError extends Error {
|
|
1124
1182
|
readonly code: OwneyErrorCode;
|
|
1125
1183
|
readonly details?: Record<string, unknown>;
|
|
@@ -1185,4 +1243,4 @@ type OwneySIWXConfig = {
|
|
|
1185
1243
|
*/
|
|
1186
1244
|
declare function createOwneySIWX(config: OwneySIWXConfig): SIWXConfig;
|
|
1187
1245
|
|
|
1188
|
-
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 RebalanceLog, type RpcUrlsConfig, type WithdrawOptions, YieldseekerAgent, type YieldseekerWalletStatus, type ZyfaiRpcUrlsConfig, createOwneySIWX, setOwneyDebug };
|
|
1246
|
+
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 RebalanceLog, type RpcUrlsConfig, type UnsignedUserOperationEvidence, type WithdrawOptions, YieldseekerAgent, type YieldseekerWalletStatus, type ZyfaiRpcUrlsConfig, createOwneySIWX, setOwneyDebug };
|
package/dist/index.d.ts
CHANGED
|
@@ -138,13 +138,20 @@ interface IAgent {
|
|
|
138
138
|
*/
|
|
139
139
|
applyOrgPolicy?(state: ConnectionState, chainId: number, policy: OrgAgentConfig): Promise<void>;
|
|
140
140
|
deposit(state: ConnectionState, chainId: number, amount: string, asset: OwneySupportedTokens, depositCallback?: DepositCallback, onProgress?: FundingProgress): Promise<OwneyDepositResult>;
|
|
141
|
-
withdraw(state: ConnectionState, chainId: number, token: OwneySupportedTokens, amount?: string, onProgress?: FundingProgress, gasMode?: "auto" | "sponsored" | "paid"): Promise<AgentWithdrawResult>;
|
|
141
|
+
withdraw(state: ConnectionState, chainId: number, token: OwneySupportedTokens, amount?: string, onProgress?: FundingProgress, gasMode?: "auto" | "sponsored" | "paid", onBeforeSubmission?: FundingProgress): Promise<AgentWithdrawResult>;
|
|
142
142
|
/** Invalidate only the confirmed asset. This hook must not sign or submit transactions. */
|
|
143
143
|
invalidateFundingRead?(state: ConnectionState, chainId: number, asset: OwneySupportedTokens, refreshUntil?: number): void;
|
|
144
144
|
/** End accelerated balance reads only for the exact snapshot the caller displayed. */
|
|
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
|
+
/** Read-only chain proof when indexed withdrawal components are incomplete.
|
|
149
|
+
* Returns raw owner-withdrawable units; unavailable proof must throw.
|
|
150
|
+
* minimumAmount is the raw liquidity required from this agent for a typed
|
|
151
|
+
* plan, so adapters can expand discovery when known positions fall short. */
|
|
152
|
+
getWithdrawableBalance?(state: ConnectionState, chainId: number, asset: OwneySupportedTokens, minimumAmount?: bigint): Promise<bigint>;
|
|
153
|
+
/** Optional positive proof for a repeat deposit; unknown must fall back to portfolio validation. */
|
|
154
|
+
hasExistingDepositFunds?(state: ConnectionState, chainId: number, asset: OwneySupportedTokens): Promise<true | undefined>;
|
|
148
155
|
getBalances(state: ConnectionState, chainId: number, asset?: OwneySupportedTokens): Promise<AgentBalance>;
|
|
149
156
|
getEarnings(state: ConnectionState, chainId: number): Promise<AgentEarnings>;
|
|
150
157
|
/**
|
|
@@ -245,6 +252,11 @@ type WithdrawOptions = {
|
|
|
245
252
|
/** Exclude unresolved providers from aggregate withdrawals; direct agent requests are unchanged. */
|
|
246
253
|
excludeAgentIds?: AgentId[];
|
|
247
254
|
onProgress?: FundingProgress;
|
|
255
|
+
/**
|
|
256
|
+
* Durable pre-dispatch checkpoint for adapters with a recoverable operation ID.
|
|
257
|
+
* Rejection prevents submission; progress observers remain non-fatal.
|
|
258
|
+
*/
|
|
259
|
+
onBeforeSubmission?: FundingProgress;
|
|
248
260
|
asset: Asset;
|
|
249
261
|
amount?: string;
|
|
250
262
|
agentId?: AgentId;
|
|
@@ -296,6 +308,8 @@ type AgentsApyOptions = {
|
|
|
296
308
|
chainId?: number;
|
|
297
309
|
};
|
|
298
310
|
type DepositOptions = {
|
|
311
|
+
/** Resume only these already signed relayer bytes; never create a new authorization. */
|
|
312
|
+
resumeTxHash?: `0x${string}`;
|
|
299
313
|
onProgress?: FundingProgress;
|
|
300
314
|
amount: string;
|
|
301
315
|
asset: Asset;
|
|
@@ -305,6 +319,19 @@ type DepositOptions = {
|
|
|
305
319
|
};
|
|
306
320
|
|
|
307
321
|
type FundingStage = "pending" | "confirmed" | "unknown" | "failed" | "not-applicable";
|
|
322
|
+
/** Hash-bound v0.6 recovery metadata. Deliberately excludes the owner signature. */
|
|
323
|
+
type UnsignedUserOperationEvidence = {
|
|
324
|
+
sender: string;
|
|
325
|
+
nonce: string;
|
|
326
|
+
initCode: string;
|
|
327
|
+
callData: string;
|
|
328
|
+
callGasLimit: string;
|
|
329
|
+
verificationGasLimit: string;
|
|
330
|
+
preVerificationGas: string;
|
|
331
|
+
maxFeePerGas: string;
|
|
332
|
+
maxPriorityFeePerGas: string;
|
|
333
|
+
paymasterAndData: string;
|
|
334
|
+
};
|
|
308
335
|
/** Evidence about one provider leg. Amounts are token base units, never USD. */
|
|
309
336
|
interface FundingEvidence {
|
|
310
337
|
agentId: AgentId;
|
|
@@ -317,6 +344,8 @@ interface FundingEvidence {
|
|
|
317
344
|
txHash?: string;
|
|
318
345
|
/** Persisted before a sponsored EOA operation is sent. */
|
|
319
346
|
userOpHash?: string;
|
|
347
|
+
/** Lets recovery verify a consumed nonce even if a bundler forgets the operation. */
|
|
348
|
+
userOperation?: UnsignedUserOperationEvidence;
|
|
320
349
|
/** Base Account calls ID used to recover an uncertain wallet submission. */
|
|
321
350
|
callsId?: string;
|
|
322
351
|
blockNumber?: string;
|
|
@@ -331,7 +360,9 @@ interface FundingEvidence {
|
|
|
331
360
|
method?: "GET" | "POST";
|
|
332
361
|
path?: "/users/withdraw" | "/users/partial-withdraw";
|
|
333
362
|
elapsedMs?: number;
|
|
334
|
-
|
|
363
|
+
/** Actual response status captured before the vendor replaces the HTTP error. */
|
|
364
|
+
httpStatus?: number;
|
|
365
|
+
failure?: "network" | "unauthorized" | "forbidden" | "rate-limited" | "insufficient-balance" | "session-key-missing" | "withdrawal-in-progress" | "other";
|
|
335
366
|
};
|
|
336
367
|
transfer: FundingStage;
|
|
337
368
|
registration: FundingStage;
|
|
@@ -365,8 +396,17 @@ interface AgentWithdrawResult {
|
|
|
365
396
|
evidence?: FundingEvidence;
|
|
366
397
|
txHash?: string;
|
|
367
398
|
type: "full" | "partial";
|
|
399
|
+
/** Owner payout is confirmed, but clearing all MAX positions still needs verification. */
|
|
400
|
+
completion?: "unverified";
|
|
368
401
|
/** Smallest-unit amount, or a provider sentinel such as "all" for a full request. */
|
|
369
402
|
amount: string;
|
|
403
|
+
/** Yieldseeker typed withdrawal fulfilled after an exactly verified fee
|
|
404
|
+
* deduction. Amount remains the confirmed net owner payout, and the gross
|
|
405
|
+
* amount must equal that payout plus the fee, all in token base units. */
|
|
406
|
+
feeAdjustment?: {
|
|
407
|
+
grossAmount: string;
|
|
408
|
+
feeAmount: string;
|
|
409
|
+
};
|
|
370
410
|
}
|
|
371
411
|
interface OwneyWithdrawResult {
|
|
372
412
|
agentResult: Record<AgentId, AgentWithdrawResult>;
|
|
@@ -834,7 +874,14 @@ declare class OwneySDK {
|
|
|
834
874
|
refreshBalance?: boolean;
|
|
835
875
|
}): Promise<FundingEvidence>;
|
|
836
876
|
/** Resolve a saved sponsored-withdrawal ID without opening a wallet prompt. */
|
|
837
|
-
resolveSponsoredWithdrawalEvidence(evidence: FundingEvidence
|
|
877
|
+
resolveSponsoredWithdrawalEvidence(evidence: FundingEvidence, options?: {
|
|
878
|
+
submittedAt?: number;
|
|
879
|
+
}): Promise<FundingEvidence>;
|
|
880
|
+
/** Recover an EIP-5792 deposit or payout using this account's exact batch ID. */
|
|
881
|
+
resolveWalletCallsFundingEvidence(evidence: FundingEvidence, direction: "deposit" | "withdraw"): Promise<FundingEvidence>;
|
|
882
|
+
/** Whether a foreground deposit can resume the same signed batch, never a
|
|
883
|
+
* fresh authorization. The batch rail independently rechecks the exact plan. */
|
|
884
|
+
canResumePendingDeposit(evidences: FundingEvidence[], amount: string): Promise<boolean>;
|
|
838
885
|
/** A display acknowledgement controls polling only; it never confirms a financial outcome. */
|
|
839
886
|
endFundingBalanceRefresh(evidence: FundingEvidence, read: AssetReadMetadata): boolean;
|
|
840
887
|
/** History lookup for receipt recovery; adapters may not authenticate or sign here. */
|
|
@@ -871,6 +918,8 @@ declare class OwneySDK {
|
|
|
871
918
|
chainId?: number;
|
|
872
919
|
asset?: OwneySupportedTokens;
|
|
873
920
|
}): Promise<OwneyBalances | AgentBalance>;
|
|
921
|
+
/** Preserve failure objects for withdrawal recovery without changing public balance results. */
|
|
922
|
+
private readAggregatedBalances;
|
|
874
923
|
/**
|
|
875
924
|
* Get the user's on-chain earnings for a specific agent, or aggregated across all agents.
|
|
876
925
|
* @param agentId - Optional. Agent to query. Omit for aggregated earnings.
|
|
@@ -1056,6 +1105,7 @@ declare class YieldseekerAgent implements IAgent {
|
|
|
1056
1105
|
private getReceiptClient;
|
|
1057
1106
|
/** Reads the actual proxy implementation; Yieldseeker's API walletType is not a version check. */
|
|
1058
1107
|
getWalletStatus(state: ConnectionState, chainId: number, asset: OwneySupportedTokens, useCachedV2?: boolean): Promise<YieldseekerWalletStatus | null>;
|
|
1108
|
+
private rememberWalletStatus;
|
|
1059
1109
|
/** Explicit owner action. This never runs as a side effect of withdrawal. */
|
|
1060
1110
|
upgradeWallet(state: ConnectionState, chainId: number, asset: OwneySupportedTokens, gasMode?: "paid" | "sponsored"): Promise<{
|
|
1061
1111
|
txHash: Hex;
|
|
@@ -1064,12 +1114,20 @@ declare class YieldseekerAgent implements IAgent {
|
|
|
1064
1114
|
disconnect(): Promise<void>;
|
|
1065
1115
|
activateAgent(state: ConnectionState, chainId: number, asset?: OwneySupportedTokens): Promise<void>;
|
|
1066
1116
|
deposit(state: ConnectionState, chainId: number, amount: string, asset: OwneySupportedTokens, depositCallback?: DepositCallback, onProgress?: FundingProgress): Promise<OwneyDepositResult>;
|
|
1067
|
-
withdraw(state: ConnectionState, chainId: number, asset: OwneySupportedTokens, amount?: string, onProgress?: FundingProgress, gasMode?: "auto" | "sponsored" | "paid"): Promise<AgentWithdrawResult>;
|
|
1117
|
+
withdraw(state: ConnectionState, chainId: number, asset: OwneySupportedTokens, amount?: string, onProgress?: FundingProgress, gasMode?: "auto" | "sponsored" | "paid", onBeforeSubmission?: FundingProgress): Promise<AgentWithdrawResult>;
|
|
1068
1118
|
private withdrawInternal;
|
|
1119
|
+
/** A withdrawal-only liquidity floor; display snapshots never authorize it. */
|
|
1120
|
+
getWithdrawableBalance(state: ConnectionState, chainId: number, asset: OwneySupportedTokens, minimumAmount?: bigint): Promise<bigint>;
|
|
1121
|
+
private readVaultLiquidity;
|
|
1122
|
+
private validateWithdrawalPositions;
|
|
1123
|
+
private withdrawalVaultHints;
|
|
1124
|
+
private readWithdrawalPositions;
|
|
1125
|
+
private resolveWithdrawalLiquidity;
|
|
1069
1126
|
getBalances(state: ConnectionState, chainId: number, asset?: OwneySupportedTokens): Promise<AgentBalance>;
|
|
1070
1127
|
invalidateFundingRead(state: ConnectionState, chainId: number, asset: OwneySupportedTokens, refreshUntil?: number): void;
|
|
1071
1128
|
endFundingBalanceRefresh(state: ConnectionState, chainId: number, asset: OwneySupportedTokens, read: AssetReadMetadata): boolean;
|
|
1072
1129
|
getFundingWallet(state: ConnectionState, chainId: number, asset: OwneySupportedTokens): Promise<string>;
|
|
1130
|
+
hasExistingDepositFunds(state: ConnectionState, chainId: number, asset: OwneySupportedTokens): Promise<true | undefined>;
|
|
1073
1131
|
getEarnings(state: ConnectionState, chainId: number): Promise<AgentEarnings>;
|
|
1074
1132
|
getAccountApy(state: ConnectionState, chainId: number, days: DailyApyDays, tokenSymbol?: string): Promise<AccountAgentApy>;
|
|
1075
1133
|
getHistory(state: ConnectionState, chainId: number, options?: HistoryFilters): Promise<OwneyAgentHistory>;
|
|
@@ -1119,7 +1177,7 @@ declare class YieldseekerAgent implements IAgent {
|
|
|
1119
1177
|
private invalidResponse;
|
|
1120
1178
|
}
|
|
1121
1179
|
|
|
1122
|
-
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" | "AGENT_ACTIVATION_PARTIAL_FAILURE" | "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_BALANCE_UNAVAILABLE" | "WITHDRAW_INSUFFICIENT_BALANCE" | "WITHDRAW_ALL_FAILED" | "WITHDRAW_PARTIAL_FAILURE" | "WITHDRAW_FAILED" | "AGENT_RATE_LIMITED" | "API_ROUTING_ERROR" | "API_ROUTING_FAILED" | "API_NO_AGENTS" | "AGENT_API_ERROR" | "AGENT_AUTH_FAILED" | "AGENT_INVALID_RESPONSE" | "AGENT_TIMEOUT" | "AGENT_TRANSACTION_REVERTED" | "SPONSOR_REQUEST_FAILED" | "PERMIT2_APPROVAL_REQUIRED" | "SPONSORED_CALLS_UNSUPPORTED" | "SPONSORED_CALLS_NO_ID" | "SPONSORED_CALLS_NO_RECEIPT" | "BALANCE_ALL_FAILED" | "EARNINGS_ALL_FAILED" | "ALLOCATION_ALL_FAILED" | "VALIDATION_INVALID_DAYS";
|
|
1180
|
+
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" | "AGENT_ACTIVATION_PARTIAL_FAILURE" | "CHAIN_UNSUPPORTED" | "CHAIN_NO_COMPATIBLE_AGENTS" | "CHAIN_MISMATCH" | "ASSET_UNSUPPORTED" | "ASSET_NO_COMPATIBLE_AGENTS" | "DEPOSIT_BALANCE_UNAVAILABLE" | "DEPOSIT_PARTIAL_FAILURE" | "DEPOSIT_IN_PROGRESS" | "DEPOSIT_AMOUNT_BELOW_MINIMUM" | "DEPOSIT_CALLBACK_REQUIRED" | "DEPOSIT_CALLBACK_INVALID" | "DEPOSIT_NO_PERMITTED_TOKENS" | "DEPOSIT_INSUFFICIENT_BALANCE" | "WITHDRAW_NO_PERMITTED_TOKENS" | "WITHDRAW_BALANCE_UNAVAILABLE" | "WITHDRAW_INSUFFICIENT_BALANCE" | "WITHDRAW_ALL_FAILED" | "WITHDRAW_PARTIAL_FAILURE" | "WITHDRAW_FAILED" | "AGENT_RATE_LIMITED" | "API_ROUTING_ERROR" | "API_ROUTING_FAILED" | "API_NO_AGENTS" | "AGENT_API_ERROR" | "AGENT_AUTH_FAILED" | "AGENT_INVALID_RESPONSE" | "AGENT_TIMEOUT" | "AGENT_TRANSACTION_REVERTED" | "SPONSOR_REQUEST_FAILED" | "PERMIT2_APPROVAL_REQUIRED" | "SPONSORED_CALLS_UNSUPPORTED" | "SPONSORED_CALLS_NO_ID" | "SPONSORED_CALLS_NO_RECEIPT" | "BALANCE_ALL_FAILED" | "EARNINGS_ALL_FAILED" | "ALLOCATION_ALL_FAILED" | "VALIDATION_INVALID_DAYS";
|
|
1123
1181
|
declare class OwneyError extends Error {
|
|
1124
1182
|
readonly code: OwneyErrorCode;
|
|
1125
1183
|
readonly details?: Record<string, unknown>;
|
|
@@ -1185,4 +1243,4 @@ type OwneySIWXConfig = {
|
|
|
1185
1243
|
*/
|
|
1186
1244
|
declare function createOwneySIWX(config: OwneySIWXConfig): SIWXConfig;
|
|
1187
1245
|
|
|
1188
|
-
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 RebalanceLog, type RpcUrlsConfig, type WithdrawOptions, YieldseekerAgent, type YieldseekerWalletStatus, type ZyfaiRpcUrlsConfig, createOwneySIWX, setOwneyDebug };
|
|
1246
|
+
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 RebalanceLog, type RpcUrlsConfig, type UnsignedUserOperationEvidence, type WithdrawOptions, YieldseekerAgent, type YieldseekerWalletStatus, type ZyfaiRpcUrlsConfig, createOwneySIWX, setOwneyDebug };
|