@owney/sdk 0.7.12 → 0.7.14-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/README.md CHANGED
@@ -310,7 +310,7 @@ console.log(allApy.agentApy.zyfai.weightedApyAfterFee); // 6.0
310
310
  // Per (chain, asset), balance-weighted across all agents.
311
311
  // Cells with 0/missing APY for a given agent are excluded from that cell.
312
312
  console.log(allApy.apyByChainAndAsset[8453]?.USDC); // 5.3
313
- console.log(allApy.apyByChainAndAsset[42161]?.USDT); // 4.7
313
+ console.log(allApy.apyByChainAndAsset[42161]?.WETH); // 4.7
314
314
  ```
315
315
 
316
316
  ### `getHistory({ agentId?, filters? })`
@@ -441,7 +441,7 @@ type Asset = string;
441
441
  type DailyApyDays = "7D" | "14D" | "30D";
442
442
  type OwneySupportedChainId = 8453 | 42161;
443
443
  type OwneySupportedChains = "BASE" | "ARBITRUM";
444
- type OwneySupportedTokens = "USDC" | "USDT";
444
+ type OwneySupportedTokens = "USDC" | "WETH";
445
445
 
446
446
  type AgentSupportedAsset = {
447
447
  readonly symbol: string;
package/dist/index.cjs CHANGED
@@ -41,7 +41,7 @@ var P_SUPPORTED_CHAINS = {
41
41
  chainIds: [8453, 42161, 1],
42
42
  chains: ["BASE", "ARBITRUM", "ETHEREUM"]
43
43
  };
44
- var SUPPORTED_TOKENS = ["USDC", "USDT", "WETH"];
44
+ var SUPPORTED_TOKENS = ["USDC", "WETH"];
45
45
  var SUPPORTED_CHAIN_IDS = P_SUPPORTED_CHAINS.chainIds;
46
46
  var SUPPORTED_CHAINS = P_SUPPORTED_CHAINS.chains;
47
47
  var SupportedAssets = [
@@ -57,12 +57,6 @@ var SupportedAssets = [
57
57
  chainId: 42161,
58
58
  decimals: 6
59
59
  },
60
- {
61
- address: `0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9`,
62
- symbol: "USDT",
63
- chainId: 42161,
64
- decimals: 6
65
- },
66
60
  {
67
61
  address: `0x4200000000000000000000000000000000000006`,
68
62
  symbol: "WETH",
@@ -175,7 +169,6 @@ var DayFilterMapping = {
175
169
  // src/agents/zyfai/zyfai.mapper.ts
176
170
  var DECIMALS_BY_SYMBOL = {
177
171
  usdc: 6,
178
- usdt: 6,
179
172
  weth: 18,
180
173
  eth: 18,
181
174
  cbeth: 18,
@@ -491,9 +484,10 @@ function mapApyByStrategy(raw) {
491
484
  const chainKey = supported.chainId;
492
485
  const symbolKey = supported.symbol;
493
486
  const bucket = apyPerAsset[chainKey] ?? {};
494
- bucket[symbolKey] = entry.average_apy;
487
+ const apy = entry.average_apy_with_fee ?? entry.average_apy;
488
+ bucket[symbolKey] = apy;
495
489
  apyPerAsset[chainKey] = bucket;
496
- apySum += entry.average_apy;
490
+ apySum += apy;
497
491
  apyCount += 1;
498
492
  }
499
493
  const averageApy = apyCount > 0 ? apySum / apyCount : 0;
@@ -3010,15 +3004,12 @@ var OwneySDK = class {
3010
3004
  /**
3011
3005
  * Activate agents ONE AT A TIME, each followed by its org policy.
3012
3006
  *
3013
- * Every agent opens its activation with its own wallet signature, each
3014
- * exchanged for that agent's own backend session — Zyfai's SIWX for a JWT,
3015
- * Sail's SIWE. Run in parallel, that puts two `personal_sign` requests on one
3016
- * wallet connection in the same instant. Over WalletConnect both are
3017
- * delivered to the wallet, which renders one signing request at a time and
3018
- * queues or silently drops the other: neither promise settles, so activation
3019
- * hangs until the caller's timeout with no prompt the user can act on. The
3020
- * single-agent era never hit this — there was no second prompt to collide
3021
- * with — so it appeared the moment a second agent became eligible.
3007
+ * Every agent may open its activation with its own wallet signature and
3008
+ * backend session. Run in parallel, multiple agents can put concurrent
3009
+ * `personal_sign` requests on one wallet connection. Over WalletConnect they
3010
+ * are delivered to the wallet, which renders one signing request at a time
3011
+ * and may queue or silently drop the others: activation can then hang until
3012
+ * the caller's timeout with no prompt the user can act on.
3022
3013
  *
3023
3014
  * Serializing costs no real wall-clock: the user can only approve one prompt
3024
3015
  * at a time anyway.
package/dist/index.d.cts CHANGED
@@ -47,14 +47,14 @@ interface ConnectionState {
47
47
  walletAddress: `0x${string}`;
48
48
  chainId: number | null;
49
49
  }
50
- declare const SUPPORTED_TOKENS: readonly ["USDC", "USDT", "WETH"];
50
+ declare const SUPPORTED_TOKENS: readonly ["USDC", "WETH"];
51
51
  declare const SUPPORTED_CHAIN_IDS: readonly [8453, 42161, 1];
52
52
  declare const SUPPORTED_CHAINS: readonly ["BASE", "ARBITRUM", "ETHEREUM"];
53
53
  type OwneySupportedChainId = (typeof SUPPORTED_CHAIN_IDS)[number];
54
54
  type OwneySupportedChains = (typeof SUPPORTED_CHAINS)[number];
55
55
  type OwneySupportedTokens = (typeof SUPPORTED_TOKENS)[number];
56
56
 
57
- type AgentId = "zyfai" | "sail";
57
+ type AgentId = "zyfai";
58
58
  type Asset = string;
59
59
  type AgentSupportedAsset = {
60
60
  readonly symbol: string;
@@ -203,7 +203,7 @@ interface OwneyPosition {
203
203
  /**
204
204
  * Funds that have landed in the agent's wallet but are not yet deployed into a
205
205
  * protocol. Sourced from Zyfai `staleBalances[].isPending`. Absent when nothing
206
- * is pending, and for agents that do not report it (sail).
206
+ * is pending.
207
207
  */
208
208
  interface OwneyPendingAllocation {
209
209
  /** Deliberately loose (not OwneySupportedChainId) because Zyfai reports balances on unsupported chains. */
@@ -231,7 +231,7 @@ interface AgentBalance {
231
231
  tokens: OwneyToken[];
232
232
  /**
233
233
  * Per-protocol/pool positions when the agent's portfolio payload includes
234
- * them (zyfai). Omitted for agents that don't expose positions (sail).
234
+ * them.
235
235
  */
236
236
  positions?: OwneyPosition[];
237
237
  /** Funds received but not yet deployed. Omitted when nothing is pending. */
@@ -341,8 +341,8 @@ interface AgentUserProfile {
341
341
  hasActiveSessionKey: boolean;
342
342
  protocols: string[];
343
343
  /**
344
- * Capital splitting, as the agent currently has it (ROUT-229). Optional
345
- * because not every agent has the concept — Sail omits both.
344
+ * Capital splitting, as the agent currently has it (ROUT-229). Optional for
345
+ * compatibility with responses that do not expose these fields.
346
346
  *
347
347
  * `minSplits` is the field that carries the meaning: 1 means "split only when
348
348
  * it beats a single pool", 2-4 means "force a split for diversification".
@@ -525,15 +525,12 @@ declare class OwneySDK {
525
525
  /**
526
526
  * Activate agents ONE AT A TIME, each followed by its org policy.
527
527
  *
528
- * Every agent opens its activation with its own wallet signature, each
529
- * exchanged for that agent's own backend session — Zyfai's SIWX for a JWT,
530
- * Sail's SIWE. Run in parallel, that puts two `personal_sign` requests on one
531
- * wallet connection in the same instant. Over WalletConnect both are
532
- * delivered to the wallet, which renders one signing request at a time and
533
- * queues or silently drops the other: neither promise settles, so activation
534
- * hangs until the caller's timeout with no prompt the user can act on. The
535
- * single-agent era never hit this — there was no second prompt to collide
536
- * with — so it appeared the moment a second agent became eligible.
528
+ * Every agent may open its activation with its own wallet signature and
529
+ * backend session. Run in parallel, multiple agents can put concurrent
530
+ * `personal_sign` requests on one wallet connection. Over WalletConnect they
531
+ * are delivered to the wallet, which renders one signing request at a time
532
+ * and may queue or silently drop the others: activation can then hang until
533
+ * the caller's timeout with no prompt the user can act on.
537
534
  *
538
535
  * Serializing costs no real wall-clock: the user can only approve one prompt
539
536
  * at a time anyway.
@@ -695,7 +692,7 @@ declare class OwneySDK {
695
692
  getAllocationApy({ agentId, }?: AllocationApyOptions): Promise<OwneyAllocationApy>;
696
693
  }
697
694
 
698
- 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_SAIL_ERROR" | "API_SAIL_TIMEOUT" | "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";
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";
699
696
  declare class OwneyError extends Error {
700
697
  readonly code: OwneyErrorCode;
701
698
  readonly details?: Record<string, unknown>;
package/dist/index.d.ts CHANGED
@@ -47,14 +47,14 @@ interface ConnectionState {
47
47
  walletAddress: `0x${string}`;
48
48
  chainId: number | null;
49
49
  }
50
- declare const SUPPORTED_TOKENS: readonly ["USDC", "USDT", "WETH"];
50
+ declare const SUPPORTED_TOKENS: readonly ["USDC", "WETH"];
51
51
  declare const SUPPORTED_CHAIN_IDS: readonly [8453, 42161, 1];
52
52
  declare const SUPPORTED_CHAINS: readonly ["BASE", "ARBITRUM", "ETHEREUM"];
53
53
  type OwneySupportedChainId = (typeof SUPPORTED_CHAIN_IDS)[number];
54
54
  type OwneySupportedChains = (typeof SUPPORTED_CHAINS)[number];
55
55
  type OwneySupportedTokens = (typeof SUPPORTED_TOKENS)[number];
56
56
 
57
- type AgentId = "zyfai" | "sail";
57
+ type AgentId = "zyfai";
58
58
  type Asset = string;
59
59
  type AgentSupportedAsset = {
60
60
  readonly symbol: string;
@@ -203,7 +203,7 @@ interface OwneyPosition {
203
203
  /**
204
204
  * Funds that have landed in the agent's wallet but are not yet deployed into a
205
205
  * protocol. Sourced from Zyfai `staleBalances[].isPending`. Absent when nothing
206
- * is pending, and for agents that do not report it (sail).
206
+ * is pending.
207
207
  */
208
208
  interface OwneyPendingAllocation {
209
209
  /** Deliberately loose (not OwneySupportedChainId) because Zyfai reports balances on unsupported chains. */
@@ -231,7 +231,7 @@ interface AgentBalance {
231
231
  tokens: OwneyToken[];
232
232
  /**
233
233
  * Per-protocol/pool positions when the agent's portfolio payload includes
234
- * them (zyfai). Omitted for agents that don't expose positions (sail).
234
+ * them.
235
235
  */
236
236
  positions?: OwneyPosition[];
237
237
  /** Funds received but not yet deployed. Omitted when nothing is pending. */
@@ -341,8 +341,8 @@ interface AgentUserProfile {
341
341
  hasActiveSessionKey: boolean;
342
342
  protocols: string[];
343
343
  /**
344
- * Capital splitting, as the agent currently has it (ROUT-229). Optional
345
- * because not every agent has the concept — Sail omits both.
344
+ * Capital splitting, as the agent currently has it (ROUT-229). Optional for
345
+ * compatibility with responses that do not expose these fields.
346
346
  *
347
347
  * `minSplits` is the field that carries the meaning: 1 means "split only when
348
348
  * it beats a single pool", 2-4 means "force a split for diversification".
@@ -525,15 +525,12 @@ declare class OwneySDK {
525
525
  /**
526
526
  * Activate agents ONE AT A TIME, each followed by its org policy.
527
527
  *
528
- * Every agent opens its activation with its own wallet signature, each
529
- * exchanged for that agent's own backend session — Zyfai's SIWX for a JWT,
530
- * Sail's SIWE. Run in parallel, that puts two `personal_sign` requests on one
531
- * wallet connection in the same instant. Over WalletConnect both are
532
- * delivered to the wallet, which renders one signing request at a time and
533
- * queues or silently drops the other: neither promise settles, so activation
534
- * hangs until the caller's timeout with no prompt the user can act on. The
535
- * single-agent era never hit this — there was no second prompt to collide
536
- * with — so it appeared the moment a second agent became eligible.
528
+ * Every agent may open its activation with its own wallet signature and
529
+ * backend session. Run in parallel, multiple agents can put concurrent
530
+ * `personal_sign` requests on one wallet connection. Over WalletConnect they
531
+ * are delivered to the wallet, which renders one signing request at a time
532
+ * and may queue or silently drop the others: activation can then hang until
533
+ * the caller's timeout with no prompt the user can act on.
537
534
  *
538
535
  * Serializing costs no real wall-clock: the user can only approve one prompt
539
536
  * at a time anyway.
@@ -695,7 +692,7 @@ declare class OwneySDK {
695
692
  getAllocationApy({ agentId, }?: AllocationApyOptions): Promise<OwneyAllocationApy>;
696
693
  }
697
694
 
698
- 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_SAIL_ERROR" | "API_SAIL_TIMEOUT" | "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";
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";
699
696
  declare class OwneyError extends Error {
700
697
  readonly code: OwneyErrorCode;
701
698
  readonly details?: Record<string, unknown>;
package/dist/index.js CHANGED
@@ -8,7 +8,7 @@ var P_SUPPORTED_CHAINS = {
8
8
  chainIds: [8453, 42161, 1],
9
9
  chains: ["BASE", "ARBITRUM", "ETHEREUM"]
10
10
  };
11
- var SUPPORTED_TOKENS = ["USDC", "USDT", "WETH"];
11
+ var SUPPORTED_TOKENS = ["USDC", "WETH"];
12
12
  var SUPPORTED_CHAIN_IDS = P_SUPPORTED_CHAINS.chainIds;
13
13
  var SUPPORTED_CHAINS = P_SUPPORTED_CHAINS.chains;
14
14
  var SupportedAssets = [
@@ -24,12 +24,6 @@ var SupportedAssets = [
24
24
  chainId: 42161,
25
25
  decimals: 6
26
26
  },
27
- {
28
- address: `0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9`,
29
- symbol: "USDT",
30
- chainId: 42161,
31
- decimals: 6
32
- },
33
27
  {
34
28
  address: `0x4200000000000000000000000000000000000006`,
35
29
  symbol: "WETH",
@@ -142,7 +136,6 @@ var DayFilterMapping = {
142
136
  // src/agents/zyfai/zyfai.mapper.ts
143
137
  var DECIMALS_BY_SYMBOL = {
144
138
  usdc: 6,
145
- usdt: 6,
146
139
  weth: 18,
147
140
  eth: 18,
148
141
  cbeth: 18,
@@ -458,9 +451,10 @@ function mapApyByStrategy(raw) {
458
451
  const chainKey = supported.chainId;
459
452
  const symbolKey = supported.symbol;
460
453
  const bucket = apyPerAsset[chainKey] ?? {};
461
- bucket[symbolKey] = entry.average_apy;
454
+ const apy = entry.average_apy_with_fee ?? entry.average_apy;
455
+ bucket[symbolKey] = apy;
462
456
  apyPerAsset[chainKey] = bucket;
463
- apySum += entry.average_apy;
457
+ apySum += apy;
464
458
  apyCount += 1;
465
459
  }
466
460
  const averageApy = apyCount > 0 ? apySum / apyCount : 0;
@@ -2981,15 +2975,12 @@ var OwneySDK = class {
2981
2975
  /**
2982
2976
  * Activate agents ONE AT A TIME, each followed by its org policy.
2983
2977
  *
2984
- * Every agent opens its activation with its own wallet signature, each
2985
- * exchanged for that agent's own backend session — Zyfai's SIWX for a JWT,
2986
- * Sail's SIWE. Run in parallel, that puts two `personal_sign` requests on one
2987
- * wallet connection in the same instant. Over WalletConnect both are
2988
- * delivered to the wallet, which renders one signing request at a time and
2989
- * queues or silently drops the other: neither promise settles, so activation
2990
- * hangs until the caller's timeout with no prompt the user can act on. The
2991
- * single-agent era never hit this — there was no second prompt to collide
2992
- * with — so it appeared the moment a second agent became eligible.
2978
+ * Every agent may open its activation with its own wallet signature and
2979
+ * backend session. Run in parallel, multiple agents can put concurrent
2980
+ * `personal_sign` requests on one wallet connection. Over WalletConnect they
2981
+ * are delivered to the wallet, which renders one signing request at a time
2982
+ * and may queue or silently drop the others: activation can then hang until
2983
+ * the caller's timeout with no prompt the user can act on.
2993
2984
  *
2994
2985
  * Serializing costs no real wall-clock: the user can only approve one prompt
2995
2986
  * at a time anyway.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@owney/sdk",
3
- "version": "0.7.12",
3
+ "version": "0.7.14-beta.0",
4
4
  "type": "module",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",