@owney/sdk 0.2.6 → 0.2.8
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 +76 -6
- package/dist/index.cjs +196 -208
- package/dist/index.d.cts +18 -4
- package/dist/index.d.ts +18 -4
- package/dist/index.js +195 -208
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
|
+
type ZyfaiRpcUrlsConfig = Partial<Record<(typeof SUPPORTED_CHAIN_IDS)[number], string>>;
|
|
1
2
|
interface OwneySDKConfig {
|
|
2
3
|
apiKey: string;
|
|
4
|
+
/**
|
|
5
|
+
* Optional per-chain RPC overrides for Zyfai SDK network calls.
|
|
6
|
+
* Example: { 8453: "https://...", 42161: "https://..." }
|
|
7
|
+
*/
|
|
8
|
+
zyfaiRpcUrls?: ZyfaiRpcUrlsConfig;
|
|
3
9
|
}
|
|
4
10
|
interface ConnectionState {
|
|
5
11
|
provider: any;
|
|
@@ -203,6 +209,7 @@ declare class OwneySDK {
|
|
|
203
209
|
private activeAgents;
|
|
204
210
|
private state;
|
|
205
211
|
private apiKey;
|
|
212
|
+
private zyfaiRpcUrls?;
|
|
206
213
|
private initializingAgentsPromise;
|
|
207
214
|
constructor(config: OwneySDKConfig);
|
|
208
215
|
/**
|
|
@@ -231,6 +238,7 @@ declare class OwneySDK {
|
|
|
231
238
|
private getAgent;
|
|
232
239
|
private getActiveAgents;
|
|
233
240
|
private ensureAgentsInitialized;
|
|
241
|
+
private createAgent;
|
|
234
242
|
/**
|
|
235
243
|
* Activate the user's smart wallet for the specified agents, or all chain-compatible agents if omitted.
|
|
236
244
|
* Deploys the Safe contract and creates a session key if not already set up.
|
|
@@ -334,13 +342,19 @@ declare class OwneySDK {
|
|
|
334
342
|
getAgentAllocation(): Promise<OwneyAgentAllocation>;
|
|
335
343
|
}
|
|
336
344
|
|
|
337
|
-
|
|
345
|
+
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_TOO_SMALL" | "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";
|
|
346
|
+
declare class OwneyError extends Error {
|
|
347
|
+
readonly code: OwneyErrorCode;
|
|
348
|
+
readonly details?: Record<string, unknown>;
|
|
349
|
+
constructor(code: OwneyErrorCode, message: string, details?: Record<string, unknown>);
|
|
350
|
+
}
|
|
351
|
+
declare class AgentNotFoundError extends OwneyError {
|
|
338
352
|
constructor(agentId: string, available: string[]);
|
|
339
353
|
}
|
|
340
|
-
declare class NotConnectedError extends
|
|
354
|
+
declare class NotConnectedError extends OwneyError {
|
|
341
355
|
constructor();
|
|
342
356
|
}
|
|
343
|
-
declare class AgentChainIncompatibleError extends
|
|
357
|
+
declare class AgentChainIncompatibleError extends OwneyError {
|
|
344
358
|
readonly incompatibleAgents: Array<{
|
|
345
359
|
agentId: string;
|
|
346
360
|
supportedChainIds: readonly number[];
|
|
@@ -352,4 +366,4 @@ declare class AgentChainIncompatibleError extends Error {
|
|
|
352
366
|
}>, connectedChainId: number);
|
|
353
367
|
}
|
|
354
368
|
|
|
355
|
-
export { AccountAgentApy, AccountApyOptions, AgentApy, AgentApyDetails, AgentBalance, AgentChainIncompatibleError, AgentEarnings, AgentHistoryEntry, AgentId, AgentNotFoundError, AgentSupportedAssets, AgentUserProfile, AgentWithdrawResult, AgentsApyOptions, Asset, ConnectionState, DailyApyDays, DepositCallback, DepositOptions, HistoryAction, HistoryFilters, HistoryOptions, HistoryTransaction, IAgent, NotConnectedError, OwneyAccountApy, OwneyAgentAllocation, OwneyAgentApy, OwneyAgentHistory, OwneyAgentStatus, OwneyBalances, OwneyDepositResult, OwneyEarnings, OwneyMultiDepositResult, OwneyRouteResponse, OwneySDK, OwneySDKConfig, OwneyToken, OwneyUserProfile, OwneyWithdrawResult, RebalanceLog, WithdrawOptions };
|
|
369
|
+
export { AccountAgentApy, AccountApyOptions, AgentApy, AgentApyDetails, AgentBalance, AgentChainIncompatibleError, AgentEarnings, AgentHistoryEntry, AgentId, AgentNotFoundError, AgentSupportedAssets, AgentUserProfile, AgentWithdrawResult, AgentsApyOptions, Asset, ConnectionState, DailyApyDays, DepositCallback, DepositOptions, HistoryAction, HistoryFilters, HistoryOptions, HistoryTransaction, IAgent, NotConnectedError, OwneyAccountApy, OwneyAgentAllocation, OwneyAgentApy, OwneyAgentHistory, OwneyAgentStatus, OwneyBalances, OwneyDepositResult, OwneyEarnings, OwneyError, OwneyErrorCode, OwneyMultiDepositResult, OwneyRouteResponse, OwneySDK, OwneySDKConfig, OwneyToken, OwneyUserProfile, OwneyWithdrawResult, RebalanceLog, WithdrawOptions };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
|
+
type ZyfaiRpcUrlsConfig = Partial<Record<(typeof SUPPORTED_CHAIN_IDS)[number], string>>;
|
|
1
2
|
interface OwneySDKConfig {
|
|
2
3
|
apiKey: string;
|
|
4
|
+
/**
|
|
5
|
+
* Optional per-chain RPC overrides for Zyfai SDK network calls.
|
|
6
|
+
* Example: { 8453: "https://...", 42161: "https://..." }
|
|
7
|
+
*/
|
|
8
|
+
zyfaiRpcUrls?: ZyfaiRpcUrlsConfig;
|
|
3
9
|
}
|
|
4
10
|
interface ConnectionState {
|
|
5
11
|
provider: any;
|
|
@@ -203,6 +209,7 @@ declare class OwneySDK {
|
|
|
203
209
|
private activeAgents;
|
|
204
210
|
private state;
|
|
205
211
|
private apiKey;
|
|
212
|
+
private zyfaiRpcUrls?;
|
|
206
213
|
private initializingAgentsPromise;
|
|
207
214
|
constructor(config: OwneySDKConfig);
|
|
208
215
|
/**
|
|
@@ -231,6 +238,7 @@ declare class OwneySDK {
|
|
|
231
238
|
private getAgent;
|
|
232
239
|
private getActiveAgents;
|
|
233
240
|
private ensureAgentsInitialized;
|
|
241
|
+
private createAgent;
|
|
234
242
|
/**
|
|
235
243
|
* Activate the user's smart wallet for the specified agents, or all chain-compatible agents if omitted.
|
|
236
244
|
* Deploys the Safe contract and creates a session key if not already set up.
|
|
@@ -334,13 +342,19 @@ declare class OwneySDK {
|
|
|
334
342
|
getAgentAllocation(): Promise<OwneyAgentAllocation>;
|
|
335
343
|
}
|
|
336
344
|
|
|
337
|
-
|
|
345
|
+
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_TOO_SMALL" | "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";
|
|
346
|
+
declare class OwneyError extends Error {
|
|
347
|
+
readonly code: OwneyErrorCode;
|
|
348
|
+
readonly details?: Record<string, unknown>;
|
|
349
|
+
constructor(code: OwneyErrorCode, message: string, details?: Record<string, unknown>);
|
|
350
|
+
}
|
|
351
|
+
declare class AgentNotFoundError extends OwneyError {
|
|
338
352
|
constructor(agentId: string, available: string[]);
|
|
339
353
|
}
|
|
340
|
-
declare class NotConnectedError extends
|
|
354
|
+
declare class NotConnectedError extends OwneyError {
|
|
341
355
|
constructor();
|
|
342
356
|
}
|
|
343
|
-
declare class AgentChainIncompatibleError extends
|
|
357
|
+
declare class AgentChainIncompatibleError extends OwneyError {
|
|
344
358
|
readonly incompatibleAgents: Array<{
|
|
345
359
|
agentId: string;
|
|
346
360
|
supportedChainIds: readonly number[];
|
|
@@ -352,4 +366,4 @@ declare class AgentChainIncompatibleError extends Error {
|
|
|
352
366
|
}>, connectedChainId: number);
|
|
353
367
|
}
|
|
354
368
|
|
|
355
|
-
export { AccountAgentApy, AccountApyOptions, AgentApy, AgentApyDetails, AgentBalance, AgentChainIncompatibleError, AgentEarnings, AgentHistoryEntry, AgentId, AgentNotFoundError, AgentSupportedAssets, AgentUserProfile, AgentWithdrawResult, AgentsApyOptions, Asset, ConnectionState, DailyApyDays, DepositCallback, DepositOptions, HistoryAction, HistoryFilters, HistoryOptions, HistoryTransaction, IAgent, NotConnectedError, OwneyAccountApy, OwneyAgentAllocation, OwneyAgentApy, OwneyAgentHistory, OwneyAgentStatus, OwneyBalances, OwneyDepositResult, OwneyEarnings, OwneyMultiDepositResult, OwneyRouteResponse, OwneySDK, OwneySDKConfig, OwneyToken, OwneyUserProfile, OwneyWithdrawResult, RebalanceLog, WithdrawOptions };
|
|
369
|
+
export { AccountAgentApy, AccountApyOptions, AgentApy, AgentApyDetails, AgentBalance, AgentChainIncompatibleError, AgentEarnings, AgentHistoryEntry, AgentId, AgentNotFoundError, AgentSupportedAssets, AgentUserProfile, AgentWithdrawResult, AgentsApyOptions, Asset, ConnectionState, DailyApyDays, DepositCallback, DepositOptions, HistoryAction, HistoryFilters, HistoryOptions, HistoryTransaction, IAgent, NotConnectedError, OwneyAccountApy, OwneyAgentAllocation, OwneyAgentApy, OwneyAgentHistory, OwneyAgentStatus, OwneyBalances, OwneyDepositResult, OwneyEarnings, OwneyError, OwneyErrorCode, OwneyMultiDepositResult, OwneyRouteResponse, OwneySDK, OwneySDKConfig, OwneyToken, OwneyUserProfile, OwneyWithdrawResult, RebalanceLog, WithdrawOptions };
|