@zyfai/sdk 0.3.0 → 0.4.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 +102 -34
- package/dist/index.d.mts +611 -78
- package/dist/index.d.ts +611 -78
- package/dist/index.js +609 -68
- package/dist/index.mjs +609 -68
- package/package.json +8 -3
package/dist/index.d.mts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { Chain, PublicClient, Address as Address$1 } from 'viem';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Public TypeScript types for `@zyfai/sdk` request/response shapes and events.
|
|
5
5
|
*/
|
|
6
|
+
/** Checksummed Ethereum address. */
|
|
6
7
|
type Address = `0x${string}`;
|
|
8
|
+
/** Hex-encoded byte string (e.g. signatures, calldata). */
|
|
7
9
|
type Hex = `0x${string}`;
|
|
8
10
|
/**
|
|
9
11
|
* Public strategy names.
|
|
@@ -13,14 +15,27 @@ type Hex = `0x${string}`;
|
|
|
13
15
|
type Strategy = "conservative" | "aggressive" | "yieldmaxxing";
|
|
14
16
|
/** Public asset symbols supported by the SDK */
|
|
15
17
|
type SupportedAsset = "USDC" | "WETH" | "EURC" | "NVDAc";
|
|
18
|
+
/** Optional per-chain RPC URLs for on-chain reads and writes. */
|
|
16
19
|
interface RpcUrlsConfig {
|
|
20
|
+
/** Ethereum mainnet */
|
|
17
21
|
1?: string;
|
|
22
|
+
/** Base */
|
|
18
23
|
8453?: string;
|
|
24
|
+
/** Arbitrum One */
|
|
19
25
|
42161?: string;
|
|
20
26
|
}
|
|
27
|
+
/**
|
|
28
|
+
* SDK constructor configuration.
|
|
29
|
+
*
|
|
30
|
+
* @remarks
|
|
31
|
+
* A single partner `apiKey` authenticates both execution and data API calls.
|
|
32
|
+
*/
|
|
21
33
|
interface SDKConfig {
|
|
34
|
+
/** Partner API key from [sdk.zyf.ai](https://sdk.zyf.ai). */
|
|
22
35
|
apiKey: string;
|
|
36
|
+
/** Override default viem RPC endpoints per chain. */
|
|
23
37
|
rpcUrls?: RpcUrlsConfig;
|
|
38
|
+
/** Optional attribution string sent on SIWE login. */
|
|
24
39
|
referralSource?: string;
|
|
25
40
|
/** @internal Local integration tests only — not part of the public SDK contract. */
|
|
26
41
|
executionApiUrl?: string;
|
|
@@ -29,6 +44,57 @@ interface SDKConfig {
|
|
|
29
44
|
/** @internal Override client-side minimum portfolio checks (local integration). */
|
|
30
45
|
bypassMinPortfolio?: boolean;
|
|
31
46
|
}
|
|
47
|
+
/** One-time prepare → deposit binding for MCP flows (least-unit amount). */
|
|
48
|
+
interface CreateAgentDepositIntentRequest {
|
|
49
|
+
chainId: number;
|
|
50
|
+
amount: string;
|
|
51
|
+
asset: SupportedAsset;
|
|
52
|
+
}
|
|
53
|
+
interface AgentDepositIntent {
|
|
54
|
+
actionId: string;
|
|
55
|
+
expiresAt: string;
|
|
56
|
+
signingTicket: string;
|
|
57
|
+
}
|
|
58
|
+
type AgentDepositIntentStatusValue = "pending" | "completed" | "expired";
|
|
59
|
+
interface AgentDepositIntentStatus {
|
|
60
|
+
status: AgentDepositIntentStatusValue;
|
|
61
|
+
actionId?: string;
|
|
62
|
+
depositId?: string;
|
|
63
|
+
txHash?: string;
|
|
64
|
+
chainId?: number;
|
|
65
|
+
asset?: string;
|
|
66
|
+
amount?: string;
|
|
67
|
+
}
|
|
68
|
+
interface ResolvedAgentDepositIntent {
|
|
69
|
+
actionId: string;
|
|
70
|
+
chainId: number;
|
|
71
|
+
asset: string;
|
|
72
|
+
amount: string;
|
|
73
|
+
status: AgentDepositIntentStatusValue;
|
|
74
|
+
ownerAddress: string;
|
|
75
|
+
expiresAt: string;
|
|
76
|
+
}
|
|
77
|
+
interface ConsumeAgentDepositIntentRequest {
|
|
78
|
+
chainId: number;
|
|
79
|
+
amount: string;
|
|
80
|
+
asset: SupportedAsset;
|
|
81
|
+
txHash: string;
|
|
82
|
+
depositId: string;
|
|
83
|
+
}
|
|
84
|
+
interface CompleteAgentDepositIntentRequest {
|
|
85
|
+
txHash: string;
|
|
86
|
+
depositId: string;
|
|
87
|
+
}
|
|
88
|
+
interface UserSessionAuth {
|
|
89
|
+
/** Zyfai execution API JWT from SIWE login. */
|
|
90
|
+
accessToken: string;
|
|
91
|
+
/** Authenticated user id when available. */
|
|
92
|
+
userId?: string;
|
|
93
|
+
/** User EOA address (checksum) for address binding checks. */
|
|
94
|
+
eoa?: Address;
|
|
95
|
+
/** Delegated MCP agent JWT (`channel=agent` on the execution API). */
|
|
96
|
+
channel?: "agent";
|
|
97
|
+
}
|
|
32
98
|
interface DeploySafeResponse {
|
|
33
99
|
success: boolean;
|
|
34
100
|
safeAddress: Address;
|
|
@@ -68,6 +134,22 @@ interface UpdateUserProfileResponse {
|
|
|
68
134
|
asset?: SupportedAsset;
|
|
69
135
|
}
|
|
70
136
|
/** @internal */
|
|
137
|
+
interface LoginResponse {
|
|
138
|
+
userId: string;
|
|
139
|
+
accessToken?: string;
|
|
140
|
+
refreshToken?: string;
|
|
141
|
+
tokenExpires?: number;
|
|
142
|
+
hasActiveSessionKey?: boolean;
|
|
143
|
+
smartWallet?: string | null;
|
|
144
|
+
/**
|
|
145
|
+
* True when the smart wallet was provisioned by the predeployment pool
|
|
146
|
+
* (backend-owned at deploy, rotated to the user on first deposit). Such
|
|
147
|
+
* wallets are already deployed with the agent session enabled, so the client
|
|
148
|
+
* skips deploy, never signs a session key, and never derives the address.
|
|
149
|
+
*/
|
|
150
|
+
predeployed?: boolean;
|
|
151
|
+
}
|
|
152
|
+
/** @internal */
|
|
71
153
|
interface AddSessionKeyResponse {
|
|
72
154
|
id: string;
|
|
73
155
|
hash: string;
|
|
@@ -410,9 +492,8 @@ interface OnchainEarnings {
|
|
|
410
492
|
totalEarningsByToken: TokenEarnings;
|
|
411
493
|
totalEarningsByChain?: ChainTokenEarnings;
|
|
412
494
|
/**
|
|
413
|
-
* Net totals: lifetime + unrealized + current × (1 - feeRate).
|
|
414
|
-
*
|
|
415
|
-
* Does not apply feeRate to lifetime (already crystallised).
|
|
495
|
+
* Net totals: (lifetime + unrealized + current) × (1 - feeRate).
|
|
496
|
+
* Ledger buckets are gross. Crystallized yield is fee × 10.
|
|
416
497
|
*/
|
|
417
498
|
totalEarningsByTokenWithFee: TokenEarnings;
|
|
418
499
|
totalEarningsByChainWithFee?: ChainTokenEarnings;
|
|
@@ -462,16 +543,20 @@ interface DebankPortfolioResponse {
|
|
|
462
543
|
totalValueUsd: number;
|
|
463
544
|
chains: Record<string, ChainPortfolio>;
|
|
464
545
|
}
|
|
546
|
+
/** Yield opportunity row from the data API opportunities endpoints. */
|
|
465
547
|
interface Opportunity {
|
|
548
|
+
/** Opportunity identifier. */
|
|
466
549
|
id: string;
|
|
467
550
|
protocolId: string;
|
|
468
551
|
protocolName: string;
|
|
469
552
|
poolName: string;
|
|
470
553
|
chainId: number;
|
|
554
|
+
/** Gross APY percentage. */
|
|
471
555
|
apy: number;
|
|
472
556
|
tvl?: number;
|
|
473
557
|
asset?: string;
|
|
474
558
|
risk?: string;
|
|
559
|
+
/** Public {@link Strategy} bucket for this pool. */
|
|
475
560
|
strategyType: Strategy;
|
|
476
561
|
status?: string;
|
|
477
562
|
}
|
|
@@ -521,19 +606,36 @@ interface RebalanceFrequencyResponse {
|
|
|
521
606
|
frequency: number;
|
|
522
607
|
description?: string;
|
|
523
608
|
}
|
|
609
|
+
/** Result of {@link ZyfaiSDK.sendDeposit} and {@link ZyfaiSDK.depositFunds}. */
|
|
524
610
|
interface DepositResponse {
|
|
525
611
|
success: boolean;
|
|
612
|
+
/** On-chain ERC-20 transfer transaction hash. */
|
|
526
613
|
txHash: string;
|
|
614
|
+
/** Safe address that received the transfer. */
|
|
527
615
|
smartWallet: string;
|
|
616
|
+
/** Deposited amount in least units (decimal string). */
|
|
528
617
|
amount: string;
|
|
529
|
-
/**
|
|
618
|
+
/**
|
|
619
|
+
* Deposit lifecycle record. After `sendDeposit`, status is usually
|
|
620
|
+
* `handover_pending` until {@link ZyfaiSDK.waitForDepositCredit} completes.
|
|
621
|
+
*/
|
|
530
622
|
registration: DepositLifecycleResponse;
|
|
531
623
|
}
|
|
624
|
+
/**
|
|
625
|
+
* Custody handover and balance-credit states for a registered deposit.
|
|
626
|
+
*
|
|
627
|
+
* @remarks
|
|
628
|
+
* `credited` with `balanceCredited: true` means funds are investable.
|
|
629
|
+
*/
|
|
532
630
|
type DepositLifecycleStatus = "handover_pending" | "credited" | "recovered_to_eoa";
|
|
631
|
+
/** Deposit registration and credit lifecycle (execution API). */
|
|
533
632
|
interface DepositLifecycleResponse {
|
|
633
|
+
/** Lifecycle id — pass to {@link ZyfaiSDK.getDepositStatus} / {@link ZyfaiSDK.waitForDepositCredit}. */
|
|
534
634
|
id: string;
|
|
535
635
|
status: DepositLifecycleStatus;
|
|
636
|
+
/** True when the Safe balance reflects the deposit. */
|
|
536
637
|
balanceCredited: boolean;
|
|
638
|
+
/** Backend URL for status polling (informational). */
|
|
537
639
|
statusUrl: string;
|
|
538
640
|
}
|
|
539
641
|
interface LogDepositResponse {
|
|
@@ -541,15 +643,21 @@ interface LogDepositResponse {
|
|
|
541
643
|
message: string;
|
|
542
644
|
deposit: DepositLifecycleResponse;
|
|
543
645
|
}
|
|
646
|
+
/** Polling overrides for {@link ZyfaiSDK.waitForDepositCredit}. */
|
|
544
647
|
interface WaitForDepositCreditOptions {
|
|
648
|
+
/** Milliseconds between {@link ZyfaiSDK.getDepositStatus} calls. */
|
|
545
649
|
intervalMs?: number;
|
|
650
|
+
/** Maximum wait before throwing `DepositCreditTimeoutError`. */
|
|
546
651
|
timeoutMs?: number;
|
|
547
652
|
}
|
|
653
|
+
/** Result of {@link ZyfaiSDK.withdrawFunds}. */
|
|
548
654
|
interface WithdrawResponse {
|
|
549
655
|
success: boolean;
|
|
550
656
|
message: string;
|
|
657
|
+
/** Present once the withdrawal transaction is submitted on-chain. */
|
|
551
658
|
txHash?: string;
|
|
552
659
|
type: "full" | "partial";
|
|
660
|
+
/** Withdrawn amount in least units (decimal string). */
|
|
553
661
|
amount: string;
|
|
554
662
|
}
|
|
555
663
|
interface AddWalletToSdkResponse {
|
|
@@ -582,7 +690,9 @@ interface UserPosition {
|
|
|
582
690
|
pool: string;
|
|
583
691
|
tvl: number;
|
|
584
692
|
}
|
|
693
|
+
/** Input for {@link ZyfaiSDK.simulateBestPositions}. */
|
|
585
694
|
interface SimulateBestPositionsParams {
|
|
695
|
+
/** Human-readable amount (not least units). */
|
|
586
696
|
amount: number;
|
|
587
697
|
token: string;
|
|
588
698
|
networks: number | number[];
|
|
@@ -629,6 +739,7 @@ interface ExcludedPool {
|
|
|
629
739
|
detail: string;
|
|
630
740
|
failed_checks?: string[];
|
|
631
741
|
}
|
|
742
|
+
/** Simulation result keyed by chain id string. */
|
|
632
743
|
interface SimulateBestPositionsResponse {
|
|
633
744
|
success: boolean;
|
|
634
745
|
data: Record<string, SimulatedPosition[]>;
|
|
@@ -685,10 +796,13 @@ interface RegisterAgentResponse {
|
|
|
685
796
|
chainId: number;
|
|
686
797
|
smartWallet: string;
|
|
687
798
|
}
|
|
799
|
+
/** One protocol/pool customization row for {@link ZyfaiSDK.customizeBatch}. */
|
|
688
800
|
interface CustomizationConfig {
|
|
689
801
|
protocolId: string;
|
|
802
|
+
/** Pool display names; empty when `autoselect` is true. */
|
|
690
803
|
pools: string[];
|
|
691
804
|
chainId: number;
|
|
805
|
+
/** When true, the engine picks pools automatically. */
|
|
692
806
|
autoselect: boolean;
|
|
693
807
|
}
|
|
694
808
|
interface CustomizeBatchRequest {
|
|
@@ -797,11 +911,13 @@ interface LiquidityDropEvent {
|
|
|
797
911
|
windowMinutes: number;
|
|
798
912
|
timestamp: string;
|
|
799
913
|
}
|
|
914
|
+
/** Optional subscribe filters for {@link ZyfaiSDK.subscribeToEvents}. */
|
|
800
915
|
interface ZyfaiEventFilters {
|
|
801
916
|
chains?: string[];
|
|
802
917
|
protocols?: string[];
|
|
803
918
|
pools?: string[];
|
|
804
919
|
}
|
|
920
|
+
/** WebSocket event callbacks for {@link ZyfaiSDK.subscribeToEvents}. */
|
|
805
921
|
interface ZyfaiEventHandlers {
|
|
806
922
|
onDepeg?: (data: DepegEvent) => void;
|
|
807
923
|
onNewCollateralDetected?: (data: NewCollateralDetectedEvent) => void;
|
|
@@ -810,32 +926,49 @@ interface ZyfaiEventHandlers {
|
|
|
810
926
|
}
|
|
811
927
|
|
|
812
928
|
/**
|
|
813
|
-
* Chain
|
|
814
|
-
*
|
|
929
|
+
* Chain configuration for SDK execution chains (Ethereum, Base, Arbitrum).
|
|
930
|
+
*
|
|
931
|
+
* @remarks
|
|
932
|
+
* Sonic and other data-only chains may appear in asset metadata but are not
|
|
933
|
+
* {@link SupportedChainId} execution targets.
|
|
815
934
|
*/
|
|
816
935
|
|
|
936
|
+
/** Chain IDs supported for deposits, withdrawals, and on-chain SDK calls. */
|
|
817
937
|
type SupportedChainId = 1 | 8453 | 42161;
|
|
938
|
+
/** viem chain, RPC URL, and public client for a {@link SupportedChainId}. */
|
|
818
939
|
interface ChainConfig {
|
|
819
940
|
chain: Chain;
|
|
820
941
|
rpcUrl: string;
|
|
821
942
|
publicClient: PublicClient;
|
|
822
943
|
}
|
|
944
|
+
/** Default USDC token addresses per execution chain. */
|
|
823
945
|
declare const DEFAULT_TOKEN_ADDRESSES: Record<SupportedChainId, string>;
|
|
946
|
+
/**
|
|
947
|
+
* Resolve the canonical ERC-20 address for an asset on a chain.
|
|
948
|
+
*
|
|
949
|
+
* @param chainId - Execution chain
|
|
950
|
+
* @param asset - Asset symbol (defaults to USDC)
|
|
951
|
+
* @returns Token contract address
|
|
952
|
+
* @throws If the asset is not configured on the chain
|
|
953
|
+
*/
|
|
824
954
|
declare const getDefaultTokenAddress: (chainId: SupportedChainId, asset?: string) => string;
|
|
825
955
|
/**
|
|
826
956
|
* Get chain configuration for a given chain ID.
|
|
827
957
|
*
|
|
828
958
|
* @param chainId - Supported chain ID
|
|
829
|
-
* @param rpcUrls - Optional per-chain RPC URL overrides
|
|
959
|
+
* @param rpcUrls - Optional per-chain RPC URL overrides from {@link SDKConfig}
|
|
960
|
+
* @returns Chain metadata and a viem `PublicClient`
|
|
961
|
+
* @throws If `chainId` is not supported
|
|
830
962
|
*/
|
|
831
963
|
declare const getChainConfig: (chainId: SupportedChainId, rpcUrls?: RpcUrlsConfig) => ChainConfig;
|
|
832
964
|
/**
|
|
833
|
-
* Check
|
|
965
|
+
* Check whether a numeric chain id is an SDK execution chain.
|
|
966
|
+
*
|
|
967
|
+
* @param chainId - Chain id to test
|
|
968
|
+
* @returns True when `chainId` is {@link SupportedChainId}
|
|
834
969
|
*/
|
|
835
970
|
declare const isSupportedChain: (chainId: number) => chainId is SupportedChainId;
|
|
836
|
-
/**
|
|
837
|
-
* Get all supported chain IDs
|
|
838
|
-
*/
|
|
971
|
+
/** List all {@link SupportedChainId} values. */
|
|
839
972
|
declare const getSupportedChainIds: () => SupportedChainId[];
|
|
840
973
|
|
|
841
974
|
/**
|
|
@@ -852,6 +985,20 @@ type DailyApyHistoryPeriod = `${AllowedHistoryDays}D`;
|
|
|
852
985
|
* Zyfai SDK Main Class
|
|
853
986
|
*/
|
|
854
987
|
|
|
988
|
+
/**
|
|
989
|
+
* Client for Zyfai execution (`api.zyf.ai`) and intelligence (`defiapi.zyf.ai`) APIs.
|
|
990
|
+
*
|
|
991
|
+
* @remarks
|
|
992
|
+
* The connected wallet from {@link ZyfaiSDK.connectAccount} is used for **signing only**
|
|
993
|
+
* (SIWE, on-chain transfers). Pass the user's **EOA** as `userAddress` on execution
|
|
994
|
+
* methods; the backend resolves the assigned Safe.
|
|
995
|
+
*
|
|
996
|
+
* First-time onboarding uses predeployed Safes: {@link ZyfaiSDK.sendDeposit} handles
|
|
997
|
+
* session and deploy-on-first-deposit without {@link ZyfaiSDK.deploySafe} or
|
|
998
|
+
* {@link ZyfaiSDK.createSessionKey}.
|
|
999
|
+
*
|
|
1000
|
+
* @see {@link https://docs.zyf.ai/docs/sdk/agent-quickstart | Agent quickstart}
|
|
1001
|
+
*/
|
|
855
1002
|
declare class ZyfaiSDK {
|
|
856
1003
|
private httpClient;
|
|
857
1004
|
private signer;
|
|
@@ -859,11 +1006,63 @@ declare class ZyfaiSDK {
|
|
|
859
1006
|
private authenticatedUserId;
|
|
860
1007
|
private hasActiveSessionKey;
|
|
861
1008
|
private isPredeployed;
|
|
1009
|
+
/** False until SIWE login or GET /users/me has set `isPredeployed`. */
|
|
1010
|
+
private predeployedResolved;
|
|
862
1011
|
private connectedSmartWallet;
|
|
863
1012
|
private currentProvider;
|
|
864
1013
|
private currentChainId;
|
|
865
1014
|
private rpcUrls?;
|
|
866
1015
|
private referralSource?;
|
|
1016
|
+
/** EOA of the active user session (bearer or SIWE). Cleared on disconnect. */
|
|
1017
|
+
private sessionEoa;
|
|
1018
|
+
/** When set, profile writes use agent-accessible endpoints instead of PATCH /users/me. */
|
|
1019
|
+
private sessionChannel?;
|
|
1020
|
+
/**
|
|
1021
|
+
* Create an SDK instance with an existing Zyfai user JWT (no wallet connected).
|
|
1022
|
+
*
|
|
1023
|
+
* @group Authentication and wallet
|
|
1024
|
+
*/
|
|
1025
|
+
static forUser(config: SDKConfig | string, session: UserSessionAuth): ZyfaiSDK;
|
|
1026
|
+
/** Alias for MCP delegated grants (scoped agent JWT). */
|
|
1027
|
+
static forDelegatedGrant(config: SDKConfig | string, session: UserSessionAuth): ZyfaiSDK;
|
|
1028
|
+
/**
|
|
1029
|
+
* Attach a Zyfai user JWT for API calls without `connectAccount`.
|
|
1030
|
+
*
|
|
1031
|
+
* @group Authentication and wallet
|
|
1032
|
+
*/
|
|
1033
|
+
applyUserSession(session: UserSessionAuth): void;
|
|
1034
|
+
/**
|
|
1035
|
+
* @internal Attach headers to execution API requests (MCP server agent channel).
|
|
1036
|
+
*/
|
|
1037
|
+
setExecutionRequestHeaders(headers: Record<string, string>): void;
|
|
1038
|
+
/** EOA of the active user session, if one is bound. */
|
|
1039
|
+
getSessionEoa(): Address | null;
|
|
1040
|
+
/**
|
|
1041
|
+
* Complete SIWE login with a prepared message and signature (OAuth consent, MCP).
|
|
1042
|
+
*
|
|
1043
|
+
* @group Authentication and wallet
|
|
1044
|
+
*
|
|
1045
|
+
* @param params.message - SIWE message fields (same shape as login API body)
|
|
1046
|
+
* @param params.signature - Wallet signature over the prepared SIWE string
|
|
1047
|
+
* @param params.origin - Origin header value; must match `message.uri`
|
|
1048
|
+
*/
|
|
1049
|
+
authenticateWithSignature(params: {
|
|
1050
|
+
message: {
|
|
1051
|
+
address: string;
|
|
1052
|
+
chainId: number;
|
|
1053
|
+
domain: string;
|
|
1054
|
+
nonce: string;
|
|
1055
|
+
statement?: string;
|
|
1056
|
+
uri: string;
|
|
1057
|
+
version: string;
|
|
1058
|
+
issuedAt: string;
|
|
1059
|
+
resources?: string[];
|
|
1060
|
+
notBefore?: string;
|
|
1061
|
+
expirationTime?: string;
|
|
1062
|
+
};
|
|
1063
|
+
signature: Hex;
|
|
1064
|
+
origin?: string;
|
|
1065
|
+
}): Promise<LoginResponse>;
|
|
867
1066
|
/**
|
|
868
1067
|
* Warn that a legacy method is deprecated in favor of sendDeposit.
|
|
869
1068
|
* Predeployed wallets no longer require deploySafe / createSessionKey.
|
|
@@ -871,6 +1070,22 @@ declare class ZyfaiSDK {
|
|
|
871
1070
|
private warnDeprecatedOnboardingMethod;
|
|
872
1071
|
private readonly executionApiUrl;
|
|
873
1072
|
private readonly bypassMinPortfolio;
|
|
1073
|
+
/**
|
|
1074
|
+
* Create an SDK instance bound to a partner API key.
|
|
1075
|
+
*
|
|
1076
|
+
* @param config - API key string or {@link SDKConfig} with optional `rpcUrls` and `referralSource`
|
|
1077
|
+
*
|
|
1078
|
+
* @remarks
|
|
1079
|
+
* `@internal` fields on {@link SDKConfig} (`executionApiUrl`, `dataApiUrl`,
|
|
1080
|
+
* `bypassMinPortfolio`) are for local integration tests only.
|
|
1081
|
+
*
|
|
1082
|
+
* @throws If `apiKey` is missing
|
|
1083
|
+
*
|
|
1084
|
+
* @example
|
|
1085
|
+
* ```typescript
|
|
1086
|
+
* const sdk = new ZyfaiSDK({ apiKey: process.env.ZYFAI_API_KEY! });
|
|
1087
|
+
* ```
|
|
1088
|
+
*/
|
|
874
1089
|
constructor(config: SDKConfig | string);
|
|
875
1090
|
/**
|
|
876
1091
|
* Authenticate user with SIWE (Sign-In with Ethereum) & JWT token
|
|
@@ -884,8 +1099,12 @@ declare class ZyfaiSDK {
|
|
|
884
1099
|
* Update user profile with Smart Wallet address and chain configuration
|
|
885
1100
|
* This method requires SIWE authentication and is automatically called after deploySafe
|
|
886
1101
|
*
|
|
887
|
-
* @
|
|
888
|
-
*
|
|
1102
|
+
* @group Portfolio and execution
|
|
1103
|
+
*
|
|
1104
|
+
* @param request - Profile fields to update (per-asset settings supported)
|
|
1105
|
+
* @returns Updated user profile from the execution API
|
|
1106
|
+
*
|
|
1107
|
+
* @throws If strategy is invalid or authentication fails
|
|
889
1108
|
*
|
|
890
1109
|
* @example
|
|
891
1110
|
* ```typescript
|
|
@@ -900,8 +1119,12 @@ declare class ZyfaiSDK {
|
|
|
900
1119
|
* Pause the agent by clearing all protocols
|
|
901
1120
|
* Sets the user's protocols to an empty array, effectively pausing automated operations
|
|
902
1121
|
*
|
|
1122
|
+
* @group Portfolio and execution
|
|
1123
|
+
*
|
|
903
1124
|
* @returns Response indicating success and updated user details
|
|
904
1125
|
*
|
|
1126
|
+
* @remarks Requires {@link ZyfaiSDK.connectAccount} (SIWE).
|
|
1127
|
+
*
|
|
905
1128
|
* @example
|
|
906
1129
|
* ```typescript
|
|
907
1130
|
* const sdk = new ZyfaiSDK({ apiKey: 'your-api-key' });
|
|
@@ -919,8 +1142,12 @@ declare class ZyfaiSDK {
|
|
|
919
1142
|
* Resume the agent by restoring protocols based on user's strategy for each asset
|
|
920
1143
|
* Fetches available protocols and assigns them based on each asset's strategy
|
|
921
1144
|
*
|
|
1145
|
+
* @group Portfolio and execution
|
|
1146
|
+
*
|
|
922
1147
|
* @returns Response indicating success and updated user details
|
|
923
1148
|
*
|
|
1149
|
+
* @remarks Requires {@link ZyfaiSDK.connectAccount} (SIWE).
|
|
1150
|
+
*
|
|
924
1151
|
* @example
|
|
925
1152
|
* ```typescript
|
|
926
1153
|
* const sdk = new ZyfaiSDK({ apiKey: 'your-api-key' });
|
|
@@ -938,9 +1165,16 @@ declare class ZyfaiSDK {
|
|
|
938
1165
|
* Enable splitting for the user's account
|
|
939
1166
|
* When enabled, deposits are split across multiple protocols based on minSplits setting
|
|
940
1167
|
*
|
|
941
|
-
* @
|
|
1168
|
+
* @group Portfolio and execution
|
|
1169
|
+
*
|
|
1170
|
+
* @param minSplits - Minimum protocols to split across (max 4)
|
|
1171
|
+
* @defaultValue 1
|
|
942
1172
|
* @returns Response indicating success and updated user details
|
|
943
1173
|
*
|
|
1174
|
+
* @remarks Requires {@link ZyfaiSDK.connectAccount} (SIWE).
|
|
1175
|
+
*
|
|
1176
|
+
* @throws If `minSplits` exceeds 4
|
|
1177
|
+
*
|
|
944
1178
|
* @example
|
|
945
1179
|
* ```typescript
|
|
946
1180
|
* const sdk = new ZyfaiSDK({ apiKey: 'your-api-key' });
|
|
@@ -958,8 +1192,12 @@ declare class ZyfaiSDK {
|
|
|
958
1192
|
* Disable splitting for the user's account
|
|
959
1193
|
* When disabled, deposits will not be split across multiple protocols
|
|
960
1194
|
*
|
|
1195
|
+
* @group Portfolio and execution
|
|
1196
|
+
*
|
|
961
1197
|
* @returns Response indicating success and updated user details
|
|
962
1198
|
*
|
|
1199
|
+
* @remarks Requires {@link ZyfaiSDK.connectAccount} (SIWE).
|
|
1200
|
+
*
|
|
963
1201
|
* @example
|
|
964
1202
|
* ```typescript
|
|
965
1203
|
* const sdk = new ZyfaiSDK({ apiKey: 'your-api-key' });
|
|
@@ -977,9 +1215,13 @@ declare class ZyfaiSDK {
|
|
|
977
1215
|
* Update the minimum number of splits for the user's account
|
|
978
1216
|
* This controls across how many protocols deposits should be distributed
|
|
979
1217
|
*
|
|
980
|
-
* @
|
|
1218
|
+
* @group Portfolio and execution
|
|
1219
|
+
*
|
|
1220
|
+
* @param minSplits - Minimum number of protocols to split across (at least 1)
|
|
981
1221
|
* @returns Response indicating success and updated user details
|
|
982
1222
|
*
|
|
1223
|
+
* @throws If `minSplits` is less than 1
|
|
1224
|
+
*
|
|
983
1225
|
* @example
|
|
984
1226
|
* ```typescript
|
|
985
1227
|
* const sdk = new ZyfaiSDK({ apiKey: 'your-api-key' });
|
|
@@ -1015,12 +1257,20 @@ declare class ZyfaiSDK {
|
|
|
1015
1257
|
*/
|
|
1016
1258
|
private handleAccountsChanged;
|
|
1017
1259
|
/**
|
|
1018
|
-
* Connect account for signing
|
|
1019
|
-
*
|
|
1260
|
+
* Connect an account for signing (SIWE and on-chain transfers).
|
|
1261
|
+
*
|
|
1262
|
+
* @remarks
|
|
1263
|
+
* Required before user-scoped execution calls (deposits, withdrawals, profile).
|
|
1264
|
+
* Data API reads typically need only the API key.
|
|
1265
|
+
*
|
|
1266
|
+
* @group Authentication and wallet
|
|
1020
1267
|
*
|
|
1021
|
-
* @param account - Private key string or wallet provider
|
|
1022
|
-
* @param chainId -
|
|
1023
|
-
* @
|
|
1268
|
+
* @param account - Private key hex string or EIP-1193 wallet provider
|
|
1269
|
+
* @param chainId - Initial chain for RPC and SIWE
|
|
1270
|
+
* @defaultValue 8453
|
|
1271
|
+
* @returns The connected EOA address (checksum)
|
|
1272
|
+
*
|
|
1273
|
+
* @throws If the chain is unsupported or the provider returns no accounts
|
|
1024
1274
|
*
|
|
1025
1275
|
* @example
|
|
1026
1276
|
* // With private key
|
|
@@ -1033,8 +1283,11 @@ declare class ZyfaiSDK {
|
|
|
1033
1283
|
*/
|
|
1034
1284
|
connectAccount(account: string | any, chainId?: SupportedChainId): Promise<Address>;
|
|
1035
1285
|
/**
|
|
1036
|
-
*
|
|
1037
|
-
*
|
|
1286
|
+
* Clear the connected wallet, SIWE session, and cached smart-wallet state.
|
|
1287
|
+
*
|
|
1288
|
+
* @group Authentication and wallet
|
|
1289
|
+
*
|
|
1290
|
+
* @returns Resolves when local SDK state is cleared
|
|
1038
1291
|
*
|
|
1039
1292
|
* @example
|
|
1040
1293
|
* ```typescript
|
|
@@ -1049,10 +1302,16 @@ declare class ZyfaiSDK {
|
|
|
1049
1302
|
*/
|
|
1050
1303
|
private getWalletClient;
|
|
1051
1304
|
/**
|
|
1052
|
-
* True when userAddress is the
|
|
1305
|
+
* True when userAddress is the signer, wallet client, or agent session EOA.
|
|
1053
1306
|
* @private
|
|
1054
1307
|
*/
|
|
1055
1308
|
private isConnectedUser;
|
|
1309
|
+
/**
|
|
1310
|
+
* SIWE login sets predeployed. Agent sessions (`forUser`) do not, so read it
|
|
1311
|
+
* from the user record before allowing a transfer to an undeployed pool Safe.
|
|
1312
|
+
* @private
|
|
1313
|
+
*/
|
|
1314
|
+
private hydrateSessionWallet;
|
|
1056
1315
|
/**
|
|
1057
1316
|
* Resolve the Safe address: backend-assigned for the connected predeployed
|
|
1058
1317
|
* user, registered agent for everyone else. If none, CREATE2-derive when
|
|
@@ -1061,24 +1320,32 @@ declare class ZyfaiSDK {
|
|
|
1061
1320
|
*/
|
|
1062
1321
|
private getSafeAddressFor;
|
|
1063
1322
|
/**
|
|
1064
|
-
*
|
|
1065
|
-
*
|
|
1066
|
-
*
|
|
1323
|
+
* Resolve the Safe smart wallet for an EOA on a chain.
|
|
1324
|
+
*
|
|
1325
|
+
* @remarks
|
|
1326
|
+
* Predeployed pool wallets use a backend-assigned address; legacy wallets use
|
|
1327
|
+
* a deterministic CREATE2 address.
|
|
1328
|
+
*
|
|
1329
|
+
* @group Authentication and wallet
|
|
1067
1330
|
*
|
|
1068
1331
|
* @param userAddress - User's EOA address
|
|
1069
1332
|
* @param chainId - Target chain ID
|
|
1070
|
-
* @returns Smart wallet address, deployment status, and
|
|
1071
|
-
*
|
|
1072
|
-
*
|
|
1333
|
+
* @returns Smart wallet address, deployment status, and on-chain ownership flag
|
|
1334
|
+
*
|
|
1335
|
+
* @throws If `userAddress` is missing or `chainId` is unsupported
|
|
1073
1336
|
*/
|
|
1074
1337
|
getSmartWalletAddress(userAddress: string, chainId: SupportedChainId): Promise<SmartWalletResponse>;
|
|
1075
1338
|
/**
|
|
1076
1339
|
* Deploy Safe Smart Wallet for a user
|
|
1077
1340
|
*
|
|
1078
|
-
* @deprecated Prefer
|
|
1341
|
+
* @deprecated Prefer {@link ZyfaiSDK.sendDeposit}. Predeployed Safes and session keys are
|
|
1079
1342
|
* managed automatically on first deposit. This method remains available for
|
|
1080
1343
|
* legacy flows.
|
|
1081
1344
|
*
|
|
1345
|
+
* @see {@link ZyfaiSDK.sendDeposit}
|
|
1346
|
+
*
|
|
1347
|
+
* @group Deposits and withdrawals
|
|
1348
|
+
*
|
|
1082
1349
|
* @param userAddress - User's EOA address (the connected EOA, not the smart wallet address)
|
|
1083
1350
|
* @param chainId - Target chain ID
|
|
1084
1351
|
* @param strategy - Optional strategy selection: "conservative" (default), "aggressive" or "yieldmaxxing"
|
|
@@ -1100,10 +1367,14 @@ declare class ZyfaiSDK {
|
|
|
1100
1367
|
* Create session key with auto-fetched configuration from Zyfai API
|
|
1101
1368
|
* This is the simplified method that automatically fetches session configuration
|
|
1102
1369
|
*
|
|
1103
|
-
* @deprecated Prefer
|
|
1370
|
+
* @deprecated Prefer {@link ZyfaiSDK.sendDeposit}. Predeployed wallets already have the
|
|
1104
1371
|
* agent session enabled; session activation is handled after first deposit.
|
|
1105
1372
|
* This method remains available for legacy flows.
|
|
1106
1373
|
*
|
|
1374
|
+
* @see {@link ZyfaiSDK.sendDeposit}
|
|
1375
|
+
*
|
|
1376
|
+
* @group Deposits and withdrawals
|
|
1377
|
+
*
|
|
1107
1378
|
* @param userAddress - User's EOA or Safe address
|
|
1108
1379
|
* @param chainId - Target chain ID
|
|
1109
1380
|
* @returns Session key response with signature and nonces
|
|
@@ -1146,6 +1417,11 @@ declare class ZyfaiSDK {
|
|
|
1146
1417
|
* @internal
|
|
1147
1418
|
*/
|
|
1148
1419
|
private updateUserProtocolsForAsset;
|
|
1420
|
+
/**
|
|
1421
|
+
* Persist protocol discovery for one asset (user PATCH or agent deposit-setup).
|
|
1422
|
+
* @internal
|
|
1423
|
+
*/
|
|
1424
|
+
private persistDiscoveredAssetProfile;
|
|
1149
1425
|
/**
|
|
1150
1426
|
* Switch one asset to a strategy and select the protocols that go with it.
|
|
1151
1427
|
*
|
|
@@ -1167,6 +1443,8 @@ declare class ZyfaiSDK {
|
|
|
1167
1443
|
* @param params.chains - Chains to enable. Defaults to every chain the asset
|
|
1168
1444
|
* exists on. **Additive**: chains already enabled are kept, so this cannot
|
|
1169
1445
|
* be used to disable one.
|
|
1446
|
+
* @group Portfolio and execution
|
|
1447
|
+
*
|
|
1170
1448
|
* @returns The updated profile for that asset
|
|
1171
1449
|
*
|
|
1172
1450
|
* @example
|
|
@@ -1216,7 +1494,16 @@ declare class ZyfaiSDK {
|
|
|
1216
1494
|
* transfer lands on the counterfactual address and the backend deploys + hands over on first
|
|
1217
1495
|
* deposit (report-deposit). Use this only to pre-provision chains ahead of time.
|
|
1218
1496
|
*
|
|
1219
|
-
* @
|
|
1497
|
+
* @group Deposits and withdrawals
|
|
1498
|
+
*
|
|
1499
|
+
* @param chainIds - Chain IDs to deploy the wallet on (e.g. `[1, 42161]`)
|
|
1500
|
+
* @returns Deployment summary from the execution API
|
|
1501
|
+
*
|
|
1502
|
+
* @throws If `chainIds` is empty or contains an unsupported chain
|
|
1503
|
+
*
|
|
1504
|
+
* @remarks
|
|
1505
|
+
* Requires {@link ZyfaiSDK.connectAccount} (SIWE). Optional ahead of deposits;
|
|
1506
|
+
* {@link ZyfaiSDK.sendDeposit} can deploy on first deposit for predeployed wallets.
|
|
1220
1507
|
*/
|
|
1221
1508
|
deployOnChains(chainIds: SupportedChainId[]): Promise<{
|
|
1222
1509
|
success: boolean;
|
|
@@ -1225,22 +1512,60 @@ declare class ZyfaiSDK {
|
|
|
1225
1512
|
status: string;
|
|
1226
1513
|
}>;
|
|
1227
1514
|
/**
|
|
1228
|
-
*
|
|
1515
|
+
* Transfer funds from the connected EOA to the user's Safe and register the deposit.
|
|
1516
|
+
*
|
|
1517
|
+
* @remarks
|
|
1518
|
+
* Execution API + on-chain ERC-20 `transfer`. Confirms the transaction, then calls
|
|
1519
|
+
* {@link ZyfaiSDK.logDeposit}. Pair with {@link ZyfaiSDK.waitForDepositCredit} for
|
|
1520
|
+
* investable balance. Custom-wallet flows: {@link ZyfaiSDK.buildDepositTransfer},
|
|
1521
|
+
* {@link ZyfaiSDK.logDeposit}, {@link ZyfaiSDK.getDepositStatus}.
|
|
1522
|
+
*
|
|
1523
|
+
* Requires {@link ZyfaiSDK.connectAccount}. Pass the **EOA** as `userAddress`.
|
|
1524
|
+
*
|
|
1525
|
+
* @group Deposits and withdrawals
|
|
1229
1526
|
*
|
|
1230
|
-
*
|
|
1231
|
-
*
|
|
1527
|
+
* @param userAddress - Owner EOA (not the Safe)
|
|
1528
|
+
* @param chainId - Chain for the transfer
|
|
1529
|
+
* @param amount - Amount in least units (string integer)
|
|
1530
|
+
* @param asset - Asset symbol (`USDC`, `WETH`, `EURC`, `NVDAc`)
|
|
1531
|
+
* @param strategy - Optional first-deposit {@link Strategy}
|
|
1532
|
+
* @returns Transfer receipt and deposit registration (not yet credited until polled)
|
|
1533
|
+
*
|
|
1534
|
+
* @throws If validation fails, minimum portfolio is not met, Safe is unavailable, or transfer/register fails
|
|
1535
|
+
*
|
|
1536
|
+
* @example
|
|
1537
|
+
* ```typescript
|
|
1538
|
+
* await sdk.connectAccount(provider);
|
|
1539
|
+
* const sent = await sdk.sendDeposit(eoa, 8453, "10000000", "USDC", "conservative");
|
|
1540
|
+
* await sdk.waitForDepositCredit(sent.registration.id, 8453);
|
|
1541
|
+
* ```
|
|
1232
1542
|
*/
|
|
1233
1543
|
sendDeposit(userAddress: string, chainId: SupportedChainId, amount: string, asset: string, strategy?: Strategy): Promise<DepositResponse>;
|
|
1234
1544
|
/**
|
|
1235
|
-
* @deprecated Compatibility convenience method. Prefer
|
|
1236
|
-
*
|
|
1545
|
+
* @deprecated Compatibility convenience method. Prefer {@link ZyfaiSDK.sendDeposit} followed by
|
|
1546
|
+
* {@link ZyfaiSDK.waitForDepositCredit} when the caller owns the completion UX.
|
|
1547
|
+
*
|
|
1548
|
+
* @see {@link ZyfaiSDK.sendDeposit}
|
|
1549
|
+
*
|
|
1550
|
+
* @group Deposits and withdrawals
|
|
1237
1551
|
*/
|
|
1238
1552
|
depositFunds(userAddress: string, chainId: SupportedChainId, amount: string, asset: string, strategy?: Strategy): Promise<DepositResponse>;
|
|
1239
1553
|
/**
|
|
1240
|
-
*
|
|
1241
|
-
*
|
|
1242
|
-
*
|
|
1243
|
-
*
|
|
1554
|
+
* Build ERC-20 transfer calldata for a custom signer or sponsored tx flow.
|
|
1555
|
+
*
|
|
1556
|
+
* @remarks
|
|
1557
|
+
* Compose with {@link ZyfaiSDK.ensureFirstDepositSetup}, submit the transfer, then
|
|
1558
|
+
* {@link ZyfaiSDK.logDeposit} and {@link ZyfaiSDK.waitForDepositCredit}.
|
|
1559
|
+
*
|
|
1560
|
+
* @group Deposits and withdrawals
|
|
1561
|
+
*
|
|
1562
|
+
* @param params.userAddress - Owner EOA
|
|
1563
|
+
* @param params.chainId - Target chain
|
|
1564
|
+
* @param params.amount - Least units (string integer)
|
|
1565
|
+
* @param params.asset - {@link SupportedAsset}
|
|
1566
|
+
* @returns Safe address, token, and encoded `transfer` calldata
|
|
1567
|
+
*
|
|
1568
|
+
* @throws If inputs are invalid or the Safe address cannot be resolved
|
|
1244
1569
|
*/
|
|
1245
1570
|
buildDepositTransfer(params: {
|
|
1246
1571
|
userAddress: string;
|
|
@@ -1264,10 +1589,47 @@ declare class ZyfaiSDK {
|
|
|
1264
1589
|
* When setup runs (`applied: true`), protocol configuration is persisted
|
|
1265
1590
|
* before returning. Failures throw so callers can abort before submitting a
|
|
1266
1591
|
* transfer. High-level deposit methods still treat setup as best-effort.
|
|
1592
|
+
*
|
|
1593
|
+
* @group Deposits and withdrawals
|
|
1594
|
+
*
|
|
1595
|
+
* @param strategy - Optional first-deposit {@link Strategy}
|
|
1596
|
+
* @returns `{ applied: true }` when chain/protocol config was written; `false` if already configured
|
|
1597
|
+
*
|
|
1598
|
+
* @throws If strategy is invalid or setup did not persist
|
|
1267
1599
|
*/
|
|
1268
1600
|
ensureFirstDepositSetup(strategy?: Strategy): Promise<{
|
|
1269
1601
|
applied: boolean;
|
|
1270
1602
|
}>;
|
|
1603
|
+
/**
|
|
1604
|
+
* Idempotently configure the deposit asset for a single chain before MCP prepare.
|
|
1605
|
+
*
|
|
1606
|
+
* @internal
|
|
1607
|
+
*/
|
|
1608
|
+
private ensureDepositProfileForPrepare;
|
|
1609
|
+
/**
|
|
1610
|
+
* Prepare a deposit: persist first-deposit profile when needed and return
|
|
1611
|
+
* ERC-20 transfer calldata for the user to sign (does not broadcast).
|
|
1612
|
+
*
|
|
1613
|
+
* @group Deposits and withdrawals
|
|
1614
|
+
*/
|
|
1615
|
+
prepareDeposit(params: {
|
|
1616
|
+
userAddress: string;
|
|
1617
|
+
chainId: SupportedChainId;
|
|
1618
|
+
amount: string;
|
|
1619
|
+
asset: SupportedAsset;
|
|
1620
|
+
}): Promise<{
|
|
1621
|
+
phase: "prepare_transfer";
|
|
1622
|
+
setup: {
|
|
1623
|
+
applied: boolean;
|
|
1624
|
+
};
|
|
1625
|
+
transfer: {
|
|
1626
|
+
safeAddress: Address;
|
|
1627
|
+
tokenAddress: Address;
|
|
1628
|
+
to: Address;
|
|
1629
|
+
data: Hex;
|
|
1630
|
+
value: "0";
|
|
1631
|
+
};
|
|
1632
|
+
}>;
|
|
1271
1633
|
/** Best-effort first-deposit setup shared by both high-level deposit flows. */
|
|
1272
1634
|
private prepareFirstDeposit;
|
|
1273
1635
|
/** Shared post-transfer registration path for every deposit flow. */
|
|
@@ -1299,8 +1661,12 @@ declare class ZyfaiSDK {
|
|
|
1299
1661
|
* @param chainId - Chain ID where the deposit was made
|
|
1300
1662
|
* @param txHash - Transaction hash of the deposit
|
|
1301
1663
|
* @param amount - Amount in least decimal units (e.g., "100000000" for 100 USDC with 6 decimals)
|
|
1302
|
-
* @param tokenAddress - Optional
|
|
1303
|
-
* @returns Log deposit response with
|
|
1664
|
+
* @param tokenAddress - Optional token contract (defaults per chain)
|
|
1665
|
+
* @returns Log deposit response with lifecycle record
|
|
1666
|
+
*
|
|
1667
|
+
* @group Deposits and withdrawals
|
|
1668
|
+
*
|
|
1669
|
+
* @throws If inputs are invalid or the execution API rejects registration
|
|
1304
1670
|
*
|
|
1305
1671
|
* @example
|
|
1306
1672
|
* ```typescript
|
|
@@ -1321,8 +1687,18 @@ declare class ZyfaiSDK {
|
|
|
1321
1687
|
*/
|
|
1322
1688
|
logDeposit(chainId: SupportedChainId, txHash: string, amount: string, tokenAddress?: string): Promise<LogDepositResponse>;
|
|
1323
1689
|
/**
|
|
1324
|
-
* Fetch
|
|
1325
|
-
*
|
|
1690
|
+
* Fetch custody handover and balance-credit status for a registered deposit.
|
|
1691
|
+
*
|
|
1692
|
+
* @remarks
|
|
1693
|
+
* `status === "credited"` with `balanceCredited === true` means funds are investable.
|
|
1694
|
+
* Requires {@link ZyfaiSDK.connectAccount} (SIWE).
|
|
1695
|
+
*
|
|
1696
|
+
* @group Deposits and withdrawals
|
|
1697
|
+
*
|
|
1698
|
+
* @param depositId - Id from {@link LogDepositResponse} / {@link DepositResponse.registration}
|
|
1699
|
+
* @returns {@link DepositLifecycleResponse}
|
|
1700
|
+
*
|
|
1701
|
+
* @throws If `depositId` is missing
|
|
1326
1702
|
*/
|
|
1327
1703
|
getDepositStatus(depositId: string): Promise<DepositLifecycleResponse>;
|
|
1328
1704
|
/**
|
|
@@ -1336,7 +1712,17 @@ declare class ZyfaiSDK {
|
|
|
1336
1712
|
* ~250ms) with a ~20 second completion window. Override `timeoutMs` when a
|
|
1337
1713
|
* caller intentionally wants to wait longer than the normal UX window.
|
|
1338
1714
|
*
|
|
1339
|
-
* Requires
|
|
1715
|
+
* Requires {@link ZyfaiSDK.connectAccount} on the same SDK instance.
|
|
1716
|
+
*
|
|
1717
|
+
* @group Deposits and withdrawals
|
|
1718
|
+
*
|
|
1719
|
+
* @param depositId - Deposit lifecycle id
|
|
1720
|
+
* @param chainId - Chain (controls poll interval and default timeout)
|
|
1721
|
+
* @param options - Optional `intervalMs` and `timeoutMs` overrides
|
|
1722
|
+
* @returns Final lifecycle record when credited
|
|
1723
|
+
*
|
|
1724
|
+
* @throws `DepositCreditTimeoutError` when the poll window elapses without credit
|
|
1725
|
+
* @throws If deposit recovers to EOA or polling fails
|
|
1340
1726
|
*/
|
|
1341
1727
|
waitForDepositCredit(depositId: string, chainId: SupportedChainId, options?: WaitForDepositCreditOptions): Promise<DepositLifecycleResponse>;
|
|
1342
1728
|
/**
|
|
@@ -1373,8 +1759,13 @@ declare class ZyfaiSDK {
|
|
|
1373
1759
|
*
|
|
1374
1760
|
* @param userAddress - User's address (owner of the Safe)
|
|
1375
1761
|
* @param chainId - Target chain ID
|
|
1376
|
-
* @param amount - Optional
|
|
1377
|
-
* @
|
|
1762
|
+
* @param amount - Optional amount in least units (partial withdrawal); omit for full withdraw
|
|
1763
|
+
* @param tokenSymbol - Optional asset symbol when withdrawing a specific token
|
|
1764
|
+
* @returns Withdraw response with message and optional transaction hash
|
|
1765
|
+
*
|
|
1766
|
+
* @group Deposits and withdrawals
|
|
1767
|
+
*
|
|
1768
|
+
* @throws If `userAddress` or `chainId` is invalid, or the execution API rejects the request
|
|
1378
1769
|
*
|
|
1379
1770
|
* @example
|
|
1380
1771
|
* ```typescript
|
|
@@ -1400,11 +1791,17 @@ declare class ZyfaiSDK {
|
|
|
1400
1791
|
*/
|
|
1401
1792
|
private assertAsyncRedemptionSlotFree;
|
|
1402
1793
|
/**
|
|
1403
|
-
* Get available DeFi protocols and pools for a specific chain
|
|
1794
|
+
* Get available DeFi protocols and pools for a specific chain.
|
|
1795
|
+
*
|
|
1796
|
+
* @group Portfolio and execution
|
|
1797
|
+
*
|
|
1798
|
+
* @remarks Execution API. Partner API key only.
|
|
1404
1799
|
*
|
|
1405
1800
|
* @param chainId - Target chain ID
|
|
1406
1801
|
* @returns List of available protocols with their pools and APY data
|
|
1407
1802
|
*
|
|
1803
|
+
* @throws If `chainId` is unsupported
|
|
1804
|
+
*
|
|
1408
1805
|
* @example
|
|
1409
1806
|
* ```typescript
|
|
1410
1807
|
* const protocols = await sdk.getAvailableProtocols(8453);
|
|
@@ -1415,11 +1812,15 @@ declare class ZyfaiSDK {
|
|
|
1415
1812
|
*/
|
|
1416
1813
|
getAvailableProtocols(chainId: SupportedChainId): Promise<ProtocolsResponse>;
|
|
1417
1814
|
/**
|
|
1418
|
-
* Get
|
|
1815
|
+
* Get active DeFi positions for a user.
|
|
1816
|
+
*
|
|
1817
|
+
* @group Portfolio and execution
|
|
1818
|
+
*
|
|
1819
|
+
* @remarks Execution API (`/data/position`). Pass the **EOA**; the SDK resolves the Safe.
|
|
1419
1820
|
*
|
|
1420
1821
|
* @param userAddress - User's EOA address
|
|
1421
|
-
* @param chainId -
|
|
1422
|
-
* @returns User's positions across
|
|
1822
|
+
* @param chainId - Chain used to resolve the Safe (defaults to Base `8453`)
|
|
1823
|
+
* @returns User's positions across protocols
|
|
1423
1824
|
*
|
|
1424
1825
|
* @example
|
|
1425
1826
|
* ```typescript
|
|
@@ -1466,9 +1867,16 @@ declare class ZyfaiSDK {
|
|
|
1466
1867
|
* Do not add `CLAIMED` withdrawals either (the array keeps them for 24
|
|
1467
1868
|
* hours); their funds are back in the Safe and already counted.
|
|
1468
1869
|
*
|
|
1870
|
+
* @group Portfolio and execution
|
|
1871
|
+
*
|
|
1872
|
+
* @remarks Data API portfolio endpoint. See {@link PortfolioDetailed.pendingAsyncWithdrawals}
|
|
1873
|
+
* when using {@link Strategy | yieldmaxxing}.
|
|
1874
|
+
*
|
|
1469
1875
|
* @param userAddress - User's EOA address
|
|
1470
1876
|
* @returns Portfolio with optional fee-adjusted balance fields
|
|
1471
1877
|
*
|
|
1878
|
+
* @throws If `userAddress` is missing
|
|
1879
|
+
*
|
|
1472
1880
|
* @example
|
|
1473
1881
|
* ```typescript
|
|
1474
1882
|
* const { portfolio } = await sdk.getPortfolio(userAddress);
|
|
@@ -1482,10 +1890,15 @@ declare class ZyfaiSDK {
|
|
|
1482
1890
|
*/
|
|
1483
1891
|
getPortfolio(userAddress: string): Promise<PortfolioDetailedResponse>;
|
|
1484
1892
|
/**
|
|
1485
|
-
* Get
|
|
1486
|
-
*
|
|
1893
|
+
* Get the authenticated user's profile for an asset.
|
|
1894
|
+
*
|
|
1895
|
+
* @group Portfolio and execution
|
|
1896
|
+
*
|
|
1897
|
+
* @remarks Execution API. Requires {@link ZyfaiSDK.connectAccount} (SIWE).
|
|
1487
1898
|
*
|
|
1488
|
-
* @
|
|
1899
|
+
* @param asset - Asset slice of the profile to return
|
|
1900
|
+
* @defaultValue `"USDC"`
|
|
1901
|
+
* @returns User details including smart wallet, chains, and protocols
|
|
1489
1902
|
*
|
|
1490
1903
|
* @example
|
|
1491
1904
|
* ```typescript
|
|
@@ -1497,9 +1910,13 @@ declare class ZyfaiSDK {
|
|
|
1497
1910
|
*/
|
|
1498
1911
|
getUserDetails(asset?: SupportedAsset): Promise<UpdateUserProfileResponse>;
|
|
1499
1912
|
/**
|
|
1500
|
-
* Get total value locked (TVL) across all Zyfai accounts
|
|
1913
|
+
* Get total value locked (TVL) across all Zyfai accounts.
|
|
1501
1914
|
*
|
|
1502
|
-
* @
|
|
1915
|
+
* @group Analytics and opportunities
|
|
1916
|
+
*
|
|
1917
|
+
* @remarks Data API. Partner API key only; SIWE not required.
|
|
1918
|
+
*
|
|
1919
|
+
* @returns Total TVL in USD
|
|
1503
1920
|
*
|
|
1504
1921
|
* @example
|
|
1505
1922
|
* ```typescript
|
|
@@ -1509,7 +1926,11 @@ declare class ZyfaiSDK {
|
|
|
1509
1926
|
*/
|
|
1510
1927
|
getTVL(): Promise<TVLResponse>;
|
|
1511
1928
|
/**
|
|
1512
|
-
* Get APY per strategy for a specific chain
|
|
1929
|
+
* Get APY per strategy for a specific chain.
|
|
1930
|
+
*
|
|
1931
|
+
* @group Analytics and opportunities
|
|
1932
|
+
*
|
|
1933
|
+
* @remarks Data API. Partner API key only.
|
|
1513
1934
|
*
|
|
1514
1935
|
* @param crossChain - Whether to get cross-chain APY (true = omni account, false = simple account)
|
|
1515
1936
|
* @param days - Time period: 7, 14, or 30
|
|
@@ -1526,7 +1947,11 @@ declare class ZyfaiSDK {
|
|
|
1526
1947
|
*/
|
|
1527
1948
|
getAPYPerStrategy(crossChain?: boolean, days?: number, strategy?: Strategy, chainId?: number, tokenSymbol?: string): Promise<APYPerStrategyResponse>;
|
|
1528
1949
|
/**
|
|
1529
|
-
* Get total volume across all Zyfai accounts
|
|
1950
|
+
* Get total volume across all Zyfai accounts.
|
|
1951
|
+
*
|
|
1952
|
+
* @group Analytics and opportunities
|
|
1953
|
+
*
|
|
1954
|
+
* @remarks Data API. Partner API key only.
|
|
1530
1955
|
*
|
|
1531
1956
|
* @returns Total volume in USD
|
|
1532
1957
|
*
|
|
@@ -1538,7 +1963,11 @@ declare class ZyfaiSDK {
|
|
|
1538
1963
|
*/
|
|
1539
1964
|
getVolume(assetType?: "usdc" | "eth" | "eurc"): Promise<VolumeResponse>;
|
|
1540
1965
|
/**
|
|
1541
|
-
* Get active wallets for a specific chain
|
|
1966
|
+
* Get active wallets for a specific chain.
|
|
1967
|
+
*
|
|
1968
|
+
* @group Analytics and opportunities
|
|
1969
|
+
*
|
|
1970
|
+
* @remarks Data API. Partner API key only.
|
|
1542
1971
|
*
|
|
1543
1972
|
* @param chainId - Chain ID to filter wallets
|
|
1544
1973
|
* @returns List of active wallets on the specified chain
|
|
@@ -1551,7 +1980,11 @@ declare class ZyfaiSDK {
|
|
|
1551
1980
|
*/
|
|
1552
1981
|
getActiveWallets(chainId: number): Promise<ActiveWalletsResponse>;
|
|
1553
1982
|
/**
|
|
1554
|
-
* Get smart wallets associated with an EOA address
|
|
1983
|
+
* Get smart wallets associated with an EOA address.
|
|
1984
|
+
*
|
|
1985
|
+
* @group Analytics and opportunities
|
|
1986
|
+
*
|
|
1987
|
+
* @remarks Data API. Partner API key only.
|
|
1555
1988
|
*
|
|
1556
1989
|
* @param eoaAddress - EOA (externally owned account) address
|
|
1557
1990
|
* @returns List of smart wallets owned by the EOA
|
|
@@ -1564,7 +1997,11 @@ declare class ZyfaiSDK {
|
|
|
1564
1997
|
*/
|
|
1565
1998
|
getSmartWalletByEOA(eoaAddress: string): Promise<SmartWalletByEOAResponse>;
|
|
1566
1999
|
/**
|
|
1567
|
-
* Get the first topup (deposit) information for a wallet
|
|
2000
|
+
* Get the first topup (deposit) information for a wallet.
|
|
2001
|
+
*
|
|
2002
|
+
* @group Analytics and opportunities
|
|
2003
|
+
*
|
|
2004
|
+
* @remarks Data API. Partner API key only.
|
|
1568
2005
|
*
|
|
1569
2006
|
* @param walletAddress - Smart wallet address
|
|
1570
2007
|
* @param chainId - Chain ID
|
|
@@ -1578,7 +2015,11 @@ declare class ZyfaiSDK {
|
|
|
1578
2015
|
*/
|
|
1579
2016
|
getFirstTopup(walletAddress: string, chainId: number): Promise<FirstTopupResponse>;
|
|
1580
2017
|
/**
|
|
1581
|
-
* Get transaction history for a wallet
|
|
2018
|
+
* Get transaction history for a wallet.
|
|
2019
|
+
*
|
|
2020
|
+
* @group Analytics and opportunities
|
|
2021
|
+
*
|
|
2022
|
+
* @remarks Data API. Partner API key only.
|
|
1582
2023
|
*
|
|
1583
2024
|
* @param walletAddress - Smart wallet address
|
|
1584
2025
|
* @param chainId - Chain ID
|
|
@@ -1602,11 +2043,15 @@ declare class ZyfaiSDK {
|
|
|
1602
2043
|
assetType?: "usdc" | "eth" | "eurc";
|
|
1603
2044
|
}): Promise<HistoryResponse>;
|
|
1604
2045
|
/**
|
|
1605
|
-
* Get onchain earnings for a wallet
|
|
2046
|
+
* Get onchain earnings for a wallet.
|
|
2047
|
+
*
|
|
2048
|
+
* @group Analytics and opportunities
|
|
2049
|
+
*
|
|
2050
|
+
* @remarks Data API. Partner API key only.
|
|
1606
2051
|
*
|
|
1607
2052
|
* Includes gross totals plus net-of-fee totals:
|
|
1608
|
-
* `totalEarningsByTokenWithFee = lifetime + unrealized + current × (1 - feeRate)`.
|
|
1609
|
-
*
|
|
2053
|
+
* `totalEarningsByTokenWithFee = (lifetime + unrealized + current) × (1 - feeRate)`.
|
|
2054
|
+
* Ledger buckets are gross, so the keep-rate applies to all three.
|
|
1610
2055
|
*
|
|
1611
2056
|
* @param walletAddress - Smart wallet address
|
|
1612
2057
|
* @returns Onchain earnings data with per-token breakdowns
|
|
@@ -1663,7 +2108,11 @@ declare class ZyfaiSDK {
|
|
|
1663
2108
|
*/
|
|
1664
2109
|
getDailyEarnings(walletAddress: string, startDate?: string, endDate?: string): Promise<DailyEarningsResponse>;
|
|
1665
2110
|
/**
|
|
1666
|
-
* Get conservative (low-risk) yield opportunities
|
|
2111
|
+
* Get conservative (low-risk) yield opportunities.
|
|
2112
|
+
*
|
|
2113
|
+
* @group Analytics and opportunities
|
|
2114
|
+
*
|
|
2115
|
+
* @remarks Data API. Partner API key only.
|
|
1667
2116
|
*
|
|
1668
2117
|
* @param chainId - Optional chain ID filter
|
|
1669
2118
|
* @param asset - Optional asset filter (e.g. "USDC", "WETH", "WBTC")
|
|
@@ -1829,6 +2278,10 @@ declare class ZyfaiSDK {
|
|
|
1829
2278
|
* Allows granular control over which pools to use for each protocol on each chain.
|
|
1830
2279
|
* This is useful for advanced users who want to target specific pools with desired APY/risk profiles.
|
|
1831
2280
|
*
|
|
2281
|
+
* @group Customization and simulation
|
|
2282
|
+
*
|
|
2283
|
+
* @remarks Execution API. Requires {@link ZyfaiSDK.connectAccount} (SIWE).
|
|
2284
|
+
*
|
|
1832
2285
|
* @param customizations - Array of customization configurations
|
|
1833
2286
|
* @returns Response indicating success
|
|
1834
2287
|
*
|
|
@@ -1857,14 +2310,64 @@ declare class ZyfaiSDK {
|
|
|
1857
2310
|
* ]);
|
|
1858
2311
|
* ```
|
|
1859
2312
|
*/
|
|
2313
|
+
/**
|
|
2314
|
+
* Get persisted per-asset-type management settings (strategy, chains, protocols).
|
|
2315
|
+
*
|
|
2316
|
+
* @group Agent management
|
|
2317
|
+
*/
|
|
2318
|
+
getAssetTypeSettings(): Promise<unknown>;
|
|
2319
|
+
/**
|
|
2320
|
+
* Reserve a one-time action id before the user signs an ERC-20 transfer.
|
|
2321
|
+
*
|
|
2322
|
+
* @group Agent management
|
|
2323
|
+
*/
|
|
2324
|
+
createAgentDepositIntent(request: CreateAgentDepositIntentRequest): Promise<{
|
|
2325
|
+
data: AgentDepositIntent;
|
|
2326
|
+
}>;
|
|
2327
|
+
/**
|
|
2328
|
+
* Consume a one-time action id when registering the signed deposit.
|
|
2329
|
+
*
|
|
2330
|
+
* @group Agent management
|
|
2331
|
+
*/
|
|
2332
|
+
consumeAgentDepositIntent(actionId: string, request: ConsumeAgentDepositIntentRequest): Promise<{
|
|
2333
|
+
data: AgentDepositIntentStatus;
|
|
2334
|
+
}>;
|
|
2335
|
+
/**
|
|
2336
|
+
* Poll MCP deposit-intent status (agent delegated session).
|
|
2337
|
+
*
|
|
2338
|
+
* @group Agent management
|
|
2339
|
+
*/
|
|
2340
|
+
getAgentDepositIntentStatus(actionId: string): Promise<{
|
|
2341
|
+
data: AgentDepositIntentStatus;
|
|
2342
|
+
}>;
|
|
2343
|
+
/**
|
|
2344
|
+
* Mark intent complete after the user signed on zyf.ai (SIWE session).
|
|
2345
|
+
*
|
|
2346
|
+
* @group Agent management
|
|
2347
|
+
*/
|
|
2348
|
+
completeAgentDepositIntent(actionId: string, request: CompleteAgentDepositIntentRequest): Promise<{
|
|
2349
|
+
data: AgentDepositIntentStatus;
|
|
2350
|
+
}>;
|
|
2351
|
+
/**
|
|
2352
|
+
* Resolve a signing ticket from prepare_deposit (no user auth).
|
|
2353
|
+
*
|
|
2354
|
+
* @group Agent management
|
|
2355
|
+
*/
|
|
2356
|
+
resolveAgentDepositIntentTicket(ticket: string): Promise<{
|
|
2357
|
+
data: ResolvedAgentDepositIntent;
|
|
2358
|
+
}>;
|
|
1860
2359
|
customizeBatch(customizations: CustomizationConfig[]): Promise<CustomizeBatchResponse>;
|
|
1861
2360
|
/**
|
|
1862
2361
|
* Get available pools for a protocol.
|
|
1863
2362
|
*
|
|
1864
2363
|
* Returns the list of pools available for a given protocol, optionally filtered by strategy.
|
|
1865
2364
|
*
|
|
2365
|
+
* @group Customization and simulation
|
|
2366
|
+
*
|
|
2367
|
+
* @remarks Execution API. Partner API key only.
|
|
2368
|
+
*
|
|
1866
2369
|
* @param protocolId - The protocol UUID
|
|
1867
|
-
* @param strategy - Optional
|
|
2370
|
+
* @param strategy - Optional {@link Strategy} filter
|
|
1868
2371
|
* @returns List of available pool names
|
|
1869
2372
|
*
|
|
1870
2373
|
* @example
|
|
@@ -1889,7 +2392,11 @@ declare class ZyfaiSDK {
|
|
|
1889
2392
|
* calldata contains a "<RECEIVER>" placeholder that must be replaced with the
|
|
1890
2393
|
* actual receiving address (e.g. the user's Safe) before sending the transaction.
|
|
1891
2394
|
*
|
|
1892
|
-
* @
|
|
2395
|
+
* @group Customization and simulation
|
|
2396
|
+
*
|
|
2397
|
+
* @remarks Data API simulation endpoint. Partner API key only.
|
|
2398
|
+
*
|
|
2399
|
+
* @param params - {@link SimulateBestPositionsParams}
|
|
1893
2400
|
* @returns Chain-keyed map of simulated positions with calldata
|
|
1894
2401
|
*
|
|
1895
2402
|
* @example
|
|
@@ -1912,6 +2419,10 @@ declare class ZyfaiSDK {
|
|
|
1912
2419
|
* Returns the pools that are currently configured for the authenticated user
|
|
1913
2420
|
* for a given protocol and chain combination.
|
|
1914
2421
|
*
|
|
2422
|
+
* @group Customization and simulation
|
|
2423
|
+
*
|
|
2424
|
+
* @remarks Execution API. Requires {@link ZyfaiSDK.connectAccount} (SIWE).
|
|
2425
|
+
*
|
|
1915
2426
|
* @param protocolId - The protocol UUID
|
|
1916
2427
|
* @param chainId - The chain ID
|
|
1917
2428
|
* @returns Currently selected pools and autoselect status
|
|
@@ -1957,10 +2468,13 @@ declare class ZyfaiSDK {
|
|
|
1957
2468
|
*/
|
|
1958
2469
|
registerAgentOnIdentityRegistry(smartWallet: string, chainId: SupportedChainId): Promise<RegisterAgentResponse>;
|
|
1959
2470
|
/**
|
|
1960
|
-
* Deposit assets into the Zyfai Vault
|
|
1961
|
-
*
|
|
2471
|
+
* Deposit assets into the Zyfai Vault (USDC on Base by default).
|
|
2472
|
+
*
|
|
2473
|
+
* @group Vault
|
|
2474
|
+
*
|
|
2475
|
+
* @remarks On-chain vault flow via connected wallet. Requires {@link ZyfaiSDK.connectAccount}.
|
|
1962
2476
|
*
|
|
1963
|
-
* @param amount -
|
|
2477
|
+
* @param amount - Human-readable amount (e.g. `"100"` USDC)
|
|
1964
2478
|
* @param asset - Asset to deposit (default: "USDC")
|
|
1965
2479
|
* @returns Deposit transaction result
|
|
1966
2480
|
*
|
|
@@ -2036,9 +2550,14 @@ declare class ZyfaiSDK {
|
|
|
2036
2550
|
* Events: depeg, liquidity_trap, liquidity_restored, pool_status_change,
|
|
2037
2551
|
* new_collateral_detected, liquidity_drop.
|
|
2038
2552
|
*
|
|
2039
|
-
* @
|
|
2040
|
-
*
|
|
2041
|
-
* @
|
|
2553
|
+
* @group Realtime events
|
|
2554
|
+
*
|
|
2555
|
+
* @remarks Connects to defi-api WebSocket (`WS_ENDPOINT`). Auto-reconnects every 3s until
|
|
2556
|
+
* the returned cleanup function is called.
|
|
2557
|
+
*
|
|
2558
|
+
* @param handlers - {@link ZyfaiEventHandlers}
|
|
2559
|
+
* @param filters - Optional {@link ZyfaiEventFilters} sent on subscribe
|
|
2560
|
+
* @returns Cleanup function — call it to close the connection and stop reconnecting
|
|
2042
2561
|
*
|
|
2043
2562
|
* @example
|
|
2044
2563
|
* ```typescript
|
|
@@ -2088,8 +2607,13 @@ interface BankrProviderConfig {
|
|
|
2088
2607
|
* const sdk = new ZyfaiSDK({ apiKey: process.env.ZYFAI_API_KEY });
|
|
2089
2608
|
*
|
|
2090
2609
|
* const address = await sdk.connectAccount(provider);
|
|
2091
|
-
* await sdk.
|
|
2610
|
+
* const sent = await sdk.sendDeposit(address, 8453, "10000000", "USDC", "conservative");
|
|
2611
|
+
* await sdk.waitForDepositCredit(sent.registration.id, 8453);
|
|
2092
2612
|
* ```
|
|
2613
|
+
*
|
|
2614
|
+
* @remarks
|
|
2615
|
+
* The provider implements EIP-1193 methods used by the SDK (`eth_requestAccounts`,
|
|
2616
|
+
* `eth_chainId`, `personal_sign`, `eth_sendTransaction`, etc.).
|
|
2093
2617
|
*/
|
|
2094
2618
|
declare function createBankrProvider(config: BankrProviderConfig): {
|
|
2095
2619
|
/**
|
|
@@ -2124,6 +2648,7 @@ type BankrProvider = ReturnType<typeof createBankrProvider>;
|
|
|
2124
2648
|
* examples, internal tooling).
|
|
2125
2649
|
*/
|
|
2126
2650
|
|
|
2651
|
+
/** Backend stack selector for URL helper functions. */
|
|
2127
2652
|
type BackendEnvironment = "production" | "staging" | "local";
|
|
2128
2653
|
/** Execution API (zyfai-api) origin — no `/api/v1` suffix. */
|
|
2129
2654
|
declare const EXECUTION_API_BASE_URLS: {
|
|
@@ -2156,8 +2681,16 @@ declare const STAGING_WS_URL: "wss://staging-defiapi.zyf.ai/ws/events";
|
|
|
2156
2681
|
declare const LOCAL_EXECUTION_API_BASE_URL: "http://localhost:3000";
|
|
2157
2682
|
declare const LOCAL_DATA_API_BASE_URL: "http://localhost:3000";
|
|
2158
2683
|
declare const LOCAL_WS_URL: "ws://localhost:3000/ws/events";
|
|
2684
|
+
/**
|
|
2685
|
+
* Execution API origin for an environment (no `/api/v1` suffix).
|
|
2686
|
+
*
|
|
2687
|
+
* @remarks The default {@link ZyfaiSDK} instance always uses production unless
|
|
2688
|
+
* `@internal` test overrides are set on {@link SDKConfig}.
|
|
2689
|
+
*/
|
|
2159
2690
|
declare function getExecutionApiBaseUrl(environment?: BackendEnvironment): string;
|
|
2691
|
+
/** Data API origin for an environment (no `/api/v2` suffix). */
|
|
2160
2692
|
declare function getDataApiBaseUrl(environment?: BackendEnvironment): string;
|
|
2693
|
+
/** Defi-api WebSocket URL (includes `/ws/events`). */
|
|
2161
2694
|
declare function getWsUrl(environment?: BackendEnvironment): string;
|
|
2162
2695
|
|
|
2163
2696
|
declare const VAULT_ADDRESS: "0xD580071c47d4a667858B5FafAb85BC9C609beC5D";
|
|
@@ -2206,4 +2739,4 @@ declare const ERC7579_LAUNCHPAD_ADDRESS: Address$1;
|
|
|
2206
2739
|
*/
|
|
2207
2740
|
declare const POOL_MODULE_ADDRESSES: readonly Address$1[];
|
|
2208
2741
|
|
|
2209
|
-
export { ALLOWED_HISTORY_DAYS, API_ENDPOINT, type APYPerStrategy, type APYPerStrategyResponse, type ActionData, type ActiveWallet, type ActiveWalletsResponse, type AddWalletToSdkResponse, type Address, type AllocationDetail, type AllowedHistoryDays, type ApyPosition, type AsyncWithdrawal, type AsyncWithdrawalStatus, type BackendEnvironment, type BankrProvider, type BankrProviderConfig, type BestOpportunityDetails, type BestOpportunityResponse, type ChainConfig, type ChainPortfolio, type ChainTokenEarnings, type CustomizationConfig, type CustomizeBatchRequest, type CustomizeBatchResponse, DATA_API_BASE_URLS, DATA_API_ENDPOINT, DEFAULT_TOKEN_ADDRESSES, type DailyApyEntry, type DailyApyHistoryPeriod, type DailyApyHistoryResponse, type DailyEarning, type DailyEarningsResponse, type DebankPortfolioResponse, type DepegEvent, type DeploySafeResponse, type DepositLifecycleResponse, type DepositLifecycleStatus, type DepositResponse, ERC7579_LAUNCHPAD_ADDRESS, type ERC7739Context, type ERC7739Data, EXECUTION_API_BASE_URLS, type ExcludedPool, type FirstTopupResponse, type GetPoolsResponse, type GetSelectedPoolsResponse, type Hex, type HistoryEntry, type HistoryFeeData, type HistoryPosition, type HistoryRebalanceLog, type HistoryResponse, INTENT_EXECUTOR, INTENT_SMART_SESSIONS, LOCAL_DATA_API_BASE_URL, LOCAL_EXECUTION_API_BASE_URL, LOCAL_WS_URL, type LiquidityDropEvent, type LogDepositResponse, type NewCollateralDetectedEvent, OWNABLE_VALIDATOR, type OnchainEarnings, type OnchainEarningsResponse, type OpportunitiesResponse, type Opportunity, type OpportunityPosition, POOL_MODULE_ADDRESSES, PROXY_EXECUTOR, type PolicyData, type Pool, type Portfolio, type PortfolioAssetBalance, type PortfolioByAssetType, type PortfolioByChain, type PortfolioDetailed, type PortfolioDetailedResponse, type PortfolioResponse, type PortfolioToken, type PositionSlot, type Protocol, type ProtocolsResponse, type RebalanceFrequencyResponse, type RegisterAgentResponse, SAFE_7579_ADDRESS, type SDKConfig, SMART_SESSIONS_FALLBACK, SMART_SESSIONS_VALIDATOR, STAGING_DATA_API_BASE_URL, STAGING_EXECUTION_API_BASE_URL, STAGING_WS_URL, type SdkKeyTVLResponse, type Session, type SessionKeyResponse, type SimulateBestPositionsParams, type SimulateBestPositionsResponse, type SimulateCalldataItem, type SimulatedPosition, type SmartWalletByEOAResponse, type SmartWalletResponse, type Strategy, type SupportedAsset, type SupportedChainId, type TVLResponse, type TokenApy, type TokenEarnings, type UpdateUserProfileRequest, type UpdateUserProfileResponse, type UserPosition, VAULT_ADDRESS, type VaultAsset, type VaultClaimResponse, type VaultDepositResponse, type VaultSharesResponse, type VaultWithdrawResponse, type VaultWithdrawStatusResponse, type VolumeResponse, WS_ENDPOINT, WS_URLS, type WaitForDepositCreditOptions, type WalletTVL, type WithdrawResponse, type ZyfaiEventFilters, type ZyfaiEventHandlers, ZyfaiSDK, createBankrProvider, getChainConfig, getDataApiBaseUrl, getDefaultTokenAddress, getExecutionApiBaseUrl, getSupportedChainIds, getWsUrl, isSupportedChain, type staleBalances };
|
|
2742
|
+
export { ALLOWED_HISTORY_DAYS, API_ENDPOINT, type APYPerStrategy, type APYPerStrategyResponse, type ActionData, type ActiveWallet, type ActiveWalletsResponse, type AddWalletToSdkResponse, type Address, type AllocationDetail, type AllowedHistoryDays, type ApyPosition, type AsyncWithdrawal, type AsyncWithdrawalStatus, type BackendEnvironment, type BankrProvider, type BankrProviderConfig, type BestOpportunityDetails, type BestOpportunityResponse, type ChainConfig, type ChainPortfolio, type ChainTokenEarnings, type CustomizationConfig, type CustomizeBatchRequest, type CustomizeBatchResponse, DATA_API_BASE_URLS, DATA_API_ENDPOINT, DEFAULT_TOKEN_ADDRESSES, type DailyApyEntry, type DailyApyHistoryPeriod, type DailyApyHistoryResponse, type DailyEarning, type DailyEarningsResponse, type DebankPortfolioResponse, type DepegEvent, type DeploySafeResponse, type DepositLifecycleResponse, type DepositLifecycleStatus, type DepositResponse, ERC7579_LAUNCHPAD_ADDRESS, type ERC7739Context, type ERC7739Data, EXECUTION_API_BASE_URLS, type ExcludedPool, type FirstTopupResponse, type GetPoolsResponse, type GetSelectedPoolsResponse, type Hex, type HistoryEntry, type HistoryFeeData, type HistoryPosition, type HistoryRebalanceLog, type HistoryResponse, INTENT_EXECUTOR, INTENT_SMART_SESSIONS, LOCAL_DATA_API_BASE_URL, LOCAL_EXECUTION_API_BASE_URL, LOCAL_WS_URL, type LiquidityDropEvent, type LogDepositResponse, type NewCollateralDetectedEvent, OWNABLE_VALIDATOR, type OnchainEarnings, type OnchainEarningsResponse, type OpportunitiesResponse, type Opportunity, type OpportunityPosition, POOL_MODULE_ADDRESSES, PROXY_EXECUTOR, type PolicyData, type Pool, type Portfolio, type PortfolioAssetBalance, type PortfolioByAssetType, type PortfolioByChain, type PortfolioDetailed, type PortfolioDetailedResponse, type PortfolioResponse, type PortfolioToken, type PositionSlot, type Protocol, type ProtocolsResponse, type RebalanceFrequencyResponse, type RegisterAgentResponse, SAFE_7579_ADDRESS, type SDKConfig, SMART_SESSIONS_FALLBACK, SMART_SESSIONS_VALIDATOR, STAGING_DATA_API_BASE_URL, STAGING_EXECUTION_API_BASE_URL, STAGING_WS_URL, type SdkKeyTVLResponse, type Session, type SessionKeyResponse, type SimulateBestPositionsParams, type SimulateBestPositionsResponse, type SimulateCalldataItem, type SimulatedPosition, type SmartWalletByEOAResponse, type SmartWalletResponse, type Strategy, type SupportedAsset, type SupportedChainId, type TVLResponse, type TokenApy, type TokenEarnings, type UpdateUserProfileRequest, type UpdateUserProfileResponse, type UserPosition, type UserSessionAuth, VAULT_ADDRESS, type VaultAsset, type VaultClaimResponse, type VaultDepositResponse, type VaultSharesResponse, type VaultWithdrawResponse, type VaultWithdrawStatusResponse, type VolumeResponse, WS_ENDPOINT, WS_URLS, type WaitForDepositCreditOptions, type WalletTVL, type WithdrawResponse, type ZyfaiEventFilters, type ZyfaiEventHandlers, ZyfaiSDK, createBankrProvider, getChainConfig, getDataApiBaseUrl, getDefaultTokenAddress, getExecutionApiBaseUrl, getSupportedChainIds, getWsUrl, isSupportedChain, type staleBalances };
|