@owney/sdk 0.6.0-beta.2 → 0.6.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
@@ -407,17 +407,6 @@ const usdcBaseApy = await sdk.getAgentApy({
407
407
  console.log(usdcBaseApy.agentApy.zyfai.averageApy); // APY scoped to USDC on Base
408
408
  ```
409
409
 
410
- ### `getAgentAllocation()`
411
-
412
- Get the current fund allocation percentages across agents.
413
-
414
- Returns: `OwneyAgentAllocation`
415
-
416
- ```typescript
417
- const allocation = await sdk.getAgentAllocation();
418
- console.log(allocation.agentAllocation); // { zyfai: 100 }
419
- ```
420
-
421
410
  ## Types
422
411
 
423
412
  ### Configuration
@@ -630,10 +619,6 @@ interface AgentApyDetails {
630
619
  interface OwneyAgentApy {
631
620
  agentApy: Record<AgentId, AgentApy>;
632
621
  }
633
-
634
- interface OwneyAgentAllocation {
635
- agentAllocation: Record<AgentId, number>;
636
- }
637
622
  ```
638
623
 
639
624
  ### Callback Types
package/dist/index.cjs CHANGED
@@ -40,7 +40,7 @@ var P_SUPPORTED_CHAINS = {
40
40
  chainIds: [8453, 42161],
41
41
  chains: ["BASE", "ARBITRUM"]
42
42
  };
43
- var SUPPORTED_TOKENS = ["USDC", "USDT", "WETH"];
43
+ var SUPPORTED_TOKENS = ["USDC", "USDT"];
44
44
  var SUPPORTED_CHAIN_IDS = P_SUPPORTED_CHAINS.chainIds;
45
45
  var SUPPORTED_CHAINS = P_SUPPORTED_CHAINS.chains;
46
46
  var SupportedAssets = [
@@ -61,18 +61,6 @@ var SupportedAssets = [
61
61
  symbol: "USDT",
62
62
  chainId: 42161,
63
63
  decimals: 6
64
- },
65
- {
66
- address: `0x4200000000000000000000000000000000000006`,
67
- symbol: "WETH",
68
- chainId: 8453,
69
- decimals: 18
70
- },
71
- {
72
- address: `0x82aF49447D8a07e3bd95BD0d56f35241523fBab1`,
73
- symbol: "WETH",
74
- chainId: 42161,
75
- decimals: 18
76
64
  }
77
65
  ];
78
66
 
@@ -545,10 +533,6 @@ var DEFAULT_ZYFAI_RPC_URLS = {
545
533
  8453: "https://base-mainnet.g.alchemy.com/v2/ZWyVU-9XfS3z8Rn-xkq7V",
546
534
  42161: "https://arb-mainnet.g.alchemy.com/v2/ZWyVU-9XfS3z8Rn-xkq7V"
547
535
  };
548
- var WETH_ADDRESS_BY_CHAIN = {
549
- 8453: "0x4200000000000000000000000000000000000006",
550
- 42161: "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1"
551
- };
552
536
  var VIEM_CHAIN = { 8453: import_chains.base, 42161: import_chains.arbitrum };
553
537
  var ZyfaiAgent = class {
554
538
  id = "zyfai";
@@ -557,18 +541,12 @@ var ZyfaiAgent = class {
557
541
  {
558
542
  chainId: 8453,
559
543
  chain: "BASE",
560
- assets: [
561
- { symbol: "USDC", minDepositAmount: "1500000" },
562
- { symbol: "WETH", minDepositAmount: "500000000000000" }
563
- ]
544
+ assets: [{ symbol: "USDC", minDepositAmount: "1500000" }]
564
545
  },
565
546
  {
566
547
  chainId: 42161,
567
548
  chain: "ARBITRUM",
568
- assets: [
569
- { symbol: "USDC", minDepositAmount: "1500000" },
570
- { symbol: "WETH", minDepositAmount: "500000000000000" }
571
- ]
549
+ assets: [{ symbol: "USDC", minDepositAmount: "1500000" }]
572
550
  }
573
551
  ];
574
552
  sdk;
@@ -804,7 +782,7 @@ var ZyfaiAgent = class {
804
782
  throw error;
805
783
  }
806
784
  }
807
- async deposit(state, chainId, amount, asset, depositCallback) {
785
+ async deposit(state, chainId, amount, depositCallback) {
808
786
  try {
809
787
  await this.connectFull(state, chainId);
810
788
  const validChainId = isValidChainId(chainId);
@@ -818,15 +796,13 @@ var ZyfaiAgent = class {
818
796
  validChainId,
819
797
  amount
820
798
  );
821
- const tokenAddress = asset === "WETH" ? WETH_ADDRESS_BY_CHAIN[validChainId] : void 0;
822
- await (tokenAddress ? this.sdk.logDeposit(validChainId, txHash, amount, tokenAddress) : this.sdk.logDeposit(validChainId, txHash, amount));
799
+ await this.sdk.logDeposit(validChainId, txHash, amount);
823
800
  return { txHash, smartWallet: wallet.address, amount };
824
801
  }
825
802
  const raw = await this.sdk.depositFunds(
826
803
  this.getAddress(),
827
804
  validChainId,
828
- amount,
829
- asset
805
+ amount
830
806
  );
831
807
  return mapDeposit(raw);
832
808
  } catch (error) {
@@ -1553,7 +1529,7 @@ var OwneySDK = class {
1553
1529
  }
1554
1530
  const state = this.requireState();
1555
1531
  const chainId = this.requireChainId();
1556
- const effectiveCallback = depositCallback ?? (asset === "WETH" ? void 0 : this.getDefaultSponsoredCallback());
1532
+ const effectiveCallback = depositCallback ?? this.getDefaultSponsoredCallback();
1557
1533
  if (agentId) {
1558
1534
  if (this.isAgentDisabled(agentId)) {
1559
1535
  throw new OwneyError(
@@ -1568,13 +1544,7 @@ var OwneySDK = class {
1568
1544
  return withFailureReporting(
1569
1545
  this.apiKey,
1570
1546
  agent.id,
1571
- () => agent.deposit(
1572
- state,
1573
- chainId,
1574
- amount,
1575
- asset,
1576
- effectiveCallback
1577
- )
1547
+ () => agent.deposit(state, chainId, amount, effectiveCallback)
1578
1548
  );
1579
1549
  }
1580
1550
  const totalAmount = BigInt(amount);
@@ -1608,13 +1578,7 @@ var OwneySDK = class {
1608
1578
  agentResults[agent.id] = await withFailureReporting(
1609
1579
  this.apiKey,
1610
1580
  agent.id,
1611
- () => agent.deposit(
1612
- state,
1613
- chainId,
1614
- agentAmount,
1615
- asset,
1616
- effectiveCallback
1617
- )
1581
+ () => agent.deposit(state, chainId, agentAmount, effectiveCallback)
1618
1582
  );
1619
1583
  }
1620
1584
  return { agentResults };
@@ -2144,70 +2108,6 @@ var OwneySDK = class {
2144
2108
  agentApy: results
2145
2109
  };
2146
2110
  }
2147
- /**
2148
- * Get the current fund allocation percentages across agents.
2149
- * @returns Object with agent names as keys and allocation percentages as values
2150
- */
2151
- async getAgentAllocation() {
2152
- const state = this.requireState();
2153
- const chainId = this.requireChainId();
2154
- const activeAgents = this.getActiveAgents();
2155
- const balances = {};
2156
- const positionsByAgent = {};
2157
- let totalBalance = 0;
2158
- const entries = [...activeAgents.entries()];
2159
- const balanceResults = await Promise.allSettled(
2160
- entries.map(async ([id, agent]) => {
2161
- const b = await agent.getBalances(state, chainId);
2162
- return [id, Number(b.totalBalance), b.positions ?? []];
2163
- })
2164
- );
2165
- let successCount = 0;
2166
- const agentErrors = {};
2167
- for (let i = 0; i < balanceResults.length; i++) {
2168
- const settledResult = balanceResults[i];
2169
- const [agentId] = entries[i];
2170
- if (settledResult.status === "fulfilled") {
2171
- const [id, bal, agentPositions] = settledResult.value;
2172
- balances[id] = bal;
2173
- positionsByAgent[id] = agentPositions;
2174
- totalBalance += bal;
2175
- successCount += 1;
2176
- } else {
2177
- const reason = settledResult.reason;
2178
- agentErrors[agentId] = reason instanceof Error ? reason.message : String(reason);
2179
- console.error(`getAgentAllocation agent "${agentId}" failed:`, reason);
2180
- }
2181
- }
2182
- if (successCount === 0) {
2183
- throw new OwneyError(
2184
- "ALLOCATION_ALL_FAILED",
2185
- "Failed to fetch allocation: all agents failed.",
2186
- { agentErrors }
2187
- );
2188
- }
2189
- const allocation = {};
2190
- if (totalBalance === 0) {
2191
- for (const id of activeAgents.keys()) {
2192
- allocation[id] = 0;
2193
- }
2194
- } else {
2195
- for (const id of activeAgents.keys()) {
2196
- allocation[id] = balances[id] > 0 ? Math.max(1, Math.floor(balances[id] / totalBalance * 100)) : 0;
2197
- }
2198
- const remainder = 100 - Object.values(allocation).reduce((a, b) => a + b, 0);
2199
- if (remainder > 0) {
2200
- const largestId = [...activeAgents.keys()].reduce(
2201
- (a, b) => balances[a] >= balances[b] ? a : b
2202
- );
2203
- allocation[largestId] += remainder;
2204
- }
2205
- }
2206
- return {
2207
- agentAllocation: allocation,
2208
- agentPositions: positionsByAgent
2209
- };
2210
- }
2211
2111
  /**
2212
2112
  * Allocation-weighted APY from the current portfolio: each pool's APY
2213
2113
  * weighted by the user's position value in it. More accurate per-user than
package/dist/index.d.cts CHANGED
@@ -14,7 +14,7 @@ interface ConnectionState {
14
14
  walletAddress: `0x${string}`;
15
15
  chainId: number | null;
16
16
  }
17
- declare const SUPPORTED_TOKENS: readonly ["USDC", "USDT", "WETH"];
17
+ declare const SUPPORTED_TOKENS: readonly ["USDC", "USDT"];
18
18
  declare const SUPPORTED_CHAIN_IDS: readonly [8453, 42161];
19
19
  declare const SUPPORTED_CHAINS: readonly ["BASE", "ARBITRUM"];
20
20
  type OwneySupportedChainId = (typeof SUPPORTED_CHAIN_IDS)[number];
@@ -171,11 +171,6 @@ interface AgentApy {
171
171
  interface OwneyAgentApy {
172
172
  agentApy: Record<AgentId, AgentApy>;
173
173
  }
174
- interface OwneyAgentAllocation {
175
- agentAllocation: Record<AgentId, number>;
176
- /** Per-agent positions. Empty array for agents that don't expose positions. */
177
- agentPositions: Record<AgentId, OwneyPosition[]>;
178
- }
179
174
 
180
175
  type DepositCallback = (smartWalletAddress: string, chainId: number, amount: string) => Promise<`0x${string}`> | `0x${string}`;
181
176
  interface IAgent {
@@ -184,7 +179,7 @@ interface IAgent {
184
179
  readonly supportedAssets: readonly AgentSupportedAssets[];
185
180
  disconnect(): Promise<void>;
186
181
  activateAgent(state: ConnectionState, chainId: number): Promise<void>;
187
- deposit(state: ConnectionState, chainId: number, amount: string, asset: OwneySupportedTokens, depositCallback?: DepositCallback): Promise<OwneyDepositResult>;
182
+ deposit(state: ConnectionState, chainId: number, amount: string, depositCallback?: DepositCallback): Promise<OwneyDepositResult>;
188
183
  withdraw(state: ConnectionState, chainId: number, token: OwneySupportedTokens, amount?: string): Promise<AgentWithdrawResult>;
189
184
  getBalances(state: ConnectionState, chainId: number): Promise<AgentBalance>;
190
185
  getEarnings(state: ConnectionState, chainId: number): Promise<AgentEarnings>;
@@ -414,11 +409,6 @@ declare class OwneySDK {
414
409
  * @returns {AgentApy} for a single agent, or {OwneyAgentApy} with per-agent APY
415
410
  */
416
411
  getAgentApy({ agentId, days, tokenSymbol, chainId, }: AgentsApyOptions): Promise<OwneyAgentApy | AgentApy>;
417
- /**
418
- * Get the current fund allocation percentages across agents.
419
- * @returns Object with agent names as keys and allocation percentages as values
420
- */
421
- getAgentAllocation(): Promise<OwneyAgentAllocation>;
422
412
  /**
423
413
  * Allocation-weighted APY from the current portfolio: each pool's APY
424
414
  * weighted by the user's position value in it. More accurate per-user than
@@ -474,4 +464,4 @@ type OwneySIWXConfig = {
474
464
  */
475
465
  declare function createOwneySIWX(config: OwneySIWXConfig): SIWXConfig;
476
466
 
477
- export { AccountAgentApy, AccountApyOptions, AgentApy, AgentApyDetails, AgentBalance, AgentChainIncompatibleError, AgentEarnings, AgentHistoryEntry, AgentHistoryPosition, AgentId, AgentNotFoundError, AgentSupportedAsset, AgentSupportedAssets, AgentUserProfile, AgentWithdrawResult, AgentsApyOptions, AllocationAgentApy, ApyByChainAndAsset, Asset, ConnectionState, DailyApyDays, DepositCallback, DepositOptions, HistoryAction, HistoryFilters, HistoryOptions, HistoryTransaction, IAgent, InvalidHistoryCursorError, NotConnectedError, OwneyAccountApy, OwneyAgentAllocation, OwneyAgentApy, OwneyAgentHistory, OwneyAllocationApy, OwneyBalances, OwneyDepositResult, OwneyEarnings, OwneyError, OwneyErrorCode, OwneyMultiDepositResult, OwneyPosition, OwneySDK, OwneySDKConfig, OwneySIWXConfig, OwneySupportedChainId, OwneySupportedChains, OwneySupportedTokens, OwneyToken, OwneyUserProfile, OwneyWithdrawResult, RebalanceLog, WithdrawOptions, createOwneySIWX };
467
+ export { AccountAgentApy, AccountApyOptions, AgentApy, AgentApyDetails, AgentBalance, AgentChainIncompatibleError, AgentEarnings, AgentHistoryEntry, AgentHistoryPosition, AgentId, AgentNotFoundError, AgentSupportedAsset, AgentSupportedAssets, AgentUserProfile, AgentWithdrawResult, AgentsApyOptions, AllocationAgentApy, ApyByChainAndAsset, Asset, ConnectionState, DailyApyDays, DepositCallback, DepositOptions, HistoryAction, HistoryFilters, HistoryOptions, HistoryTransaction, IAgent, InvalidHistoryCursorError, NotConnectedError, OwneyAccountApy, OwneyAgentApy, OwneyAgentHistory, OwneyAllocationApy, 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
@@ -14,7 +14,7 @@ interface ConnectionState {
14
14
  walletAddress: `0x${string}`;
15
15
  chainId: number | null;
16
16
  }
17
- declare const SUPPORTED_TOKENS: readonly ["USDC", "USDT", "WETH"];
17
+ declare const SUPPORTED_TOKENS: readonly ["USDC", "USDT"];
18
18
  declare const SUPPORTED_CHAIN_IDS: readonly [8453, 42161];
19
19
  declare const SUPPORTED_CHAINS: readonly ["BASE", "ARBITRUM"];
20
20
  type OwneySupportedChainId = (typeof SUPPORTED_CHAIN_IDS)[number];
@@ -171,11 +171,6 @@ interface AgentApy {
171
171
  interface OwneyAgentApy {
172
172
  agentApy: Record<AgentId, AgentApy>;
173
173
  }
174
- interface OwneyAgentAllocation {
175
- agentAllocation: Record<AgentId, number>;
176
- /** Per-agent positions. Empty array for agents that don't expose positions. */
177
- agentPositions: Record<AgentId, OwneyPosition[]>;
178
- }
179
174
 
180
175
  type DepositCallback = (smartWalletAddress: string, chainId: number, amount: string) => Promise<`0x${string}`> | `0x${string}`;
181
176
  interface IAgent {
@@ -184,7 +179,7 @@ interface IAgent {
184
179
  readonly supportedAssets: readonly AgentSupportedAssets[];
185
180
  disconnect(): Promise<void>;
186
181
  activateAgent(state: ConnectionState, chainId: number): Promise<void>;
187
- deposit(state: ConnectionState, chainId: number, amount: string, asset: OwneySupportedTokens, depositCallback?: DepositCallback): Promise<OwneyDepositResult>;
182
+ deposit(state: ConnectionState, chainId: number, amount: string, depositCallback?: DepositCallback): Promise<OwneyDepositResult>;
188
183
  withdraw(state: ConnectionState, chainId: number, token: OwneySupportedTokens, amount?: string): Promise<AgentWithdrawResult>;
189
184
  getBalances(state: ConnectionState, chainId: number): Promise<AgentBalance>;
190
185
  getEarnings(state: ConnectionState, chainId: number): Promise<AgentEarnings>;
@@ -414,11 +409,6 @@ declare class OwneySDK {
414
409
  * @returns {AgentApy} for a single agent, or {OwneyAgentApy} with per-agent APY
415
410
  */
416
411
  getAgentApy({ agentId, days, tokenSymbol, chainId, }: AgentsApyOptions): Promise<OwneyAgentApy | AgentApy>;
417
- /**
418
- * Get the current fund allocation percentages across agents.
419
- * @returns Object with agent names as keys and allocation percentages as values
420
- */
421
- getAgentAllocation(): Promise<OwneyAgentAllocation>;
422
412
  /**
423
413
  * Allocation-weighted APY from the current portfolio: each pool's APY
424
414
  * weighted by the user's position value in it. More accurate per-user than
@@ -474,4 +464,4 @@ type OwneySIWXConfig = {
474
464
  */
475
465
  declare function createOwneySIWX(config: OwneySIWXConfig): SIWXConfig;
476
466
 
477
- export { AccountAgentApy, AccountApyOptions, AgentApy, AgentApyDetails, AgentBalance, AgentChainIncompatibleError, AgentEarnings, AgentHistoryEntry, AgentHistoryPosition, AgentId, AgentNotFoundError, AgentSupportedAsset, AgentSupportedAssets, AgentUserProfile, AgentWithdrawResult, AgentsApyOptions, AllocationAgentApy, ApyByChainAndAsset, Asset, ConnectionState, DailyApyDays, DepositCallback, DepositOptions, HistoryAction, HistoryFilters, HistoryOptions, HistoryTransaction, IAgent, InvalidHistoryCursorError, NotConnectedError, OwneyAccountApy, OwneyAgentAllocation, OwneyAgentApy, OwneyAgentHistory, OwneyAllocationApy, OwneyBalances, OwneyDepositResult, OwneyEarnings, OwneyError, OwneyErrorCode, OwneyMultiDepositResult, OwneyPosition, OwneySDK, OwneySDKConfig, OwneySIWXConfig, OwneySupportedChainId, OwneySupportedChains, OwneySupportedTokens, OwneyToken, OwneyUserProfile, OwneyWithdrawResult, RebalanceLog, WithdrawOptions, createOwneySIWX };
467
+ export { AccountAgentApy, AccountApyOptions, AgentApy, AgentApyDetails, AgentBalance, AgentChainIncompatibleError, AgentEarnings, AgentHistoryEntry, AgentHistoryPosition, AgentId, AgentNotFoundError, AgentSupportedAsset, AgentSupportedAssets, AgentUserProfile, AgentWithdrawResult, AgentsApyOptions, AllocationAgentApy, ApyByChainAndAsset, Asset, ConnectionState, DailyApyDays, DepositCallback, DepositOptions, HistoryAction, HistoryFilters, HistoryOptions, HistoryTransaction, IAgent, InvalidHistoryCursorError, NotConnectedError, OwneyAccountApy, OwneyAgentApy, OwneyAgentHistory, OwneyAllocationApy, OwneyBalances, OwneyDepositResult, OwneyEarnings, OwneyError, OwneyErrorCode, OwneyMultiDepositResult, OwneyPosition, OwneySDK, OwneySDKConfig, OwneySIWXConfig, OwneySupportedChainId, OwneySupportedChains, OwneySupportedTokens, OwneyToken, OwneyUserProfile, OwneyWithdrawResult, RebalanceLog, WithdrawOptions, createOwneySIWX };
package/dist/index.js CHANGED
@@ -8,7 +8,7 @@ var P_SUPPORTED_CHAINS = {
8
8
  chainIds: [8453, 42161],
9
9
  chains: ["BASE", "ARBITRUM"]
10
10
  };
11
- var SUPPORTED_TOKENS = ["USDC", "USDT", "WETH"];
11
+ var SUPPORTED_TOKENS = ["USDC", "USDT"];
12
12
  var SUPPORTED_CHAIN_IDS = P_SUPPORTED_CHAINS.chainIds;
13
13
  var SUPPORTED_CHAINS = P_SUPPORTED_CHAINS.chains;
14
14
  var SupportedAssets = [
@@ -29,18 +29,6 @@ var SupportedAssets = [
29
29
  symbol: "USDT",
30
30
  chainId: 42161,
31
31
  decimals: 6
32
- },
33
- {
34
- address: `0x4200000000000000000000000000000000000006`,
35
- symbol: "WETH",
36
- chainId: 8453,
37
- decimals: 18
38
- },
39
- {
40
- address: `0x82aF49447D8a07e3bd95BD0d56f35241523fBab1`,
41
- symbol: "WETH",
42
- chainId: 42161,
43
- decimals: 18
44
32
  }
45
33
  ];
46
34
 
@@ -513,10 +501,6 @@ var DEFAULT_ZYFAI_RPC_URLS = {
513
501
  8453: "https://base-mainnet.g.alchemy.com/v2/ZWyVU-9XfS3z8Rn-xkq7V",
514
502
  42161: "https://arb-mainnet.g.alchemy.com/v2/ZWyVU-9XfS3z8Rn-xkq7V"
515
503
  };
516
- var WETH_ADDRESS_BY_CHAIN = {
517
- 8453: "0x4200000000000000000000000000000000000006",
518
- 42161: "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1"
519
- };
520
504
  var VIEM_CHAIN = { 8453: base, 42161: arbitrum };
521
505
  var ZyfaiAgent = class {
522
506
  id = "zyfai";
@@ -525,18 +509,12 @@ var ZyfaiAgent = class {
525
509
  {
526
510
  chainId: 8453,
527
511
  chain: "BASE",
528
- assets: [
529
- { symbol: "USDC", minDepositAmount: "1500000" },
530
- { symbol: "WETH", minDepositAmount: "500000000000000" }
531
- ]
512
+ assets: [{ symbol: "USDC", minDepositAmount: "1500000" }]
532
513
  },
533
514
  {
534
515
  chainId: 42161,
535
516
  chain: "ARBITRUM",
536
- assets: [
537
- { symbol: "USDC", minDepositAmount: "1500000" },
538
- { symbol: "WETH", minDepositAmount: "500000000000000" }
539
- ]
517
+ assets: [{ symbol: "USDC", minDepositAmount: "1500000" }]
540
518
  }
541
519
  ];
542
520
  sdk;
@@ -772,7 +750,7 @@ var ZyfaiAgent = class {
772
750
  throw error;
773
751
  }
774
752
  }
775
- async deposit(state, chainId, amount, asset, depositCallback) {
753
+ async deposit(state, chainId, amount, depositCallback) {
776
754
  try {
777
755
  await this.connectFull(state, chainId);
778
756
  const validChainId = isValidChainId(chainId);
@@ -786,15 +764,13 @@ var ZyfaiAgent = class {
786
764
  validChainId,
787
765
  amount
788
766
  );
789
- const tokenAddress = asset === "WETH" ? WETH_ADDRESS_BY_CHAIN[validChainId] : void 0;
790
- await (tokenAddress ? this.sdk.logDeposit(validChainId, txHash, amount, tokenAddress) : this.sdk.logDeposit(validChainId, txHash, amount));
767
+ await this.sdk.logDeposit(validChainId, txHash, amount);
791
768
  return { txHash, smartWallet: wallet.address, amount };
792
769
  }
793
770
  const raw = await this.sdk.depositFunds(
794
771
  this.getAddress(),
795
772
  validChainId,
796
- amount,
797
- asset
773
+ amount
798
774
  );
799
775
  return mapDeposit(raw);
800
776
  } catch (error) {
@@ -1525,7 +1501,7 @@ var OwneySDK = class {
1525
1501
  }
1526
1502
  const state = this.requireState();
1527
1503
  const chainId = this.requireChainId();
1528
- const effectiveCallback = depositCallback ?? (asset === "WETH" ? void 0 : this.getDefaultSponsoredCallback());
1504
+ const effectiveCallback = depositCallback ?? this.getDefaultSponsoredCallback();
1529
1505
  if (agentId) {
1530
1506
  if (this.isAgentDisabled(agentId)) {
1531
1507
  throw new OwneyError(
@@ -1540,13 +1516,7 @@ var OwneySDK = class {
1540
1516
  return withFailureReporting(
1541
1517
  this.apiKey,
1542
1518
  agent.id,
1543
- () => agent.deposit(
1544
- state,
1545
- chainId,
1546
- amount,
1547
- asset,
1548
- effectiveCallback
1549
- )
1519
+ () => agent.deposit(state, chainId, amount, effectiveCallback)
1550
1520
  );
1551
1521
  }
1552
1522
  const totalAmount = BigInt(amount);
@@ -1580,13 +1550,7 @@ var OwneySDK = class {
1580
1550
  agentResults[agent.id] = await withFailureReporting(
1581
1551
  this.apiKey,
1582
1552
  agent.id,
1583
- () => agent.deposit(
1584
- state,
1585
- chainId,
1586
- agentAmount,
1587
- asset,
1588
- effectiveCallback
1589
- )
1553
+ () => agent.deposit(state, chainId, agentAmount, effectiveCallback)
1590
1554
  );
1591
1555
  }
1592
1556
  return { agentResults };
@@ -2116,70 +2080,6 @@ var OwneySDK = class {
2116
2080
  agentApy: results
2117
2081
  };
2118
2082
  }
2119
- /**
2120
- * Get the current fund allocation percentages across agents.
2121
- * @returns Object with agent names as keys and allocation percentages as values
2122
- */
2123
- async getAgentAllocation() {
2124
- const state = this.requireState();
2125
- const chainId = this.requireChainId();
2126
- const activeAgents = this.getActiveAgents();
2127
- const balances = {};
2128
- const positionsByAgent = {};
2129
- let totalBalance = 0;
2130
- const entries = [...activeAgents.entries()];
2131
- const balanceResults = await Promise.allSettled(
2132
- entries.map(async ([id, agent]) => {
2133
- const b = await agent.getBalances(state, chainId);
2134
- return [id, Number(b.totalBalance), b.positions ?? []];
2135
- })
2136
- );
2137
- let successCount = 0;
2138
- const agentErrors = {};
2139
- for (let i = 0; i < balanceResults.length; i++) {
2140
- const settledResult = balanceResults[i];
2141
- const [agentId] = entries[i];
2142
- if (settledResult.status === "fulfilled") {
2143
- const [id, bal, agentPositions] = settledResult.value;
2144
- balances[id] = bal;
2145
- positionsByAgent[id] = agentPositions;
2146
- totalBalance += bal;
2147
- successCount += 1;
2148
- } else {
2149
- const reason = settledResult.reason;
2150
- agentErrors[agentId] = reason instanceof Error ? reason.message : String(reason);
2151
- console.error(`getAgentAllocation agent "${agentId}" failed:`, reason);
2152
- }
2153
- }
2154
- if (successCount === 0) {
2155
- throw new OwneyError(
2156
- "ALLOCATION_ALL_FAILED",
2157
- "Failed to fetch allocation: all agents failed.",
2158
- { agentErrors }
2159
- );
2160
- }
2161
- const allocation = {};
2162
- if (totalBalance === 0) {
2163
- for (const id of activeAgents.keys()) {
2164
- allocation[id] = 0;
2165
- }
2166
- } else {
2167
- for (const id of activeAgents.keys()) {
2168
- allocation[id] = balances[id] > 0 ? Math.max(1, Math.floor(balances[id] / totalBalance * 100)) : 0;
2169
- }
2170
- const remainder = 100 - Object.values(allocation).reduce((a, b) => a + b, 0);
2171
- if (remainder > 0) {
2172
- const largestId = [...activeAgents.keys()].reduce(
2173
- (a, b) => balances[a] >= balances[b] ? a : b
2174
- );
2175
- allocation[largestId] += remainder;
2176
- }
2177
- }
2178
- return {
2179
- agentAllocation: allocation,
2180
- agentPositions: positionsByAgent
2181
- };
2182
- }
2183
2083
  /**
2184
2084
  * Allocation-weighted APY from the current portfolio: each pool's APY
2185
2085
  * weighted by the user's position value in it. More accurate per-user than
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@owney/sdk",
3
- "version": "0.6.0-beta.2",
3
+ "version": "0.6.0",
4
4
  "type": "module",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",