@owney/sdk 0.5.1 → 0.5.2
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 +20 -67
- package/dist/index.cjs +0 -39
- package/dist/index.d.cts +83 -102
- package/dist/index.d.ts +83 -102
- package/dist/index.js +0 -39
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @owney/sdk
|
|
2
2
|
|
|
3
|
-
A TypeScript SDK for interacting with DeFi yield agents. Supports multiple
|
|
3
|
+
A TypeScript SDK for interacting with DeFi yield agents. Supports multiple agents through a unified interface.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
@@ -117,7 +117,7 @@ Activate the user's smart wallet for the specified agents, or all chain-compatib
|
|
|
117
117
|
|
|
118
118
|
```typescript
|
|
119
119
|
// Activate specific agents on Base
|
|
120
|
-
await sdk.activateAgent(8453, ["zyfai"
|
|
120
|
+
await sdk.activateAgent(8453, ["zyfai"]);
|
|
121
121
|
|
|
122
122
|
// Activate all agents that support Arbitrum
|
|
123
123
|
await sdk.activateAgent(42161);
|
|
@@ -159,8 +159,7 @@ const results = await sdk.deposit({
|
|
|
159
159
|
return await transferTokens(smartWallet, amount);
|
|
160
160
|
},
|
|
161
161
|
});
|
|
162
|
-
console.log(results.agentResults.zyfai.amount); // "
|
|
163
|
-
console.log(results.agentResults.sail.amount); // "50000000"
|
|
162
|
+
console.log(results.agentResults.zyfai.amount); // "100000000"
|
|
164
163
|
```
|
|
165
164
|
|
|
166
165
|
### `withdraw(options)`
|
|
@@ -199,15 +198,13 @@ console.log(result.type); // "partial"
|
|
|
199
198
|
console.log(result.amount); // "50000000"
|
|
200
199
|
|
|
201
200
|
// Partial withdrawal split proportionally across all agents
|
|
202
|
-
// e.g. zyfai=$5,
|
|
201
|
+
// e.g. zyfai=$5, amount=$4 -> zyfai withdraws $4
|
|
203
202
|
const split = await sdk.withdraw({ asset: "USDC", amount: "4000000" });
|
|
204
|
-
console.log(split.agentResult.zyfai.amount); // "
|
|
205
|
-
console.log(split.agentResult.sail.amount); // "1000000"
|
|
203
|
+
console.log(split.agentResult.zyfai.amount); // "4000000"
|
|
206
204
|
|
|
207
205
|
// Full withdrawal from all agents
|
|
208
206
|
const results = await sdk.withdraw({ asset: "USDC" });
|
|
209
207
|
console.log(results.agentResult.zyfai.type); // "full"
|
|
210
|
-
console.log(results.agentResult.sail.type); // "full"
|
|
211
208
|
```
|
|
212
209
|
|
|
213
210
|
### `getBalances(agentId?)`
|
|
@@ -216,7 +213,7 @@ Get the user's balances for a specific agent, or aggregated across all agents.
|
|
|
216
213
|
|
|
217
214
|
| Param | Type | Description |
|
|
218
215
|
| --------- | ------------------------------ | ------------------------------------ |
|
|
219
|
-
| `agentId` | `"zyfai"
|
|
216
|
+
| `agentId` | `"zyfai"` (optional) | Agent to query. Omit for all agents. |
|
|
220
217
|
|
|
221
218
|
Returns: `AgentBalance` (single agent) or `OwneyBalances` (all agents)
|
|
222
219
|
|
|
@@ -229,9 +226,8 @@ console.log(balance.tokens); // [{ chain: "BASE", chainId: 8453, asset: "USDC",
|
|
|
229
226
|
|
|
230
227
|
// All agents
|
|
231
228
|
const allBalances = await sdk.getBalances();
|
|
232
|
-
console.log(allBalances.totalBalance); // "
|
|
229
|
+
console.log(allBalances.totalBalance); // "150.25"
|
|
233
230
|
console.log(allBalances.agentBalances.zyfai.totalBalance); // "150.25"
|
|
234
|
-
console.log(allBalances.agentBalances.sail.totalBalance); // "150.25"
|
|
235
231
|
```
|
|
236
232
|
|
|
237
233
|
### `getEarnings(agentId?)`
|
|
@@ -240,7 +236,7 @@ Get the user's on-chain earnings for a specific agent, or aggregated across all
|
|
|
240
236
|
|
|
241
237
|
| Param | Type | Description |
|
|
242
238
|
| --------- | ------------------------------ | ------------------------------------ |
|
|
243
|
-
| `agentId` | `"zyfai"
|
|
239
|
+
| `agentId` | `"zyfai"` (optional) | Agent to query. Omit for all agents. |
|
|
244
240
|
|
|
245
241
|
Returns: `AgentEarnings` (single agent) or `OwneyEarnings` (all agents)
|
|
246
242
|
|
|
@@ -268,7 +264,7 @@ Get the weighted APY for the user's account. When querying all agents, the total
|
|
|
268
264
|
|
|
269
265
|
| Param | Type | Description |
|
|
270
266
|
| --------- | ------------------------------ | ------------------------------------------------ |
|
|
271
|
-
| `agentId` | `"zyfai"
|
|
267
|
+
| `agentId` | `"zyfai"` (optional) | Agent to query. Omit for balance-weighted total. |
|
|
272
268
|
| `days` | `"7D" \| "14D" \| "30D"` | Lookback period |
|
|
273
269
|
|
|
274
270
|
Returns: `AccountAgentApy` (single agent) or `OwneyAccountApy` (all agents)
|
|
@@ -287,7 +283,6 @@ console.log(apy.apyByChainAndAsset?.[8453]?.USDC); // 5.4
|
|
|
287
283
|
const allApy = await sdk.getAccountApy({ days: "30D" });
|
|
288
284
|
console.log(allApy.totalApy); // "5.6"
|
|
289
285
|
console.log(allApy.agentApy.zyfai.weightedApyAfterFee); // 6.0
|
|
290
|
-
console.log(allApy.agentApy.sail.weightedApyAfterFee); // 4.0
|
|
291
286
|
// Per (chain, asset), balance-weighted across all agents.
|
|
292
287
|
// Cells with 0/missing APY for a given agent are excluded from that cell.
|
|
293
288
|
console.log(allApy.apyByChainAndAsset[8453]?.USDC); // 5.3
|
|
@@ -304,7 +299,7 @@ Results are **cursor-paginated**. The first call (no `cursor`) anchors a stable
|
|
|
304
299
|
|
|
305
300
|
| Param | Type | Description |
|
|
306
301
|
| ------------------ | ------------------------------ | -------------------------------------------------------- |
|
|
307
|
-
| `agentId` | `"zyfai"
|
|
302
|
+
| `agentId` | `"zyfai"` (optional) | Agent to query. Omit for all agents. |
|
|
308
303
|
| `filters.fromDate` | `string` (optional) | Start date (`YYYY-MM-DD`) |
|
|
309
304
|
| `filters.toDate` | `string` (optional) | End date (`YYYY-MM-DD`) |
|
|
310
305
|
| `filters.limit` | `number` (optional) | Max entries returned per call. Defaults to `10`. |
|
|
@@ -336,7 +331,7 @@ console.log(history.data[0].rebalanceLog[0].status); // "success"
|
|
|
336
331
|
// All agents (merged and sorted by date)
|
|
337
332
|
const allHistory = await sdk.getHistory();
|
|
338
333
|
console.log(allHistory.hasMore); // true | false
|
|
339
|
-
console.log(allHistory.data[0].agent); // "
|
|
334
|
+
console.log(allHistory.data[0].agent); // "zyfai" (most recent entry)
|
|
340
335
|
console.log(allHistory.data[0].action); // "Rebalance"
|
|
341
336
|
|
|
342
337
|
// Paginate through all history (per-chain, anchored to a single snapshot)
|
|
@@ -351,44 +346,13 @@ do {
|
|
|
351
346
|
} while (cursor);
|
|
352
347
|
```
|
|
353
348
|
|
|
354
|
-
### `pauseAgent(agentId)`
|
|
355
|
-
|
|
356
|
-
Pause an agent's automated operations. The agent will stop rebalancing until resumed.
|
|
357
|
-
|
|
358
|
-
| Param | Type | Description |
|
|
359
|
-
| --------- | ------------------- | -------------- |
|
|
360
|
-
| `agentId` | `"zyfai" \| "sail"` | Agent to pause |
|
|
361
|
-
|
|
362
|
-
Returns: `OwneyAgentStatus`
|
|
363
|
-
|
|
364
|
-
```typescript
|
|
365
|
-
const status = await sdk.pauseAgent("zyfai");
|
|
366
|
-
console.log(status.success); // true
|
|
367
|
-
```
|
|
368
|
-
|
|
369
|
-
### `resumeAgent(agentId)`
|
|
370
|
-
|
|
371
|
-
Resume an agent's automated operations.
|
|
372
|
-
|
|
373
|
-
| Param | Type | Description |
|
|
374
|
-
| --------- | ------------------- | --------------- |
|
|
375
|
-
| `agentId` | `"zyfai" \| "sail"` | Agent to resume |
|
|
376
|
-
|
|
377
|
-
Returns: `OwneyAgentStatus`
|
|
378
|
-
|
|
379
|
-
```typescript
|
|
380
|
-
const status = await sdk.resumeAgent("zyfai");
|
|
381
|
-
console.log(status.success); // true
|
|
382
|
-
console.log(status.protocols); // ["aave", "compound"]
|
|
383
|
-
```
|
|
384
|
-
|
|
385
349
|
### `getUserProfile(agentId?)`
|
|
386
350
|
|
|
387
351
|
Get the user's profile for a specific agent, or all agents.
|
|
388
352
|
|
|
389
353
|
| Param | Type | Description |
|
|
390
354
|
| --------- | ------------------------------ | ------------------------------------ |
|
|
391
|
-
| `agentId` | `"zyfai"
|
|
355
|
+
| `agentId` | `"zyfai"` (optional) | Agent to query. Omit for all agents. |
|
|
392
356
|
|
|
393
357
|
Returns: `AgentUserProfile` (single agent) or `OwneyUserProfile` (all agents)
|
|
394
358
|
|
|
@@ -404,7 +368,6 @@ console.log(profile.protocols); // ["aave", "compound"]
|
|
|
404
368
|
// All agents
|
|
405
369
|
const allProfiles = await sdk.getUserProfile();
|
|
406
370
|
console.log(allProfiles.agentUserProfile.zyfai.smartWallet); // "0x..."
|
|
407
|
-
console.log(allProfiles.agentUserProfile.sail.smartWallet); // "0x..."
|
|
408
371
|
```
|
|
409
372
|
|
|
410
373
|
### `getAgentApy({ agentId?, days, tokenSymbol?, chainId? })`
|
|
@@ -413,14 +376,14 @@ Get the agent's average APY performance over a time period. Does not require a w
|
|
|
413
376
|
|
|
414
377
|
| Param | Type | Description |
|
|
415
378
|
| ------------- | ------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
416
|
-
| `agentId` | `"zyfai"
|
|
379
|
+
| `agentId` | `"zyfai"` (optional) | Agent to query. Omit for all agents. |
|
|
417
380
|
| `days` | `"7D" \| "14D" \| "30D"` | Lookback period |
|
|
418
|
-
| `tokenSymbol` | `string` (optional) | Asset symbol (e.g. `"USDC"
|
|
419
|
-
| `chainId` | `number` (optional) | Chain id. Typically paired with `tokenSymbol` for per-asset+chain APY.
|
|
381
|
+
| `tokenSymbol` | `string` (optional) | Asset symbol (e.g. `"USDC"`). Scopes the upstream request to a specific asset when the agent's backend supports it. |
|
|
382
|
+
| `chainId` | `number` (optional) | Chain id. Typically paired with `tokenSymbol` for per-asset+chain APY. |
|
|
420
383
|
|
|
421
384
|
Returns: `AgentApy` (single agent) or `OwneyAgentApy` (all agents)
|
|
422
385
|
|
|
423
|
-
|
|
386
|
+
The agent populates `detailedApys.apyPerAsset` with a per-chain, per-token
|
|
424
387
|
breakdown when available. `tokenSymbol` / `chainId` only affect whether the
|
|
425
388
|
upstream query is scoped — the breakdown is built from whatever the agent
|
|
426
389
|
returns.
|
|
@@ -434,10 +397,8 @@ console.log(apy.detailedApys?.apyPerAsset[8453]?.USDC); // 8.7
|
|
|
434
397
|
// All agents
|
|
435
398
|
const allApy = await sdk.getAgentApy({ days: "30D" });
|
|
436
399
|
console.log(allApy.agentApy.zyfai.averageApy); // 8.5
|
|
437
|
-
console.log(allApy.agentApy.sail.averageApy); // 6.2
|
|
438
|
-
console.log(allApy.agentApy.sail.detailedApys?.apyPerAsset[42161]?.USDT); // 6.4
|
|
439
400
|
|
|
440
|
-
// Scope the upstream query to USDC on Base
|
|
401
|
+
// Scope the upstream query to USDC on Base
|
|
441
402
|
const usdcBaseApy = await sdk.getAgentApy({
|
|
442
403
|
days: "30D",
|
|
443
404
|
tokenSymbol: "USDC",
|
|
@@ -454,7 +415,7 @@ Returns: `OwneyAgentAllocation`
|
|
|
454
415
|
|
|
455
416
|
```typescript
|
|
456
417
|
const allocation = await sdk.getAgentAllocation();
|
|
457
|
-
console.log(allocation.agentAllocation); // { zyfai:
|
|
418
|
+
console.log(allocation.agentAllocation); // { zyfai: 100 }
|
|
458
419
|
```
|
|
459
420
|
|
|
460
421
|
## Types
|
|
@@ -462,7 +423,7 @@ console.log(allocation.agentAllocation); // { zyfai: 75, sail: 25 }
|
|
|
462
423
|
### Configuration
|
|
463
424
|
|
|
464
425
|
```typescript
|
|
465
|
-
type AgentId = "zyfai"
|
|
426
|
+
type AgentId = "zyfai";
|
|
466
427
|
type Asset = string;
|
|
467
428
|
type DailyApyDays = "7D" | "14D" | "30D";
|
|
468
429
|
type OwneySupportedChainId = 8453 | 42161;
|
|
@@ -639,12 +600,6 @@ interface OwneyAgentHistory {
|
|
|
639
600
|
nextCursor?: string;
|
|
640
601
|
}
|
|
641
602
|
|
|
642
|
-
interface OwneyAgentStatus {
|
|
643
|
-
success: boolean;
|
|
644
|
-
strategy?: string;
|
|
645
|
-
protocols?: string[];
|
|
646
|
-
}
|
|
647
|
-
|
|
648
603
|
interface AgentUserProfile {
|
|
649
604
|
address: string;
|
|
650
605
|
smartWallet: string;
|
|
@@ -738,7 +693,7 @@ type OwneyErrorCode =
|
|
|
738
693
|
| "ASSET_NO_COMPATIBLE_AGENTS" // No agents support the asset on the active chain
|
|
739
694
|
// Deposit
|
|
740
695
|
| "DEPOSIT_AMOUNT_BELOW_MINIMUM" // Amount below an agent's required minimum deposit for the chain+asset
|
|
741
|
-
| "DEPOSIT_CALLBACK_REQUIRED" //
|
|
696
|
+
| "DEPOSIT_CALLBACK_REQUIRED" // Agent requires a depositCallback
|
|
742
697
|
| "DEPOSIT_CALLBACK_INVALID" // depositCallback didn't return a tx hash
|
|
743
698
|
| "DEPOSIT_NO_PERMITTED_TOKENS" // No permitted tokens available for deposit
|
|
744
699
|
// Withdraw
|
|
@@ -750,8 +705,6 @@ type OwneyErrorCode =
|
|
|
750
705
|
// API
|
|
751
706
|
| "API_ROUTING_ERROR" // Routing API returned a non-OK HTTP status
|
|
752
707
|
| "API_ROUTING_FAILED" // Routing API returned { success: false }
|
|
753
|
-
| "API_SAIL_ERROR" // Sail API returned a non-OK HTTP status
|
|
754
|
-
| "API_SAIL_TIMEOUT" // Sail API request timed out
|
|
755
708
|
| "API_NO_AGENTS" // No supported agents returned by routing API
|
|
756
709
|
// Aggregation
|
|
757
710
|
| "BALANCE_ALL_FAILED" // All agents failed to return balances
|
package/dist/index.cjs
CHANGED
|
@@ -305,13 +305,6 @@ function mapEntries(rawEntries, chainId) {
|
|
|
305
305
|
};
|
|
306
306
|
});
|
|
307
307
|
}
|
|
308
|
-
function mapAgentStatus(raw) {
|
|
309
|
-
return {
|
|
310
|
-
success: raw.success,
|
|
311
|
-
strategy: raw.strategy,
|
|
312
|
-
protocols: raw.protocols
|
|
313
|
-
};
|
|
314
|
-
}
|
|
315
308
|
function mapUserProfile(raw, userAddress) {
|
|
316
309
|
return {
|
|
317
310
|
address: userAddress,
|
|
@@ -729,17 +722,6 @@ var ZyfaiAgent = class {
|
|
|
729
722
|
nextCursor
|
|
730
723
|
};
|
|
731
724
|
}
|
|
732
|
-
// --- IAgent: Agent control ---
|
|
733
|
-
async pause(state, chainId) {
|
|
734
|
-
await this.connectAuth(state, chainId);
|
|
735
|
-
const raw = await this.sdk.pauseAgent();
|
|
736
|
-
return mapAgentStatus(raw);
|
|
737
|
-
}
|
|
738
|
-
async resume(state, chainId) {
|
|
739
|
-
await this.connectAuth(state, chainId);
|
|
740
|
-
const raw = await this.sdk.resumeAgent();
|
|
741
|
-
return mapAgentStatus(raw);
|
|
742
|
-
}
|
|
743
725
|
async getUserProfile(state, chainId) {
|
|
744
726
|
await this.connectAuth(state, chainId);
|
|
745
727
|
const validChainId = isValidChainId(chainId);
|
|
@@ -1894,27 +1876,6 @@ var OwneySDK = class {
|
|
|
1894
1876
|
nextCursor: hasMore ? encodeMultiAgentCursor(nextCursorMap) : void 0
|
|
1895
1877
|
};
|
|
1896
1878
|
}
|
|
1897
|
-
// --- Agent control ---
|
|
1898
|
-
/**
|
|
1899
|
-
* Pause an agent's automated operations. The agent will stop rebalancing until resumed.
|
|
1900
|
-
* @param agentId - The agent to pause (e.g. "zyfai")
|
|
1901
|
-
* @returns OwneyAgentStatus with success flag
|
|
1902
|
-
*/
|
|
1903
|
-
async pauseAgent(agentId) {
|
|
1904
|
-
const state = this.requireState();
|
|
1905
|
-
const chainId = this.requireChainId();
|
|
1906
|
-
return this.getAgent(agentId).pause(state, chainId);
|
|
1907
|
-
}
|
|
1908
|
-
/**
|
|
1909
|
-
* Resume an agent's automated operations.
|
|
1910
|
-
* @param agentId - The agent to resume (e.g. "zyfai")
|
|
1911
|
-
* @returns OwneyAgentStatus with success flag
|
|
1912
|
-
*/
|
|
1913
|
-
async resumeAgent(agentId) {
|
|
1914
|
-
const state = this.requireState();
|
|
1915
|
-
const chainId = this.requireChainId();
|
|
1916
|
-
return this.getAgent(agentId).resume(state, chainId);
|
|
1917
|
-
}
|
|
1918
1879
|
/**
|
|
1919
1880
|
* Get the user's profile for a specific agent, or all agents.
|
|
1920
1881
|
* @param agentId - Optional. Agent to query. Omit for all agents.
|
package/dist/index.d.cts
CHANGED
|
@@ -21,90 +21,6 @@ type OwneySupportedChainId = (typeof SUPPORTED_CHAIN_IDS)[number];
|
|
|
21
21
|
type OwneySupportedChains = (typeof SUPPORTED_CHAINS)[number];
|
|
22
22
|
type OwneySupportedTokens = (typeof SUPPORTED_TOKENS)[number];
|
|
23
23
|
|
|
24
|
-
type DepositCallback = (smartWalletAddress: string, chainId: number, amount: string) => Promise<`0x${string}`> | `0x${string}`;
|
|
25
|
-
interface IAgent {
|
|
26
|
-
readonly id: string;
|
|
27
|
-
readonly supportedChainIds: readonly OwneySupportedChainId[];
|
|
28
|
-
readonly supportedAssets: readonly AgentSupportedAssets[];
|
|
29
|
-
disconnect(): Promise<void>;
|
|
30
|
-
activateAgent(state: ConnectionState, chainId: number): Promise<void>;
|
|
31
|
-
deposit(state: ConnectionState, chainId: number, amount: string, depositCallback?: DepositCallback): Promise<OwneyDepositResult>;
|
|
32
|
-
withdraw(state: ConnectionState, chainId: number, token: OwneySupportedTokens, amount?: string): Promise<AgentWithdrawResult>;
|
|
33
|
-
getBalances(state: ConnectionState, chainId: number): Promise<AgentBalance>;
|
|
34
|
-
getEarnings(state: ConnectionState, chainId: number): Promise<AgentEarnings>;
|
|
35
|
-
getAccountApy(state: ConnectionState, chainId: number, days: DailyApyDays): Promise<AccountAgentApy>;
|
|
36
|
-
getHistory(state: ConnectionState, chainId: number, options?: HistoryFilters): Promise<OwneyAgentHistory>;
|
|
37
|
-
pause(state: ConnectionState, chainId: number): Promise<OwneyAgentStatus>;
|
|
38
|
-
resume(state: ConnectionState, chainId: number): Promise<OwneyAgentStatus>;
|
|
39
|
-
getUserProfile(state: ConnectionState, chainId: number): Promise<AgentUserProfile>;
|
|
40
|
-
getAgentApy(days: DailyApyDays, options?: AgentApyOptions): Promise<AgentApy>;
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Optional filters for per-agent APY lookups.
|
|
44
|
-
* - `tokenSymbol` / `chainId` scope the APY to a specific asset+chain when
|
|
45
|
-
* the underlying provider supports it (Zyfai). Agents whose backends do
|
|
46
|
-
* not yet support per-asset APY will ignore these options.
|
|
47
|
-
*/
|
|
48
|
-
type AgentApyOptions = {
|
|
49
|
-
tokenSymbol?: string;
|
|
50
|
-
chainId?: number;
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
type AgentId = "zyfai" | "sail";
|
|
54
|
-
type Asset = string;
|
|
55
|
-
type AgentSupportedAsset = {
|
|
56
|
-
readonly symbol: string;
|
|
57
|
-
readonly minDepositAmount: string;
|
|
58
|
-
};
|
|
59
|
-
type AgentSupportedAssets = {
|
|
60
|
-
readonly chainId: number;
|
|
61
|
-
readonly chain?: string;
|
|
62
|
-
readonly assets: readonly AgentSupportedAsset[];
|
|
63
|
-
};
|
|
64
|
-
type DailyApyDays = "7D" | "14D" | "30D";
|
|
65
|
-
type HistoryFilters = {
|
|
66
|
-
fromDate?: string;
|
|
67
|
-
toDate?: string;
|
|
68
|
-
/** Max entries returned per call. Defaults to 10. */
|
|
69
|
-
limit?: number;
|
|
70
|
-
/** Opaque cursor returned by a previous getHistory call. */
|
|
71
|
-
cursor?: string;
|
|
72
|
-
};
|
|
73
|
-
type HistoryOptions = {
|
|
74
|
-
agentId?: AgentId;
|
|
75
|
-
filters?: HistoryFilters;
|
|
76
|
-
};
|
|
77
|
-
type WithdrawOptions = {
|
|
78
|
-
asset: Asset;
|
|
79
|
-
amount?: string;
|
|
80
|
-
agentId?: AgentId;
|
|
81
|
-
};
|
|
82
|
-
type AccountApyOptions = {
|
|
83
|
-
agentId?: AgentId;
|
|
84
|
-
days: DailyApyDays;
|
|
85
|
-
};
|
|
86
|
-
type AgentsApyOptions = {
|
|
87
|
-
agentId?: AgentId;
|
|
88
|
-
days: DailyApyDays;
|
|
89
|
-
/**
|
|
90
|
-
* Optional asset symbol (e.g. "USDC", "WETH") to scope the APY to a
|
|
91
|
-
* specific asset+chain. Ignored by agents whose backends do not yet
|
|
92
|
-
* support per-asset APY.
|
|
93
|
-
*/
|
|
94
|
-
tokenSymbol?: string;
|
|
95
|
-
/**
|
|
96
|
-
* Optional chain id for per-asset APY lookups. Typically paired with
|
|
97
|
-
* `tokenSymbol`.
|
|
98
|
-
*/
|
|
99
|
-
chainId?: number;
|
|
100
|
-
};
|
|
101
|
-
type DepositOptions = {
|
|
102
|
-
amount: string;
|
|
103
|
-
asset: Asset;
|
|
104
|
-
depositCallback?: DepositCallback;
|
|
105
|
-
agentId?: AgentId;
|
|
106
|
-
};
|
|
107
|
-
|
|
108
24
|
interface OwneyDepositResult {
|
|
109
25
|
txHash: string;
|
|
110
26
|
smartWallet: string;
|
|
@@ -214,11 +130,6 @@ interface OwneyAgentHistory {
|
|
|
214
130
|
/** Opaque cursor for the next page. Present iff `hasMore === true`. */
|
|
215
131
|
nextCursor?: string;
|
|
216
132
|
}
|
|
217
|
-
interface OwneyAgentStatus {
|
|
218
|
-
success: boolean;
|
|
219
|
-
strategy?: string;
|
|
220
|
-
protocols?: string[];
|
|
221
|
-
}
|
|
222
133
|
interface AgentUserProfile {
|
|
223
134
|
address: string;
|
|
224
135
|
smartWallet: string;
|
|
@@ -246,6 +157,88 @@ interface OwneyAgentAllocation {
|
|
|
246
157
|
agentPositions: Record<AgentId, OwneyPosition[]>;
|
|
247
158
|
}
|
|
248
159
|
|
|
160
|
+
type DepositCallback = (smartWalletAddress: string, chainId: number, amount: string) => Promise<`0x${string}`> | `0x${string}`;
|
|
161
|
+
interface IAgent {
|
|
162
|
+
readonly id: string;
|
|
163
|
+
readonly supportedChainIds: readonly OwneySupportedChainId[];
|
|
164
|
+
readonly supportedAssets: readonly AgentSupportedAssets[];
|
|
165
|
+
disconnect(): Promise<void>;
|
|
166
|
+
activateAgent(state: ConnectionState, chainId: number): Promise<void>;
|
|
167
|
+
deposit(state: ConnectionState, chainId: number, amount: string, depositCallback?: DepositCallback): Promise<OwneyDepositResult>;
|
|
168
|
+
withdraw(state: ConnectionState, chainId: number, token: OwneySupportedTokens, amount?: string): Promise<AgentWithdrawResult>;
|
|
169
|
+
getBalances(state: ConnectionState, chainId: number): Promise<AgentBalance>;
|
|
170
|
+
getEarnings(state: ConnectionState, chainId: number): Promise<AgentEarnings>;
|
|
171
|
+
getAccountApy(state: ConnectionState, chainId: number, days: DailyApyDays): Promise<AccountAgentApy>;
|
|
172
|
+
getHistory(state: ConnectionState, chainId: number, options?: HistoryFilters): Promise<OwneyAgentHistory>;
|
|
173
|
+
getUserProfile(state: ConnectionState, chainId: number): Promise<AgentUserProfile>;
|
|
174
|
+
getAgentApy(days: DailyApyDays, options?: AgentApyOptions): Promise<AgentApy>;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Optional filters for per-agent APY lookups.
|
|
178
|
+
* - `tokenSymbol` / `chainId` scope the APY to a specific asset+chain when
|
|
179
|
+
* the underlying provider supports it (Zyfai). Agents whose backends do
|
|
180
|
+
* not yet support per-asset APY will ignore these options.
|
|
181
|
+
*/
|
|
182
|
+
type AgentApyOptions = {
|
|
183
|
+
tokenSymbol?: string;
|
|
184
|
+
chainId?: number;
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
type AgentId = "zyfai" | "sail";
|
|
188
|
+
type Asset = string;
|
|
189
|
+
type AgentSupportedAsset = {
|
|
190
|
+
readonly symbol: string;
|
|
191
|
+
readonly minDepositAmount: string;
|
|
192
|
+
};
|
|
193
|
+
type AgentSupportedAssets = {
|
|
194
|
+
readonly chainId: number;
|
|
195
|
+
readonly chain?: string;
|
|
196
|
+
readonly assets: readonly AgentSupportedAsset[];
|
|
197
|
+
};
|
|
198
|
+
type DailyApyDays = "7D" | "14D" | "30D";
|
|
199
|
+
type HistoryFilters = {
|
|
200
|
+
fromDate?: string;
|
|
201
|
+
toDate?: string;
|
|
202
|
+
/** Max entries returned per call. Defaults to 10. */
|
|
203
|
+
limit?: number;
|
|
204
|
+
/** Opaque cursor returned by a previous getHistory call. */
|
|
205
|
+
cursor?: string;
|
|
206
|
+
};
|
|
207
|
+
type HistoryOptions = {
|
|
208
|
+
agentId?: AgentId;
|
|
209
|
+
filters?: HistoryFilters;
|
|
210
|
+
};
|
|
211
|
+
type WithdrawOptions = {
|
|
212
|
+
asset: Asset;
|
|
213
|
+
amount?: string;
|
|
214
|
+
agentId?: AgentId;
|
|
215
|
+
};
|
|
216
|
+
type AccountApyOptions = {
|
|
217
|
+
agentId?: AgentId;
|
|
218
|
+
days: DailyApyDays;
|
|
219
|
+
};
|
|
220
|
+
type AgentsApyOptions = {
|
|
221
|
+
agentId?: AgentId;
|
|
222
|
+
days: DailyApyDays;
|
|
223
|
+
/**
|
|
224
|
+
* Optional asset symbol (e.g. "USDC", "WETH") to scope the APY to a
|
|
225
|
+
* specific asset+chain. Ignored by agents whose backends do not yet
|
|
226
|
+
* support per-asset APY.
|
|
227
|
+
*/
|
|
228
|
+
tokenSymbol?: string;
|
|
229
|
+
/**
|
|
230
|
+
* Optional chain id for per-asset APY lookups. Typically paired with
|
|
231
|
+
* `tokenSymbol`.
|
|
232
|
+
*/
|
|
233
|
+
chainId?: number;
|
|
234
|
+
};
|
|
235
|
+
type DepositOptions = {
|
|
236
|
+
amount: string;
|
|
237
|
+
asset: Asset;
|
|
238
|
+
depositCallback?: DepositCallback;
|
|
239
|
+
agentId?: AgentId;
|
|
240
|
+
};
|
|
241
|
+
|
|
249
242
|
declare class OwneySDK {
|
|
250
243
|
private agents;
|
|
251
244
|
private activeAgents;
|
|
@@ -382,18 +375,6 @@ declare class OwneySDK {
|
|
|
382
375
|
* @returns {OwneyAgentHistory} `data` (up to `limit` entries), `hasMore`, `nextCursor`.
|
|
383
376
|
*/
|
|
384
377
|
getHistory(params?: HistoryOptions): Promise<OwneyAgentHistory>;
|
|
385
|
-
/**
|
|
386
|
-
* Pause an agent's automated operations. The agent will stop rebalancing until resumed.
|
|
387
|
-
* @param agentId - The agent to pause (e.g. "zyfai")
|
|
388
|
-
* @returns OwneyAgentStatus with success flag
|
|
389
|
-
*/
|
|
390
|
-
pauseAgent(agentId: AgentId): Promise<OwneyAgentStatus>;
|
|
391
|
-
/**
|
|
392
|
-
* Resume an agent's automated operations.
|
|
393
|
-
* @param agentId - The agent to resume (e.g. "zyfai")
|
|
394
|
-
* @returns OwneyAgentStatus with success flag
|
|
395
|
-
*/
|
|
396
|
-
resumeAgent(agentId: AgentId): Promise<OwneyAgentStatus>;
|
|
397
378
|
/**
|
|
398
379
|
* Get the user's profile for a specific agent, or all agents.
|
|
399
380
|
* @param agentId - Optional. Agent to query. Omit for all agents.
|
|
@@ -463,4 +444,4 @@ type OwneySIWXConfig = {
|
|
|
463
444
|
*/
|
|
464
445
|
declare function createOwneySIWX(config: OwneySIWXConfig): SIWXConfig;
|
|
465
446
|
|
|
466
|
-
export { AccountAgentApy, AccountApyOptions, AgentApy, AgentApyDetails, AgentBalance, AgentChainIncompatibleError, AgentEarnings, AgentHistoryEntry, AgentHistoryPosition, AgentId, AgentNotFoundError, AgentSupportedAsset, AgentSupportedAssets, AgentUserProfile, AgentWithdrawResult, AgentsApyOptions, ApyByChainAndAsset, Asset, ConnectionState, DailyApyDays, DepositCallback, DepositOptions, HistoryAction, HistoryFilters, HistoryOptions, HistoryTransaction, IAgent, InvalidHistoryCursorError, NotConnectedError, OwneyAccountApy, OwneyAgentAllocation, OwneyAgentApy, OwneyAgentHistory,
|
|
447
|
+
export { AccountAgentApy, AccountApyOptions, AgentApy, AgentApyDetails, AgentBalance, AgentChainIncompatibleError, AgentEarnings, AgentHistoryEntry, AgentHistoryPosition, AgentId, AgentNotFoundError, AgentSupportedAsset, AgentSupportedAssets, AgentUserProfile, AgentWithdrawResult, AgentsApyOptions, ApyByChainAndAsset, Asset, ConnectionState, DailyApyDays, DepositCallback, DepositOptions, HistoryAction, HistoryFilters, HistoryOptions, HistoryTransaction, IAgent, InvalidHistoryCursorError, NotConnectedError, OwneyAccountApy, OwneyAgentAllocation, OwneyAgentApy, OwneyAgentHistory, OwneyBalances, OwneyDepositResult, OwneyEarnings, OwneyError, OwneyErrorCode, OwneyMultiDepositResult, OwneyPosition, OwneySDK, OwneySDKConfig, OwneySIWXConfig, OwneySupportedChainId, OwneySupportedChains, OwneySupportedTokens, OwneyToken, OwneyUserProfile, OwneyWithdrawResult, RebalanceLog, WithdrawOptions, createOwneySIWX };
|
package/dist/index.d.ts
CHANGED
|
@@ -21,90 +21,6 @@ type OwneySupportedChainId = (typeof SUPPORTED_CHAIN_IDS)[number];
|
|
|
21
21
|
type OwneySupportedChains = (typeof SUPPORTED_CHAINS)[number];
|
|
22
22
|
type OwneySupportedTokens = (typeof SUPPORTED_TOKENS)[number];
|
|
23
23
|
|
|
24
|
-
type DepositCallback = (smartWalletAddress: string, chainId: number, amount: string) => Promise<`0x${string}`> | `0x${string}`;
|
|
25
|
-
interface IAgent {
|
|
26
|
-
readonly id: string;
|
|
27
|
-
readonly supportedChainIds: readonly OwneySupportedChainId[];
|
|
28
|
-
readonly supportedAssets: readonly AgentSupportedAssets[];
|
|
29
|
-
disconnect(): Promise<void>;
|
|
30
|
-
activateAgent(state: ConnectionState, chainId: number): Promise<void>;
|
|
31
|
-
deposit(state: ConnectionState, chainId: number, amount: string, depositCallback?: DepositCallback): Promise<OwneyDepositResult>;
|
|
32
|
-
withdraw(state: ConnectionState, chainId: number, token: OwneySupportedTokens, amount?: string): Promise<AgentWithdrawResult>;
|
|
33
|
-
getBalances(state: ConnectionState, chainId: number): Promise<AgentBalance>;
|
|
34
|
-
getEarnings(state: ConnectionState, chainId: number): Promise<AgentEarnings>;
|
|
35
|
-
getAccountApy(state: ConnectionState, chainId: number, days: DailyApyDays): Promise<AccountAgentApy>;
|
|
36
|
-
getHistory(state: ConnectionState, chainId: number, options?: HistoryFilters): Promise<OwneyAgentHistory>;
|
|
37
|
-
pause(state: ConnectionState, chainId: number): Promise<OwneyAgentStatus>;
|
|
38
|
-
resume(state: ConnectionState, chainId: number): Promise<OwneyAgentStatus>;
|
|
39
|
-
getUserProfile(state: ConnectionState, chainId: number): Promise<AgentUserProfile>;
|
|
40
|
-
getAgentApy(days: DailyApyDays, options?: AgentApyOptions): Promise<AgentApy>;
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Optional filters for per-agent APY lookups.
|
|
44
|
-
* - `tokenSymbol` / `chainId` scope the APY to a specific asset+chain when
|
|
45
|
-
* the underlying provider supports it (Zyfai). Agents whose backends do
|
|
46
|
-
* not yet support per-asset APY will ignore these options.
|
|
47
|
-
*/
|
|
48
|
-
type AgentApyOptions = {
|
|
49
|
-
tokenSymbol?: string;
|
|
50
|
-
chainId?: number;
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
type AgentId = "zyfai" | "sail";
|
|
54
|
-
type Asset = string;
|
|
55
|
-
type AgentSupportedAsset = {
|
|
56
|
-
readonly symbol: string;
|
|
57
|
-
readonly minDepositAmount: string;
|
|
58
|
-
};
|
|
59
|
-
type AgentSupportedAssets = {
|
|
60
|
-
readonly chainId: number;
|
|
61
|
-
readonly chain?: string;
|
|
62
|
-
readonly assets: readonly AgentSupportedAsset[];
|
|
63
|
-
};
|
|
64
|
-
type DailyApyDays = "7D" | "14D" | "30D";
|
|
65
|
-
type HistoryFilters = {
|
|
66
|
-
fromDate?: string;
|
|
67
|
-
toDate?: string;
|
|
68
|
-
/** Max entries returned per call. Defaults to 10. */
|
|
69
|
-
limit?: number;
|
|
70
|
-
/** Opaque cursor returned by a previous getHistory call. */
|
|
71
|
-
cursor?: string;
|
|
72
|
-
};
|
|
73
|
-
type HistoryOptions = {
|
|
74
|
-
agentId?: AgentId;
|
|
75
|
-
filters?: HistoryFilters;
|
|
76
|
-
};
|
|
77
|
-
type WithdrawOptions = {
|
|
78
|
-
asset: Asset;
|
|
79
|
-
amount?: string;
|
|
80
|
-
agentId?: AgentId;
|
|
81
|
-
};
|
|
82
|
-
type AccountApyOptions = {
|
|
83
|
-
agentId?: AgentId;
|
|
84
|
-
days: DailyApyDays;
|
|
85
|
-
};
|
|
86
|
-
type AgentsApyOptions = {
|
|
87
|
-
agentId?: AgentId;
|
|
88
|
-
days: DailyApyDays;
|
|
89
|
-
/**
|
|
90
|
-
* Optional asset symbol (e.g. "USDC", "WETH") to scope the APY to a
|
|
91
|
-
* specific asset+chain. Ignored by agents whose backends do not yet
|
|
92
|
-
* support per-asset APY.
|
|
93
|
-
*/
|
|
94
|
-
tokenSymbol?: string;
|
|
95
|
-
/**
|
|
96
|
-
* Optional chain id for per-asset APY lookups. Typically paired with
|
|
97
|
-
* `tokenSymbol`.
|
|
98
|
-
*/
|
|
99
|
-
chainId?: number;
|
|
100
|
-
};
|
|
101
|
-
type DepositOptions = {
|
|
102
|
-
amount: string;
|
|
103
|
-
asset: Asset;
|
|
104
|
-
depositCallback?: DepositCallback;
|
|
105
|
-
agentId?: AgentId;
|
|
106
|
-
};
|
|
107
|
-
|
|
108
24
|
interface OwneyDepositResult {
|
|
109
25
|
txHash: string;
|
|
110
26
|
smartWallet: string;
|
|
@@ -214,11 +130,6 @@ interface OwneyAgentHistory {
|
|
|
214
130
|
/** Opaque cursor for the next page. Present iff `hasMore === true`. */
|
|
215
131
|
nextCursor?: string;
|
|
216
132
|
}
|
|
217
|
-
interface OwneyAgentStatus {
|
|
218
|
-
success: boolean;
|
|
219
|
-
strategy?: string;
|
|
220
|
-
protocols?: string[];
|
|
221
|
-
}
|
|
222
133
|
interface AgentUserProfile {
|
|
223
134
|
address: string;
|
|
224
135
|
smartWallet: string;
|
|
@@ -246,6 +157,88 @@ interface OwneyAgentAllocation {
|
|
|
246
157
|
agentPositions: Record<AgentId, OwneyPosition[]>;
|
|
247
158
|
}
|
|
248
159
|
|
|
160
|
+
type DepositCallback = (smartWalletAddress: string, chainId: number, amount: string) => Promise<`0x${string}`> | `0x${string}`;
|
|
161
|
+
interface IAgent {
|
|
162
|
+
readonly id: string;
|
|
163
|
+
readonly supportedChainIds: readonly OwneySupportedChainId[];
|
|
164
|
+
readonly supportedAssets: readonly AgentSupportedAssets[];
|
|
165
|
+
disconnect(): Promise<void>;
|
|
166
|
+
activateAgent(state: ConnectionState, chainId: number): Promise<void>;
|
|
167
|
+
deposit(state: ConnectionState, chainId: number, amount: string, depositCallback?: DepositCallback): Promise<OwneyDepositResult>;
|
|
168
|
+
withdraw(state: ConnectionState, chainId: number, token: OwneySupportedTokens, amount?: string): Promise<AgentWithdrawResult>;
|
|
169
|
+
getBalances(state: ConnectionState, chainId: number): Promise<AgentBalance>;
|
|
170
|
+
getEarnings(state: ConnectionState, chainId: number): Promise<AgentEarnings>;
|
|
171
|
+
getAccountApy(state: ConnectionState, chainId: number, days: DailyApyDays): Promise<AccountAgentApy>;
|
|
172
|
+
getHistory(state: ConnectionState, chainId: number, options?: HistoryFilters): Promise<OwneyAgentHistory>;
|
|
173
|
+
getUserProfile(state: ConnectionState, chainId: number): Promise<AgentUserProfile>;
|
|
174
|
+
getAgentApy(days: DailyApyDays, options?: AgentApyOptions): Promise<AgentApy>;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Optional filters for per-agent APY lookups.
|
|
178
|
+
* - `tokenSymbol` / `chainId` scope the APY to a specific asset+chain when
|
|
179
|
+
* the underlying provider supports it (Zyfai). Agents whose backends do
|
|
180
|
+
* not yet support per-asset APY will ignore these options.
|
|
181
|
+
*/
|
|
182
|
+
type AgentApyOptions = {
|
|
183
|
+
tokenSymbol?: string;
|
|
184
|
+
chainId?: number;
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
type AgentId = "zyfai" | "sail";
|
|
188
|
+
type Asset = string;
|
|
189
|
+
type AgentSupportedAsset = {
|
|
190
|
+
readonly symbol: string;
|
|
191
|
+
readonly minDepositAmount: string;
|
|
192
|
+
};
|
|
193
|
+
type AgentSupportedAssets = {
|
|
194
|
+
readonly chainId: number;
|
|
195
|
+
readonly chain?: string;
|
|
196
|
+
readonly assets: readonly AgentSupportedAsset[];
|
|
197
|
+
};
|
|
198
|
+
type DailyApyDays = "7D" | "14D" | "30D";
|
|
199
|
+
type HistoryFilters = {
|
|
200
|
+
fromDate?: string;
|
|
201
|
+
toDate?: string;
|
|
202
|
+
/** Max entries returned per call. Defaults to 10. */
|
|
203
|
+
limit?: number;
|
|
204
|
+
/** Opaque cursor returned by a previous getHistory call. */
|
|
205
|
+
cursor?: string;
|
|
206
|
+
};
|
|
207
|
+
type HistoryOptions = {
|
|
208
|
+
agentId?: AgentId;
|
|
209
|
+
filters?: HistoryFilters;
|
|
210
|
+
};
|
|
211
|
+
type WithdrawOptions = {
|
|
212
|
+
asset: Asset;
|
|
213
|
+
amount?: string;
|
|
214
|
+
agentId?: AgentId;
|
|
215
|
+
};
|
|
216
|
+
type AccountApyOptions = {
|
|
217
|
+
agentId?: AgentId;
|
|
218
|
+
days: DailyApyDays;
|
|
219
|
+
};
|
|
220
|
+
type AgentsApyOptions = {
|
|
221
|
+
agentId?: AgentId;
|
|
222
|
+
days: DailyApyDays;
|
|
223
|
+
/**
|
|
224
|
+
* Optional asset symbol (e.g. "USDC", "WETH") to scope the APY to a
|
|
225
|
+
* specific asset+chain. Ignored by agents whose backends do not yet
|
|
226
|
+
* support per-asset APY.
|
|
227
|
+
*/
|
|
228
|
+
tokenSymbol?: string;
|
|
229
|
+
/**
|
|
230
|
+
* Optional chain id for per-asset APY lookups. Typically paired with
|
|
231
|
+
* `tokenSymbol`.
|
|
232
|
+
*/
|
|
233
|
+
chainId?: number;
|
|
234
|
+
};
|
|
235
|
+
type DepositOptions = {
|
|
236
|
+
amount: string;
|
|
237
|
+
asset: Asset;
|
|
238
|
+
depositCallback?: DepositCallback;
|
|
239
|
+
agentId?: AgentId;
|
|
240
|
+
};
|
|
241
|
+
|
|
249
242
|
declare class OwneySDK {
|
|
250
243
|
private agents;
|
|
251
244
|
private activeAgents;
|
|
@@ -382,18 +375,6 @@ declare class OwneySDK {
|
|
|
382
375
|
* @returns {OwneyAgentHistory} `data` (up to `limit` entries), `hasMore`, `nextCursor`.
|
|
383
376
|
*/
|
|
384
377
|
getHistory(params?: HistoryOptions): Promise<OwneyAgentHistory>;
|
|
385
|
-
/**
|
|
386
|
-
* Pause an agent's automated operations. The agent will stop rebalancing until resumed.
|
|
387
|
-
* @param agentId - The agent to pause (e.g. "zyfai")
|
|
388
|
-
* @returns OwneyAgentStatus with success flag
|
|
389
|
-
*/
|
|
390
|
-
pauseAgent(agentId: AgentId): Promise<OwneyAgentStatus>;
|
|
391
|
-
/**
|
|
392
|
-
* Resume an agent's automated operations.
|
|
393
|
-
* @param agentId - The agent to resume (e.g. "zyfai")
|
|
394
|
-
* @returns OwneyAgentStatus with success flag
|
|
395
|
-
*/
|
|
396
|
-
resumeAgent(agentId: AgentId): Promise<OwneyAgentStatus>;
|
|
397
378
|
/**
|
|
398
379
|
* Get the user's profile for a specific agent, or all agents.
|
|
399
380
|
* @param agentId - Optional. Agent to query. Omit for all agents.
|
|
@@ -463,4 +444,4 @@ type OwneySIWXConfig = {
|
|
|
463
444
|
*/
|
|
464
445
|
declare function createOwneySIWX(config: OwneySIWXConfig): SIWXConfig;
|
|
465
446
|
|
|
466
|
-
export { AccountAgentApy, AccountApyOptions, AgentApy, AgentApyDetails, AgentBalance, AgentChainIncompatibleError, AgentEarnings, AgentHistoryEntry, AgentHistoryPosition, AgentId, AgentNotFoundError, AgentSupportedAsset, AgentSupportedAssets, AgentUserProfile, AgentWithdrawResult, AgentsApyOptions, ApyByChainAndAsset, Asset, ConnectionState, DailyApyDays, DepositCallback, DepositOptions, HistoryAction, HistoryFilters, HistoryOptions, HistoryTransaction, IAgent, InvalidHistoryCursorError, NotConnectedError, OwneyAccountApy, OwneyAgentAllocation, OwneyAgentApy, OwneyAgentHistory,
|
|
447
|
+
export { AccountAgentApy, AccountApyOptions, AgentApy, AgentApyDetails, AgentBalance, AgentChainIncompatibleError, AgentEarnings, AgentHistoryEntry, AgentHistoryPosition, AgentId, AgentNotFoundError, AgentSupportedAsset, AgentSupportedAssets, AgentUserProfile, AgentWithdrawResult, AgentsApyOptions, ApyByChainAndAsset, Asset, ConnectionState, DailyApyDays, DepositCallback, DepositOptions, HistoryAction, HistoryFilters, HistoryOptions, HistoryTransaction, IAgent, InvalidHistoryCursorError, NotConnectedError, OwneyAccountApy, OwneyAgentAllocation, OwneyAgentApy, OwneyAgentHistory, OwneyBalances, OwneyDepositResult, OwneyEarnings, OwneyError, OwneyErrorCode, OwneyMultiDepositResult, OwneyPosition, OwneySDK, OwneySDKConfig, OwneySIWXConfig, OwneySupportedChainId, OwneySupportedChains, OwneySupportedTokens, OwneyToken, OwneyUserProfile, OwneyWithdrawResult, RebalanceLog, WithdrawOptions, createOwneySIWX };
|
package/dist/index.js
CHANGED
|
@@ -273,13 +273,6 @@ function mapEntries(rawEntries, chainId) {
|
|
|
273
273
|
};
|
|
274
274
|
});
|
|
275
275
|
}
|
|
276
|
-
function mapAgentStatus(raw) {
|
|
277
|
-
return {
|
|
278
|
-
success: raw.success,
|
|
279
|
-
strategy: raw.strategy,
|
|
280
|
-
protocols: raw.protocols
|
|
281
|
-
};
|
|
282
|
-
}
|
|
283
276
|
function mapUserProfile(raw, userAddress) {
|
|
284
277
|
return {
|
|
285
278
|
address: userAddress,
|
|
@@ -697,17 +690,6 @@ var ZyfaiAgent = class {
|
|
|
697
690
|
nextCursor
|
|
698
691
|
};
|
|
699
692
|
}
|
|
700
|
-
// --- IAgent: Agent control ---
|
|
701
|
-
async pause(state, chainId) {
|
|
702
|
-
await this.connectAuth(state, chainId);
|
|
703
|
-
const raw = await this.sdk.pauseAgent();
|
|
704
|
-
return mapAgentStatus(raw);
|
|
705
|
-
}
|
|
706
|
-
async resume(state, chainId) {
|
|
707
|
-
await this.connectAuth(state, chainId);
|
|
708
|
-
const raw = await this.sdk.resumeAgent();
|
|
709
|
-
return mapAgentStatus(raw);
|
|
710
|
-
}
|
|
711
693
|
async getUserProfile(state, chainId) {
|
|
712
694
|
await this.connectAuth(state, chainId);
|
|
713
695
|
const validChainId = isValidChainId(chainId);
|
|
@@ -1866,27 +1848,6 @@ var OwneySDK = class {
|
|
|
1866
1848
|
nextCursor: hasMore ? encodeMultiAgentCursor(nextCursorMap) : void 0
|
|
1867
1849
|
};
|
|
1868
1850
|
}
|
|
1869
|
-
// --- Agent control ---
|
|
1870
|
-
/**
|
|
1871
|
-
* Pause an agent's automated operations. The agent will stop rebalancing until resumed.
|
|
1872
|
-
* @param agentId - The agent to pause (e.g. "zyfai")
|
|
1873
|
-
* @returns OwneyAgentStatus with success flag
|
|
1874
|
-
*/
|
|
1875
|
-
async pauseAgent(agentId) {
|
|
1876
|
-
const state = this.requireState();
|
|
1877
|
-
const chainId = this.requireChainId();
|
|
1878
|
-
return this.getAgent(agentId).pause(state, chainId);
|
|
1879
|
-
}
|
|
1880
|
-
/**
|
|
1881
|
-
* Resume an agent's automated operations.
|
|
1882
|
-
* @param agentId - The agent to resume (e.g. "zyfai")
|
|
1883
|
-
* @returns OwneyAgentStatus with success flag
|
|
1884
|
-
*/
|
|
1885
|
-
async resumeAgent(agentId) {
|
|
1886
|
-
const state = this.requireState();
|
|
1887
|
-
const chainId = this.requireChainId();
|
|
1888
|
-
return this.getAgent(agentId).resume(state, chainId);
|
|
1889
|
-
}
|
|
1890
1851
|
/**
|
|
1891
1852
|
* Get the user's profile for a specific agent, or all agents.
|
|
1892
1853
|
* @param agentId - Optional. Agent to query. Omit for all agents.
|