@owney/sdk 0.7.34 → 0.8.0-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/dist/index.d.cts CHANGED
@@ -302,7 +302,7 @@ interface ConnectionState {
302
302
  walletAddress: `0x${string}`;
303
303
  chainId: number | null;
304
304
  }
305
- declare const SUPPORTED_TOKENS: readonly ["USDC", "WETH"];
305
+ declare const SUPPORTED_TOKENS: readonly ["USDC", "WETH", "EURC", "USDT"];
306
306
  declare const SUPPORTED_CHAIN_IDS: readonly [8453, 42161, 1];
307
307
  declare const SUPPORTED_CHAINS: readonly ["BASE", "ARBITRUM", "ETHEREUM"];
308
308
  type OwneySupportedChainId = (typeof SUPPORTED_CHAIN_IDS)[number];
@@ -556,7 +556,7 @@ type AvailablePool = {
556
556
  type PoolSelectionStrategy = "aggressive" | "yieldmaxxing";
557
557
  /** One asset's explicit choice for a protocol on one chain. */
558
558
  type UserPoolSelection = {
559
- asset: "USDC" | "WETH";
559
+ asset: OwneySupportedTokens;
560
560
  protocolId: string;
561
561
  chainId: number;
562
562
  /** Names enabled by the user for this asset/protocol/chain. */
@@ -567,7 +567,7 @@ type UserPoolSelection = {
567
567
  /** The complete saved draft for the asset/chain legs selected in the deposit. */
568
568
  type UserPoolSelectionRequest = {
569
569
  strategies: Array<{
570
- asset: "USDC" | "WETH";
570
+ asset: OwneySupportedTokens;
571
571
  strategy: PoolSelectionStrategy;
572
572
  }>;
573
573
  selections: UserPoolSelection[];
@@ -579,7 +579,7 @@ type UserPoolSelectionRequest = {
579
579
  */
580
580
  type SavedPoolSelection = {
581
581
  strategies: Array<{
582
- asset: "USDC" | "WETH";
582
+ asset: OwneySupportedTokens;
583
583
  strategy: string;
584
584
  }>;
585
585
  pairs: Array<{
@@ -715,17 +715,31 @@ interface OwneyEarnings {
715
715
  agentEarnings: Record<AgentId, AgentEarnings>;
716
716
  }
717
717
  type ApyByChainAndAsset = Partial<Record<OwneySupportedChainId, Partial<Record<OwneySupportedTokens, number>>>>;
718
+ /** One external reward program contributing percentage points to a day. */
719
+ interface ApyIncentive {
720
+ source: "merkl";
721
+ agentId: AgentId;
722
+ opportunityId: string;
723
+ /** All on-chain campaigns represented by the opportunity APR that day. */
724
+ campaignIds: string[];
725
+ /** Source APR before portfolio weighting, expressed as a percentage. */
726
+ apr: number;
727
+ /** Percentage points to add to this point's native/provider `apy`. */
728
+ apyContribution: number;
729
+ }
718
730
  /** A single day's net APY for the connected account, as a percentage number. */
719
731
  interface ApyHistoryPoint {
720
732
  /** ISO date string for the day, e.g. "2026-06-20". */
721
733
  date: string;
722
- /** Net (after-fee) weighted APY for that day, summed across tokens. */
734
+ /** Native/provider net APY. External incentives are deliberately excluded. */
723
735
  apy: number;
724
736
  /** Balance on this date, in the explicitly named unit; never today's balance. */
725
737
  historicalBalance?: {
726
738
  amount: number;
727
739
  unit: string;
728
740
  };
741
+ /** Best-effort external rewards. Absent when none apply or cannot be read. */
742
+ incentives?: ApyIncentive[];
729
743
  }
730
744
  /**
731
745
  * What the APY chart's chain/asset menus are allowed to offer, and how far
@@ -963,7 +977,7 @@ interface IAgent {
963
977
  protocolId: string;
964
978
  chainId: number;
965
979
  }>;
966
- assets: Array<"USDC" | "WETH">;
980
+ assets: Array<OwneySupportedTokens>;
967
981
  }): Promise<SavedPoolSelection>;
968
982
  deposit(state: ConnectionState, chainId: number, amount: string, asset: OwneySupportedTokens, depositCallback?: DepositCallback): Promise<OwneyDepositResult>;
969
983
  withdraw(state: ConnectionState, chainId: number, token: OwneySupportedTokens, amount?: string): Promise<AgentWithdrawResult>;
@@ -1001,7 +1015,7 @@ interface IAgent {
1001
1015
  * backend models per-asset protocol selection implement it. Returns whether
1002
1016
  * a write occurred (`false` = already enabled / not supported).
1003
1017
  */
1004
- ensureAutoSelectProtocols?(state: ConnectionState, chainId: number, asset: "USDC" | "WETH"): Promise<boolean>;
1018
+ ensureAutoSelectProtocols?(state: ConnectionState, chainId: number, asset: OwneySupportedTokens): Promise<boolean>;
1005
1019
  getAgentApy(days: DailyApyDays, options?: AgentApyOptions): Promise<AgentApy>;
1006
1020
  }
1007
1021
  /**
@@ -1182,8 +1196,8 @@ declare class OwneySDK {
1182
1196
  private userPoolCustomization;
1183
1197
  private routingApiBaseUrl?;
1184
1198
  private referralSource?;
1185
- private cachedSponsoredCallback;
1186
- private cachedWethSponsoredCallback;
1199
+ private cachedSponsoredCallbacks;
1200
+ private cachedPermit2SponsoredCallbacks;
1187
1201
  private paymasterServiceUrl?;
1188
1202
  private cachedSponsoredCallsCallbacks;
1189
1203
  private readonly agentReads;
@@ -1224,19 +1238,18 @@ declare class OwneySDK {
1224
1238
  */
1225
1239
  private getDefaultSponsoredCallback;
1226
1240
  /**
1227
- * Lazily builds (and caches) the default Permit2 sponsored WETH deposit
1228
- * callback used when the caller omits `depositCallback` for a WETH
1229
- * deposit. Mirrors `getDefaultSponsoredCallback()` but signs a Permit2
1230
- * `PermitTransferFrom` instead of an EIP-3009 authorization.
1241
+ * Lazily builds (and caches, per asset) the default paymaster-sponsored
1242
+ * deposit callback used when the caller omits `depositCallback` and a
1243
+ * `paymasterServiceUrl` is configured. One rail serves every asset.
1231
1244
  */
1232
1245
  private getDefaultSponsoredCallsCallback;
1233
1246
  /**
1234
- * Lazily builds (and caches) the default Permit2 sponsored WETH deposit
1235
- * callback used when the caller omits `depositCallback` for a WETH deposit.
1236
- * Mirrors `getDefaultSponsoredCallback()` but signs a Permit2
1237
- * `PermitTransferFrom` instead of an EIP-3009 authorization.
1247
+ * Lazily builds (and caches, per asset) the default Permit2 sponsored
1248
+ * deposit callback used when the caller omits `depositCallback` for a
1249
+ * Permit2 asset (WETH, USDT). Mirrors `getDefaultSponsoredCallback()` but
1250
+ * signs a Permit2 `PermitTransferFrom` instead of an EIP-3009 authorization.
1238
1251
  */
1239
- private getDefaultWethSponsoredCallback;
1252
+ private getDefaultPermit2SponsoredCallback;
1240
1253
  private getAgent;
1241
1254
  private getActiveAgents;
1242
1255
  /**
@@ -1311,15 +1324,16 @@ declare class OwneySDK {
1311
1324
  *
1312
1325
  * 1. Missing Permit2 allowance: when the app did not supply its own
1313
1326
  * callback and the attempt fails with `PERMIT2_APPROVAL_REQUIRED` on a
1314
- * WETH deposit, this is the wallet's first gasless WETH deposit. We send
1315
- * the one-time (user-paid) Permit2 approval via `approvePermit2()` and
1316
- * retry the SAME sponsored attempt once. Bounded to one approval attempt
1317
- * per call so a wallet/agent that keeps reporting the allowance as
1318
- * missing can't loop forever. If `approvePermit2()` itself throws (e.g.
1327
+ * Permit2 asset (WETH, USDT), this is the wallet's first gasless deposit
1328
+ * of that asset on this chain. We send the one-time (user-paid) Permit2
1329
+ * approval via `approvePermit2(asset)` and retry the SAME sponsored
1330
+ * attempt once. Bounded to one approval attempt per call so a
1331
+ * wallet/agent that keeps reporting the allowance as missing can't loop
1332
+ * forever. If `approvePermit2()` itself throws (e.g.
1319
1333
  * the user rejects the wallet prompt), that error propagates as-is —
1320
1334
  * the user said no to a transaction, so we must not turn around and ask
1321
1335
  * them to pay for a different one via the fallback below.
1322
- * 2. `shouldFallbackToUserPaid`: the SDK's own WETH sponsor path failed at
1336
+ * 2. `shouldFallbackToUserPaid`: the SDK's own sponsor path failed at
1323
1337
  * the infrastructure layer in a provably safe-to-retry way, so we warn
1324
1338
  * and retry once with `undefined`, falling through to a user-paid
1325
1339
  * native deposit. This still applies after a successful Permit2
@@ -1426,23 +1440,26 @@ declare class OwneySDK {
1426
1440
  * figure directly. It is the entire arrival, so there is no slack: anything
1427
1441
  * that spends the target asset between the two fails the deposit outright.
1428
1442
  *
1429
- * Something does. A first WETH deposit needs a one-time Permit2 approval,
1430
- * and that approval is a transaction. A wallet holding no native gas token -
1431
- * the normal state of someone who just swapped everything INTO WETH - pays
1432
- * for it out of the WETH. The deposit then asked for ~2e12 wei more than was
1433
- * left and refused with DEPOSIT_INSUFFICIENT_BALANCE, under a wrapper saying
1434
- * the funds were safe but unadded (ROUT-242).
1443
+ * Something does. A first deposit of a Permit2 asset (WETH, USDT) needs a
1444
+ * one-time Permit2 approval, and that approval is a transaction. For WETH,
1445
+ * a wallet holding no native gas token - the normal state of someone who
1446
+ * just swapped everything INTO WETH - pays for it out of the WETH. The
1447
+ * deposit then asked for ~2e12 wei more than was left and refused with
1448
+ * DEPOSIT_INSUFFICIENT_BALANCE, under a wrapper saying the funds were safe
1449
+ * but unadded (ROUT-242). For USDT the gas cannot come out of the token, so
1450
+ * this step only adds the one-time approval and the read changes nothing.
1435
1451
  *
1436
1452
  * So the approval happens here, before the amount is settled, and the amount
1437
1453
  * comes from a read taken after it. Two things this deliberately is not:
1438
1454
  *
1439
1455
  * - It is not a balance sweep. `received` is a DELTA over the pre-swap
1440
- * balance, so a wallet already holding WETH reads far above it; depositing
1441
- * the balance would move funds the user never offered. The arrival is the
1442
- * ceiling and the balance is only ever allowed to lower it.
1443
- * - It does not touch USDC, which moves on signed typed data and so spends
1444
- * nothing of the user's in between, nor a paymaster-configured client,
1445
- * where the sponsor covers the transfer and Permit2 never applies.
1456
+ * balance, so a wallet already holding the asset reads far above it;
1457
+ * depositing the balance would move funds the user never offered. The
1458
+ * arrival is the ceiling and the balance is only ever allowed to lower it.
1459
+ * - It does not touch USDC or EURC, which move on signed typed data
1460
+ * (EIP-3009) and so spend nothing of the user's in between, nor a
1461
+ * paymaster-configured client, where the sponsor covers the transfer and
1462
+ * Permit2 never applies.
1446
1463
  */
1447
1464
  private settleSwapDepositAmount;
1448
1465
  /**
@@ -1844,10 +1861,11 @@ declare class OwneySDK {
1844
1861
  protocolId: string;
1845
1862
  chainId: number;
1846
1863
  }>;
1847
- assets: Array<"USDC" | "WETH">;
1864
+ assets: Array<OwneySupportedTokens>;
1848
1865
  agentId?: AgentId;
1849
1866
  }): Promise<SavedPoolSelection>;
1850
1867
  getAccountApy({ agentId, days, tokenSymbol, chainId: scope, }: AccountApyOptions): Promise<OwneyAccountApy | AccountAgentApy>;
1868
+ private enrichApyHistory;
1851
1869
  /**
1852
1870
  * Get transaction history for a specific agent, or all agents.
1853
1871
  *
@@ -1875,20 +1893,26 @@ declare class OwneySDK {
1875
1893
  /**
1876
1894
  * Ensure the given asset uses backend protocol auto-selection for the active
1877
1895
  * chain's account. No-op (returns false) for agents that don't support it.
1878
- * @param asset - "USDC" or "WETH".
1896
+ * @param asset - Asset symbol (e.g. "USDC").
1879
1897
  * @param agentId - Agent to target. Defaults to "zyfai".
1880
1898
  * @returns whether a profile write occurred.
1881
1899
  */
1882
- ensureAutoSelectProtocols(asset: "USDC" | "WETH", agentId?: AgentId): Promise<boolean>;
1900
+ ensureAutoSelectProtocols(asset: OwneySupportedTokens, agentId?: AgentId): Promise<boolean>;
1883
1901
  /**
1884
- * One-time, user-paid approval of Permit2 on the sponsored WETH token for
1885
- * the active chain. Required once per wallet per chain before gasless WETH
1886
- * deposits; afterwards deposit() is signature-only. Resolves only after the
1887
- * approval transaction is mined (1 confirmation), so a subsequent deposit()
1888
- * will see the new allowance; throws if the transaction reverted.
1902
+ * One-time, user-paid approval of Permit2 on the sponsored WETH (default) or
1903
+ * USDT token for the active chain. Required once per wallet per chain before
1904
+ * gasless deposits of that asset; afterwards deposit() is signature-only.
1905
+ * Resolves only after the approval transaction is mined (1 confirmation), so
1906
+ * a subsequent deposit() will see the new allowance; throws if the
1907
+ * transaction reverted.
1908
+ *
1909
+ * On mainnet USDT only (`needsAllowanceReset`), a non-zero existing allowance
1910
+ * is first zeroed in its own transaction. If the user rejects the second
1911
+ * prompt, the previous Permit2 allowance stays zeroed; calling this again
1912
+ * approves from zero in a single transaction.
1889
1913
  * @returns the approval transaction hash.
1890
1914
  */
1891
- approvePermit2(asset?: "WETH"): Promise<`0x${string}`>;
1915
+ approvePermit2(asset?: "WETH" | "USDT"): Promise<`0x${string}`>;
1892
1916
  /**
1893
1917
  * Get the agent's average APY performance over a time period. Does not require a wallet connection.
1894
1918
  * @param options - Contains agentId (optional) and days ("7D", "14D", or "30D")
@@ -2006,4 +2030,4 @@ type StoredOrder = {
2006
2030
  */
2007
2031
  declare function listOrders(now?: number): StoredOrder[];
2008
2032
 
2009
- export { type AccountAgentApy, type AccountApyOptions, type AccountDailyEarnings, type ActivateAgentOptions, type AgentApy, type AgentApyDetails, type AgentBalance, AgentChainIncompatibleError, type AgentEarnings, type AgentHistoryEntry, type AgentHistoryPosition, type AgentId, AgentNotFoundError, type AgentSupportedAsset, type AgentSupportedAssets, type AgentUserProfile, type AgentWithdrawResult, type AgentsApyOptions, type AllocationAgentApy, type AllocationApyOptions, type ApyByChainAndAsset, type ApyCoverage, type ApyHistoryPoint, type Asset, type AssetDailyEarnings, type AvailableAgent, type AvailableAgentsOptions, type AvailablePool, type ConnectionState, type DailyApyDays, type DailyEarningsOptions, type DailyEarningsPoint, type DepositCallback, type DepositOptions, type HistoryAction, type HistoryFilters, type HistoryOptions, type HistoryTransaction, type IAgent, InvalidHistoryCursorError, type LookbackDays, NotConnectedError, type OrgPoolPolicy, type OrgPoolSelection, type OwneyAccountApy, type OwneyAgentApy, type OwneyAgentHistory, type OwneyAllocationApy, type OwneyBalances, type OwneyDepositResult, type OwneyEarnings, OwneyError, type OwneyErrorCode, type OwneyMultiDepositResult, type OwneyPosition, OwneySDK, type OwneySDKConfig, type OwneySIWXConfig, type OwneySupportedChainId, type OwneySupportedChains, type OwneySupportedTokens, type OwneyToken, type OwneyUserProfile, type OwneyWithdrawAllLeg, type OwneyWithdrawAllResult, type OwneyWithdrawResult, type PendingDeposit, type PoolCatalogProtocol, type PoolSelectionStrategy, type RebalanceLog, type SavedPoolSelection, type SwapChainTokens, type SwapDirection, type SwapOrderStatus, type SwapQuote, type SwapQuoteParams, type SwapRail, type SwapStage, type SwapTokenInfo, type SwapTokenSearchResult, type UserPoolSelection, type UserPoolSelectionRequest, type WithdrawOptions, type WithdrawSwapRecord, type WithdrawSwapStatus, clearWithdrawSwap, createOwneySIWX, listPendingDeposits, listOrders as listPendingSwaps, listWithdrawSwaps, saveWithdrawSwap, setOwneyDebug, subscribeWithdrawSwaps, switchWalletConnectChain, updateWithdrawSwap };
2033
+ export { type AccountAgentApy, type AccountApyOptions, type AccountDailyEarnings, type ActivateAgentOptions, type AgentApy, type AgentApyDetails, type AgentBalance, AgentChainIncompatibleError, type AgentEarnings, type AgentHistoryEntry, type AgentHistoryPosition, type AgentId, AgentNotFoundError, type AgentSupportedAsset, type AgentSupportedAssets, type AgentUserProfile, type AgentWithdrawResult, type AgentsApyOptions, type AllocationAgentApy, type AllocationApyOptions, type ApyByChainAndAsset, type ApyCoverage, type ApyHistoryPoint, type ApyIncentive, type Asset, type AssetDailyEarnings, type AvailableAgent, type AvailableAgentsOptions, type AvailablePool, type ConnectionState, type DailyApyDays, type DailyEarningsOptions, type DailyEarningsPoint, type DepositCallback, type DepositOptions, type HistoryAction, type HistoryFilters, type HistoryOptions, type HistoryTransaction, type IAgent, InvalidHistoryCursorError, type LookbackDays, NotConnectedError, type OrgPoolPolicy, type OrgPoolSelection, type OwneyAccountApy, type OwneyAgentApy, type OwneyAgentHistory, type OwneyAllocationApy, type OwneyBalances, type OwneyDepositResult, type OwneyEarnings, OwneyError, type OwneyErrorCode, type OwneyMultiDepositResult, type OwneyPosition, OwneySDK, type OwneySDKConfig, type OwneySIWXConfig, type OwneySupportedChainId, type OwneySupportedChains, type OwneySupportedTokens, type OwneyToken, type OwneyUserProfile, type OwneyWithdrawAllLeg, type OwneyWithdrawAllResult, type OwneyWithdrawResult, type PendingDeposit, type PoolCatalogProtocol, type PoolSelectionStrategy, type RebalanceLog, type SavedPoolSelection, type SwapChainTokens, type SwapDirection, type SwapOrderStatus, type SwapQuote, type SwapQuoteParams, type SwapRail, type SwapStage, type SwapTokenInfo, type SwapTokenSearchResult, type UserPoolSelection, type UserPoolSelectionRequest, type WithdrawOptions, type WithdrawSwapRecord, type WithdrawSwapStatus, clearWithdrawSwap, createOwneySIWX, listPendingDeposits, listOrders as listPendingSwaps, listWithdrawSwaps, saveWithdrawSwap, setOwneyDebug, subscribeWithdrawSwaps, switchWalletConnectChain, updateWithdrawSwap };
package/dist/index.d.ts CHANGED
@@ -302,7 +302,7 @@ interface ConnectionState {
302
302
  walletAddress: `0x${string}`;
303
303
  chainId: number | null;
304
304
  }
305
- declare const SUPPORTED_TOKENS: readonly ["USDC", "WETH"];
305
+ declare const SUPPORTED_TOKENS: readonly ["USDC", "WETH", "EURC", "USDT"];
306
306
  declare const SUPPORTED_CHAIN_IDS: readonly [8453, 42161, 1];
307
307
  declare const SUPPORTED_CHAINS: readonly ["BASE", "ARBITRUM", "ETHEREUM"];
308
308
  type OwneySupportedChainId = (typeof SUPPORTED_CHAIN_IDS)[number];
@@ -556,7 +556,7 @@ type AvailablePool = {
556
556
  type PoolSelectionStrategy = "aggressive" | "yieldmaxxing";
557
557
  /** One asset's explicit choice for a protocol on one chain. */
558
558
  type UserPoolSelection = {
559
- asset: "USDC" | "WETH";
559
+ asset: OwneySupportedTokens;
560
560
  protocolId: string;
561
561
  chainId: number;
562
562
  /** Names enabled by the user for this asset/protocol/chain. */
@@ -567,7 +567,7 @@ type UserPoolSelection = {
567
567
  /** The complete saved draft for the asset/chain legs selected in the deposit. */
568
568
  type UserPoolSelectionRequest = {
569
569
  strategies: Array<{
570
- asset: "USDC" | "WETH";
570
+ asset: OwneySupportedTokens;
571
571
  strategy: PoolSelectionStrategy;
572
572
  }>;
573
573
  selections: UserPoolSelection[];
@@ -579,7 +579,7 @@ type UserPoolSelectionRequest = {
579
579
  */
580
580
  type SavedPoolSelection = {
581
581
  strategies: Array<{
582
- asset: "USDC" | "WETH";
582
+ asset: OwneySupportedTokens;
583
583
  strategy: string;
584
584
  }>;
585
585
  pairs: Array<{
@@ -715,17 +715,31 @@ interface OwneyEarnings {
715
715
  agentEarnings: Record<AgentId, AgentEarnings>;
716
716
  }
717
717
  type ApyByChainAndAsset = Partial<Record<OwneySupportedChainId, Partial<Record<OwneySupportedTokens, number>>>>;
718
+ /** One external reward program contributing percentage points to a day. */
719
+ interface ApyIncentive {
720
+ source: "merkl";
721
+ agentId: AgentId;
722
+ opportunityId: string;
723
+ /** All on-chain campaigns represented by the opportunity APR that day. */
724
+ campaignIds: string[];
725
+ /** Source APR before portfolio weighting, expressed as a percentage. */
726
+ apr: number;
727
+ /** Percentage points to add to this point's native/provider `apy`. */
728
+ apyContribution: number;
729
+ }
718
730
  /** A single day's net APY for the connected account, as a percentage number. */
719
731
  interface ApyHistoryPoint {
720
732
  /** ISO date string for the day, e.g. "2026-06-20". */
721
733
  date: string;
722
- /** Net (after-fee) weighted APY for that day, summed across tokens. */
734
+ /** Native/provider net APY. External incentives are deliberately excluded. */
723
735
  apy: number;
724
736
  /** Balance on this date, in the explicitly named unit; never today's balance. */
725
737
  historicalBalance?: {
726
738
  amount: number;
727
739
  unit: string;
728
740
  };
741
+ /** Best-effort external rewards. Absent when none apply or cannot be read. */
742
+ incentives?: ApyIncentive[];
729
743
  }
730
744
  /**
731
745
  * What the APY chart's chain/asset menus are allowed to offer, and how far
@@ -963,7 +977,7 @@ interface IAgent {
963
977
  protocolId: string;
964
978
  chainId: number;
965
979
  }>;
966
- assets: Array<"USDC" | "WETH">;
980
+ assets: Array<OwneySupportedTokens>;
967
981
  }): Promise<SavedPoolSelection>;
968
982
  deposit(state: ConnectionState, chainId: number, amount: string, asset: OwneySupportedTokens, depositCallback?: DepositCallback): Promise<OwneyDepositResult>;
969
983
  withdraw(state: ConnectionState, chainId: number, token: OwneySupportedTokens, amount?: string): Promise<AgentWithdrawResult>;
@@ -1001,7 +1015,7 @@ interface IAgent {
1001
1015
  * backend models per-asset protocol selection implement it. Returns whether
1002
1016
  * a write occurred (`false` = already enabled / not supported).
1003
1017
  */
1004
- ensureAutoSelectProtocols?(state: ConnectionState, chainId: number, asset: "USDC" | "WETH"): Promise<boolean>;
1018
+ ensureAutoSelectProtocols?(state: ConnectionState, chainId: number, asset: OwneySupportedTokens): Promise<boolean>;
1005
1019
  getAgentApy(days: DailyApyDays, options?: AgentApyOptions): Promise<AgentApy>;
1006
1020
  }
1007
1021
  /**
@@ -1182,8 +1196,8 @@ declare class OwneySDK {
1182
1196
  private userPoolCustomization;
1183
1197
  private routingApiBaseUrl?;
1184
1198
  private referralSource?;
1185
- private cachedSponsoredCallback;
1186
- private cachedWethSponsoredCallback;
1199
+ private cachedSponsoredCallbacks;
1200
+ private cachedPermit2SponsoredCallbacks;
1187
1201
  private paymasterServiceUrl?;
1188
1202
  private cachedSponsoredCallsCallbacks;
1189
1203
  private readonly agentReads;
@@ -1224,19 +1238,18 @@ declare class OwneySDK {
1224
1238
  */
1225
1239
  private getDefaultSponsoredCallback;
1226
1240
  /**
1227
- * Lazily builds (and caches) the default Permit2 sponsored WETH deposit
1228
- * callback used when the caller omits `depositCallback` for a WETH
1229
- * deposit. Mirrors `getDefaultSponsoredCallback()` but signs a Permit2
1230
- * `PermitTransferFrom` instead of an EIP-3009 authorization.
1241
+ * Lazily builds (and caches, per asset) the default paymaster-sponsored
1242
+ * deposit callback used when the caller omits `depositCallback` and a
1243
+ * `paymasterServiceUrl` is configured. One rail serves every asset.
1231
1244
  */
1232
1245
  private getDefaultSponsoredCallsCallback;
1233
1246
  /**
1234
- * Lazily builds (and caches) the default Permit2 sponsored WETH deposit
1235
- * callback used when the caller omits `depositCallback` for a WETH deposit.
1236
- * Mirrors `getDefaultSponsoredCallback()` but signs a Permit2
1237
- * `PermitTransferFrom` instead of an EIP-3009 authorization.
1247
+ * Lazily builds (and caches, per asset) the default Permit2 sponsored
1248
+ * deposit callback used when the caller omits `depositCallback` for a
1249
+ * Permit2 asset (WETH, USDT). Mirrors `getDefaultSponsoredCallback()` but
1250
+ * signs a Permit2 `PermitTransferFrom` instead of an EIP-3009 authorization.
1238
1251
  */
1239
- private getDefaultWethSponsoredCallback;
1252
+ private getDefaultPermit2SponsoredCallback;
1240
1253
  private getAgent;
1241
1254
  private getActiveAgents;
1242
1255
  /**
@@ -1311,15 +1324,16 @@ declare class OwneySDK {
1311
1324
  *
1312
1325
  * 1. Missing Permit2 allowance: when the app did not supply its own
1313
1326
  * callback and the attempt fails with `PERMIT2_APPROVAL_REQUIRED` on a
1314
- * WETH deposit, this is the wallet's first gasless WETH deposit. We send
1315
- * the one-time (user-paid) Permit2 approval via `approvePermit2()` and
1316
- * retry the SAME sponsored attempt once. Bounded to one approval attempt
1317
- * per call so a wallet/agent that keeps reporting the allowance as
1318
- * missing can't loop forever. If `approvePermit2()` itself throws (e.g.
1327
+ * Permit2 asset (WETH, USDT), this is the wallet's first gasless deposit
1328
+ * of that asset on this chain. We send the one-time (user-paid) Permit2
1329
+ * approval via `approvePermit2(asset)` and retry the SAME sponsored
1330
+ * attempt once. Bounded to one approval attempt per call so a
1331
+ * wallet/agent that keeps reporting the allowance as missing can't loop
1332
+ * forever. If `approvePermit2()` itself throws (e.g.
1319
1333
  * the user rejects the wallet prompt), that error propagates as-is —
1320
1334
  * the user said no to a transaction, so we must not turn around and ask
1321
1335
  * them to pay for a different one via the fallback below.
1322
- * 2. `shouldFallbackToUserPaid`: the SDK's own WETH sponsor path failed at
1336
+ * 2. `shouldFallbackToUserPaid`: the SDK's own sponsor path failed at
1323
1337
  * the infrastructure layer in a provably safe-to-retry way, so we warn
1324
1338
  * and retry once with `undefined`, falling through to a user-paid
1325
1339
  * native deposit. This still applies after a successful Permit2
@@ -1426,23 +1440,26 @@ declare class OwneySDK {
1426
1440
  * figure directly. It is the entire arrival, so there is no slack: anything
1427
1441
  * that spends the target asset between the two fails the deposit outright.
1428
1442
  *
1429
- * Something does. A first WETH deposit needs a one-time Permit2 approval,
1430
- * and that approval is a transaction. A wallet holding no native gas token -
1431
- * the normal state of someone who just swapped everything INTO WETH - pays
1432
- * for it out of the WETH. The deposit then asked for ~2e12 wei more than was
1433
- * left and refused with DEPOSIT_INSUFFICIENT_BALANCE, under a wrapper saying
1434
- * the funds were safe but unadded (ROUT-242).
1443
+ * Something does. A first deposit of a Permit2 asset (WETH, USDT) needs a
1444
+ * one-time Permit2 approval, and that approval is a transaction. For WETH,
1445
+ * a wallet holding no native gas token - the normal state of someone who
1446
+ * just swapped everything INTO WETH - pays for it out of the WETH. The
1447
+ * deposit then asked for ~2e12 wei more than was left and refused with
1448
+ * DEPOSIT_INSUFFICIENT_BALANCE, under a wrapper saying the funds were safe
1449
+ * but unadded (ROUT-242). For USDT the gas cannot come out of the token, so
1450
+ * this step only adds the one-time approval and the read changes nothing.
1435
1451
  *
1436
1452
  * So the approval happens here, before the amount is settled, and the amount
1437
1453
  * comes from a read taken after it. Two things this deliberately is not:
1438
1454
  *
1439
1455
  * - It is not a balance sweep. `received` is a DELTA over the pre-swap
1440
- * balance, so a wallet already holding WETH reads far above it; depositing
1441
- * the balance would move funds the user never offered. The arrival is the
1442
- * ceiling and the balance is only ever allowed to lower it.
1443
- * - It does not touch USDC, which moves on signed typed data and so spends
1444
- * nothing of the user's in between, nor a paymaster-configured client,
1445
- * where the sponsor covers the transfer and Permit2 never applies.
1456
+ * balance, so a wallet already holding the asset reads far above it;
1457
+ * depositing the balance would move funds the user never offered. The
1458
+ * arrival is the ceiling and the balance is only ever allowed to lower it.
1459
+ * - It does not touch USDC or EURC, which move on signed typed data
1460
+ * (EIP-3009) and so spend nothing of the user's in between, nor a
1461
+ * paymaster-configured client, where the sponsor covers the transfer and
1462
+ * Permit2 never applies.
1446
1463
  */
1447
1464
  private settleSwapDepositAmount;
1448
1465
  /**
@@ -1844,10 +1861,11 @@ declare class OwneySDK {
1844
1861
  protocolId: string;
1845
1862
  chainId: number;
1846
1863
  }>;
1847
- assets: Array<"USDC" | "WETH">;
1864
+ assets: Array<OwneySupportedTokens>;
1848
1865
  agentId?: AgentId;
1849
1866
  }): Promise<SavedPoolSelection>;
1850
1867
  getAccountApy({ agentId, days, tokenSymbol, chainId: scope, }: AccountApyOptions): Promise<OwneyAccountApy | AccountAgentApy>;
1868
+ private enrichApyHistory;
1851
1869
  /**
1852
1870
  * Get transaction history for a specific agent, or all agents.
1853
1871
  *
@@ -1875,20 +1893,26 @@ declare class OwneySDK {
1875
1893
  /**
1876
1894
  * Ensure the given asset uses backend protocol auto-selection for the active
1877
1895
  * chain's account. No-op (returns false) for agents that don't support it.
1878
- * @param asset - "USDC" or "WETH".
1896
+ * @param asset - Asset symbol (e.g. "USDC").
1879
1897
  * @param agentId - Agent to target. Defaults to "zyfai".
1880
1898
  * @returns whether a profile write occurred.
1881
1899
  */
1882
- ensureAutoSelectProtocols(asset: "USDC" | "WETH", agentId?: AgentId): Promise<boolean>;
1900
+ ensureAutoSelectProtocols(asset: OwneySupportedTokens, agentId?: AgentId): Promise<boolean>;
1883
1901
  /**
1884
- * One-time, user-paid approval of Permit2 on the sponsored WETH token for
1885
- * the active chain. Required once per wallet per chain before gasless WETH
1886
- * deposits; afterwards deposit() is signature-only. Resolves only after the
1887
- * approval transaction is mined (1 confirmation), so a subsequent deposit()
1888
- * will see the new allowance; throws if the transaction reverted.
1902
+ * One-time, user-paid approval of Permit2 on the sponsored WETH (default) or
1903
+ * USDT token for the active chain. Required once per wallet per chain before
1904
+ * gasless deposits of that asset; afterwards deposit() is signature-only.
1905
+ * Resolves only after the approval transaction is mined (1 confirmation), so
1906
+ * a subsequent deposit() will see the new allowance; throws if the
1907
+ * transaction reverted.
1908
+ *
1909
+ * On mainnet USDT only (`needsAllowanceReset`), a non-zero existing allowance
1910
+ * is first zeroed in its own transaction. If the user rejects the second
1911
+ * prompt, the previous Permit2 allowance stays zeroed; calling this again
1912
+ * approves from zero in a single transaction.
1889
1913
  * @returns the approval transaction hash.
1890
1914
  */
1891
- approvePermit2(asset?: "WETH"): Promise<`0x${string}`>;
1915
+ approvePermit2(asset?: "WETH" | "USDT"): Promise<`0x${string}`>;
1892
1916
  /**
1893
1917
  * Get the agent's average APY performance over a time period. Does not require a wallet connection.
1894
1918
  * @param options - Contains agentId (optional) and days ("7D", "14D", or "30D")
@@ -2006,4 +2030,4 @@ type StoredOrder = {
2006
2030
  */
2007
2031
  declare function listOrders(now?: number): StoredOrder[];
2008
2032
 
2009
- export { type AccountAgentApy, type AccountApyOptions, type AccountDailyEarnings, type ActivateAgentOptions, type AgentApy, type AgentApyDetails, type AgentBalance, AgentChainIncompatibleError, type AgentEarnings, type AgentHistoryEntry, type AgentHistoryPosition, type AgentId, AgentNotFoundError, type AgentSupportedAsset, type AgentSupportedAssets, type AgentUserProfile, type AgentWithdrawResult, type AgentsApyOptions, type AllocationAgentApy, type AllocationApyOptions, type ApyByChainAndAsset, type ApyCoverage, type ApyHistoryPoint, type Asset, type AssetDailyEarnings, type AvailableAgent, type AvailableAgentsOptions, type AvailablePool, type ConnectionState, type DailyApyDays, type DailyEarningsOptions, type DailyEarningsPoint, type DepositCallback, type DepositOptions, type HistoryAction, type HistoryFilters, type HistoryOptions, type HistoryTransaction, type IAgent, InvalidHistoryCursorError, type LookbackDays, NotConnectedError, type OrgPoolPolicy, type OrgPoolSelection, type OwneyAccountApy, type OwneyAgentApy, type OwneyAgentHistory, type OwneyAllocationApy, type OwneyBalances, type OwneyDepositResult, type OwneyEarnings, OwneyError, type OwneyErrorCode, type OwneyMultiDepositResult, type OwneyPosition, OwneySDK, type OwneySDKConfig, type OwneySIWXConfig, type OwneySupportedChainId, type OwneySupportedChains, type OwneySupportedTokens, type OwneyToken, type OwneyUserProfile, type OwneyWithdrawAllLeg, type OwneyWithdrawAllResult, type OwneyWithdrawResult, type PendingDeposit, type PoolCatalogProtocol, type PoolSelectionStrategy, type RebalanceLog, type SavedPoolSelection, type SwapChainTokens, type SwapDirection, type SwapOrderStatus, type SwapQuote, type SwapQuoteParams, type SwapRail, type SwapStage, type SwapTokenInfo, type SwapTokenSearchResult, type UserPoolSelection, type UserPoolSelectionRequest, type WithdrawOptions, type WithdrawSwapRecord, type WithdrawSwapStatus, clearWithdrawSwap, createOwneySIWX, listPendingDeposits, listOrders as listPendingSwaps, listWithdrawSwaps, saveWithdrawSwap, setOwneyDebug, subscribeWithdrawSwaps, switchWalletConnectChain, updateWithdrawSwap };
2033
+ export { type AccountAgentApy, type AccountApyOptions, type AccountDailyEarnings, type ActivateAgentOptions, type AgentApy, type AgentApyDetails, type AgentBalance, AgentChainIncompatibleError, type AgentEarnings, type AgentHistoryEntry, type AgentHistoryPosition, type AgentId, AgentNotFoundError, type AgentSupportedAsset, type AgentSupportedAssets, type AgentUserProfile, type AgentWithdrawResult, type AgentsApyOptions, type AllocationAgentApy, type AllocationApyOptions, type ApyByChainAndAsset, type ApyCoverage, type ApyHistoryPoint, type ApyIncentive, type Asset, type AssetDailyEarnings, type AvailableAgent, type AvailableAgentsOptions, type AvailablePool, type ConnectionState, type DailyApyDays, type DailyEarningsOptions, type DailyEarningsPoint, type DepositCallback, type DepositOptions, type HistoryAction, type HistoryFilters, type HistoryOptions, type HistoryTransaction, type IAgent, InvalidHistoryCursorError, type LookbackDays, NotConnectedError, type OrgPoolPolicy, type OrgPoolSelection, type OwneyAccountApy, type OwneyAgentApy, type OwneyAgentHistory, type OwneyAllocationApy, type OwneyBalances, type OwneyDepositResult, type OwneyEarnings, OwneyError, type OwneyErrorCode, type OwneyMultiDepositResult, type OwneyPosition, OwneySDK, type OwneySDKConfig, type OwneySIWXConfig, type OwneySupportedChainId, type OwneySupportedChains, type OwneySupportedTokens, type OwneyToken, type OwneyUserProfile, type OwneyWithdrawAllLeg, type OwneyWithdrawAllResult, type OwneyWithdrawResult, type PendingDeposit, type PoolCatalogProtocol, type PoolSelectionStrategy, type RebalanceLog, type SavedPoolSelection, type SwapChainTokens, type SwapDirection, type SwapOrderStatus, type SwapQuote, type SwapQuoteParams, type SwapRail, type SwapStage, type SwapTokenInfo, type SwapTokenSearchResult, type UserPoolSelection, type UserPoolSelectionRequest, type WithdrawOptions, type WithdrawSwapRecord, type WithdrawSwapStatus, clearWithdrawSwap, createOwneySIWX, listPendingDeposits, listOrders as listPendingSwaps, listWithdrawSwaps, saveWithdrawSwap, setOwneyDebug, subscribeWithdrawSwaps, switchWalletConnectChain, updateWithdrawSwap };