@owney/sdk 0.7.16-beta.1 → 0.7.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/README.md +0 -2
- package/dist/index.cjs +666 -1708
- package/dist/index.d.cts +5 -115
- package/dist/index.d.ts +5 -115
- package/dist/index.js +685 -1738
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Hex } from 'viem';
|
|
2
1
|
import { SIWXConfig } from '@reown/appkit-controllers';
|
|
3
2
|
|
|
4
3
|
type ZyfaiRpcUrlsConfig = Partial<Record<(typeof SUPPORTED_CHAIN_IDS)[number], string>>;
|
|
@@ -9,8 +8,6 @@ interface OwneySDKConfig {
|
|
|
9
8
|
* Example: { 8453: "https://...", 42161: "https://..." }
|
|
10
9
|
*/
|
|
11
10
|
zyfaiRpcUrls?: ZyfaiRpcUrlsConfig;
|
|
12
|
-
/** Optional Owney Yieldseeker proxy base URL override for integration tests. */
|
|
13
|
-
yieldseekerApiBaseUrl?: string;
|
|
14
11
|
/**
|
|
15
12
|
* Optional override for the Owney routing API base URL used by all routing
|
|
16
13
|
* calls (defaults to the OWNEY_ROUTING_API_BASE_URL env var, then the
|
|
@@ -57,7 +54,7 @@ type OwneySupportedChainId = (typeof SUPPORTED_CHAIN_IDS)[number];
|
|
|
57
54
|
type OwneySupportedChains = (typeof SUPPORTED_CHAINS)[number];
|
|
58
55
|
type OwneySupportedTokens = (typeof SUPPORTED_TOKENS)[number];
|
|
59
56
|
|
|
60
|
-
type AgentId = "zyfai"
|
|
57
|
+
type AgentId = "zyfai";
|
|
61
58
|
type Asset = string;
|
|
62
59
|
type AgentSupportedAsset = {
|
|
63
60
|
readonly symbol: string;
|
|
@@ -68,18 +65,6 @@ type AgentSupportedAssets = {
|
|
|
68
65
|
readonly chain?: string;
|
|
69
66
|
readonly assets: readonly AgentSupportedAsset[];
|
|
70
67
|
};
|
|
71
|
-
type AvailableAgent = {
|
|
72
|
-
id: AgentId;
|
|
73
|
-
isEnabled: boolean;
|
|
74
|
-
supportedChainIds: readonly number[];
|
|
75
|
-
supportedAssets: readonly AgentSupportedAssets[];
|
|
76
|
-
};
|
|
77
|
-
type AvailableAgentsOptions = {
|
|
78
|
-
chainId?: number;
|
|
79
|
-
asset?: Asset;
|
|
80
|
-
/** Disabled agents are omitted by default because they cannot accept funds. */
|
|
81
|
-
includeDisabled?: boolean;
|
|
82
|
-
};
|
|
83
68
|
type DailyApyDays = "7D" | "14D" | "30D";
|
|
84
69
|
type HistoryFilters = {
|
|
85
70
|
fromDate?: string;
|
|
@@ -209,8 +194,6 @@ interface OwneyPosition {
|
|
|
209
194
|
pool?: string;
|
|
210
195
|
asset: string;
|
|
211
196
|
amount: string;
|
|
212
|
-
/** Smallest-unit amount when the provider exposes it alongside `amount`. */
|
|
213
|
-
amountRaw?: string;
|
|
214
197
|
apy?: number;
|
|
215
198
|
tvl?: number;
|
|
216
199
|
/** Pool liquidity. Prepared slot — Zyfai will add this to its portfolio
|
|
@@ -259,12 +242,6 @@ interface OwneyBalances {
|
|
|
259
242
|
/** Asset that `totalBalance` is denominated in. Currently always `"usdc"`. */
|
|
260
243
|
totalBalanceAsset: string;
|
|
261
244
|
agentBalances: Record<AgentId, AgentBalance>;
|
|
262
|
-
/**
|
|
263
|
-
* Per-agent read failures when an aggregate balance request returned only a
|
|
264
|
-
* partial result. Callers may display the successful balances, but funding
|
|
265
|
-
* operations must not interpret a missing agent as having a zero balance.
|
|
266
|
-
*/
|
|
267
|
-
agentErrors?: Partial<Record<AgentId, string>>;
|
|
268
245
|
}
|
|
269
246
|
interface AgentEarnings {
|
|
270
247
|
smartWallet: `0x${string}`;
|
|
@@ -298,12 +275,6 @@ interface OwneyAccountApy {
|
|
|
298
275
|
totalApy: string;
|
|
299
276
|
agentApy: Record<AgentId, AccountAgentApy>;
|
|
300
277
|
apyByChainAndAsset: ApyByChainAndAsset;
|
|
301
|
-
/**
|
|
302
|
-
* Balance-weighted daily APY across the agents that returned a point for each
|
|
303
|
-
* date. The weights use the selected chain/asset balance when getAccountApy
|
|
304
|
-
* is asset-scoped, otherwise each agent's total balance.
|
|
305
|
-
*/
|
|
306
|
-
history?: ApyHistoryPoint[];
|
|
307
278
|
}
|
|
308
279
|
interface AllocationAgentApy {
|
|
309
280
|
/** Account-wide weighted APY for this agent, as a decimal string. */
|
|
@@ -402,15 +373,8 @@ interface IAgent {
|
|
|
402
373
|
readonly id: string;
|
|
403
374
|
readonly supportedChainIds: readonly OwneySupportedChainId[];
|
|
404
375
|
readonly supportedAssets: readonly AgentSupportedAssets[];
|
|
405
|
-
/**
|
|
406
|
-
* Describes how `AgentBalance.tokens` relates to `positions`.
|
|
407
|
-
* Most adapters expose token totals that already include deployed positions.
|
|
408
|
-
* Providers such as Yieldseeker expose idle wallet tokens separately, so
|
|
409
|
-
* withdrawal planning must add matching position amounts.
|
|
410
|
-
*/
|
|
411
|
-
readonly balanceComposition?: "tokens-include-positions" | "tokens-plus-positions";
|
|
412
376
|
disconnect(): Promise<void>;
|
|
413
|
-
activateAgent(state: ConnectionState, chainId: number
|
|
377
|
+
activateAgent(state: ConnectionState, chainId: number): Promise<void>;
|
|
414
378
|
/**
|
|
415
379
|
* Apply the organization's agent policy to this user's account.
|
|
416
380
|
*
|
|
@@ -475,7 +439,6 @@ declare class OwneySDK {
|
|
|
475
439
|
private orgAgentConfig;
|
|
476
440
|
private orgAgentConfigPromise;
|
|
477
441
|
private zyfaiRpcUrls?;
|
|
478
|
-
private yieldseekerApiBaseUrl?;
|
|
479
442
|
private routingApiBaseUrl?;
|
|
480
443
|
private referralSource?;
|
|
481
444
|
private cachedSponsoredCallback;
|
|
@@ -548,11 +511,6 @@ declare class OwneySDK {
|
|
|
548
511
|
private applyOrgPolicyTo;
|
|
549
512
|
private ensureAgentsInitialized;
|
|
550
513
|
private createAgent;
|
|
551
|
-
/**
|
|
552
|
-
* Discover the agents actually returned by routing for this organization.
|
|
553
|
-
* Consumers should use this instead of hardcoding a global agent roster.
|
|
554
|
-
*/
|
|
555
|
-
getAvailableAgents(options?: AvailableAgentsOptions): Promise<AvailableAgent[]>;
|
|
556
514
|
/**
|
|
557
515
|
* Activate the user's smart wallet for the specified agents, or all chain-compatible agents if omitted.
|
|
558
516
|
* Deploys the Safe contract and creates a session key if not already set up.
|
|
@@ -563,7 +521,7 @@ declare class OwneySDK {
|
|
|
563
521
|
* If provided, ALL specified agents must support the chainId or the call
|
|
564
522
|
* throws before activating any agent.
|
|
565
523
|
*/
|
|
566
|
-
activateAgent(chainId: number, agentId?: AgentId[]
|
|
524
|
+
activateAgent(chainId: number, agentId?: AgentId[]): Promise<void>;
|
|
567
525
|
/**
|
|
568
526
|
* Activate agents ONE AT A TIME, each followed by its org policy.
|
|
569
527
|
*
|
|
@@ -734,75 +692,7 @@ declare class OwneySDK {
|
|
|
734
692
|
getAllocationApy({ agentId, }?: AllocationApyOptions): Promise<OwneyAllocationApy>;
|
|
735
693
|
}
|
|
736
694
|
|
|
737
|
-
type
|
|
738
|
-
now?: () => Date;
|
|
739
|
-
nonce?: () => string;
|
|
740
|
-
};
|
|
741
|
-
|
|
742
|
-
type YieldseekerFetch = typeof fetch;
|
|
743
|
-
|
|
744
|
-
type YieldseekerTransaction = {
|
|
745
|
-
from: `0x${string}`;
|
|
746
|
-
to: `0x${string}`;
|
|
747
|
-
data: `0x${string}`;
|
|
748
|
-
value: string;
|
|
749
|
-
chainId: number;
|
|
750
|
-
};
|
|
751
|
-
|
|
752
|
-
type YieldseekerAgentOptions = {
|
|
753
|
-
baseUrl?: string;
|
|
754
|
-
fetchFn?: YieldseekerFetch;
|
|
755
|
-
auth?: YieldseekerAuthDependencies;
|
|
756
|
-
/** Test seam for the wallet-submission/receipt boundary. */
|
|
757
|
-
transactionExecutor?: (state: ConnectionState, chainId: number, transaction: YieldseekerTransaction) => Promise<Hex>;
|
|
758
|
-
/** Test seam for Yieldseeker's already-submitted unwind transaction. */
|
|
759
|
-
unwindReceiptWaiter?: (state: ConnectionState, chainId: number, transactionHash: Hex) => Promise<void>;
|
|
760
|
-
};
|
|
761
|
-
declare class YieldseekerAgent implements IAgent {
|
|
762
|
-
readonly id = "yieldseeker";
|
|
763
|
-
readonly balanceComposition: "tokens-plus-positions";
|
|
764
|
-
readonly supportedChainIds: readonly [8453];
|
|
765
|
-
readonly supportedAssets: readonly [{
|
|
766
|
-
readonly chainId: 8453;
|
|
767
|
-
readonly chain: "BASE";
|
|
768
|
-
readonly assets: readonly [{
|
|
769
|
-
readonly symbol: "USDC";
|
|
770
|
-
readonly minDepositAmount: "1";
|
|
771
|
-
}, {
|
|
772
|
-
readonly symbol: "WETH";
|
|
773
|
-
readonly minDepositAmount: "1";
|
|
774
|
-
}];
|
|
775
|
-
}];
|
|
776
|
-
private readonly api;
|
|
777
|
-
private readonly auth;
|
|
778
|
-
private readonly transactionExecutor?;
|
|
779
|
-
private readonly unwindReceiptWaiter?;
|
|
780
|
-
private readonly activated;
|
|
781
|
-
constructor(owneyApiKey: string, options?: YieldseekerAgentOptions);
|
|
782
|
-
disconnect(): Promise<void>;
|
|
783
|
-
activateAgent(state: ConnectionState, chainId: number, asset?: OwneySupportedTokens): Promise<void>;
|
|
784
|
-
deposit(state: ConnectionState, chainId: number, amount: string, asset: OwneySupportedTokens, depositCallback?: DepositCallback): Promise<OwneyDepositResult>;
|
|
785
|
-
withdraw(state: ConnectionState, chainId: number, asset: OwneySupportedTokens, amount?: string): Promise<AgentWithdrawResult>;
|
|
786
|
-
getBalances(state: ConnectionState, chainId: number): Promise<AgentBalance>;
|
|
787
|
-
getEarnings(state: ConnectionState, chainId: number): Promise<AgentEarnings>;
|
|
788
|
-
getAccountApy(state: ConnectionState, chainId: number, days: DailyApyDays, tokenSymbol?: string): Promise<AccountAgentApy>;
|
|
789
|
-
getHistory(state: ConnectionState, chainId: number, options?: HistoryFilters): Promise<OwneyAgentHistory>;
|
|
790
|
-
getUserProfile(state: ConnectionState, chainId: number): Promise<AgentUserProfile>;
|
|
791
|
-
getAgentApy(days: DailyApyDays, options?: AgentApyOptions): Promise<AgentApy>;
|
|
792
|
-
private ensureActivated;
|
|
793
|
-
private walletRequest;
|
|
794
|
-
private mapApiError;
|
|
795
|
-
private submitTransaction;
|
|
796
|
-
private waitForUnwindReceipt;
|
|
797
|
-
private positionMatchesChain;
|
|
798
|
-
private isTransactionHash;
|
|
799
|
-
private assertChain;
|
|
800
|
-
private assertOptionalChain;
|
|
801
|
-
private assertAsset;
|
|
802
|
-
private invalidResponse;
|
|
803
|
-
}
|
|
804
|
-
|
|
805
|
-
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_BALANCE_UNAVAILABLE" | "WITHDRAW_INSUFFICIENT_BALANCE" | "WITHDRAW_ALL_FAILED" | "WITHDRAW_PARTIAL_FAILURE" | "WITHDRAW_FAILED" | "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" | "ALLOCATION_ALL_FAILED" | "VALIDATION_INVALID_DAYS";
|
|
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";
|
|
806
696
|
declare class OwneyError extends Error {
|
|
807
697
|
readonly code: OwneyErrorCode;
|
|
808
698
|
readonly details?: Record<string, unknown>;
|
|
@@ -868,4 +758,4 @@ type OwneySIWXConfig = {
|
|
|
868
758
|
*/
|
|
869
759
|
declare function createOwneySIWX(config: OwneySIWXConfig): SIWXConfig;
|
|
870
760
|
|
|
871
|
-
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
|
|
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Hex } from 'viem';
|
|
2
1
|
import { SIWXConfig } from '@reown/appkit-controllers';
|
|
3
2
|
|
|
4
3
|
type ZyfaiRpcUrlsConfig = Partial<Record<(typeof SUPPORTED_CHAIN_IDS)[number], string>>;
|
|
@@ -9,8 +8,6 @@ interface OwneySDKConfig {
|
|
|
9
8
|
* Example: { 8453: "https://...", 42161: "https://..." }
|
|
10
9
|
*/
|
|
11
10
|
zyfaiRpcUrls?: ZyfaiRpcUrlsConfig;
|
|
12
|
-
/** Optional Owney Yieldseeker proxy base URL override for integration tests. */
|
|
13
|
-
yieldseekerApiBaseUrl?: string;
|
|
14
11
|
/**
|
|
15
12
|
* Optional override for the Owney routing API base URL used by all routing
|
|
16
13
|
* calls (defaults to the OWNEY_ROUTING_API_BASE_URL env var, then the
|
|
@@ -57,7 +54,7 @@ type OwneySupportedChainId = (typeof SUPPORTED_CHAIN_IDS)[number];
|
|
|
57
54
|
type OwneySupportedChains = (typeof SUPPORTED_CHAINS)[number];
|
|
58
55
|
type OwneySupportedTokens = (typeof SUPPORTED_TOKENS)[number];
|
|
59
56
|
|
|
60
|
-
type AgentId = "zyfai"
|
|
57
|
+
type AgentId = "zyfai";
|
|
61
58
|
type Asset = string;
|
|
62
59
|
type AgentSupportedAsset = {
|
|
63
60
|
readonly symbol: string;
|
|
@@ -68,18 +65,6 @@ type AgentSupportedAssets = {
|
|
|
68
65
|
readonly chain?: string;
|
|
69
66
|
readonly assets: readonly AgentSupportedAsset[];
|
|
70
67
|
};
|
|
71
|
-
type AvailableAgent = {
|
|
72
|
-
id: AgentId;
|
|
73
|
-
isEnabled: boolean;
|
|
74
|
-
supportedChainIds: readonly number[];
|
|
75
|
-
supportedAssets: readonly AgentSupportedAssets[];
|
|
76
|
-
};
|
|
77
|
-
type AvailableAgentsOptions = {
|
|
78
|
-
chainId?: number;
|
|
79
|
-
asset?: Asset;
|
|
80
|
-
/** Disabled agents are omitted by default because they cannot accept funds. */
|
|
81
|
-
includeDisabled?: boolean;
|
|
82
|
-
};
|
|
83
68
|
type DailyApyDays = "7D" | "14D" | "30D";
|
|
84
69
|
type HistoryFilters = {
|
|
85
70
|
fromDate?: string;
|
|
@@ -209,8 +194,6 @@ interface OwneyPosition {
|
|
|
209
194
|
pool?: string;
|
|
210
195
|
asset: string;
|
|
211
196
|
amount: string;
|
|
212
|
-
/** Smallest-unit amount when the provider exposes it alongside `amount`. */
|
|
213
|
-
amountRaw?: string;
|
|
214
197
|
apy?: number;
|
|
215
198
|
tvl?: number;
|
|
216
199
|
/** Pool liquidity. Prepared slot — Zyfai will add this to its portfolio
|
|
@@ -259,12 +242,6 @@ interface OwneyBalances {
|
|
|
259
242
|
/** Asset that `totalBalance` is denominated in. Currently always `"usdc"`. */
|
|
260
243
|
totalBalanceAsset: string;
|
|
261
244
|
agentBalances: Record<AgentId, AgentBalance>;
|
|
262
|
-
/**
|
|
263
|
-
* Per-agent read failures when an aggregate balance request returned only a
|
|
264
|
-
* partial result. Callers may display the successful balances, but funding
|
|
265
|
-
* operations must not interpret a missing agent as having a zero balance.
|
|
266
|
-
*/
|
|
267
|
-
agentErrors?: Partial<Record<AgentId, string>>;
|
|
268
245
|
}
|
|
269
246
|
interface AgentEarnings {
|
|
270
247
|
smartWallet: `0x${string}`;
|
|
@@ -298,12 +275,6 @@ interface OwneyAccountApy {
|
|
|
298
275
|
totalApy: string;
|
|
299
276
|
agentApy: Record<AgentId, AccountAgentApy>;
|
|
300
277
|
apyByChainAndAsset: ApyByChainAndAsset;
|
|
301
|
-
/**
|
|
302
|
-
* Balance-weighted daily APY across the agents that returned a point for each
|
|
303
|
-
* date. The weights use the selected chain/asset balance when getAccountApy
|
|
304
|
-
* is asset-scoped, otherwise each agent's total balance.
|
|
305
|
-
*/
|
|
306
|
-
history?: ApyHistoryPoint[];
|
|
307
278
|
}
|
|
308
279
|
interface AllocationAgentApy {
|
|
309
280
|
/** Account-wide weighted APY for this agent, as a decimal string. */
|
|
@@ -402,15 +373,8 @@ interface IAgent {
|
|
|
402
373
|
readonly id: string;
|
|
403
374
|
readonly supportedChainIds: readonly OwneySupportedChainId[];
|
|
404
375
|
readonly supportedAssets: readonly AgentSupportedAssets[];
|
|
405
|
-
/**
|
|
406
|
-
* Describes how `AgentBalance.tokens` relates to `positions`.
|
|
407
|
-
* Most adapters expose token totals that already include deployed positions.
|
|
408
|
-
* Providers such as Yieldseeker expose idle wallet tokens separately, so
|
|
409
|
-
* withdrawal planning must add matching position amounts.
|
|
410
|
-
*/
|
|
411
|
-
readonly balanceComposition?: "tokens-include-positions" | "tokens-plus-positions";
|
|
412
376
|
disconnect(): Promise<void>;
|
|
413
|
-
activateAgent(state: ConnectionState, chainId: number
|
|
377
|
+
activateAgent(state: ConnectionState, chainId: number): Promise<void>;
|
|
414
378
|
/**
|
|
415
379
|
* Apply the organization's agent policy to this user's account.
|
|
416
380
|
*
|
|
@@ -475,7 +439,6 @@ declare class OwneySDK {
|
|
|
475
439
|
private orgAgentConfig;
|
|
476
440
|
private orgAgentConfigPromise;
|
|
477
441
|
private zyfaiRpcUrls?;
|
|
478
|
-
private yieldseekerApiBaseUrl?;
|
|
479
442
|
private routingApiBaseUrl?;
|
|
480
443
|
private referralSource?;
|
|
481
444
|
private cachedSponsoredCallback;
|
|
@@ -548,11 +511,6 @@ declare class OwneySDK {
|
|
|
548
511
|
private applyOrgPolicyTo;
|
|
549
512
|
private ensureAgentsInitialized;
|
|
550
513
|
private createAgent;
|
|
551
|
-
/**
|
|
552
|
-
* Discover the agents actually returned by routing for this organization.
|
|
553
|
-
* Consumers should use this instead of hardcoding a global agent roster.
|
|
554
|
-
*/
|
|
555
|
-
getAvailableAgents(options?: AvailableAgentsOptions): Promise<AvailableAgent[]>;
|
|
556
514
|
/**
|
|
557
515
|
* Activate the user's smart wallet for the specified agents, or all chain-compatible agents if omitted.
|
|
558
516
|
* Deploys the Safe contract and creates a session key if not already set up.
|
|
@@ -563,7 +521,7 @@ declare class OwneySDK {
|
|
|
563
521
|
* If provided, ALL specified agents must support the chainId or the call
|
|
564
522
|
* throws before activating any agent.
|
|
565
523
|
*/
|
|
566
|
-
activateAgent(chainId: number, agentId?: AgentId[]
|
|
524
|
+
activateAgent(chainId: number, agentId?: AgentId[]): Promise<void>;
|
|
567
525
|
/**
|
|
568
526
|
* Activate agents ONE AT A TIME, each followed by its org policy.
|
|
569
527
|
*
|
|
@@ -734,75 +692,7 @@ declare class OwneySDK {
|
|
|
734
692
|
getAllocationApy({ agentId, }?: AllocationApyOptions): Promise<OwneyAllocationApy>;
|
|
735
693
|
}
|
|
736
694
|
|
|
737
|
-
type
|
|
738
|
-
now?: () => Date;
|
|
739
|
-
nonce?: () => string;
|
|
740
|
-
};
|
|
741
|
-
|
|
742
|
-
type YieldseekerFetch = typeof fetch;
|
|
743
|
-
|
|
744
|
-
type YieldseekerTransaction = {
|
|
745
|
-
from: `0x${string}`;
|
|
746
|
-
to: `0x${string}`;
|
|
747
|
-
data: `0x${string}`;
|
|
748
|
-
value: string;
|
|
749
|
-
chainId: number;
|
|
750
|
-
};
|
|
751
|
-
|
|
752
|
-
type YieldseekerAgentOptions = {
|
|
753
|
-
baseUrl?: string;
|
|
754
|
-
fetchFn?: YieldseekerFetch;
|
|
755
|
-
auth?: YieldseekerAuthDependencies;
|
|
756
|
-
/** Test seam for the wallet-submission/receipt boundary. */
|
|
757
|
-
transactionExecutor?: (state: ConnectionState, chainId: number, transaction: YieldseekerTransaction) => Promise<Hex>;
|
|
758
|
-
/** Test seam for Yieldseeker's already-submitted unwind transaction. */
|
|
759
|
-
unwindReceiptWaiter?: (state: ConnectionState, chainId: number, transactionHash: Hex) => Promise<void>;
|
|
760
|
-
};
|
|
761
|
-
declare class YieldseekerAgent implements IAgent {
|
|
762
|
-
readonly id = "yieldseeker";
|
|
763
|
-
readonly balanceComposition: "tokens-plus-positions";
|
|
764
|
-
readonly supportedChainIds: readonly [8453];
|
|
765
|
-
readonly supportedAssets: readonly [{
|
|
766
|
-
readonly chainId: 8453;
|
|
767
|
-
readonly chain: "BASE";
|
|
768
|
-
readonly assets: readonly [{
|
|
769
|
-
readonly symbol: "USDC";
|
|
770
|
-
readonly minDepositAmount: "1";
|
|
771
|
-
}, {
|
|
772
|
-
readonly symbol: "WETH";
|
|
773
|
-
readonly minDepositAmount: "1";
|
|
774
|
-
}];
|
|
775
|
-
}];
|
|
776
|
-
private readonly api;
|
|
777
|
-
private readonly auth;
|
|
778
|
-
private readonly transactionExecutor?;
|
|
779
|
-
private readonly unwindReceiptWaiter?;
|
|
780
|
-
private readonly activated;
|
|
781
|
-
constructor(owneyApiKey: string, options?: YieldseekerAgentOptions);
|
|
782
|
-
disconnect(): Promise<void>;
|
|
783
|
-
activateAgent(state: ConnectionState, chainId: number, asset?: OwneySupportedTokens): Promise<void>;
|
|
784
|
-
deposit(state: ConnectionState, chainId: number, amount: string, asset: OwneySupportedTokens, depositCallback?: DepositCallback): Promise<OwneyDepositResult>;
|
|
785
|
-
withdraw(state: ConnectionState, chainId: number, asset: OwneySupportedTokens, amount?: string): Promise<AgentWithdrawResult>;
|
|
786
|
-
getBalances(state: ConnectionState, chainId: number): Promise<AgentBalance>;
|
|
787
|
-
getEarnings(state: ConnectionState, chainId: number): Promise<AgentEarnings>;
|
|
788
|
-
getAccountApy(state: ConnectionState, chainId: number, days: DailyApyDays, tokenSymbol?: string): Promise<AccountAgentApy>;
|
|
789
|
-
getHistory(state: ConnectionState, chainId: number, options?: HistoryFilters): Promise<OwneyAgentHistory>;
|
|
790
|
-
getUserProfile(state: ConnectionState, chainId: number): Promise<AgentUserProfile>;
|
|
791
|
-
getAgentApy(days: DailyApyDays, options?: AgentApyOptions): Promise<AgentApy>;
|
|
792
|
-
private ensureActivated;
|
|
793
|
-
private walletRequest;
|
|
794
|
-
private mapApiError;
|
|
795
|
-
private submitTransaction;
|
|
796
|
-
private waitForUnwindReceipt;
|
|
797
|
-
private positionMatchesChain;
|
|
798
|
-
private isTransactionHash;
|
|
799
|
-
private assertChain;
|
|
800
|
-
private assertOptionalChain;
|
|
801
|
-
private assertAsset;
|
|
802
|
-
private invalidResponse;
|
|
803
|
-
}
|
|
804
|
-
|
|
805
|
-
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_BALANCE_UNAVAILABLE" | "WITHDRAW_INSUFFICIENT_BALANCE" | "WITHDRAW_ALL_FAILED" | "WITHDRAW_PARTIAL_FAILURE" | "WITHDRAW_FAILED" | "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" | "ALLOCATION_ALL_FAILED" | "VALIDATION_INVALID_DAYS";
|
|
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";
|
|
806
696
|
declare class OwneyError extends Error {
|
|
807
697
|
readonly code: OwneyErrorCode;
|
|
808
698
|
readonly details?: Record<string, unknown>;
|
|
@@ -868,4 +758,4 @@ type OwneySIWXConfig = {
|
|
|
868
758
|
*/
|
|
869
759
|
declare function createOwneySIWX(config: OwneySIWXConfig): SIWXConfig;
|
|
870
760
|
|
|
871
|
-
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
|
|
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 };
|