@owney/sdk 0.7.35 → 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/README.md +25 -4
- package/dist/index.cjs +319 -147
- package/dist/index.d.cts +53 -44
- package/dist/index.d.ts +53 -44
- package/dist/index.js +319 -147
- package/package.json +1 -1
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:
|
|
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:
|
|
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:
|
|
582
|
+
asset: OwneySupportedTokens;
|
|
583
583
|
strategy: string;
|
|
584
584
|
}>;
|
|
585
585
|
pairs: Array<{
|
|
@@ -977,7 +977,7 @@ interface IAgent {
|
|
|
977
977
|
protocolId: string;
|
|
978
978
|
chainId: number;
|
|
979
979
|
}>;
|
|
980
|
-
assets: Array<
|
|
980
|
+
assets: Array<OwneySupportedTokens>;
|
|
981
981
|
}): Promise<SavedPoolSelection>;
|
|
982
982
|
deposit(state: ConnectionState, chainId: number, amount: string, asset: OwneySupportedTokens, depositCallback?: DepositCallback): Promise<OwneyDepositResult>;
|
|
983
983
|
withdraw(state: ConnectionState, chainId: number, token: OwneySupportedTokens, amount?: string): Promise<AgentWithdrawResult>;
|
|
@@ -1015,7 +1015,7 @@ interface IAgent {
|
|
|
1015
1015
|
* backend models per-asset protocol selection implement it. Returns whether
|
|
1016
1016
|
* a write occurred (`false` = already enabled / not supported).
|
|
1017
1017
|
*/
|
|
1018
|
-
ensureAutoSelectProtocols?(state: ConnectionState, chainId: number, asset:
|
|
1018
|
+
ensureAutoSelectProtocols?(state: ConnectionState, chainId: number, asset: OwneySupportedTokens): Promise<boolean>;
|
|
1019
1019
|
getAgentApy(days: DailyApyDays, options?: AgentApyOptions): Promise<AgentApy>;
|
|
1020
1020
|
}
|
|
1021
1021
|
/**
|
|
@@ -1196,8 +1196,8 @@ declare class OwneySDK {
|
|
|
1196
1196
|
private userPoolCustomization;
|
|
1197
1197
|
private routingApiBaseUrl?;
|
|
1198
1198
|
private referralSource?;
|
|
1199
|
-
private
|
|
1200
|
-
private
|
|
1199
|
+
private cachedSponsoredCallbacks;
|
|
1200
|
+
private cachedPermit2SponsoredCallbacks;
|
|
1201
1201
|
private paymasterServiceUrl?;
|
|
1202
1202
|
private cachedSponsoredCallsCallbacks;
|
|
1203
1203
|
private readonly agentReads;
|
|
@@ -1238,19 +1238,18 @@ declare class OwneySDK {
|
|
|
1238
1238
|
*/
|
|
1239
1239
|
private getDefaultSponsoredCallback;
|
|
1240
1240
|
/**
|
|
1241
|
-
* Lazily builds (and caches) the default
|
|
1242
|
-
* callback used when the caller omits `depositCallback`
|
|
1243
|
-
*
|
|
1244
|
-
* `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.
|
|
1245
1244
|
*/
|
|
1246
1245
|
private getDefaultSponsoredCallsCallback;
|
|
1247
1246
|
/**
|
|
1248
|
-
* Lazily builds (and caches) the default Permit2 sponsored
|
|
1249
|
-
* callback used when the caller omits `depositCallback` for a
|
|
1250
|
-
* Mirrors `getDefaultSponsoredCallback()` but
|
|
1251
|
-
* `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.
|
|
1252
1251
|
*/
|
|
1253
|
-
private
|
|
1252
|
+
private getDefaultPermit2SponsoredCallback;
|
|
1254
1253
|
private getAgent;
|
|
1255
1254
|
private getActiveAgents;
|
|
1256
1255
|
/**
|
|
@@ -1325,15 +1324,16 @@ declare class OwneySDK {
|
|
|
1325
1324
|
*
|
|
1326
1325
|
* 1. Missing Permit2 allowance: when the app did not supply its own
|
|
1327
1326
|
* callback and the attempt fails with `PERMIT2_APPROVAL_REQUIRED` on a
|
|
1328
|
-
* WETH
|
|
1329
|
-
* the one-time (user-paid) Permit2
|
|
1330
|
-
* retry the SAME sponsored
|
|
1331
|
-
*
|
|
1332
|
-
*
|
|
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.
|
|
1333
1333
|
* the user rejects the wallet prompt), that error propagates as-is —
|
|
1334
1334
|
* the user said no to a transaction, so we must not turn around and ask
|
|
1335
1335
|
* them to pay for a different one via the fallback below.
|
|
1336
|
-
* 2. `shouldFallbackToUserPaid`: the SDK's own
|
|
1336
|
+
* 2. `shouldFallbackToUserPaid`: the SDK's own sponsor path failed at
|
|
1337
1337
|
* the infrastructure layer in a provably safe-to-retry way, so we warn
|
|
1338
1338
|
* and retry once with `undefined`, falling through to a user-paid
|
|
1339
1339
|
* native deposit. This still applies after a successful Permit2
|
|
@@ -1440,23 +1440,26 @@ declare class OwneySDK {
|
|
|
1440
1440
|
* figure directly. It is the entire arrival, so there is no slack: anything
|
|
1441
1441
|
* that spends the target asset between the two fails the deposit outright.
|
|
1442
1442
|
*
|
|
1443
|
-
* Something does. A first
|
|
1444
|
-
* and that approval is a transaction.
|
|
1445
|
-
*
|
|
1446
|
-
* for it out of the WETH. The
|
|
1447
|
-
*
|
|
1448
|
-
* the funds were safe
|
|
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.
|
|
1449
1451
|
*
|
|
1450
1452
|
* So the approval happens here, before the amount is settled, and the amount
|
|
1451
1453
|
* comes from a read taken after it. Two things this deliberately is not:
|
|
1452
1454
|
*
|
|
1453
1455
|
* - It is not a balance sweep. `received` is a DELTA over the pre-swap
|
|
1454
|
-
* balance, so a wallet already holding
|
|
1455
|
-
* the balance would move funds the user never offered. The
|
|
1456
|
-
* ceiling and the balance is only ever allowed to lower it.
|
|
1457
|
-
* - It does not touch USDC, which
|
|
1458
|
-
* nothing of the user's in between, nor a
|
|
1459
|
-
* where the sponsor covers the transfer and
|
|
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.
|
|
1460
1463
|
*/
|
|
1461
1464
|
private settleSwapDepositAmount;
|
|
1462
1465
|
/**
|
|
@@ -1858,7 +1861,7 @@ declare class OwneySDK {
|
|
|
1858
1861
|
protocolId: string;
|
|
1859
1862
|
chainId: number;
|
|
1860
1863
|
}>;
|
|
1861
|
-
assets: Array<
|
|
1864
|
+
assets: Array<OwneySupportedTokens>;
|
|
1862
1865
|
agentId?: AgentId;
|
|
1863
1866
|
}): Promise<SavedPoolSelection>;
|
|
1864
1867
|
getAccountApy({ agentId, days, tokenSymbol, chainId: scope, }: AccountApyOptions): Promise<OwneyAccountApy | AccountAgentApy>;
|
|
@@ -1890,20 +1893,26 @@ declare class OwneySDK {
|
|
|
1890
1893
|
/**
|
|
1891
1894
|
* Ensure the given asset uses backend protocol auto-selection for the active
|
|
1892
1895
|
* chain's account. No-op (returns false) for agents that don't support it.
|
|
1893
|
-
* @param asset -
|
|
1896
|
+
* @param asset - Asset symbol (e.g. "USDC").
|
|
1894
1897
|
* @param agentId - Agent to target. Defaults to "zyfai".
|
|
1895
1898
|
* @returns whether a profile write occurred.
|
|
1896
1899
|
*/
|
|
1897
|
-
ensureAutoSelectProtocols(asset:
|
|
1900
|
+
ensureAutoSelectProtocols(asset: OwneySupportedTokens, agentId?: AgentId): Promise<boolean>;
|
|
1898
1901
|
/**
|
|
1899
|
-
* One-time, user-paid approval of Permit2 on the sponsored WETH
|
|
1900
|
-
* the active chain. Required once per wallet per chain before
|
|
1901
|
-
* deposits; afterwards deposit() is signature-only.
|
|
1902
|
-
* approval transaction is mined (1 confirmation), so
|
|
1903
|
-
* will see the new allowance; throws if the
|
|
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.
|
|
1904
1913
|
* @returns the approval transaction hash.
|
|
1905
1914
|
*/
|
|
1906
|
-
approvePermit2(asset?: "WETH"): Promise<`0x${string}`>;
|
|
1915
|
+
approvePermit2(asset?: "WETH" | "USDT"): Promise<`0x${string}`>;
|
|
1907
1916
|
/**
|
|
1908
1917
|
* Get the agent's average APY performance over a time period. Does not require a wallet connection.
|
|
1909
1918
|
* @param options - Contains agentId (optional) and days ("7D", "14D", or "30D")
|
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:
|
|
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:
|
|
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:
|
|
582
|
+
asset: OwneySupportedTokens;
|
|
583
583
|
strategy: string;
|
|
584
584
|
}>;
|
|
585
585
|
pairs: Array<{
|
|
@@ -977,7 +977,7 @@ interface IAgent {
|
|
|
977
977
|
protocolId: string;
|
|
978
978
|
chainId: number;
|
|
979
979
|
}>;
|
|
980
|
-
assets: Array<
|
|
980
|
+
assets: Array<OwneySupportedTokens>;
|
|
981
981
|
}): Promise<SavedPoolSelection>;
|
|
982
982
|
deposit(state: ConnectionState, chainId: number, amount: string, asset: OwneySupportedTokens, depositCallback?: DepositCallback): Promise<OwneyDepositResult>;
|
|
983
983
|
withdraw(state: ConnectionState, chainId: number, token: OwneySupportedTokens, amount?: string): Promise<AgentWithdrawResult>;
|
|
@@ -1015,7 +1015,7 @@ interface IAgent {
|
|
|
1015
1015
|
* backend models per-asset protocol selection implement it. Returns whether
|
|
1016
1016
|
* a write occurred (`false` = already enabled / not supported).
|
|
1017
1017
|
*/
|
|
1018
|
-
ensureAutoSelectProtocols?(state: ConnectionState, chainId: number, asset:
|
|
1018
|
+
ensureAutoSelectProtocols?(state: ConnectionState, chainId: number, asset: OwneySupportedTokens): Promise<boolean>;
|
|
1019
1019
|
getAgentApy(days: DailyApyDays, options?: AgentApyOptions): Promise<AgentApy>;
|
|
1020
1020
|
}
|
|
1021
1021
|
/**
|
|
@@ -1196,8 +1196,8 @@ declare class OwneySDK {
|
|
|
1196
1196
|
private userPoolCustomization;
|
|
1197
1197
|
private routingApiBaseUrl?;
|
|
1198
1198
|
private referralSource?;
|
|
1199
|
-
private
|
|
1200
|
-
private
|
|
1199
|
+
private cachedSponsoredCallbacks;
|
|
1200
|
+
private cachedPermit2SponsoredCallbacks;
|
|
1201
1201
|
private paymasterServiceUrl?;
|
|
1202
1202
|
private cachedSponsoredCallsCallbacks;
|
|
1203
1203
|
private readonly agentReads;
|
|
@@ -1238,19 +1238,18 @@ declare class OwneySDK {
|
|
|
1238
1238
|
*/
|
|
1239
1239
|
private getDefaultSponsoredCallback;
|
|
1240
1240
|
/**
|
|
1241
|
-
* Lazily builds (and caches) the default
|
|
1242
|
-
* callback used when the caller omits `depositCallback`
|
|
1243
|
-
*
|
|
1244
|
-
* `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.
|
|
1245
1244
|
*/
|
|
1246
1245
|
private getDefaultSponsoredCallsCallback;
|
|
1247
1246
|
/**
|
|
1248
|
-
* Lazily builds (and caches) the default Permit2 sponsored
|
|
1249
|
-
* callback used when the caller omits `depositCallback` for a
|
|
1250
|
-
* Mirrors `getDefaultSponsoredCallback()` but
|
|
1251
|
-
* `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.
|
|
1252
1251
|
*/
|
|
1253
|
-
private
|
|
1252
|
+
private getDefaultPermit2SponsoredCallback;
|
|
1254
1253
|
private getAgent;
|
|
1255
1254
|
private getActiveAgents;
|
|
1256
1255
|
/**
|
|
@@ -1325,15 +1324,16 @@ declare class OwneySDK {
|
|
|
1325
1324
|
*
|
|
1326
1325
|
* 1. Missing Permit2 allowance: when the app did not supply its own
|
|
1327
1326
|
* callback and the attempt fails with `PERMIT2_APPROVAL_REQUIRED` on a
|
|
1328
|
-
* WETH
|
|
1329
|
-
* the one-time (user-paid) Permit2
|
|
1330
|
-
* retry the SAME sponsored
|
|
1331
|
-
*
|
|
1332
|
-
*
|
|
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.
|
|
1333
1333
|
* the user rejects the wallet prompt), that error propagates as-is —
|
|
1334
1334
|
* the user said no to a transaction, so we must not turn around and ask
|
|
1335
1335
|
* them to pay for a different one via the fallback below.
|
|
1336
|
-
* 2. `shouldFallbackToUserPaid`: the SDK's own
|
|
1336
|
+
* 2. `shouldFallbackToUserPaid`: the SDK's own sponsor path failed at
|
|
1337
1337
|
* the infrastructure layer in a provably safe-to-retry way, so we warn
|
|
1338
1338
|
* and retry once with `undefined`, falling through to a user-paid
|
|
1339
1339
|
* native deposit. This still applies after a successful Permit2
|
|
@@ -1440,23 +1440,26 @@ declare class OwneySDK {
|
|
|
1440
1440
|
* figure directly. It is the entire arrival, so there is no slack: anything
|
|
1441
1441
|
* that spends the target asset between the two fails the deposit outright.
|
|
1442
1442
|
*
|
|
1443
|
-
* Something does. A first
|
|
1444
|
-
* and that approval is a transaction.
|
|
1445
|
-
*
|
|
1446
|
-
* for it out of the WETH. The
|
|
1447
|
-
*
|
|
1448
|
-
* the funds were safe
|
|
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.
|
|
1449
1451
|
*
|
|
1450
1452
|
* So the approval happens here, before the amount is settled, and the amount
|
|
1451
1453
|
* comes from a read taken after it. Two things this deliberately is not:
|
|
1452
1454
|
*
|
|
1453
1455
|
* - It is not a balance sweep. `received` is a DELTA over the pre-swap
|
|
1454
|
-
* balance, so a wallet already holding
|
|
1455
|
-
* the balance would move funds the user never offered. The
|
|
1456
|
-
* ceiling and the balance is only ever allowed to lower it.
|
|
1457
|
-
* - It does not touch USDC, which
|
|
1458
|
-
* nothing of the user's in between, nor a
|
|
1459
|
-
* where the sponsor covers the transfer and
|
|
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.
|
|
1460
1463
|
*/
|
|
1461
1464
|
private settleSwapDepositAmount;
|
|
1462
1465
|
/**
|
|
@@ -1858,7 +1861,7 @@ declare class OwneySDK {
|
|
|
1858
1861
|
protocolId: string;
|
|
1859
1862
|
chainId: number;
|
|
1860
1863
|
}>;
|
|
1861
|
-
assets: Array<
|
|
1864
|
+
assets: Array<OwneySupportedTokens>;
|
|
1862
1865
|
agentId?: AgentId;
|
|
1863
1866
|
}): Promise<SavedPoolSelection>;
|
|
1864
1867
|
getAccountApy({ agentId, days, tokenSymbol, chainId: scope, }: AccountApyOptions): Promise<OwneyAccountApy | AccountAgentApy>;
|
|
@@ -1890,20 +1893,26 @@ declare class OwneySDK {
|
|
|
1890
1893
|
/**
|
|
1891
1894
|
* Ensure the given asset uses backend protocol auto-selection for the active
|
|
1892
1895
|
* chain's account. No-op (returns false) for agents that don't support it.
|
|
1893
|
-
* @param asset -
|
|
1896
|
+
* @param asset - Asset symbol (e.g. "USDC").
|
|
1894
1897
|
* @param agentId - Agent to target. Defaults to "zyfai".
|
|
1895
1898
|
* @returns whether a profile write occurred.
|
|
1896
1899
|
*/
|
|
1897
|
-
ensureAutoSelectProtocols(asset:
|
|
1900
|
+
ensureAutoSelectProtocols(asset: OwneySupportedTokens, agentId?: AgentId): Promise<boolean>;
|
|
1898
1901
|
/**
|
|
1899
|
-
* One-time, user-paid approval of Permit2 on the sponsored WETH
|
|
1900
|
-
* the active chain. Required once per wallet per chain before
|
|
1901
|
-
* deposits; afterwards deposit() is signature-only.
|
|
1902
|
-
* approval transaction is mined (1 confirmation), so
|
|
1903
|
-
* will see the new allowance; throws if the
|
|
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.
|
|
1904
1913
|
* @returns the approval transaction hash.
|
|
1905
1914
|
*/
|
|
1906
|
-
approvePermit2(asset?: "WETH"): Promise<`0x${string}`>;
|
|
1915
|
+
approvePermit2(asset?: "WETH" | "USDT"): Promise<`0x${string}`>;
|
|
1907
1916
|
/**
|
|
1908
1917
|
* Get the agent's average APY performance over a time period. Does not require a wallet connection.
|
|
1909
1918
|
* @param options - Contains agentId (optional) and days ("7D", "14D", or "30D")
|