@owney/sdk 0.7.25-beta.12 → 0.7.25-beta.13

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
@@ -1,4 +1,5 @@
1
- import { Hex } from 'viem';
1
+ import * as viem from 'viem';
2
+ import { Address, Hex } from 'viem';
2
3
  import { SIWXConfig } from '@reown/appkit-controllers';
3
4
 
4
5
  type RpcUrlsConfig = Partial<Record<(typeof SUPPORTED_CHAIN_IDS)[number], string>>;
@@ -137,7 +138,7 @@ interface IAgent {
137
138
  */
138
139
  applyOrgPolicy?(state: ConnectionState, chainId: number, policy: OrgAgentConfig): Promise<void>;
139
140
  deposit(state: ConnectionState, chainId: number, amount: string, asset: OwneySupportedTokens, depositCallback?: DepositCallback, onProgress?: FundingProgress): Promise<OwneyDepositResult>;
140
- withdraw(state: ConnectionState, chainId: number, token: OwneySupportedTokens, amount?: string, onProgress?: FundingProgress): Promise<AgentWithdrawResult>;
141
+ withdraw(state: ConnectionState, chainId: number, token: OwneySupportedTokens, amount?: string, onProgress?: FundingProgress, gasMode?: "auto" | "sponsored" | "paid"): Promise<AgentWithdrawResult>;
141
142
  /** Invalidate only the confirmed asset. This hook must not sign or submit transactions. */
142
143
  invalidateFundingRead?(state: ConnectionState, chainId: number, asset: OwneySupportedTokens, refreshUntil?: number): void;
143
144
  /** End accelerated balance reads only for the exact snapshot the caller displayed. */
@@ -239,6 +240,8 @@ type HistoryOptions = {
239
240
  filters?: HistoryFilters;
240
241
  };
241
242
  type WithdrawOptions = {
243
+ /** Yieldseeker V2 only. "auto" requests sponsorship for a verified V2 wallet. */
244
+ gasMode?: "auto" | "sponsored" | "paid";
242
245
  /** Exclude unresolved providers from aggregate withdrawals; direct agent requests are unchanged. */
243
246
  excludeAgentIds?: AgentId[];
244
247
  onProgress?: FundingProgress;
@@ -312,6 +315,10 @@ interface FundingEvidence {
312
315
  intendedAmount: string;
313
316
  confirmedAmount?: string;
314
317
  txHash?: string;
318
+ /** Persisted before a sponsored EOA operation is sent. */
319
+ userOpHash?: string;
320
+ /** Base Account calls ID used to recover an uncertain wallet submission. */
321
+ callsId?: string;
315
322
  blockNumber?: string;
316
323
  logIndexes?: number[];
317
324
  transferLogs?: {
@@ -826,11 +833,24 @@ declare class OwneySDK {
826
833
  balanceRefreshUntil?: number;
827
834
  refreshBalance?: boolean;
828
835
  }): Promise<FundingEvidence>;
836
+ /** Resolve a saved sponsored-withdrawal ID without opening a wallet prompt. */
837
+ resolveSponsoredWithdrawalEvidence(evidence: FundingEvidence): Promise<FundingEvidence>;
829
838
  /** A display acknowledgement controls polling only; it never confirms a financial outcome. */
830
839
  endFundingBalanceRefresh(evidence: FundingEvidence, read: AssetReadMetadata): boolean;
831
840
  /** History lookup for receipt recovery; adapters may not authenticate or sign here. */
832
841
  getFundingHistory(evidence: FundingEvidence, fromDate: string, options?: Pick<HistoryFilters, "cursor" | "toDate">): Promise<OwneyAgentHistory>;
833
842
  recoverDepositRegistration(evidence: FundingEvidence): Promise<FundingEvidence>;
843
+ /** On-chain version and ownership status for this owner's Yieldseeker agent. */
844
+ getYieldseekerWalletStatus(asset: OwneySupportedTokens): Promise<YieldseekerWalletStatus | null>;
845
+ /** Deployment gate; an unavailable response keeps the current paid path. */
846
+ isYieldseekerWithdrawalSponsorshipAvailable(): Promise<boolean>;
847
+ isYieldseekerUpgradeSponsorshipAvailable(): Promise<boolean>;
848
+ private isYieldseekerSponsorshipAvailable;
849
+ /** Explicit V1-to-V2 upgrade, confirmed on chain before returning. */
850
+ upgradeYieldseekerWallet(asset: OwneySupportedTokens, gasMode?: "paid" | "sponsored"): Promise<{
851
+ txHash: viem.Hex;
852
+ status: YieldseekerWalletStatus;
853
+ }>;
834
854
  /**
835
855
  * Withdraw funds from a specific agent, or all agents that support the active chain+asset if agentId is omitted.
836
856
  * Validates that the asset is supported by the target agent(s) on the active chain.
@@ -967,8 +987,21 @@ type YieldseekerTransaction = {
967
987
  chainId: number;
968
988
  };
969
989
 
990
+ type YieldseekerWalletStatus = {
991
+ agentWallet: Address;
992
+ owner: Address;
993
+ ownerPath: "eoa" | "smart";
994
+ asset: Address;
995
+ implementation: Address;
996
+ version: "v1" | "v2" | "unknown";
997
+ upgradeAvailable: boolean;
998
+ /** The factory, owner, base asset, and provider wallet mapping all agree. */
999
+ verified: boolean;
1000
+ };
1001
+
970
1002
  type YieldseekerAgentOptions = {
971
1003
  baseUrl?: string;
1004
+ routingApiBaseUrl?: string;
972
1005
  fetchFn?: YieldseekerFetch;
973
1006
  auth?: YieldseekerAuthDependencies;
974
1007
  /** Dedicated read transport; Base is used for receipt polling. */
@@ -997,7 +1030,10 @@ declare class YieldseekerAgent implements IAgent {
997
1030
  private readonly api;
998
1031
  private readonly auth;
999
1032
  private readonly rpcUrls?;
1033
+ private readonly owneyApiKey;
1034
+ private readonly routingApiBaseUrl?;
1000
1035
  private receiptClient?;
1036
+ private readonly withdrawalVersionCache;
1001
1037
  private readonly transactionExecutor?;
1002
1038
  private readonly unwindReceiptWaiter?;
1003
1039
  private readonly agentContexts;
@@ -1018,10 +1054,17 @@ declare class YieldseekerAgent implements IAgent {
1018
1054
  private readonly pendingYieldOptions;
1019
1055
  constructor(owneyApiKey: string, options?: YieldseekerAgentOptions);
1020
1056
  private getReceiptClient;
1057
+ /** Reads the actual proxy implementation; Yieldseeker's API walletType is not a version check. */
1058
+ getWalletStatus(state: ConnectionState, chainId: number, asset: OwneySupportedTokens, useCachedV2?: boolean): Promise<YieldseekerWalletStatus | null>;
1059
+ /** Explicit owner action. This never runs as a side effect of withdrawal. */
1060
+ upgradeWallet(state: ConnectionState, chainId: number, asset: OwneySupportedTokens, gasMode?: "paid" | "sponsored"): Promise<{
1061
+ txHash: Hex;
1062
+ status: YieldseekerWalletStatus;
1063
+ }>;
1021
1064
  disconnect(): Promise<void>;
1022
1065
  activateAgent(state: ConnectionState, chainId: number, asset?: OwneySupportedTokens): Promise<void>;
1023
1066
  deposit(state: ConnectionState, chainId: number, amount: string, asset: OwneySupportedTokens, depositCallback?: DepositCallback, onProgress?: FundingProgress): Promise<OwneyDepositResult>;
1024
- withdraw(state: ConnectionState, chainId: number, asset: OwneySupportedTokens, amount?: string, onProgress?: FundingProgress): Promise<AgentWithdrawResult>;
1067
+ withdraw(state: ConnectionState, chainId: number, asset: OwneySupportedTokens, amount?: string, onProgress?: FundingProgress, gasMode?: "auto" | "sponsored" | "paid"): Promise<AgentWithdrawResult>;
1025
1068
  private withdrawInternal;
1026
1069
  getBalances(state: ConnectionState, chainId: number, asset?: OwneySupportedTokens): Promise<AgentBalance>;
1027
1070
  invalidateFundingRead(state: ConnectionState, chainId: number, asset: OwneySupportedTokens, refreshUntil?: number): void;
@@ -1142,4 +1185,4 @@ type OwneySIWXConfig = {
1142
1185
  */
1143
1186
  declare function createOwneySIWX(config: OwneySIWXConfig): SIWXConfig;
1144
1187
 
1145
- 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 ZyfaiRpcUrlsConfig, createOwneySIWX, setOwneyDebug };
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 };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
- import { Hex } from 'viem';
1
+ import * as viem from 'viem';
2
+ import { Address, Hex } from 'viem';
2
3
  import { SIWXConfig } from '@reown/appkit-controllers';
3
4
 
4
5
  type RpcUrlsConfig = Partial<Record<(typeof SUPPORTED_CHAIN_IDS)[number], string>>;
@@ -137,7 +138,7 @@ interface IAgent {
137
138
  */
138
139
  applyOrgPolicy?(state: ConnectionState, chainId: number, policy: OrgAgentConfig): Promise<void>;
139
140
  deposit(state: ConnectionState, chainId: number, amount: string, asset: OwneySupportedTokens, depositCallback?: DepositCallback, onProgress?: FundingProgress): Promise<OwneyDepositResult>;
140
- withdraw(state: ConnectionState, chainId: number, token: OwneySupportedTokens, amount?: string, onProgress?: FundingProgress): Promise<AgentWithdrawResult>;
141
+ withdraw(state: ConnectionState, chainId: number, token: OwneySupportedTokens, amount?: string, onProgress?: FundingProgress, gasMode?: "auto" | "sponsored" | "paid"): Promise<AgentWithdrawResult>;
141
142
  /** Invalidate only the confirmed asset. This hook must not sign or submit transactions. */
142
143
  invalidateFundingRead?(state: ConnectionState, chainId: number, asset: OwneySupportedTokens, refreshUntil?: number): void;
143
144
  /** End accelerated balance reads only for the exact snapshot the caller displayed. */
@@ -239,6 +240,8 @@ type HistoryOptions = {
239
240
  filters?: HistoryFilters;
240
241
  };
241
242
  type WithdrawOptions = {
243
+ /** Yieldseeker V2 only. "auto" requests sponsorship for a verified V2 wallet. */
244
+ gasMode?: "auto" | "sponsored" | "paid";
242
245
  /** Exclude unresolved providers from aggregate withdrawals; direct agent requests are unchanged. */
243
246
  excludeAgentIds?: AgentId[];
244
247
  onProgress?: FundingProgress;
@@ -312,6 +315,10 @@ interface FundingEvidence {
312
315
  intendedAmount: string;
313
316
  confirmedAmount?: string;
314
317
  txHash?: string;
318
+ /** Persisted before a sponsored EOA operation is sent. */
319
+ userOpHash?: string;
320
+ /** Base Account calls ID used to recover an uncertain wallet submission. */
321
+ callsId?: string;
315
322
  blockNumber?: string;
316
323
  logIndexes?: number[];
317
324
  transferLogs?: {
@@ -826,11 +833,24 @@ declare class OwneySDK {
826
833
  balanceRefreshUntil?: number;
827
834
  refreshBalance?: boolean;
828
835
  }): Promise<FundingEvidence>;
836
+ /** Resolve a saved sponsored-withdrawal ID without opening a wallet prompt. */
837
+ resolveSponsoredWithdrawalEvidence(evidence: FundingEvidence): Promise<FundingEvidence>;
829
838
  /** A display acknowledgement controls polling only; it never confirms a financial outcome. */
830
839
  endFundingBalanceRefresh(evidence: FundingEvidence, read: AssetReadMetadata): boolean;
831
840
  /** History lookup for receipt recovery; adapters may not authenticate or sign here. */
832
841
  getFundingHistory(evidence: FundingEvidence, fromDate: string, options?: Pick<HistoryFilters, "cursor" | "toDate">): Promise<OwneyAgentHistory>;
833
842
  recoverDepositRegistration(evidence: FundingEvidence): Promise<FundingEvidence>;
843
+ /** On-chain version and ownership status for this owner's Yieldseeker agent. */
844
+ getYieldseekerWalletStatus(asset: OwneySupportedTokens): Promise<YieldseekerWalletStatus | null>;
845
+ /** Deployment gate; an unavailable response keeps the current paid path. */
846
+ isYieldseekerWithdrawalSponsorshipAvailable(): Promise<boolean>;
847
+ isYieldseekerUpgradeSponsorshipAvailable(): Promise<boolean>;
848
+ private isYieldseekerSponsorshipAvailable;
849
+ /** Explicit V1-to-V2 upgrade, confirmed on chain before returning. */
850
+ upgradeYieldseekerWallet(asset: OwneySupportedTokens, gasMode?: "paid" | "sponsored"): Promise<{
851
+ txHash: viem.Hex;
852
+ status: YieldseekerWalletStatus;
853
+ }>;
834
854
  /**
835
855
  * Withdraw funds from a specific agent, or all agents that support the active chain+asset if agentId is omitted.
836
856
  * Validates that the asset is supported by the target agent(s) on the active chain.
@@ -967,8 +987,21 @@ type YieldseekerTransaction = {
967
987
  chainId: number;
968
988
  };
969
989
 
990
+ type YieldseekerWalletStatus = {
991
+ agentWallet: Address;
992
+ owner: Address;
993
+ ownerPath: "eoa" | "smart";
994
+ asset: Address;
995
+ implementation: Address;
996
+ version: "v1" | "v2" | "unknown";
997
+ upgradeAvailable: boolean;
998
+ /** The factory, owner, base asset, and provider wallet mapping all agree. */
999
+ verified: boolean;
1000
+ };
1001
+
970
1002
  type YieldseekerAgentOptions = {
971
1003
  baseUrl?: string;
1004
+ routingApiBaseUrl?: string;
972
1005
  fetchFn?: YieldseekerFetch;
973
1006
  auth?: YieldseekerAuthDependencies;
974
1007
  /** Dedicated read transport; Base is used for receipt polling. */
@@ -997,7 +1030,10 @@ declare class YieldseekerAgent implements IAgent {
997
1030
  private readonly api;
998
1031
  private readonly auth;
999
1032
  private readonly rpcUrls?;
1033
+ private readonly owneyApiKey;
1034
+ private readonly routingApiBaseUrl?;
1000
1035
  private receiptClient?;
1036
+ private readonly withdrawalVersionCache;
1001
1037
  private readonly transactionExecutor?;
1002
1038
  private readonly unwindReceiptWaiter?;
1003
1039
  private readonly agentContexts;
@@ -1018,10 +1054,17 @@ declare class YieldseekerAgent implements IAgent {
1018
1054
  private readonly pendingYieldOptions;
1019
1055
  constructor(owneyApiKey: string, options?: YieldseekerAgentOptions);
1020
1056
  private getReceiptClient;
1057
+ /** Reads the actual proxy implementation; Yieldseeker's API walletType is not a version check. */
1058
+ getWalletStatus(state: ConnectionState, chainId: number, asset: OwneySupportedTokens, useCachedV2?: boolean): Promise<YieldseekerWalletStatus | null>;
1059
+ /** Explicit owner action. This never runs as a side effect of withdrawal. */
1060
+ upgradeWallet(state: ConnectionState, chainId: number, asset: OwneySupportedTokens, gasMode?: "paid" | "sponsored"): Promise<{
1061
+ txHash: Hex;
1062
+ status: YieldseekerWalletStatus;
1063
+ }>;
1021
1064
  disconnect(): Promise<void>;
1022
1065
  activateAgent(state: ConnectionState, chainId: number, asset?: OwneySupportedTokens): Promise<void>;
1023
1066
  deposit(state: ConnectionState, chainId: number, amount: string, asset: OwneySupportedTokens, depositCallback?: DepositCallback, onProgress?: FundingProgress): Promise<OwneyDepositResult>;
1024
- withdraw(state: ConnectionState, chainId: number, asset: OwneySupportedTokens, amount?: string, onProgress?: FundingProgress): Promise<AgentWithdrawResult>;
1067
+ withdraw(state: ConnectionState, chainId: number, asset: OwneySupportedTokens, amount?: string, onProgress?: FundingProgress, gasMode?: "auto" | "sponsored" | "paid"): Promise<AgentWithdrawResult>;
1025
1068
  private withdrawInternal;
1026
1069
  getBalances(state: ConnectionState, chainId: number, asset?: OwneySupportedTokens): Promise<AgentBalance>;
1027
1070
  invalidateFundingRead(state: ConnectionState, chainId: number, asset: OwneySupportedTokens, refreshUntil?: number): void;
@@ -1142,4 +1185,4 @@ type OwneySIWXConfig = {
1142
1185
  */
1143
1186
  declare function createOwneySIWX(config: OwneySIWXConfig): SIWXConfig;
1144
1187
 
1145
- 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 ZyfaiRpcUrlsConfig, createOwneySIWX, setOwneyDebug };
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 };