@owney/sdk 0.2.9 → 0.2.11

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
@@ -28,7 +28,7 @@ interface IAgent {
28
28
  disconnect(): Promise<void>;
29
29
  activateAgent(state: ConnectionState, chainId: number): Promise<void>;
30
30
  deposit(state: ConnectionState, chainId: number, amount: string, depositCallback?: DepositCallback): Promise<OwneyDepositResult>;
31
- withdraw(state: ConnectionState, chainId: number, amount?: string): Promise<AgentWithdrawResult>;
31
+ withdraw(state: ConnectionState, chainId: number, token: OwneySupportedTokens, amount?: string): Promise<AgentWithdrawResult>;
32
32
  getBalances(state: ConnectionState, chainId: number): Promise<AgentBalance>;
33
33
  getEarnings(state: ConnectionState, chainId: number): Promise<AgentEarnings>;
34
34
  getAccountApy(state: ConnectionState, chainId: number, days: DailyApyDays): Promise<AccountAgentApy>;
@@ -42,14 +42,14 @@ interface IAgent {
42
42
  * Optional filters for per-agent APY lookups.
43
43
  * - `tokenSymbol` / `chainId` scope the APY to a specific asset+chain when
44
44
  * the underlying provider supports it (Zyfai). Agents whose backends do
45
- * not yet support per-asset APY (Sail) will ignore these options.
45
+ * not yet support per-asset APY will ignore these options.
46
46
  */
47
47
  type AgentApyOptions = {
48
48
  tokenSymbol?: string;
49
49
  chainId?: number;
50
50
  };
51
51
 
52
- type AgentId = "zyfai" | "sail";
52
+ type AgentId = "zyfai";
53
53
  type Asset = string;
54
54
  type AgentSupportedAssets = {
55
55
  readonly chainId: number;
@@ -328,7 +328,7 @@ declare class OwneySDK {
328
328
  * @param options.days - Lookback period: "7D", "14D", or "30D"
329
329
  * @param options.tokenSymbol - Optional asset symbol ("USDC" / "WETH") to
330
330
  * scope the APY to a specific asset+chain. Agents whose backends do not
331
- * support per-asset APY (currently Sail) ignore this.
331
+ * support per-asset APY ignore this.
332
332
  * @param options.chainId - Optional chain id for per-asset APY lookups.
333
333
  * Typically paired with `tokenSymbol`.
334
334
  * @returns {AgentApy} for a single agent, or {OwneyAgentApy} with per-agent APY
@@ -341,11 +341,12 @@ declare class OwneySDK {
341
341
  getAgentAllocation(): Promise<OwneyAgentAllocation>;
342
342
  }
343
343
 
344
- type OwneyErrorCode = "NOT_CONNECTED" | "NO_ACTIVE_CHAIN" | "WALLET_NO_ACCOUNTS" | "WALLET_ADDRESS_REQUIRED" | "AGENT_NOT_FOUND" | "AGENT_CHAIN_INCOMPATIBLE" | "AGENT_EMPTY_LIST" | "CHAIN_UNSUPPORTED" | "CHAIN_NO_COMPATIBLE_AGENTS" | "ASSET_UNSUPPORTED" | "ASSET_NO_COMPATIBLE_AGENTS" | "DEPOSIT_AMOUNT_BELOW_MINIMUM" | "DEPOSIT_CALLBACK_REQUIRED" | "DEPOSIT_CALLBACK_INVALID" | "DEPOSIT_NO_PERMITTED_TOKENS" | "WITHDRAW_NO_PERMITTED_TOKENS" | "API_ROUTING_ERROR" | "API_ROUTING_FAILED" | "API_SAIL_ERROR" | "API_SAIL_TIMEOUT" | "API_NO_AGENTS" | "BALANCE_ALL_FAILED" | "ALLOCATION_ALL_FAILED" | "VALIDATION_INVALID_DAYS";
344
+ type OwneyErrorCode = "NOT_CONNECTED" | "NO_ACTIVE_CHAIN" | "WALLET_NO_ACCOUNTS" | "WALLET_ADDRESS_REQUIRED" | "AGENT_NOT_FOUND" | "AGENT_CHAIN_INCOMPATIBLE" | "AGENT_EMPTY_LIST" | "CHAIN_UNSUPPORTED" | "CHAIN_NO_COMPATIBLE_AGENTS" | "ASSET_UNSUPPORTED" | "ASSET_NO_COMPATIBLE_AGENTS" | "DEPOSIT_AMOUNT_BELOW_MINIMUM" | "DEPOSIT_CALLBACK_REQUIRED" | "DEPOSIT_CALLBACK_INVALID" | "DEPOSIT_NO_PERMITTED_TOKENS" | "WITHDRAW_NO_PERMITTED_TOKENS" | "WITHDRAW_INSUFFICIENT_BALANCE" | "WITHDRAW_ALL_FAILED" | "WITHDRAW_PARTIAL_FAILURE" | "API_ROUTING_ERROR" | "API_ROUTING_FAILED" | "API_SAIL_ERROR" | "API_SAIL_TIMEOUT" | "API_NO_AGENTS" | "BALANCE_ALL_FAILED" | "ALLOCATION_ALL_FAILED" | "VALIDATION_INVALID_DAYS";
345
345
  declare class OwneyError extends Error {
346
346
  readonly code: OwneyErrorCode;
347
347
  readonly details?: Record<string, unknown>;
348
- constructor(code: OwneyErrorCode, message: string, details?: Record<string, unknown>);
348
+ readonly agentId?: string;
349
+ constructor(code: OwneyErrorCode, message: string, details?: Record<string, unknown>, agentId?: string);
349
350
  }
350
351
  declare class AgentNotFoundError extends OwneyError {
351
352
  constructor(agentId: string, available: string[]);
package/dist/index.d.ts CHANGED
@@ -28,7 +28,7 @@ interface IAgent {
28
28
  disconnect(): Promise<void>;
29
29
  activateAgent(state: ConnectionState, chainId: number): Promise<void>;
30
30
  deposit(state: ConnectionState, chainId: number, amount: string, depositCallback?: DepositCallback): Promise<OwneyDepositResult>;
31
- withdraw(state: ConnectionState, chainId: number, amount?: string): Promise<AgentWithdrawResult>;
31
+ withdraw(state: ConnectionState, chainId: number, token: OwneySupportedTokens, amount?: string): Promise<AgentWithdrawResult>;
32
32
  getBalances(state: ConnectionState, chainId: number): Promise<AgentBalance>;
33
33
  getEarnings(state: ConnectionState, chainId: number): Promise<AgentEarnings>;
34
34
  getAccountApy(state: ConnectionState, chainId: number, days: DailyApyDays): Promise<AccountAgentApy>;
@@ -42,14 +42,14 @@ interface IAgent {
42
42
  * Optional filters for per-agent APY lookups.
43
43
  * - `tokenSymbol` / `chainId` scope the APY to a specific asset+chain when
44
44
  * the underlying provider supports it (Zyfai). Agents whose backends do
45
- * not yet support per-asset APY (Sail) will ignore these options.
45
+ * not yet support per-asset APY will ignore these options.
46
46
  */
47
47
  type AgentApyOptions = {
48
48
  tokenSymbol?: string;
49
49
  chainId?: number;
50
50
  };
51
51
 
52
- type AgentId = "zyfai" | "sail";
52
+ type AgentId = "zyfai";
53
53
  type Asset = string;
54
54
  type AgentSupportedAssets = {
55
55
  readonly chainId: number;
@@ -328,7 +328,7 @@ declare class OwneySDK {
328
328
  * @param options.days - Lookback period: "7D", "14D", or "30D"
329
329
  * @param options.tokenSymbol - Optional asset symbol ("USDC" / "WETH") to
330
330
  * scope the APY to a specific asset+chain. Agents whose backends do not
331
- * support per-asset APY (currently Sail) ignore this.
331
+ * support per-asset APY ignore this.
332
332
  * @param options.chainId - Optional chain id for per-asset APY lookups.
333
333
  * Typically paired with `tokenSymbol`.
334
334
  * @returns {AgentApy} for a single agent, or {OwneyAgentApy} with per-agent APY
@@ -341,11 +341,12 @@ declare class OwneySDK {
341
341
  getAgentAllocation(): Promise<OwneyAgentAllocation>;
342
342
  }
343
343
 
344
- type OwneyErrorCode = "NOT_CONNECTED" | "NO_ACTIVE_CHAIN" | "WALLET_NO_ACCOUNTS" | "WALLET_ADDRESS_REQUIRED" | "AGENT_NOT_FOUND" | "AGENT_CHAIN_INCOMPATIBLE" | "AGENT_EMPTY_LIST" | "CHAIN_UNSUPPORTED" | "CHAIN_NO_COMPATIBLE_AGENTS" | "ASSET_UNSUPPORTED" | "ASSET_NO_COMPATIBLE_AGENTS" | "DEPOSIT_AMOUNT_BELOW_MINIMUM" | "DEPOSIT_CALLBACK_REQUIRED" | "DEPOSIT_CALLBACK_INVALID" | "DEPOSIT_NO_PERMITTED_TOKENS" | "WITHDRAW_NO_PERMITTED_TOKENS" | "API_ROUTING_ERROR" | "API_ROUTING_FAILED" | "API_SAIL_ERROR" | "API_SAIL_TIMEOUT" | "API_NO_AGENTS" | "BALANCE_ALL_FAILED" | "ALLOCATION_ALL_FAILED" | "VALIDATION_INVALID_DAYS";
344
+ type OwneyErrorCode = "NOT_CONNECTED" | "NO_ACTIVE_CHAIN" | "WALLET_NO_ACCOUNTS" | "WALLET_ADDRESS_REQUIRED" | "AGENT_NOT_FOUND" | "AGENT_CHAIN_INCOMPATIBLE" | "AGENT_EMPTY_LIST" | "CHAIN_UNSUPPORTED" | "CHAIN_NO_COMPATIBLE_AGENTS" | "ASSET_UNSUPPORTED" | "ASSET_NO_COMPATIBLE_AGENTS" | "DEPOSIT_AMOUNT_BELOW_MINIMUM" | "DEPOSIT_CALLBACK_REQUIRED" | "DEPOSIT_CALLBACK_INVALID" | "DEPOSIT_NO_PERMITTED_TOKENS" | "WITHDRAW_NO_PERMITTED_TOKENS" | "WITHDRAW_INSUFFICIENT_BALANCE" | "WITHDRAW_ALL_FAILED" | "WITHDRAW_PARTIAL_FAILURE" | "API_ROUTING_ERROR" | "API_ROUTING_FAILED" | "API_SAIL_ERROR" | "API_SAIL_TIMEOUT" | "API_NO_AGENTS" | "BALANCE_ALL_FAILED" | "ALLOCATION_ALL_FAILED" | "VALIDATION_INVALID_DAYS";
345
345
  declare class OwneyError extends Error {
346
346
  readonly code: OwneyErrorCode;
347
347
  readonly details?: Record<string, unknown>;
348
- constructor(code: OwneyErrorCode, message: string, details?: Record<string, unknown>);
348
+ readonly agentId?: string;
349
+ constructor(code: OwneyErrorCode, message: string, details?: Record<string, unknown>, agentId?: string);
349
350
  }
350
351
  declare class AgentNotFoundError extends OwneyError {
351
352
  constructor(agentId: string, available: string[]);