@owney/sdk 0.7.16 → 0.7.17-beta.0
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 +425 -124
- package/dist/index.d.cts +25 -4
- package/dist/index.d.ts +25 -4
- package/dist/index.js +425 -124
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -65,6 +65,18 @@ type AgentSupportedAssets = {
|
|
|
65
65
|
readonly chain?: string;
|
|
66
66
|
readonly assets: readonly AgentSupportedAsset[];
|
|
67
67
|
};
|
|
68
|
+
type AvailableAgent = {
|
|
69
|
+
id: AgentId;
|
|
70
|
+
isEnabled: boolean;
|
|
71
|
+
supportedChainIds: readonly number[];
|
|
72
|
+
supportedAssets: readonly AgentSupportedAssets[];
|
|
73
|
+
};
|
|
74
|
+
type AvailableAgentsOptions = {
|
|
75
|
+
chainId?: number;
|
|
76
|
+
asset?: Asset;
|
|
77
|
+
/** Disabled agents are omitted by default because they cannot accept funds. */
|
|
78
|
+
includeDisabled?: boolean;
|
|
79
|
+
};
|
|
68
80
|
type DailyApyDays = "7D" | "14D" | "30D";
|
|
69
81
|
type HistoryFilters = {
|
|
70
82
|
fromDate?: string;
|
|
@@ -445,6 +457,9 @@ declare class OwneySDK {
|
|
|
445
457
|
private cachedWethSponsoredCallback;
|
|
446
458
|
private paymasterServiceUrl?;
|
|
447
459
|
private cachedSponsoredCallsCallbacks;
|
|
460
|
+
private readonly agentReads;
|
|
461
|
+
private readonly activationChecks;
|
|
462
|
+
private readAgent;
|
|
448
463
|
private initializingAgentsPromise;
|
|
449
464
|
constructor(config: OwneySDKConfig);
|
|
450
465
|
/**
|
|
@@ -511,6 +526,11 @@ declare class OwneySDK {
|
|
|
511
526
|
private applyOrgPolicyTo;
|
|
512
527
|
private ensureAgentsInitialized;
|
|
513
528
|
private createAgent;
|
|
529
|
+
/**
|
|
530
|
+
* Discover the agents actually returned by routing for this organization.
|
|
531
|
+
* Consumers should use this instead of hardcoding a global agent roster.
|
|
532
|
+
*/
|
|
533
|
+
getAvailableAgents(options?: AvailableAgentsOptions): Promise<AvailableAgent[]>;
|
|
514
534
|
/**
|
|
515
535
|
* Activate the user's smart wallet for the specified agents, or all chain-compatible agents if omitted.
|
|
516
536
|
* Deploys the Safe contract and creates a session key if not already set up.
|
|
@@ -542,7 +562,7 @@ declare class OwneySDK {
|
|
|
542
562
|
*/
|
|
543
563
|
private activateAgentsInTurn;
|
|
544
564
|
/**
|
|
545
|
-
* Deposit
|
|
565
|
+
* Deposit into a specific agent, or distribute across all eligible agents.
|
|
546
566
|
* Validates that the asset is supported and amount meets minimums for the target agent(s).
|
|
547
567
|
* @param options - Deposit parameters
|
|
548
568
|
* @param options.amount - Amount to deposit in smallest unit (e.g. "100000000" for 100 USDC)
|
|
@@ -550,7 +570,8 @@ declare class OwneySDK {
|
|
|
550
570
|
* @param options.depositCallback - Callback that performs the token transfer and returns a tx hash.
|
|
551
571
|
* When agentId is omitted, this callback is invoked once per eligible agent with that agent's
|
|
552
572
|
* split amount and smart wallet address — expect multiple wallet prompts.
|
|
553
|
-
* @param options.agentId - Optional
|
|
573
|
+
* @param options.agentId - Optional explicit target. Otherwise split equally,
|
|
574
|
+
* or fund remaining agents when a recovery deposit cannot meet every minimum.
|
|
554
575
|
* @returns {OwneyDepositResult} for a single agent, or {OwneyMultiDepositResult} with per-agent results
|
|
555
576
|
*/
|
|
556
577
|
deposit(options: DepositOptions): Promise<OwneyDepositResult | OwneyMultiDepositResult>;
|
|
@@ -692,7 +713,7 @@ declare class OwneySDK {
|
|
|
692
713
|
getAllocationApy({ agentId, }?: AllocationApyOptions): Promise<OwneyAllocationApy>;
|
|
693
714
|
}
|
|
694
715
|
|
|
695
|
-
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_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" | "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";
|
|
716
|
+
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";
|
|
696
717
|
declare class OwneyError extends Error {
|
|
697
718
|
readonly code: OwneyErrorCode;
|
|
698
719
|
readonly details?: Record<string, unknown>;
|
|
@@ -758,4 +779,4 @@ type OwneySIWXConfig = {
|
|
|
758
779
|
*/
|
|
759
780
|
declare function createOwneySIWX(config: OwneySIWXConfig): SIWXConfig;
|
|
760
781
|
|
|
761
|
-
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 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 };
|
|
782
|
+
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -65,6 +65,18 @@ type AgentSupportedAssets = {
|
|
|
65
65
|
readonly chain?: string;
|
|
66
66
|
readonly assets: readonly AgentSupportedAsset[];
|
|
67
67
|
};
|
|
68
|
+
type AvailableAgent = {
|
|
69
|
+
id: AgentId;
|
|
70
|
+
isEnabled: boolean;
|
|
71
|
+
supportedChainIds: readonly number[];
|
|
72
|
+
supportedAssets: readonly AgentSupportedAssets[];
|
|
73
|
+
};
|
|
74
|
+
type AvailableAgentsOptions = {
|
|
75
|
+
chainId?: number;
|
|
76
|
+
asset?: Asset;
|
|
77
|
+
/** Disabled agents are omitted by default because they cannot accept funds. */
|
|
78
|
+
includeDisabled?: boolean;
|
|
79
|
+
};
|
|
68
80
|
type DailyApyDays = "7D" | "14D" | "30D";
|
|
69
81
|
type HistoryFilters = {
|
|
70
82
|
fromDate?: string;
|
|
@@ -445,6 +457,9 @@ declare class OwneySDK {
|
|
|
445
457
|
private cachedWethSponsoredCallback;
|
|
446
458
|
private paymasterServiceUrl?;
|
|
447
459
|
private cachedSponsoredCallsCallbacks;
|
|
460
|
+
private readonly agentReads;
|
|
461
|
+
private readonly activationChecks;
|
|
462
|
+
private readAgent;
|
|
448
463
|
private initializingAgentsPromise;
|
|
449
464
|
constructor(config: OwneySDKConfig);
|
|
450
465
|
/**
|
|
@@ -511,6 +526,11 @@ declare class OwneySDK {
|
|
|
511
526
|
private applyOrgPolicyTo;
|
|
512
527
|
private ensureAgentsInitialized;
|
|
513
528
|
private createAgent;
|
|
529
|
+
/**
|
|
530
|
+
* Discover the agents actually returned by routing for this organization.
|
|
531
|
+
* Consumers should use this instead of hardcoding a global agent roster.
|
|
532
|
+
*/
|
|
533
|
+
getAvailableAgents(options?: AvailableAgentsOptions): Promise<AvailableAgent[]>;
|
|
514
534
|
/**
|
|
515
535
|
* Activate the user's smart wallet for the specified agents, or all chain-compatible agents if omitted.
|
|
516
536
|
* Deploys the Safe contract and creates a session key if not already set up.
|
|
@@ -542,7 +562,7 @@ declare class OwneySDK {
|
|
|
542
562
|
*/
|
|
543
563
|
private activateAgentsInTurn;
|
|
544
564
|
/**
|
|
545
|
-
* Deposit
|
|
565
|
+
* Deposit into a specific agent, or distribute across all eligible agents.
|
|
546
566
|
* Validates that the asset is supported and amount meets minimums for the target agent(s).
|
|
547
567
|
* @param options - Deposit parameters
|
|
548
568
|
* @param options.amount - Amount to deposit in smallest unit (e.g. "100000000" for 100 USDC)
|
|
@@ -550,7 +570,8 @@ declare class OwneySDK {
|
|
|
550
570
|
* @param options.depositCallback - Callback that performs the token transfer and returns a tx hash.
|
|
551
571
|
* When agentId is omitted, this callback is invoked once per eligible agent with that agent's
|
|
552
572
|
* split amount and smart wallet address — expect multiple wallet prompts.
|
|
553
|
-
* @param options.agentId - Optional
|
|
573
|
+
* @param options.agentId - Optional explicit target. Otherwise split equally,
|
|
574
|
+
* or fund remaining agents when a recovery deposit cannot meet every minimum.
|
|
554
575
|
* @returns {OwneyDepositResult} for a single agent, or {OwneyMultiDepositResult} with per-agent results
|
|
555
576
|
*/
|
|
556
577
|
deposit(options: DepositOptions): Promise<OwneyDepositResult | OwneyMultiDepositResult>;
|
|
@@ -692,7 +713,7 @@ declare class OwneySDK {
|
|
|
692
713
|
getAllocationApy({ agentId, }?: AllocationApyOptions): Promise<OwneyAllocationApy>;
|
|
693
714
|
}
|
|
694
715
|
|
|
695
|
-
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_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" | "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";
|
|
716
|
+
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";
|
|
696
717
|
declare class OwneyError extends Error {
|
|
697
718
|
readonly code: OwneyErrorCode;
|
|
698
719
|
readonly details?: Record<string, unknown>;
|
|
@@ -758,4 +779,4 @@ type OwneySIWXConfig = {
|
|
|
758
779
|
*/
|
|
759
780
|
declare function createOwneySIWX(config: OwneySIWXConfig): SIWXConfig;
|
|
760
781
|
|
|
761
|
-
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 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 };
|
|
782
|
+
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 };
|