@paxoslabs/amplify-sdk 0.0.1-alpha.1
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/CHANGELOG.md +112 -0
- package/LICENSE +28 -0
- package/README.md +533 -0
- package/dist/amplify-sdk-api-B5hBTGrB.d.ts +258 -0
- package/dist/amplify-sdk-api-DPrRhynk.d.mts +258 -0
- package/dist/chunk-3I3PYX2F.js +45 -0
- package/dist/chunk-3I3PYX2F.js.map +1 -0
- package/dist/chunk-7RWWVUHP.mjs +39 -0
- package/dist/chunk-7RWWVUHP.mjs.map +1 -0
- package/dist/chunk-AFWUOS3M.js +15 -0
- package/dist/chunk-AFWUOS3M.js.map +1 -0
- package/dist/chunk-BDXS57YH.js +828 -0
- package/dist/chunk-BDXS57YH.js.map +1 -0
- package/dist/chunk-FYNPQXCR.mjs +46 -0
- package/dist/chunk-FYNPQXCR.mjs.map +1 -0
- package/dist/chunk-GE2VQUPP.mjs +228 -0
- package/dist/chunk-GE2VQUPP.mjs.map +1 -0
- package/dist/chunk-ICKDAKVS.js +16 -0
- package/dist/chunk-ICKDAKVS.js.map +1 -0
- package/dist/chunk-ISO6Z7LD.mjs +809 -0
- package/dist/chunk-ISO6Z7LD.mjs.map +1 -0
- package/dist/chunk-ITB7FXG4.js +14 -0
- package/dist/chunk-ITB7FXG4.js.map +1 -0
- package/dist/chunk-J3662HYT.mjs +29 -0
- package/dist/chunk-J3662HYT.mjs.map +1 -0
- package/dist/chunk-JLXNOGZB.js +2061 -0
- package/dist/chunk-JLXNOGZB.js.map +1 -0
- package/dist/chunk-O5P6SP2O.js +233 -0
- package/dist/chunk-O5P6SP2O.js.map +1 -0
- package/dist/chunk-R663BFAZ.mjs +14 -0
- package/dist/chunk-R663BFAZ.mjs.map +1 -0
- package/dist/chunk-RUIAH5HY.js +32 -0
- package/dist/chunk-RUIAH5HY.js.map +1 -0
- package/dist/chunk-SIR2TCAR.mjs +13 -0
- package/dist/chunk-SIR2TCAR.mjs.map +1 -0
- package/dist/chunk-XXHRCCZS.mjs +11 -0
- package/dist/chunk-XXHRCCZS.mjs.map +1 -0
- package/dist/chunk-ZSFIOWWT.js +49 -0
- package/dist/chunk-ZSFIOWWT.js.map +1 -0
- package/dist/chunk-ZZBZIDZP.mjs +2050 -0
- package/dist/chunk-ZZBZIDZP.mjs.map +1 -0
- package/dist/config-B-u3VqEX.d.mts +21 -0
- package/dist/config-B-u3VqEX.d.ts +21 -0
- package/dist/config-BQynVNDC.d.mts +101 -0
- package/dist/config-BQynVNDC.d.ts +101 -0
- package/dist/core.d.mts +152 -0
- package/dist/core.d.ts +152 -0
- package/dist/core.js +187 -0
- package/dist/core.js.map +1 -0
- package/dist/core.mjs +150 -0
- package/dist/core.mjs.map +1 -0
- package/dist/display.d.mts +25 -0
- package/dist/display.d.ts +25 -0
- package/dist/display.js +124 -0
- package/dist/display.js.map +1 -0
- package/dist/display.mjs +105 -0
- package/dist/display.mjs.map +1 -0
- package/dist/exchange-rate-CRA_CMaX.d.mts +65 -0
- package/dist/exchange-rate-D3_FVgqa.d.ts +65 -0
- package/dist/index.d.mts +3236 -0
- package/dist/index.d.ts +3236 -0
- package/dist/index.js +1115 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +1047 -0
- package/dist/index.mjs.map +1 -0
- package/dist/utils.d.mts +111 -0
- package/dist/utils.d.ts +111 -0
- package/dist/utils.js +51 -0
- package/dist/utils.js.map +1 -0
- package/dist/utils.mjs +17 -0
- package/dist/utils.mjs.map +1 -0
- package/dist/vault-config-BNzhv3QV.d.ts +15 -0
- package/dist/vault-config-BjSE7oL8.d.mts +15 -0
- package/dist/vaults.d.mts +6 -0
- package/dist/vaults.d.ts +6 -0
- package/dist/vaults.js +13 -0
- package/dist/vaults.js.map +1 -0
- package/dist/vaults.mjs +4 -0
- package/dist/vaults.mjs.map +1 -0
- package/package.json +142 -0
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,3236 @@
|
|
|
1
|
+
import { Address, erc20Abi, Hex } from 'viem';
|
|
2
|
+
import { A as AmplifyVault, S as SupportedAsset, a as AssetFilterOptions, V as VaultFilterOptions, W as WithdrawSupportedAsset } from './amplify-sdk-api-DPrRhynk.mjs';
|
|
3
|
+
export { b as APIError } from './amplify-sdk-api-DPrRhynk.mjs';
|
|
4
|
+
export { g as getDepositExchangeRate, a as getWithdrawExchangeRate, i as isDepositSpendApproved, b as isWithdrawalSpendApproved } from './exchange-rate-CRA_CMaX.mjs';
|
|
5
|
+
import { Y as YieldType } from './config-B-u3VqEX.mjs';
|
|
6
|
+
import { C as ChainId } from './vault-config-BjSE7oL8.mjs';
|
|
7
|
+
import './config-BQynVNDC.mjs';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Vault Cache Layer
|
|
11
|
+
*
|
|
12
|
+
* In-memory cache for vault and asset data with TTL-based expiration.
|
|
13
|
+
* Provides fast lookups and automatic refresh on expiry.
|
|
14
|
+
*
|
|
15
|
+
* @module lib/vault-cache
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* VaultCache class
|
|
20
|
+
*
|
|
21
|
+
* Manages in-memory cache for vault and asset data with TTL-based expiration.
|
|
22
|
+
* Automatically refreshes expired cache on queries.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```typescript
|
|
26
|
+
* // Initialize cache with default 10-minute TTL
|
|
27
|
+
* const cache = new VaultCache();
|
|
28
|
+
*
|
|
29
|
+
* // Initialize cache with custom TTL (5 minutes)
|
|
30
|
+
* const customCache = new VaultCache(300000);
|
|
31
|
+
*
|
|
32
|
+
* // Get vaults by deposit token address
|
|
33
|
+
* const vaults = cache.getVault("0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48");
|
|
34
|
+
*
|
|
35
|
+
* // Get asset by token address
|
|
36
|
+
* const asset = cache.getAsset("0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48");
|
|
37
|
+
*
|
|
38
|
+
* // Get all cached vaults
|
|
39
|
+
* const allVaults = cache.getAllVaults();
|
|
40
|
+
*
|
|
41
|
+
* // Check if cache is expired
|
|
42
|
+
* const expired = cache.isExpired();
|
|
43
|
+
*
|
|
44
|
+
* // Manually refresh cache
|
|
45
|
+
* await cache.refresh();
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
declare class VaultCache {
|
|
49
|
+
/**
|
|
50
|
+
* Vaults keyed by baseTokenAddress
|
|
51
|
+
* One key can map to multiple vaults (different chains/yield types)
|
|
52
|
+
*/
|
|
53
|
+
private vaults;
|
|
54
|
+
/**
|
|
55
|
+
* Assets keyed by token address
|
|
56
|
+
*/
|
|
57
|
+
private assets;
|
|
58
|
+
/**
|
|
59
|
+
* Unix timestamp (milliseconds) of last successful fetch
|
|
60
|
+
*/
|
|
61
|
+
private lastFetch;
|
|
62
|
+
/**
|
|
63
|
+
* Time-to-live in milliseconds
|
|
64
|
+
*/
|
|
65
|
+
private readonly ttl;
|
|
66
|
+
/**
|
|
67
|
+
* Flag to prevent concurrent refresh operations
|
|
68
|
+
*/
|
|
69
|
+
private refreshing;
|
|
70
|
+
/**
|
|
71
|
+
* Creates a new VaultCache instance
|
|
72
|
+
*
|
|
73
|
+
* @param ttl - Time-to-live in milliseconds (default: 600000 = 10 minutes)
|
|
74
|
+
*/
|
|
75
|
+
constructor(ttl?: number);
|
|
76
|
+
/**
|
|
77
|
+
* Gets vaults by deposit token address
|
|
78
|
+
*
|
|
79
|
+
* Returns undefined if no vaults found for the given token address.
|
|
80
|
+
* Does NOT automatically refresh if cache is expired; use refresh() for that.
|
|
81
|
+
*
|
|
82
|
+
* @param tokenAddress - Deposit token address (baseTokenAddress)
|
|
83
|
+
* @returns Array of AmplifyVault objects, or undefined if not found
|
|
84
|
+
*/
|
|
85
|
+
getVault(tokenAddress: string): AmplifyVault[] | undefined;
|
|
86
|
+
/**
|
|
87
|
+
* Gets asset by token address
|
|
88
|
+
*
|
|
89
|
+
* Returns undefined if asset not found.
|
|
90
|
+
* Does NOT automatically refresh if cache is expired; use refresh() for that.
|
|
91
|
+
*
|
|
92
|
+
* @param tokenAddress - Token address
|
|
93
|
+
* @returns SupportedAsset object, or undefined if not found
|
|
94
|
+
*/
|
|
95
|
+
getAsset(tokenAddress: string): SupportedAsset | undefined;
|
|
96
|
+
/**
|
|
97
|
+
* Gets all cached vaults
|
|
98
|
+
*
|
|
99
|
+
* Returns an array of all vaults across all deposit tokens.
|
|
100
|
+
* Does NOT automatically refresh if cache is expired; use refresh() for that.
|
|
101
|
+
*
|
|
102
|
+
* @returns Array of all AmplifyVault objects
|
|
103
|
+
*/
|
|
104
|
+
getAllVaults(): AmplifyVault[];
|
|
105
|
+
/**
|
|
106
|
+
* Gets all cached assets
|
|
107
|
+
*
|
|
108
|
+
* Returns an array of all assets.
|
|
109
|
+
* Does NOT automatically refresh if cache is expired; use refresh() for that.
|
|
110
|
+
*
|
|
111
|
+
* @returns Array of all SupportedAsset objects
|
|
112
|
+
*/
|
|
113
|
+
getAllAssets(): SupportedAsset[];
|
|
114
|
+
/**
|
|
115
|
+
* Checks if cache is expired
|
|
116
|
+
*
|
|
117
|
+
* Cache is considered expired if current time exceeds lastFetch + ttl.
|
|
118
|
+
*
|
|
119
|
+
* @returns true if cache is expired, false otherwise
|
|
120
|
+
*/
|
|
121
|
+
isExpired(): boolean;
|
|
122
|
+
/**
|
|
123
|
+
* Gets the time until cache expires
|
|
124
|
+
*
|
|
125
|
+
* @returns Milliseconds until expiry, or 0 if already expired
|
|
126
|
+
*/
|
|
127
|
+
getTimeUntilExpiry(): number;
|
|
128
|
+
/**
|
|
129
|
+
* Checks if cache is empty (never populated)
|
|
130
|
+
*
|
|
131
|
+
* @returns true if cache has never been populated, false otherwise
|
|
132
|
+
*/
|
|
133
|
+
isEmpty(): boolean;
|
|
134
|
+
/**
|
|
135
|
+
* Manually refreshes the cache
|
|
136
|
+
*
|
|
137
|
+
* Fetches fresh data from the API and updates both vaults and assets maps.
|
|
138
|
+
* Updates lastFetch timestamp on success.
|
|
139
|
+
*
|
|
140
|
+
* If a refresh is already in progress, this method waits for it to complete
|
|
141
|
+
* instead of starting a concurrent refresh.
|
|
142
|
+
*
|
|
143
|
+
* @throws {APIError} If the API request fails
|
|
144
|
+
*/
|
|
145
|
+
refresh(): Promise<void>;
|
|
146
|
+
/**
|
|
147
|
+
* Clears the cache
|
|
148
|
+
*
|
|
149
|
+
* Removes all cached data and resets lastFetch timestamp.
|
|
150
|
+
* Does not affect TTL setting.
|
|
151
|
+
*/
|
|
152
|
+
clear(): void;
|
|
153
|
+
/**
|
|
154
|
+
* Gets cache statistics
|
|
155
|
+
*
|
|
156
|
+
* @returns Object with cache statistics
|
|
157
|
+
*/
|
|
158
|
+
getStats(): {
|
|
159
|
+
vaultCount: number;
|
|
160
|
+
assetCount: number;
|
|
161
|
+
tokenCount: number;
|
|
162
|
+
lastFetch: number;
|
|
163
|
+
ttl: number;
|
|
164
|
+
isExpired: boolean;
|
|
165
|
+
isEmpty: boolean;
|
|
166
|
+
timeUntilExpiry: number;
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* Amplify SDK API Client
|
|
172
|
+
*
|
|
173
|
+
* Provides functions to fetch vault and asset data from the Amplify SDK backend API.
|
|
174
|
+
* Handles input validation, error handling, and response parsing.
|
|
175
|
+
* Includes cache integration for performance optimization.
|
|
176
|
+
*
|
|
177
|
+
* @module api/amplify-sdk-client
|
|
178
|
+
*/
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Fetches vaults from the Earn SDK API
|
|
182
|
+
*
|
|
183
|
+
* @param options - Optional filter options for vault queries
|
|
184
|
+
* @returns Promise resolving to array of AmplifyVault objects
|
|
185
|
+
* @throws {APIError} If the request fails, times out, or returns invalid data
|
|
186
|
+
*
|
|
187
|
+
* @example
|
|
188
|
+
* ```typescript
|
|
189
|
+
* // Fetch all vaults
|
|
190
|
+
* const allVaults = await fetchVaults();
|
|
191
|
+
*
|
|
192
|
+
* // Fetch PRIME vaults on Ethereum
|
|
193
|
+
* const ethPrimes = await fetchVaults({
|
|
194
|
+
* chainId: 1,
|
|
195
|
+
* yieldType: "PRIME"
|
|
196
|
+
* });
|
|
197
|
+
*
|
|
198
|
+
* // Fetch vaults accepting USDC
|
|
199
|
+
* const usdcVaults = await fetchVaults({
|
|
200
|
+
* depositTokenAddress: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"
|
|
201
|
+
* });
|
|
202
|
+
* ```
|
|
203
|
+
*/
|
|
204
|
+
declare function fetchVaults(options?: VaultFilterOptions): Promise<AmplifyVault[]>;
|
|
205
|
+
/**
|
|
206
|
+
* Fetches supported assets from the Earn SDK API
|
|
207
|
+
*
|
|
208
|
+
* @param options - Optional filter options for asset queries
|
|
209
|
+
* @returns Promise resolving to array of SupportedAsset objects
|
|
210
|
+
* @throws {APIError} If the request fails, times out, or returns invalid data
|
|
211
|
+
*
|
|
212
|
+
* @example
|
|
213
|
+
* ```typescript
|
|
214
|
+
* // Fetch all supported assets
|
|
215
|
+
* const allAssets = await fetchSupportedAssets();
|
|
216
|
+
*
|
|
217
|
+
* // Fetch assets supported on Ethereum and Base
|
|
218
|
+
* const ethAssets = await fetchSupportedAssets({
|
|
219
|
+
* chains: [1, 8453]
|
|
220
|
+
* });
|
|
221
|
+
*
|
|
222
|
+
* // Fetch PRIME yield type assets
|
|
223
|
+
* const primeAssets = await fetchSupportedAssets({
|
|
224
|
+
* yieldType: "PRIME"
|
|
225
|
+
* });
|
|
226
|
+
*
|
|
227
|
+
* // Combine filters
|
|
228
|
+
* const ethPrimeAssets = await fetchSupportedAssets({
|
|
229
|
+
* chains: [1],
|
|
230
|
+
* yieldType: "PRIME"
|
|
231
|
+
* });
|
|
232
|
+
* ```
|
|
233
|
+
*/
|
|
234
|
+
declare function fetchSupportedAssets(options?: AssetFilterOptions): Promise<SupportedAsset[]>;
|
|
235
|
+
/**
|
|
236
|
+
* Initializes the global vault cache
|
|
237
|
+
*
|
|
238
|
+
* Creates a new VaultCache instance with the specified TTL.
|
|
239
|
+
* If a cache already exists, it will be replaced with a new instance.
|
|
240
|
+
*
|
|
241
|
+
* @param ttl - Time-to-live in milliseconds (default: 600000 = 10 minutes)
|
|
242
|
+
* @returns The initialized VaultCache instance
|
|
243
|
+
*
|
|
244
|
+
* @example
|
|
245
|
+
* ```typescript
|
|
246
|
+
* // Initialize cache with default 10-minute TTL
|
|
247
|
+
* const cache = initializeCache();
|
|
248
|
+
*
|
|
249
|
+
* // Initialize cache with custom 5-minute TTL
|
|
250
|
+
* const customCache = initializeCache(300000);
|
|
251
|
+
* ```
|
|
252
|
+
*/
|
|
253
|
+
declare function initializeCache(ttl?: number): VaultCache;
|
|
254
|
+
/**
|
|
255
|
+
* Gets the global vault cache instance
|
|
256
|
+
*
|
|
257
|
+
* If no cache exists, creates one with default TTL.
|
|
258
|
+
*
|
|
259
|
+
* @returns The global VaultCache instance
|
|
260
|
+
*/
|
|
261
|
+
declare function getCache(): VaultCache;
|
|
262
|
+
/**
|
|
263
|
+
* Manually refreshes the global vault cache
|
|
264
|
+
*
|
|
265
|
+
* Fetches fresh data from the API and updates the cache.
|
|
266
|
+
* This is the public SDK method for cache refresh.
|
|
267
|
+
*
|
|
268
|
+
* @throws {APIError} If the API request fails
|
|
269
|
+
*
|
|
270
|
+
* @example
|
|
271
|
+
* ```typescript
|
|
272
|
+
* // Manually refresh cache
|
|
273
|
+
* await refreshVaultCache();
|
|
274
|
+
* ```
|
|
275
|
+
*/
|
|
276
|
+
declare function refreshVaultCache(): Promise<void>;
|
|
277
|
+
/**
|
|
278
|
+
* Gets supported assets from cache with automatic refresh on expiry
|
|
279
|
+
*
|
|
280
|
+
* @param options - Optional filter options for asset queries
|
|
281
|
+
* @returns Promise resolving to array of SupportedAsset objects
|
|
282
|
+
* @throws {APIError} If the request fails or returns invalid data
|
|
283
|
+
*
|
|
284
|
+
* @remarks
|
|
285
|
+
* Note: yieldType filtering is not supported in the cache layer because
|
|
286
|
+
* SupportedAsset objects don't have a yieldType property. For yieldType
|
|
287
|
+
* filtering, use fetchSupportedAssets() which queries the API directly.
|
|
288
|
+
*
|
|
289
|
+
* @example
|
|
290
|
+
* ```typescript
|
|
291
|
+
* // Get all supported assets (cache-first)
|
|
292
|
+
* const allAssets = await getAssetsFromCache();
|
|
293
|
+
*
|
|
294
|
+
* // Get assets supported on Ethereum and Base (cache-first)
|
|
295
|
+
* const ethAssets = await getAssetsFromCache({
|
|
296
|
+
* chains: [1, 8453]
|
|
297
|
+
* });
|
|
298
|
+
*
|
|
299
|
+
* // Get USDC by address (cache-first)
|
|
300
|
+
* const usdc = await getAssetsFromCache({
|
|
301
|
+
* address: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"
|
|
302
|
+
* });
|
|
303
|
+
*
|
|
304
|
+
* // Get asset by symbol (cache-first)
|
|
305
|
+
* const usdcBySymbol = await getAssetsFromCache({
|
|
306
|
+
* symbol: "USDC"
|
|
307
|
+
* });
|
|
308
|
+
* ```
|
|
309
|
+
*/
|
|
310
|
+
declare function getAssetsFromCache(options?: AssetFilterOptions): Promise<SupportedAsset[]>;
|
|
311
|
+
/**
|
|
312
|
+
* Finds a vault by configuration criteria
|
|
313
|
+
*
|
|
314
|
+
* Resolves the correct vault using multi-criteria filtering based on:
|
|
315
|
+
* - assetAddress: The asset token address (baseTokenAddress)
|
|
316
|
+
* - yieldType: The yield strategy (PRIME, TBILL, LENDING)
|
|
317
|
+
* - chainId: The blockchain network
|
|
318
|
+
*
|
|
319
|
+
* Automatically refreshes cache if expired.
|
|
320
|
+
* Returns the first matching vault or null if no match found.
|
|
321
|
+
*
|
|
322
|
+
* @param params - Configuration parameters
|
|
323
|
+
* @param params.assetAddress - Asset token address (viem Address)
|
|
324
|
+
* @param params.yieldType - Yield strategy type (PRIME, TBILL, or LENDING)
|
|
325
|
+
* @param params.chainId - Blockchain network ID
|
|
326
|
+
* @returns Promise resolving to AmplifyVault or null if no match found
|
|
327
|
+
* @throws {APIError} If parameters are invalid or API request fails
|
|
328
|
+
*
|
|
329
|
+
* @example
|
|
330
|
+
* ```typescript
|
|
331
|
+
* // Find PRIME vault on Ethereum for USDC
|
|
332
|
+
* const vault = await findVaultByConfig({
|
|
333
|
+
* assetAddress: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
|
|
334
|
+
* yieldType: "PRIME",
|
|
335
|
+
* chainId: 1
|
|
336
|
+
* });
|
|
337
|
+
*
|
|
338
|
+
* if (vault) {
|
|
339
|
+
* console.log("Found vault:", vault.id);
|
|
340
|
+
* } else {
|
|
341
|
+
* console.log("No matching vault found");
|
|
342
|
+
* }
|
|
343
|
+
* ```
|
|
344
|
+
*/
|
|
345
|
+
declare function findVaultByConfig(params: {
|
|
346
|
+
assetAddress: Address;
|
|
347
|
+
yieldType: string;
|
|
348
|
+
chainId: number;
|
|
349
|
+
}): Promise<AmplifyVault | null>;
|
|
350
|
+
/**
|
|
351
|
+
* Gets supported assets grouped by token with available vaults
|
|
352
|
+
*
|
|
353
|
+
* Fetches and caches vault data, then transforms it into WithdrawSupportedAsset objects.
|
|
354
|
+
* Each asset shows all vaults that support withdrawals of that token.
|
|
355
|
+
*
|
|
356
|
+
* Automatically populates cache on first call if empty.
|
|
357
|
+
* Reuses cached data on subsequent calls (if not expired).
|
|
358
|
+
*
|
|
359
|
+
* @returns Promise resolving to array of WithdrawSupportedAsset objects
|
|
360
|
+
* @throws {APIError} If the API request fails or returns invalid data
|
|
361
|
+
*
|
|
362
|
+
* @example
|
|
363
|
+
* ```typescript
|
|
364
|
+
* // Get all supported assets with available vaults
|
|
365
|
+
* const assets = await getWithdrawSupportedAssets();
|
|
366
|
+
*
|
|
367
|
+
* // Display options to user
|
|
368
|
+
* for (const asset of assets) {
|
|
369
|
+
* console.log(`${asset.symbol}: ${asset.vaults.length} vaults available`);
|
|
370
|
+
* for (const vault of asset.vaults) {
|
|
371
|
+
* console.log(` - ${vault.yieldType} on chain ${vault.chainId}`);
|
|
372
|
+
* }
|
|
373
|
+
* }
|
|
374
|
+
* ```
|
|
375
|
+
*/
|
|
376
|
+
declare function getWithdrawSupportedAssets(): Promise<WithdrawSupportedAsset[]>;
|
|
377
|
+
|
|
378
|
+
/**
|
|
379
|
+
* SDK Configuration Types
|
|
380
|
+
*
|
|
381
|
+
* Type definitions for SDK initialization and configuration management.
|
|
382
|
+
*/
|
|
383
|
+
/**
|
|
384
|
+
* SDK Configuration State
|
|
385
|
+
*
|
|
386
|
+
* Stores the API key and initialization status for the SDK.
|
|
387
|
+
* This configuration is maintained at the module level in src/lib/sdk-config.ts
|
|
388
|
+
*/
|
|
389
|
+
interface SDKConfig {
|
|
390
|
+
/**
|
|
391
|
+
* API key for Paxos Labs API authentication
|
|
392
|
+
* Set during initialization, used in all API requests
|
|
393
|
+
* Format: pxl_<type>_<random_string>
|
|
394
|
+
*/
|
|
395
|
+
apiKey: string | null;
|
|
396
|
+
/**
|
|
397
|
+
* Indicates whether SDK has been successfully initialized
|
|
398
|
+
* Set to true after init completes, false on clear
|
|
399
|
+
*/
|
|
400
|
+
isInitialized: boolean;
|
|
401
|
+
/**
|
|
402
|
+
* Timestamp when SDK was initialized
|
|
403
|
+
* Used for debugging and telemetry
|
|
404
|
+
*/
|
|
405
|
+
initializedAt: Date | null;
|
|
406
|
+
/**
|
|
407
|
+
* Flag to track if initialization is currently in progress
|
|
408
|
+
* Prevents concurrent initialization attempts
|
|
409
|
+
*/
|
|
410
|
+
isInitializing: boolean;
|
|
411
|
+
/**
|
|
412
|
+
* Promise for ongoing initialization
|
|
413
|
+
* Allows concurrent calls to wait for same initialization
|
|
414
|
+
*/
|
|
415
|
+
initPromise: Promise<void> | null;
|
|
416
|
+
}
|
|
417
|
+
/**
|
|
418
|
+
* Request headers for Paxos Labs API
|
|
419
|
+
*
|
|
420
|
+
* Standard headers used in all API requests, including authentication.
|
|
421
|
+
*/
|
|
422
|
+
type RequestHeaders = Record<string, string>;
|
|
423
|
+
/**
|
|
424
|
+
* Initialization error codes
|
|
425
|
+
*
|
|
426
|
+
* Specific error codes for different initialization failure scenarios.
|
|
427
|
+
* Use these codes for programmatic error handling.
|
|
428
|
+
*/
|
|
429
|
+
type InitErrorCode = "INVALID_API_KEY" | "EMPTY_API_KEY" | "AUTH_FAILED" | "NETWORK_TIMEOUT" | "CACHE_INIT_FAILED" | "CONCURRENT_INIT" | "UNKNOWN_ERROR";
|
|
430
|
+
|
|
431
|
+
/**
|
|
432
|
+
* SDK Configuration Module
|
|
433
|
+
*
|
|
434
|
+
* Manages SDK initialization state and API key storage.
|
|
435
|
+
* Provides core initialization function and helper utilities.
|
|
436
|
+
*/
|
|
437
|
+
|
|
438
|
+
/**
|
|
439
|
+
* Initialize Amplify SDK with API key
|
|
440
|
+
*
|
|
441
|
+
* Validates API key, configures authentication headers, and pre-populates
|
|
442
|
+
* the cache with vault and asset data.
|
|
443
|
+
*
|
|
444
|
+
* @param apiKey - API key obtained from Paxos Labs
|
|
445
|
+
* @throws {APIError} If initialization fails
|
|
446
|
+
*
|
|
447
|
+
* @example
|
|
448
|
+
* ```typescript
|
|
449
|
+
* import { initAmplifySDK } from "@paxoslabs/amplify-sdk";
|
|
450
|
+
*
|
|
451
|
+
* await initAmplifySDK("pxl_internal_your_api_key_here");
|
|
452
|
+
* ```
|
|
453
|
+
*/
|
|
454
|
+
declare function initAmplifySDK(apiKey: string): Promise<void>;
|
|
455
|
+
|
|
456
|
+
/**
|
|
457
|
+
* @file Approve Asset for deposit functionality for Paxos Labs vaults
|
|
458
|
+
* @module vaults/deposit
|
|
459
|
+
*/
|
|
460
|
+
|
|
461
|
+
/**
|
|
462
|
+
* Parameters required for preparing an approval transaction
|
|
463
|
+
* @interface PrepareApproveDepositTokenTxParams
|
|
464
|
+
* @property {Address} depositToken - Token contract address to approve
|
|
465
|
+
* @property {Address} boringVaultAddress - Address of the BoringVault to approve spending
|
|
466
|
+
* @property {string} [approvalAmount] - Optional amount to approve (defaults to maximum approval)
|
|
467
|
+
* @property {number | string} chainId - ID of the chain where the approval will occur
|
|
468
|
+
*/
|
|
469
|
+
interface PrepareApproveDepositTokenTxParams {
|
|
470
|
+
yieldType: YieldType;
|
|
471
|
+
depositToken: Address;
|
|
472
|
+
approvalAmount?: string;
|
|
473
|
+
chainId: ChainId;
|
|
474
|
+
}
|
|
475
|
+
/**
|
|
476
|
+
* Result object containing transaction data for an ERC20 approval operation
|
|
477
|
+
* @interface ApproveDepositTokenTxData
|
|
478
|
+
* @property {typeof erc20Abi} abi - ABI for the ERC20 token contract
|
|
479
|
+
* @property {Address} address - Address of the ERC20 token being approved
|
|
480
|
+
* @property {'approve'} functionName - Name of the function to call
|
|
481
|
+
* @property {[Address, bigint]} args - Arguments for the approve function:
|
|
482
|
+
* [spender (boringVault address), amount]
|
|
483
|
+
*/
|
|
484
|
+
interface ApproveDepositTokenTxData {
|
|
485
|
+
abi: typeof erc20Abi;
|
|
486
|
+
address: Address;
|
|
487
|
+
functionName: "approve";
|
|
488
|
+
args: [Address, bigint];
|
|
489
|
+
}
|
|
490
|
+
/**
|
|
491
|
+
* Prepares the transaction data needed to approve a deposit token for the vault
|
|
492
|
+
*
|
|
493
|
+
* This function prepares an ERC20 approval transaction that allows the vault's
|
|
494
|
+
* BoringVault contract to spend the user's deposit tokens.
|
|
495
|
+
*
|
|
496
|
+
* @example
|
|
497
|
+
* ```typescript
|
|
498
|
+
* const approveData = await prepareApproveDepositToken({
|
|
499
|
+
* depositToken: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', // USDC
|
|
500
|
+
* boringVaultAddress: '0x1234...',
|
|
501
|
+
* approvalAmount: "1000.0", // Approve 1000 USDC
|
|
502
|
+
* chainId: 1,
|
|
503
|
+
* });
|
|
504
|
+
* ```
|
|
505
|
+
*
|
|
506
|
+
* @param {PrepareApproveDepositTokenTxParams} params - Parameters for the approval operation
|
|
507
|
+
* @returns {Promise<ApproveDepositTokenTxData>} Promise resolving to the prepared transaction data
|
|
508
|
+
* @throws {APIError} If parameters are invalid
|
|
509
|
+
*/
|
|
510
|
+
declare function prepareApproveDepositTokenTxData({ yieldType, depositToken, approvalAmount, chainId, }: PrepareApproveDepositTokenTxParams): Promise<ApproveDepositTokenTxData>;
|
|
511
|
+
|
|
512
|
+
declare const TellerAbi: readonly [{
|
|
513
|
+
readonly inputs: readonly [{
|
|
514
|
+
readonly internalType: "address";
|
|
515
|
+
readonly name: "_owner";
|
|
516
|
+
readonly type: "address";
|
|
517
|
+
}, {
|
|
518
|
+
readonly internalType: "address";
|
|
519
|
+
readonly name: "_vault";
|
|
520
|
+
readonly type: "address";
|
|
521
|
+
}, {
|
|
522
|
+
readonly internalType: "address";
|
|
523
|
+
readonly name: "_accountant";
|
|
524
|
+
readonly type: "address";
|
|
525
|
+
}, {
|
|
526
|
+
readonly internalType: "address";
|
|
527
|
+
readonly name: "_endpoint";
|
|
528
|
+
readonly type: "address";
|
|
529
|
+
}];
|
|
530
|
+
readonly stateMutability: "nonpayable";
|
|
531
|
+
readonly type: "constructor";
|
|
532
|
+
}, {
|
|
533
|
+
readonly inputs: readonly [];
|
|
534
|
+
readonly name: "InvalidDelegate";
|
|
535
|
+
readonly type: "error";
|
|
536
|
+
}, {
|
|
537
|
+
readonly inputs: readonly [];
|
|
538
|
+
readonly name: "InvalidEndpointCall";
|
|
539
|
+
readonly type: "error";
|
|
540
|
+
}, {
|
|
541
|
+
readonly inputs: readonly [{
|
|
542
|
+
readonly internalType: "uint16";
|
|
543
|
+
readonly name: "optionType";
|
|
544
|
+
readonly type: "uint16";
|
|
545
|
+
}];
|
|
546
|
+
readonly name: "InvalidOptionType";
|
|
547
|
+
readonly type: "error";
|
|
548
|
+
}, {
|
|
549
|
+
readonly inputs: readonly [];
|
|
550
|
+
readonly name: "LzTokenUnavailable";
|
|
551
|
+
readonly type: "error";
|
|
552
|
+
}, {
|
|
553
|
+
readonly inputs: readonly [];
|
|
554
|
+
readonly name: "MultiChainLayerZeroTellerWithMultiAssetSupport_InvalidToken";
|
|
555
|
+
readonly type: "error";
|
|
556
|
+
}, {
|
|
557
|
+
readonly inputs: readonly [];
|
|
558
|
+
readonly name: "MultiChainTellerBase_DestinationChainReceiverIsZeroAddress";
|
|
559
|
+
readonly type: "error";
|
|
560
|
+
}, {
|
|
561
|
+
readonly inputs: readonly [];
|
|
562
|
+
readonly name: "MultiChainTellerBase_GasLimitExceeded";
|
|
563
|
+
readonly type: "error";
|
|
564
|
+
}, {
|
|
565
|
+
readonly inputs: readonly [];
|
|
566
|
+
readonly name: "MultiChainTellerBase_GasTooLow";
|
|
567
|
+
readonly type: "error";
|
|
568
|
+
}, {
|
|
569
|
+
readonly inputs: readonly [{
|
|
570
|
+
readonly internalType: "uint32";
|
|
571
|
+
readonly name: "chainSelector";
|
|
572
|
+
readonly type: "uint32";
|
|
573
|
+
}];
|
|
574
|
+
readonly name: "MultiChainTellerBase_MessagesNotAllowedFrom";
|
|
575
|
+
readonly type: "error";
|
|
576
|
+
}, {
|
|
577
|
+
readonly inputs: readonly [{
|
|
578
|
+
readonly internalType: "uint256";
|
|
579
|
+
readonly name: "chainSelector";
|
|
580
|
+
readonly type: "uint256";
|
|
581
|
+
}];
|
|
582
|
+
readonly name: "MultiChainTellerBase_MessagesNotAllowedTo";
|
|
583
|
+
readonly type: "error";
|
|
584
|
+
}, {
|
|
585
|
+
readonly inputs: readonly [];
|
|
586
|
+
readonly name: "MultiChainTellerBase_TargetTellerIsZeroAddress";
|
|
587
|
+
readonly type: "error";
|
|
588
|
+
}, {
|
|
589
|
+
readonly inputs: readonly [];
|
|
590
|
+
readonly name: "MultiChainTellerBase_ZeroMessageGasLimit";
|
|
591
|
+
readonly type: "error";
|
|
592
|
+
}, {
|
|
593
|
+
readonly inputs: readonly [{
|
|
594
|
+
readonly internalType: "uint32";
|
|
595
|
+
readonly name: "eid";
|
|
596
|
+
readonly type: "uint32";
|
|
597
|
+
}];
|
|
598
|
+
readonly name: "NoPeer";
|
|
599
|
+
readonly type: "error";
|
|
600
|
+
}, {
|
|
601
|
+
readonly inputs: readonly [{
|
|
602
|
+
readonly internalType: "uint256";
|
|
603
|
+
readonly name: "msgValue";
|
|
604
|
+
readonly type: "uint256";
|
|
605
|
+
}];
|
|
606
|
+
readonly name: "NotEnoughNative";
|
|
607
|
+
readonly type: "error";
|
|
608
|
+
}, {
|
|
609
|
+
readonly inputs: readonly [{
|
|
610
|
+
readonly internalType: "address";
|
|
611
|
+
readonly name: "addr";
|
|
612
|
+
readonly type: "address";
|
|
613
|
+
}];
|
|
614
|
+
readonly name: "OnlyEndpoint";
|
|
615
|
+
readonly type: "error";
|
|
616
|
+
}, {
|
|
617
|
+
readonly inputs: readonly [{
|
|
618
|
+
readonly internalType: "uint32";
|
|
619
|
+
readonly name: "eid";
|
|
620
|
+
readonly type: "uint32";
|
|
621
|
+
}, {
|
|
622
|
+
readonly internalType: "bytes32";
|
|
623
|
+
readonly name: "sender";
|
|
624
|
+
readonly type: "bytes32";
|
|
625
|
+
}];
|
|
626
|
+
readonly name: "OnlyPeer";
|
|
627
|
+
readonly type: "error";
|
|
628
|
+
}, {
|
|
629
|
+
readonly inputs: readonly [{
|
|
630
|
+
readonly internalType: "uint8";
|
|
631
|
+
readonly name: "bits";
|
|
632
|
+
readonly type: "uint8";
|
|
633
|
+
}, {
|
|
634
|
+
readonly internalType: "uint256";
|
|
635
|
+
readonly name: "value";
|
|
636
|
+
readonly type: "uint256";
|
|
637
|
+
}];
|
|
638
|
+
readonly name: "SafeCastOverflowedUintDowncast";
|
|
639
|
+
readonly type: "error";
|
|
640
|
+
}, {
|
|
641
|
+
readonly inputs: readonly [{
|
|
642
|
+
readonly internalType: "address";
|
|
643
|
+
readonly name: "token";
|
|
644
|
+
readonly type: "address";
|
|
645
|
+
}];
|
|
646
|
+
readonly name: "SafeERC20FailedOperation";
|
|
647
|
+
readonly type: "error";
|
|
648
|
+
}, {
|
|
649
|
+
readonly inputs: readonly [];
|
|
650
|
+
readonly name: "TellerWithMultiAssetSupport__AssetNotSupported";
|
|
651
|
+
readonly type: "error";
|
|
652
|
+
}, {
|
|
653
|
+
readonly inputs: readonly [];
|
|
654
|
+
readonly name: "TellerWithMultiAssetSupport__BadDepositHash";
|
|
655
|
+
readonly type: "error";
|
|
656
|
+
}, {
|
|
657
|
+
readonly inputs: readonly [];
|
|
658
|
+
readonly name: "TellerWithMultiAssetSupport__MinimumAssetsNotMet";
|
|
659
|
+
readonly type: "error";
|
|
660
|
+
}, {
|
|
661
|
+
readonly inputs: readonly [];
|
|
662
|
+
readonly name: "TellerWithMultiAssetSupport__MinimumMintNotMet";
|
|
663
|
+
readonly type: "error";
|
|
664
|
+
}, {
|
|
665
|
+
readonly inputs: readonly [];
|
|
666
|
+
readonly name: "TellerWithMultiAssetSupport__Paused";
|
|
667
|
+
readonly type: "error";
|
|
668
|
+
}, {
|
|
669
|
+
readonly inputs: readonly [];
|
|
670
|
+
readonly name: "TellerWithMultiAssetSupport__PermitFailedAndAllowanceTooLow";
|
|
671
|
+
readonly type: "error";
|
|
672
|
+
}, {
|
|
673
|
+
readonly inputs: readonly [];
|
|
674
|
+
readonly name: "TellerWithMultiAssetSupport__ShareLockPeriodTooLong";
|
|
675
|
+
readonly type: "error";
|
|
676
|
+
}, {
|
|
677
|
+
readonly inputs: readonly [];
|
|
678
|
+
readonly name: "TellerWithMultiAssetSupport__SharesAreLocked";
|
|
679
|
+
readonly type: "error";
|
|
680
|
+
}, {
|
|
681
|
+
readonly inputs: readonly [];
|
|
682
|
+
readonly name: "TellerWithMultiAssetSupport__SharesAreUnLocked";
|
|
683
|
+
readonly type: "error";
|
|
684
|
+
}, {
|
|
685
|
+
readonly inputs: readonly [];
|
|
686
|
+
readonly name: "TellerWithMultiAssetSupport__ZeroAssets";
|
|
687
|
+
readonly type: "error";
|
|
688
|
+
}, {
|
|
689
|
+
readonly inputs: readonly [];
|
|
690
|
+
readonly name: "TellerWithMultiAssetSupport__ZeroShares";
|
|
691
|
+
readonly type: "error";
|
|
692
|
+
}, {
|
|
693
|
+
readonly anonymous: false;
|
|
694
|
+
readonly inputs: readonly [{
|
|
695
|
+
readonly indexed: true;
|
|
696
|
+
readonly internalType: "address";
|
|
697
|
+
readonly name: "asset";
|
|
698
|
+
readonly type: "address";
|
|
699
|
+
}];
|
|
700
|
+
readonly name: "AssetAdded";
|
|
701
|
+
readonly type: "event";
|
|
702
|
+
}, {
|
|
703
|
+
readonly anonymous: false;
|
|
704
|
+
readonly inputs: readonly [{
|
|
705
|
+
readonly indexed: true;
|
|
706
|
+
readonly internalType: "address";
|
|
707
|
+
readonly name: "asset";
|
|
708
|
+
readonly type: "address";
|
|
709
|
+
}];
|
|
710
|
+
readonly name: "AssetRemoved";
|
|
711
|
+
readonly type: "event";
|
|
712
|
+
}, {
|
|
713
|
+
readonly anonymous: false;
|
|
714
|
+
readonly inputs: readonly [{
|
|
715
|
+
readonly indexed: true;
|
|
716
|
+
readonly internalType: "address";
|
|
717
|
+
readonly name: "user";
|
|
718
|
+
readonly type: "address";
|
|
719
|
+
}, {
|
|
720
|
+
readonly indexed: true;
|
|
721
|
+
readonly internalType: "contract Authority";
|
|
722
|
+
readonly name: "newAuthority";
|
|
723
|
+
readonly type: "address";
|
|
724
|
+
}];
|
|
725
|
+
readonly name: "AuthorityUpdated";
|
|
726
|
+
readonly type: "event";
|
|
727
|
+
}, {
|
|
728
|
+
readonly anonymous: false;
|
|
729
|
+
readonly inputs: readonly [{
|
|
730
|
+
readonly indexed: true;
|
|
731
|
+
readonly internalType: "address";
|
|
732
|
+
readonly name: "asset";
|
|
733
|
+
readonly type: "address";
|
|
734
|
+
}, {
|
|
735
|
+
readonly indexed: false;
|
|
736
|
+
readonly internalType: "uint256";
|
|
737
|
+
readonly name: "depositAmount";
|
|
738
|
+
readonly type: "uint256";
|
|
739
|
+
}];
|
|
740
|
+
readonly name: "BulkDeposit";
|
|
741
|
+
readonly type: "event";
|
|
742
|
+
}, {
|
|
743
|
+
readonly anonymous: false;
|
|
744
|
+
readonly inputs: readonly [{
|
|
745
|
+
readonly indexed: true;
|
|
746
|
+
readonly internalType: "address";
|
|
747
|
+
readonly name: "asset";
|
|
748
|
+
readonly type: "address";
|
|
749
|
+
}, {
|
|
750
|
+
readonly indexed: false;
|
|
751
|
+
readonly internalType: "uint256";
|
|
752
|
+
readonly name: "shareAmount";
|
|
753
|
+
readonly type: "uint256";
|
|
754
|
+
}];
|
|
755
|
+
readonly name: "BulkWithdraw";
|
|
756
|
+
readonly type: "event";
|
|
757
|
+
}, {
|
|
758
|
+
readonly anonymous: false;
|
|
759
|
+
readonly inputs: readonly [{
|
|
760
|
+
readonly indexed: false;
|
|
761
|
+
readonly internalType: "uint256";
|
|
762
|
+
readonly name: "chainSelector";
|
|
763
|
+
readonly type: "uint256";
|
|
764
|
+
}, {
|
|
765
|
+
readonly indexed: false;
|
|
766
|
+
readonly internalType: "bool";
|
|
767
|
+
readonly name: "allowMessagesFrom";
|
|
768
|
+
readonly type: "bool";
|
|
769
|
+
}, {
|
|
770
|
+
readonly indexed: false;
|
|
771
|
+
readonly internalType: "bool";
|
|
772
|
+
readonly name: "allowMessagesTo";
|
|
773
|
+
readonly type: "bool";
|
|
774
|
+
}, {
|
|
775
|
+
readonly indexed: false;
|
|
776
|
+
readonly internalType: "address";
|
|
777
|
+
readonly name: "targetTeller";
|
|
778
|
+
readonly type: "address";
|
|
779
|
+
}, {
|
|
780
|
+
readonly indexed: false;
|
|
781
|
+
readonly internalType: "uint64";
|
|
782
|
+
readonly name: "messageGasLimit";
|
|
783
|
+
readonly type: "uint64";
|
|
784
|
+
}, {
|
|
785
|
+
readonly indexed: false;
|
|
786
|
+
readonly internalType: "uint64";
|
|
787
|
+
readonly name: "messageGasMin";
|
|
788
|
+
readonly type: "uint64";
|
|
789
|
+
}];
|
|
790
|
+
readonly name: "ChainAdded";
|
|
791
|
+
readonly type: "event";
|
|
792
|
+
}, {
|
|
793
|
+
readonly anonymous: false;
|
|
794
|
+
readonly inputs: readonly [{
|
|
795
|
+
readonly indexed: false;
|
|
796
|
+
readonly internalType: "uint256";
|
|
797
|
+
readonly name: "chainSelector";
|
|
798
|
+
readonly type: "uint256";
|
|
799
|
+
}, {
|
|
800
|
+
readonly indexed: false;
|
|
801
|
+
readonly internalType: "address";
|
|
802
|
+
readonly name: "targetTeller";
|
|
803
|
+
readonly type: "address";
|
|
804
|
+
}];
|
|
805
|
+
readonly name: "ChainAllowMessagesFrom";
|
|
806
|
+
readonly type: "event";
|
|
807
|
+
}, {
|
|
808
|
+
readonly anonymous: false;
|
|
809
|
+
readonly inputs: readonly [{
|
|
810
|
+
readonly indexed: false;
|
|
811
|
+
readonly internalType: "uint256";
|
|
812
|
+
readonly name: "chainSelector";
|
|
813
|
+
readonly type: "uint256";
|
|
814
|
+
}, {
|
|
815
|
+
readonly indexed: false;
|
|
816
|
+
readonly internalType: "address";
|
|
817
|
+
readonly name: "targetTeller";
|
|
818
|
+
readonly type: "address";
|
|
819
|
+
}];
|
|
820
|
+
readonly name: "ChainAllowMessagesTo";
|
|
821
|
+
readonly type: "event";
|
|
822
|
+
}, {
|
|
823
|
+
readonly anonymous: false;
|
|
824
|
+
readonly inputs: readonly [{
|
|
825
|
+
readonly indexed: false;
|
|
826
|
+
readonly internalType: "uint256";
|
|
827
|
+
readonly name: "chainSelector";
|
|
828
|
+
readonly type: "uint256";
|
|
829
|
+
}];
|
|
830
|
+
readonly name: "ChainRemoved";
|
|
831
|
+
readonly type: "event";
|
|
832
|
+
}, {
|
|
833
|
+
readonly anonymous: false;
|
|
834
|
+
readonly inputs: readonly [{
|
|
835
|
+
readonly indexed: false;
|
|
836
|
+
readonly internalType: "uint256";
|
|
837
|
+
readonly name: "chainSelector";
|
|
838
|
+
readonly type: "uint256";
|
|
839
|
+
}, {
|
|
840
|
+
readonly indexed: false;
|
|
841
|
+
readonly internalType: "uint64";
|
|
842
|
+
readonly name: "messageGasLimit";
|
|
843
|
+
readonly type: "uint64";
|
|
844
|
+
}];
|
|
845
|
+
readonly name: "ChainSetGasLimit";
|
|
846
|
+
readonly type: "event";
|
|
847
|
+
}, {
|
|
848
|
+
readonly anonymous: false;
|
|
849
|
+
readonly inputs: readonly [{
|
|
850
|
+
readonly indexed: false;
|
|
851
|
+
readonly internalType: "uint256";
|
|
852
|
+
readonly name: "chainSelector";
|
|
853
|
+
readonly type: "uint256";
|
|
854
|
+
}];
|
|
855
|
+
readonly name: "ChainStopMessagesFrom";
|
|
856
|
+
readonly type: "event";
|
|
857
|
+
}, {
|
|
858
|
+
readonly anonymous: false;
|
|
859
|
+
readonly inputs: readonly [{
|
|
860
|
+
readonly indexed: false;
|
|
861
|
+
readonly internalType: "uint256";
|
|
862
|
+
readonly name: "chainSelector";
|
|
863
|
+
readonly type: "uint256";
|
|
864
|
+
}];
|
|
865
|
+
readonly name: "ChainStopMessagesTo";
|
|
866
|
+
readonly type: "event";
|
|
867
|
+
}, {
|
|
868
|
+
readonly anonymous: false;
|
|
869
|
+
readonly inputs: readonly [{
|
|
870
|
+
readonly indexed: true;
|
|
871
|
+
readonly internalType: "uint256";
|
|
872
|
+
readonly name: "nonce";
|
|
873
|
+
readonly type: "uint256";
|
|
874
|
+
}, {
|
|
875
|
+
readonly indexed: true;
|
|
876
|
+
readonly internalType: "address";
|
|
877
|
+
readonly name: "receiver";
|
|
878
|
+
readonly type: "address";
|
|
879
|
+
}, {
|
|
880
|
+
readonly indexed: true;
|
|
881
|
+
readonly internalType: "address";
|
|
882
|
+
readonly name: "depositAsset";
|
|
883
|
+
readonly type: "address";
|
|
884
|
+
}, {
|
|
885
|
+
readonly indexed: false;
|
|
886
|
+
readonly internalType: "uint256";
|
|
887
|
+
readonly name: "depositAmount";
|
|
888
|
+
readonly type: "uint256";
|
|
889
|
+
}, {
|
|
890
|
+
readonly indexed: false;
|
|
891
|
+
readonly internalType: "uint256";
|
|
892
|
+
readonly name: "shareAmount";
|
|
893
|
+
readonly type: "uint256";
|
|
894
|
+
}, {
|
|
895
|
+
readonly indexed: false;
|
|
896
|
+
readonly internalType: "uint256";
|
|
897
|
+
readonly name: "depositTimestamp";
|
|
898
|
+
readonly type: "uint256";
|
|
899
|
+
}, {
|
|
900
|
+
readonly indexed: false;
|
|
901
|
+
readonly internalType: "uint256";
|
|
902
|
+
readonly name: "shareLockPeriodAtTimeOfDeposit";
|
|
903
|
+
readonly type: "uint256";
|
|
904
|
+
}];
|
|
905
|
+
readonly name: "Deposit";
|
|
906
|
+
readonly type: "event";
|
|
907
|
+
}, {
|
|
908
|
+
readonly anonymous: false;
|
|
909
|
+
readonly inputs: readonly [{
|
|
910
|
+
readonly indexed: true;
|
|
911
|
+
readonly internalType: "uint256";
|
|
912
|
+
readonly name: "nonce";
|
|
913
|
+
readonly type: "uint256";
|
|
914
|
+
}, {
|
|
915
|
+
readonly indexed: false;
|
|
916
|
+
readonly internalType: "bytes32";
|
|
917
|
+
readonly name: "depositHash";
|
|
918
|
+
readonly type: "bytes32";
|
|
919
|
+
}, {
|
|
920
|
+
readonly indexed: true;
|
|
921
|
+
readonly internalType: "address";
|
|
922
|
+
readonly name: "user";
|
|
923
|
+
readonly type: "address";
|
|
924
|
+
}];
|
|
925
|
+
readonly name: "DepositRefunded";
|
|
926
|
+
readonly type: "event";
|
|
927
|
+
}, {
|
|
928
|
+
readonly anonymous: false;
|
|
929
|
+
readonly inputs: readonly [{
|
|
930
|
+
readonly indexed: false;
|
|
931
|
+
readonly internalType: "bytes32";
|
|
932
|
+
readonly name: "messageId";
|
|
933
|
+
readonly type: "bytes32";
|
|
934
|
+
}, {
|
|
935
|
+
readonly indexed: false;
|
|
936
|
+
readonly internalType: "uint256";
|
|
937
|
+
readonly name: "shareAmount";
|
|
938
|
+
readonly type: "uint256";
|
|
939
|
+
}, {
|
|
940
|
+
readonly indexed: false;
|
|
941
|
+
readonly internalType: "address";
|
|
942
|
+
readonly name: "to";
|
|
943
|
+
readonly type: "address";
|
|
944
|
+
}];
|
|
945
|
+
readonly name: "MessageReceived";
|
|
946
|
+
readonly type: "event";
|
|
947
|
+
}, {
|
|
948
|
+
readonly anonymous: false;
|
|
949
|
+
readonly inputs: readonly [{
|
|
950
|
+
readonly indexed: false;
|
|
951
|
+
readonly internalType: "bytes32";
|
|
952
|
+
readonly name: "messageId";
|
|
953
|
+
readonly type: "bytes32";
|
|
954
|
+
}, {
|
|
955
|
+
readonly indexed: false;
|
|
956
|
+
readonly internalType: "uint256";
|
|
957
|
+
readonly name: "shareAmount";
|
|
958
|
+
readonly type: "uint256";
|
|
959
|
+
}, {
|
|
960
|
+
readonly indexed: false;
|
|
961
|
+
readonly internalType: "address";
|
|
962
|
+
readonly name: "to";
|
|
963
|
+
readonly type: "address";
|
|
964
|
+
}];
|
|
965
|
+
readonly name: "MessageSent";
|
|
966
|
+
readonly type: "event";
|
|
967
|
+
}, {
|
|
968
|
+
readonly anonymous: false;
|
|
969
|
+
readonly inputs: readonly [{
|
|
970
|
+
readonly indexed: true;
|
|
971
|
+
readonly internalType: "address";
|
|
972
|
+
readonly name: "user";
|
|
973
|
+
readonly type: "address";
|
|
974
|
+
}, {
|
|
975
|
+
readonly indexed: true;
|
|
976
|
+
readonly internalType: "address";
|
|
977
|
+
readonly name: "newOwner";
|
|
978
|
+
readonly type: "address";
|
|
979
|
+
}];
|
|
980
|
+
readonly name: "OwnershipTransferred";
|
|
981
|
+
readonly type: "event";
|
|
982
|
+
}, {
|
|
983
|
+
readonly anonymous: false;
|
|
984
|
+
readonly inputs: readonly [];
|
|
985
|
+
readonly name: "Paused";
|
|
986
|
+
readonly type: "event";
|
|
987
|
+
}, {
|
|
988
|
+
readonly anonymous: false;
|
|
989
|
+
readonly inputs: readonly [{
|
|
990
|
+
readonly indexed: false;
|
|
991
|
+
readonly internalType: "uint32";
|
|
992
|
+
readonly name: "eid";
|
|
993
|
+
readonly type: "uint32";
|
|
994
|
+
}, {
|
|
995
|
+
readonly indexed: false;
|
|
996
|
+
readonly internalType: "bytes32";
|
|
997
|
+
readonly name: "peer";
|
|
998
|
+
readonly type: "bytes32";
|
|
999
|
+
}];
|
|
1000
|
+
readonly name: "PeerSet";
|
|
1001
|
+
readonly type: "event";
|
|
1002
|
+
}, {
|
|
1003
|
+
readonly anonymous: false;
|
|
1004
|
+
readonly inputs: readonly [];
|
|
1005
|
+
readonly name: "Unpaused";
|
|
1006
|
+
readonly type: "event";
|
|
1007
|
+
}, {
|
|
1008
|
+
readonly inputs: readonly [];
|
|
1009
|
+
readonly name: "accountant";
|
|
1010
|
+
readonly outputs: readonly [{
|
|
1011
|
+
readonly internalType: "contract AccountantWithRateProviders";
|
|
1012
|
+
readonly name: "";
|
|
1013
|
+
readonly type: "address";
|
|
1014
|
+
}];
|
|
1015
|
+
readonly stateMutability: "view";
|
|
1016
|
+
readonly type: "function";
|
|
1017
|
+
}, {
|
|
1018
|
+
readonly inputs: readonly [{
|
|
1019
|
+
readonly internalType: "contract ERC20";
|
|
1020
|
+
readonly name: "asset";
|
|
1021
|
+
readonly type: "address";
|
|
1022
|
+
}];
|
|
1023
|
+
readonly name: "addAsset";
|
|
1024
|
+
readonly outputs: readonly [];
|
|
1025
|
+
readonly stateMutability: "nonpayable";
|
|
1026
|
+
readonly type: "function";
|
|
1027
|
+
}, {
|
|
1028
|
+
readonly inputs: readonly [{
|
|
1029
|
+
readonly internalType: "uint32";
|
|
1030
|
+
readonly name: "chainSelector";
|
|
1031
|
+
readonly type: "uint32";
|
|
1032
|
+
}, {
|
|
1033
|
+
readonly internalType: "bool";
|
|
1034
|
+
readonly name: "allowMessagesFrom";
|
|
1035
|
+
readonly type: "bool";
|
|
1036
|
+
}, {
|
|
1037
|
+
readonly internalType: "bool";
|
|
1038
|
+
readonly name: "allowMessagesTo";
|
|
1039
|
+
readonly type: "bool";
|
|
1040
|
+
}, {
|
|
1041
|
+
readonly internalType: "address";
|
|
1042
|
+
readonly name: "targetTeller";
|
|
1043
|
+
readonly type: "address";
|
|
1044
|
+
}, {
|
|
1045
|
+
readonly internalType: "uint64";
|
|
1046
|
+
readonly name: "messageGasLimit";
|
|
1047
|
+
readonly type: "uint64";
|
|
1048
|
+
}, {
|
|
1049
|
+
readonly internalType: "uint64";
|
|
1050
|
+
readonly name: "messageGasMin";
|
|
1051
|
+
readonly type: "uint64";
|
|
1052
|
+
}];
|
|
1053
|
+
readonly name: "addChain";
|
|
1054
|
+
readonly outputs: readonly [];
|
|
1055
|
+
readonly stateMutability: "nonpayable";
|
|
1056
|
+
readonly type: "function";
|
|
1057
|
+
}, {
|
|
1058
|
+
readonly inputs: readonly [{
|
|
1059
|
+
readonly components: readonly [{
|
|
1060
|
+
readonly internalType: "uint32";
|
|
1061
|
+
readonly name: "srcEid";
|
|
1062
|
+
readonly type: "uint32";
|
|
1063
|
+
}, {
|
|
1064
|
+
readonly internalType: "bytes32";
|
|
1065
|
+
readonly name: "sender";
|
|
1066
|
+
readonly type: "bytes32";
|
|
1067
|
+
}, {
|
|
1068
|
+
readonly internalType: "uint64";
|
|
1069
|
+
readonly name: "nonce";
|
|
1070
|
+
readonly type: "uint64";
|
|
1071
|
+
}];
|
|
1072
|
+
readonly internalType: "struct Origin";
|
|
1073
|
+
readonly name: "origin";
|
|
1074
|
+
readonly type: "tuple";
|
|
1075
|
+
}];
|
|
1076
|
+
readonly name: "allowInitializePath";
|
|
1077
|
+
readonly outputs: readonly [{
|
|
1078
|
+
readonly internalType: "bool";
|
|
1079
|
+
readonly name: "";
|
|
1080
|
+
readonly type: "bool";
|
|
1081
|
+
}];
|
|
1082
|
+
readonly stateMutability: "view";
|
|
1083
|
+
readonly type: "function";
|
|
1084
|
+
}, {
|
|
1085
|
+
readonly inputs: readonly [{
|
|
1086
|
+
readonly internalType: "uint32";
|
|
1087
|
+
readonly name: "chainSelector";
|
|
1088
|
+
readonly type: "uint32";
|
|
1089
|
+
}, {
|
|
1090
|
+
readonly internalType: "address";
|
|
1091
|
+
readonly name: "targetTeller";
|
|
1092
|
+
readonly type: "address";
|
|
1093
|
+
}];
|
|
1094
|
+
readonly name: "allowMessagesFromChain";
|
|
1095
|
+
readonly outputs: readonly [];
|
|
1096
|
+
readonly stateMutability: "nonpayable";
|
|
1097
|
+
readonly type: "function";
|
|
1098
|
+
}, {
|
|
1099
|
+
readonly inputs: readonly [{
|
|
1100
|
+
readonly internalType: "uint32";
|
|
1101
|
+
readonly name: "chainSelector";
|
|
1102
|
+
readonly type: "uint32";
|
|
1103
|
+
}, {
|
|
1104
|
+
readonly internalType: "address";
|
|
1105
|
+
readonly name: "targetTeller";
|
|
1106
|
+
readonly type: "address";
|
|
1107
|
+
}, {
|
|
1108
|
+
readonly internalType: "uint64";
|
|
1109
|
+
readonly name: "messageGasLimit";
|
|
1110
|
+
readonly type: "uint64";
|
|
1111
|
+
}];
|
|
1112
|
+
readonly name: "allowMessagesToChain";
|
|
1113
|
+
readonly outputs: readonly [];
|
|
1114
|
+
readonly stateMutability: "nonpayable";
|
|
1115
|
+
readonly type: "function";
|
|
1116
|
+
}, {
|
|
1117
|
+
readonly inputs: readonly [];
|
|
1118
|
+
readonly name: "authority";
|
|
1119
|
+
readonly outputs: readonly [{
|
|
1120
|
+
readonly internalType: "contract Authority";
|
|
1121
|
+
readonly name: "";
|
|
1122
|
+
readonly type: "address";
|
|
1123
|
+
}];
|
|
1124
|
+
readonly stateMutability: "view";
|
|
1125
|
+
readonly type: "function";
|
|
1126
|
+
}, {
|
|
1127
|
+
readonly inputs: readonly [{
|
|
1128
|
+
readonly internalType: "address";
|
|
1129
|
+
readonly name: "from";
|
|
1130
|
+
readonly type: "address";
|
|
1131
|
+
}];
|
|
1132
|
+
readonly name: "beforeTransfer";
|
|
1133
|
+
readonly outputs: readonly [];
|
|
1134
|
+
readonly stateMutability: "view";
|
|
1135
|
+
readonly type: "function";
|
|
1136
|
+
}, {
|
|
1137
|
+
readonly inputs: readonly [{
|
|
1138
|
+
readonly internalType: "uint256";
|
|
1139
|
+
readonly name: "shareAmount";
|
|
1140
|
+
readonly type: "uint256";
|
|
1141
|
+
}, {
|
|
1142
|
+
readonly components: readonly [{
|
|
1143
|
+
readonly internalType: "uint32";
|
|
1144
|
+
readonly name: "chainSelector";
|
|
1145
|
+
readonly type: "uint32";
|
|
1146
|
+
}, {
|
|
1147
|
+
readonly internalType: "address";
|
|
1148
|
+
readonly name: "destinationChainReceiver";
|
|
1149
|
+
readonly type: "address";
|
|
1150
|
+
}, {
|
|
1151
|
+
readonly internalType: "contract ERC20";
|
|
1152
|
+
readonly name: "bridgeFeeToken";
|
|
1153
|
+
readonly type: "address";
|
|
1154
|
+
}, {
|
|
1155
|
+
readonly internalType: "uint64";
|
|
1156
|
+
readonly name: "messageGas";
|
|
1157
|
+
readonly type: "uint64";
|
|
1158
|
+
}, {
|
|
1159
|
+
readonly internalType: "bytes";
|
|
1160
|
+
readonly name: "data";
|
|
1161
|
+
readonly type: "bytes";
|
|
1162
|
+
}];
|
|
1163
|
+
readonly internalType: "struct BridgeData";
|
|
1164
|
+
readonly name: "data";
|
|
1165
|
+
readonly type: "tuple";
|
|
1166
|
+
}];
|
|
1167
|
+
readonly name: "bridge";
|
|
1168
|
+
readonly outputs: readonly [{
|
|
1169
|
+
readonly internalType: "bytes32";
|
|
1170
|
+
readonly name: "messageId";
|
|
1171
|
+
readonly type: "bytes32";
|
|
1172
|
+
}];
|
|
1173
|
+
readonly stateMutability: "payable";
|
|
1174
|
+
readonly type: "function";
|
|
1175
|
+
}, {
|
|
1176
|
+
readonly inputs: readonly [{
|
|
1177
|
+
readonly internalType: "contract ERC20";
|
|
1178
|
+
readonly name: "depositAsset";
|
|
1179
|
+
readonly type: "address";
|
|
1180
|
+
}, {
|
|
1181
|
+
readonly internalType: "uint256";
|
|
1182
|
+
readonly name: "depositAmount";
|
|
1183
|
+
readonly type: "uint256";
|
|
1184
|
+
}, {
|
|
1185
|
+
readonly internalType: "uint256";
|
|
1186
|
+
readonly name: "minimumMint";
|
|
1187
|
+
readonly type: "uint256";
|
|
1188
|
+
}, {
|
|
1189
|
+
readonly internalType: "address";
|
|
1190
|
+
readonly name: "to";
|
|
1191
|
+
readonly type: "address";
|
|
1192
|
+
}];
|
|
1193
|
+
readonly name: "bulkDeposit";
|
|
1194
|
+
readonly outputs: readonly [{
|
|
1195
|
+
readonly internalType: "uint256";
|
|
1196
|
+
readonly name: "shares";
|
|
1197
|
+
readonly type: "uint256";
|
|
1198
|
+
}];
|
|
1199
|
+
readonly stateMutability: "nonpayable";
|
|
1200
|
+
readonly type: "function";
|
|
1201
|
+
}, {
|
|
1202
|
+
readonly inputs: readonly [{
|
|
1203
|
+
readonly internalType: "contract ERC20";
|
|
1204
|
+
readonly name: "withdrawAsset";
|
|
1205
|
+
readonly type: "address";
|
|
1206
|
+
}, {
|
|
1207
|
+
readonly internalType: "uint256";
|
|
1208
|
+
readonly name: "shareAmount";
|
|
1209
|
+
readonly type: "uint256";
|
|
1210
|
+
}, {
|
|
1211
|
+
readonly internalType: "uint256";
|
|
1212
|
+
readonly name: "minimumAssets";
|
|
1213
|
+
readonly type: "uint256";
|
|
1214
|
+
}, {
|
|
1215
|
+
readonly internalType: "address";
|
|
1216
|
+
readonly name: "to";
|
|
1217
|
+
readonly type: "address";
|
|
1218
|
+
}];
|
|
1219
|
+
readonly name: "bulkWithdraw";
|
|
1220
|
+
readonly outputs: readonly [{
|
|
1221
|
+
readonly internalType: "uint256";
|
|
1222
|
+
readonly name: "assetsOut";
|
|
1223
|
+
readonly type: "uint256";
|
|
1224
|
+
}];
|
|
1225
|
+
readonly stateMutability: "nonpayable";
|
|
1226
|
+
readonly type: "function";
|
|
1227
|
+
}, {
|
|
1228
|
+
readonly inputs: readonly [{
|
|
1229
|
+
readonly internalType: "contract ERC20";
|
|
1230
|
+
readonly name: "depositAsset";
|
|
1231
|
+
readonly type: "address";
|
|
1232
|
+
}, {
|
|
1233
|
+
readonly internalType: "uint256";
|
|
1234
|
+
readonly name: "depositAmount";
|
|
1235
|
+
readonly type: "uint256";
|
|
1236
|
+
}, {
|
|
1237
|
+
readonly internalType: "uint256";
|
|
1238
|
+
readonly name: "minimumMint";
|
|
1239
|
+
readonly type: "uint256";
|
|
1240
|
+
}];
|
|
1241
|
+
readonly name: "deposit";
|
|
1242
|
+
readonly outputs: readonly [{
|
|
1243
|
+
readonly internalType: "uint256";
|
|
1244
|
+
readonly name: "shares";
|
|
1245
|
+
readonly type: "uint256";
|
|
1246
|
+
}];
|
|
1247
|
+
readonly stateMutability: "nonpayable";
|
|
1248
|
+
readonly type: "function";
|
|
1249
|
+
}, {
|
|
1250
|
+
readonly inputs: readonly [{
|
|
1251
|
+
readonly internalType: "contract ERC20";
|
|
1252
|
+
readonly name: "depositAsset";
|
|
1253
|
+
readonly type: "address";
|
|
1254
|
+
}, {
|
|
1255
|
+
readonly internalType: "uint256";
|
|
1256
|
+
readonly name: "depositAmount";
|
|
1257
|
+
readonly type: "uint256";
|
|
1258
|
+
}, {
|
|
1259
|
+
readonly internalType: "uint256";
|
|
1260
|
+
readonly name: "minimumMint";
|
|
1261
|
+
readonly type: "uint256";
|
|
1262
|
+
}, {
|
|
1263
|
+
readonly components: readonly [{
|
|
1264
|
+
readonly internalType: "uint32";
|
|
1265
|
+
readonly name: "chainSelector";
|
|
1266
|
+
readonly type: "uint32";
|
|
1267
|
+
}, {
|
|
1268
|
+
readonly internalType: "address";
|
|
1269
|
+
readonly name: "destinationChainReceiver";
|
|
1270
|
+
readonly type: "address";
|
|
1271
|
+
}, {
|
|
1272
|
+
readonly internalType: "contract ERC20";
|
|
1273
|
+
readonly name: "bridgeFeeToken";
|
|
1274
|
+
readonly type: "address";
|
|
1275
|
+
}, {
|
|
1276
|
+
readonly internalType: "uint64";
|
|
1277
|
+
readonly name: "messageGas";
|
|
1278
|
+
readonly type: "uint64";
|
|
1279
|
+
}, {
|
|
1280
|
+
readonly internalType: "bytes";
|
|
1281
|
+
readonly name: "data";
|
|
1282
|
+
readonly type: "bytes";
|
|
1283
|
+
}];
|
|
1284
|
+
readonly internalType: "struct BridgeData";
|
|
1285
|
+
readonly name: "data";
|
|
1286
|
+
readonly type: "tuple";
|
|
1287
|
+
}];
|
|
1288
|
+
readonly name: "depositAndBridge";
|
|
1289
|
+
readonly outputs: readonly [];
|
|
1290
|
+
readonly stateMutability: "payable";
|
|
1291
|
+
readonly type: "function";
|
|
1292
|
+
}, {
|
|
1293
|
+
readonly inputs: readonly [];
|
|
1294
|
+
readonly name: "depositNonce";
|
|
1295
|
+
readonly outputs: readonly [{
|
|
1296
|
+
readonly internalType: "uint96";
|
|
1297
|
+
readonly name: "";
|
|
1298
|
+
readonly type: "uint96";
|
|
1299
|
+
}];
|
|
1300
|
+
readonly stateMutability: "view";
|
|
1301
|
+
readonly type: "function";
|
|
1302
|
+
}, {
|
|
1303
|
+
readonly inputs: readonly [{
|
|
1304
|
+
readonly internalType: "contract ERC20";
|
|
1305
|
+
readonly name: "depositAsset";
|
|
1306
|
+
readonly type: "address";
|
|
1307
|
+
}, {
|
|
1308
|
+
readonly internalType: "uint256";
|
|
1309
|
+
readonly name: "depositAmount";
|
|
1310
|
+
readonly type: "uint256";
|
|
1311
|
+
}, {
|
|
1312
|
+
readonly internalType: "uint256";
|
|
1313
|
+
readonly name: "minimumMint";
|
|
1314
|
+
readonly type: "uint256";
|
|
1315
|
+
}, {
|
|
1316
|
+
readonly internalType: "uint256";
|
|
1317
|
+
readonly name: "deadline";
|
|
1318
|
+
readonly type: "uint256";
|
|
1319
|
+
}, {
|
|
1320
|
+
readonly internalType: "uint8";
|
|
1321
|
+
readonly name: "v";
|
|
1322
|
+
readonly type: "uint8";
|
|
1323
|
+
}, {
|
|
1324
|
+
readonly internalType: "bytes32";
|
|
1325
|
+
readonly name: "r";
|
|
1326
|
+
readonly type: "bytes32";
|
|
1327
|
+
}, {
|
|
1328
|
+
readonly internalType: "bytes32";
|
|
1329
|
+
readonly name: "s";
|
|
1330
|
+
readonly type: "bytes32";
|
|
1331
|
+
}];
|
|
1332
|
+
readonly name: "depositWithPermit";
|
|
1333
|
+
readonly outputs: readonly [{
|
|
1334
|
+
readonly internalType: "uint256";
|
|
1335
|
+
readonly name: "shares";
|
|
1336
|
+
readonly type: "uint256";
|
|
1337
|
+
}];
|
|
1338
|
+
readonly stateMutability: "nonpayable";
|
|
1339
|
+
readonly type: "function";
|
|
1340
|
+
}, {
|
|
1341
|
+
readonly inputs: readonly [];
|
|
1342
|
+
readonly name: "endpoint";
|
|
1343
|
+
readonly outputs: readonly [{
|
|
1344
|
+
readonly internalType: "contract ILayerZeroEndpointV2";
|
|
1345
|
+
readonly name: "";
|
|
1346
|
+
readonly type: "address";
|
|
1347
|
+
}];
|
|
1348
|
+
readonly stateMutability: "view";
|
|
1349
|
+
readonly type: "function";
|
|
1350
|
+
}, {
|
|
1351
|
+
readonly inputs: readonly [{
|
|
1352
|
+
readonly components: readonly [{
|
|
1353
|
+
readonly internalType: "uint32";
|
|
1354
|
+
readonly name: "srcEid";
|
|
1355
|
+
readonly type: "uint32";
|
|
1356
|
+
}, {
|
|
1357
|
+
readonly internalType: "bytes32";
|
|
1358
|
+
readonly name: "sender";
|
|
1359
|
+
readonly type: "bytes32";
|
|
1360
|
+
}, {
|
|
1361
|
+
readonly internalType: "uint64";
|
|
1362
|
+
readonly name: "nonce";
|
|
1363
|
+
readonly type: "uint64";
|
|
1364
|
+
}];
|
|
1365
|
+
readonly internalType: "struct Origin";
|
|
1366
|
+
readonly name: "";
|
|
1367
|
+
readonly type: "tuple";
|
|
1368
|
+
}, {
|
|
1369
|
+
readonly internalType: "bytes";
|
|
1370
|
+
readonly name: "";
|
|
1371
|
+
readonly type: "bytes";
|
|
1372
|
+
}, {
|
|
1373
|
+
readonly internalType: "address";
|
|
1374
|
+
readonly name: "_sender";
|
|
1375
|
+
readonly type: "address";
|
|
1376
|
+
}];
|
|
1377
|
+
readonly name: "isComposeMsgSender";
|
|
1378
|
+
readonly outputs: readonly [{
|
|
1379
|
+
readonly internalType: "bool";
|
|
1380
|
+
readonly name: "";
|
|
1381
|
+
readonly type: "bool";
|
|
1382
|
+
}];
|
|
1383
|
+
readonly stateMutability: "view";
|
|
1384
|
+
readonly type: "function";
|
|
1385
|
+
}, {
|
|
1386
|
+
readonly inputs: readonly [];
|
|
1387
|
+
readonly name: "isPaused";
|
|
1388
|
+
readonly outputs: readonly [{
|
|
1389
|
+
readonly internalType: "bool";
|
|
1390
|
+
readonly name: "";
|
|
1391
|
+
readonly type: "bool";
|
|
1392
|
+
}];
|
|
1393
|
+
readonly stateMutability: "view";
|
|
1394
|
+
readonly type: "function";
|
|
1395
|
+
}, {
|
|
1396
|
+
readonly inputs: readonly [{
|
|
1397
|
+
readonly internalType: "contract ERC20";
|
|
1398
|
+
readonly name: "";
|
|
1399
|
+
readonly type: "address";
|
|
1400
|
+
}];
|
|
1401
|
+
readonly name: "isSupported";
|
|
1402
|
+
readonly outputs: readonly [{
|
|
1403
|
+
readonly internalType: "bool";
|
|
1404
|
+
readonly name: "";
|
|
1405
|
+
readonly type: "bool";
|
|
1406
|
+
}];
|
|
1407
|
+
readonly stateMutability: "view";
|
|
1408
|
+
readonly type: "function";
|
|
1409
|
+
}, {
|
|
1410
|
+
readonly inputs: readonly [{
|
|
1411
|
+
readonly components: readonly [{
|
|
1412
|
+
readonly internalType: "uint32";
|
|
1413
|
+
readonly name: "srcEid";
|
|
1414
|
+
readonly type: "uint32";
|
|
1415
|
+
}, {
|
|
1416
|
+
readonly internalType: "bytes32";
|
|
1417
|
+
readonly name: "sender";
|
|
1418
|
+
readonly type: "bytes32";
|
|
1419
|
+
}, {
|
|
1420
|
+
readonly internalType: "uint64";
|
|
1421
|
+
readonly name: "nonce";
|
|
1422
|
+
readonly type: "uint64";
|
|
1423
|
+
}];
|
|
1424
|
+
readonly internalType: "struct Origin";
|
|
1425
|
+
readonly name: "_origin";
|
|
1426
|
+
readonly type: "tuple";
|
|
1427
|
+
}, {
|
|
1428
|
+
readonly internalType: "bytes32";
|
|
1429
|
+
readonly name: "_guid";
|
|
1430
|
+
readonly type: "bytes32";
|
|
1431
|
+
}, {
|
|
1432
|
+
readonly internalType: "bytes";
|
|
1433
|
+
readonly name: "_message";
|
|
1434
|
+
readonly type: "bytes";
|
|
1435
|
+
}, {
|
|
1436
|
+
readonly internalType: "address";
|
|
1437
|
+
readonly name: "_executor";
|
|
1438
|
+
readonly type: "address";
|
|
1439
|
+
}, {
|
|
1440
|
+
readonly internalType: "bytes";
|
|
1441
|
+
readonly name: "_extraData";
|
|
1442
|
+
readonly type: "bytes";
|
|
1443
|
+
}];
|
|
1444
|
+
readonly name: "lzReceive";
|
|
1445
|
+
readonly outputs: readonly [];
|
|
1446
|
+
readonly stateMutability: "payable";
|
|
1447
|
+
readonly type: "function";
|
|
1448
|
+
}, {
|
|
1449
|
+
readonly inputs: readonly [{
|
|
1450
|
+
readonly internalType: "uint32";
|
|
1451
|
+
readonly name: "";
|
|
1452
|
+
readonly type: "uint32";
|
|
1453
|
+
}, {
|
|
1454
|
+
readonly internalType: "bytes32";
|
|
1455
|
+
readonly name: "";
|
|
1456
|
+
readonly type: "bytes32";
|
|
1457
|
+
}];
|
|
1458
|
+
readonly name: "nextNonce";
|
|
1459
|
+
readonly outputs: readonly [{
|
|
1460
|
+
readonly internalType: "uint64";
|
|
1461
|
+
readonly name: "nonce";
|
|
1462
|
+
readonly type: "uint64";
|
|
1463
|
+
}];
|
|
1464
|
+
readonly stateMutability: "view";
|
|
1465
|
+
readonly type: "function";
|
|
1466
|
+
}, {
|
|
1467
|
+
readonly inputs: readonly [];
|
|
1468
|
+
readonly name: "oAppVersion";
|
|
1469
|
+
readonly outputs: readonly [{
|
|
1470
|
+
readonly internalType: "uint64";
|
|
1471
|
+
readonly name: "senderVersion";
|
|
1472
|
+
readonly type: "uint64";
|
|
1473
|
+
}, {
|
|
1474
|
+
readonly internalType: "uint64";
|
|
1475
|
+
readonly name: "receiverVersion";
|
|
1476
|
+
readonly type: "uint64";
|
|
1477
|
+
}];
|
|
1478
|
+
readonly stateMutability: "pure";
|
|
1479
|
+
readonly type: "function";
|
|
1480
|
+
}, {
|
|
1481
|
+
readonly inputs: readonly [];
|
|
1482
|
+
readonly name: "owner";
|
|
1483
|
+
readonly outputs: readonly [{
|
|
1484
|
+
readonly internalType: "address";
|
|
1485
|
+
readonly name: "";
|
|
1486
|
+
readonly type: "address";
|
|
1487
|
+
}];
|
|
1488
|
+
readonly stateMutability: "view";
|
|
1489
|
+
readonly type: "function";
|
|
1490
|
+
}, {
|
|
1491
|
+
readonly inputs: readonly [];
|
|
1492
|
+
readonly name: "pause";
|
|
1493
|
+
readonly outputs: readonly [];
|
|
1494
|
+
readonly stateMutability: "nonpayable";
|
|
1495
|
+
readonly type: "function";
|
|
1496
|
+
}, {
|
|
1497
|
+
readonly inputs: readonly [{
|
|
1498
|
+
readonly internalType: "uint32";
|
|
1499
|
+
readonly name: "eid";
|
|
1500
|
+
readonly type: "uint32";
|
|
1501
|
+
}];
|
|
1502
|
+
readonly name: "peers";
|
|
1503
|
+
readonly outputs: readonly [{
|
|
1504
|
+
readonly internalType: "bytes32";
|
|
1505
|
+
readonly name: "peer";
|
|
1506
|
+
readonly type: "bytes32";
|
|
1507
|
+
}];
|
|
1508
|
+
readonly stateMutability: "view";
|
|
1509
|
+
readonly type: "function";
|
|
1510
|
+
}, {
|
|
1511
|
+
readonly inputs: readonly [{
|
|
1512
|
+
readonly internalType: "uint256";
|
|
1513
|
+
readonly name: "shareAmount";
|
|
1514
|
+
readonly type: "uint256";
|
|
1515
|
+
}, {
|
|
1516
|
+
readonly components: readonly [{
|
|
1517
|
+
readonly internalType: "uint32";
|
|
1518
|
+
readonly name: "chainSelector";
|
|
1519
|
+
readonly type: "uint32";
|
|
1520
|
+
}, {
|
|
1521
|
+
readonly internalType: "address";
|
|
1522
|
+
readonly name: "destinationChainReceiver";
|
|
1523
|
+
readonly type: "address";
|
|
1524
|
+
}, {
|
|
1525
|
+
readonly internalType: "contract ERC20";
|
|
1526
|
+
readonly name: "bridgeFeeToken";
|
|
1527
|
+
readonly type: "address";
|
|
1528
|
+
}, {
|
|
1529
|
+
readonly internalType: "uint64";
|
|
1530
|
+
readonly name: "messageGas";
|
|
1531
|
+
readonly type: "uint64";
|
|
1532
|
+
}, {
|
|
1533
|
+
readonly internalType: "bytes";
|
|
1534
|
+
readonly name: "data";
|
|
1535
|
+
readonly type: "bytes";
|
|
1536
|
+
}];
|
|
1537
|
+
readonly internalType: "struct BridgeData";
|
|
1538
|
+
readonly name: "data";
|
|
1539
|
+
readonly type: "tuple";
|
|
1540
|
+
}];
|
|
1541
|
+
readonly name: "previewFee";
|
|
1542
|
+
readonly outputs: readonly [{
|
|
1543
|
+
readonly internalType: "uint256";
|
|
1544
|
+
readonly name: "fee";
|
|
1545
|
+
readonly type: "uint256";
|
|
1546
|
+
}];
|
|
1547
|
+
readonly stateMutability: "view";
|
|
1548
|
+
readonly type: "function";
|
|
1549
|
+
}, {
|
|
1550
|
+
readonly inputs: readonly [{
|
|
1551
|
+
readonly internalType: "uint256";
|
|
1552
|
+
readonly name: "";
|
|
1553
|
+
readonly type: "uint256";
|
|
1554
|
+
}];
|
|
1555
|
+
readonly name: "publicDepositHistory";
|
|
1556
|
+
readonly outputs: readonly [{
|
|
1557
|
+
readonly internalType: "bytes32";
|
|
1558
|
+
readonly name: "";
|
|
1559
|
+
readonly type: "bytes32";
|
|
1560
|
+
}];
|
|
1561
|
+
readonly stateMutability: "view";
|
|
1562
|
+
readonly type: "function";
|
|
1563
|
+
}, {
|
|
1564
|
+
readonly inputs: readonly [{
|
|
1565
|
+
readonly internalType: "uint256";
|
|
1566
|
+
readonly name: "nonce";
|
|
1567
|
+
readonly type: "uint256";
|
|
1568
|
+
}, {
|
|
1569
|
+
readonly internalType: "address";
|
|
1570
|
+
readonly name: "receiver";
|
|
1571
|
+
readonly type: "address";
|
|
1572
|
+
}, {
|
|
1573
|
+
readonly internalType: "address";
|
|
1574
|
+
readonly name: "depositAsset";
|
|
1575
|
+
readonly type: "address";
|
|
1576
|
+
}, {
|
|
1577
|
+
readonly internalType: "uint256";
|
|
1578
|
+
readonly name: "depositAmount";
|
|
1579
|
+
readonly type: "uint256";
|
|
1580
|
+
}, {
|
|
1581
|
+
readonly internalType: "uint256";
|
|
1582
|
+
readonly name: "shareAmount";
|
|
1583
|
+
readonly type: "uint256";
|
|
1584
|
+
}, {
|
|
1585
|
+
readonly internalType: "uint256";
|
|
1586
|
+
readonly name: "depositTimestamp";
|
|
1587
|
+
readonly type: "uint256";
|
|
1588
|
+
}, {
|
|
1589
|
+
readonly internalType: "uint256";
|
|
1590
|
+
readonly name: "shareLockUpPeriodAtTimeOfDeposit";
|
|
1591
|
+
readonly type: "uint256";
|
|
1592
|
+
}];
|
|
1593
|
+
readonly name: "refundDeposit";
|
|
1594
|
+
readonly outputs: readonly [];
|
|
1595
|
+
readonly stateMutability: "nonpayable";
|
|
1596
|
+
readonly type: "function";
|
|
1597
|
+
}, {
|
|
1598
|
+
readonly inputs: readonly [{
|
|
1599
|
+
readonly internalType: "contract ERC20";
|
|
1600
|
+
readonly name: "asset";
|
|
1601
|
+
readonly type: "address";
|
|
1602
|
+
}];
|
|
1603
|
+
readonly name: "removeAsset";
|
|
1604
|
+
readonly outputs: readonly [];
|
|
1605
|
+
readonly stateMutability: "nonpayable";
|
|
1606
|
+
readonly type: "function";
|
|
1607
|
+
}, {
|
|
1608
|
+
readonly inputs: readonly [{
|
|
1609
|
+
readonly internalType: "uint32";
|
|
1610
|
+
readonly name: "chainSelector";
|
|
1611
|
+
readonly type: "uint32";
|
|
1612
|
+
}];
|
|
1613
|
+
readonly name: "removeChain";
|
|
1614
|
+
readonly outputs: readonly [];
|
|
1615
|
+
readonly stateMutability: "nonpayable";
|
|
1616
|
+
readonly type: "function";
|
|
1617
|
+
}, {
|
|
1618
|
+
readonly inputs: readonly [{
|
|
1619
|
+
readonly internalType: "uint32";
|
|
1620
|
+
readonly name: "";
|
|
1621
|
+
readonly type: "uint32";
|
|
1622
|
+
}];
|
|
1623
|
+
readonly name: "selectorToChains";
|
|
1624
|
+
readonly outputs: readonly [{
|
|
1625
|
+
readonly internalType: "bool";
|
|
1626
|
+
readonly name: "allowMessagesFrom";
|
|
1627
|
+
readonly type: "bool";
|
|
1628
|
+
}, {
|
|
1629
|
+
readonly internalType: "bool";
|
|
1630
|
+
readonly name: "allowMessagesTo";
|
|
1631
|
+
readonly type: "bool";
|
|
1632
|
+
}, {
|
|
1633
|
+
readonly internalType: "address";
|
|
1634
|
+
readonly name: "targetTeller";
|
|
1635
|
+
readonly type: "address";
|
|
1636
|
+
}, {
|
|
1637
|
+
readonly internalType: "uint64";
|
|
1638
|
+
readonly name: "messageGasLimit";
|
|
1639
|
+
readonly type: "uint64";
|
|
1640
|
+
}, {
|
|
1641
|
+
readonly internalType: "uint64";
|
|
1642
|
+
readonly name: "minimumMessageGas";
|
|
1643
|
+
readonly type: "uint64";
|
|
1644
|
+
}];
|
|
1645
|
+
readonly stateMutability: "view";
|
|
1646
|
+
readonly type: "function";
|
|
1647
|
+
}, {
|
|
1648
|
+
readonly inputs: readonly [{
|
|
1649
|
+
readonly internalType: "contract Authority";
|
|
1650
|
+
readonly name: "newAuthority";
|
|
1651
|
+
readonly type: "address";
|
|
1652
|
+
}];
|
|
1653
|
+
readonly name: "setAuthority";
|
|
1654
|
+
readonly outputs: readonly [];
|
|
1655
|
+
readonly stateMutability: "nonpayable";
|
|
1656
|
+
readonly type: "function";
|
|
1657
|
+
}, {
|
|
1658
|
+
readonly inputs: readonly [{
|
|
1659
|
+
readonly internalType: "uint32";
|
|
1660
|
+
readonly name: "chainSelector";
|
|
1661
|
+
readonly type: "uint32";
|
|
1662
|
+
}, {
|
|
1663
|
+
readonly internalType: "uint64";
|
|
1664
|
+
readonly name: "messageGasLimit";
|
|
1665
|
+
readonly type: "uint64";
|
|
1666
|
+
}];
|
|
1667
|
+
readonly name: "setChainGasLimit";
|
|
1668
|
+
readonly outputs: readonly [];
|
|
1669
|
+
readonly stateMutability: "nonpayable";
|
|
1670
|
+
readonly type: "function";
|
|
1671
|
+
}, {
|
|
1672
|
+
readonly inputs: readonly [{
|
|
1673
|
+
readonly internalType: "address";
|
|
1674
|
+
readonly name: "_delegate";
|
|
1675
|
+
readonly type: "address";
|
|
1676
|
+
}];
|
|
1677
|
+
readonly name: "setDelegate";
|
|
1678
|
+
readonly outputs: readonly [];
|
|
1679
|
+
readonly stateMutability: "nonpayable";
|
|
1680
|
+
readonly type: "function";
|
|
1681
|
+
}, {
|
|
1682
|
+
readonly inputs: readonly [{
|
|
1683
|
+
readonly internalType: "uint32";
|
|
1684
|
+
readonly name: "_eid";
|
|
1685
|
+
readonly type: "uint32";
|
|
1686
|
+
}, {
|
|
1687
|
+
readonly internalType: "bytes32";
|
|
1688
|
+
readonly name: "_peer";
|
|
1689
|
+
readonly type: "bytes32";
|
|
1690
|
+
}];
|
|
1691
|
+
readonly name: "setPeer";
|
|
1692
|
+
readonly outputs: readonly [];
|
|
1693
|
+
readonly stateMutability: "nonpayable";
|
|
1694
|
+
readonly type: "function";
|
|
1695
|
+
}, {
|
|
1696
|
+
readonly inputs: readonly [{
|
|
1697
|
+
readonly internalType: "uint64";
|
|
1698
|
+
readonly name: "_shareLockPeriod";
|
|
1699
|
+
readonly type: "uint64";
|
|
1700
|
+
}];
|
|
1701
|
+
readonly name: "setShareLockPeriod";
|
|
1702
|
+
readonly outputs: readonly [];
|
|
1703
|
+
readonly stateMutability: "nonpayable";
|
|
1704
|
+
readonly type: "function";
|
|
1705
|
+
}, {
|
|
1706
|
+
readonly inputs: readonly [];
|
|
1707
|
+
readonly name: "shareLockPeriod";
|
|
1708
|
+
readonly outputs: readonly [{
|
|
1709
|
+
readonly internalType: "uint64";
|
|
1710
|
+
readonly name: "";
|
|
1711
|
+
readonly type: "uint64";
|
|
1712
|
+
}];
|
|
1713
|
+
readonly stateMutability: "view";
|
|
1714
|
+
readonly type: "function";
|
|
1715
|
+
}, {
|
|
1716
|
+
readonly inputs: readonly [{
|
|
1717
|
+
readonly internalType: "address";
|
|
1718
|
+
readonly name: "";
|
|
1719
|
+
readonly type: "address";
|
|
1720
|
+
}];
|
|
1721
|
+
readonly name: "shareUnlockTime";
|
|
1722
|
+
readonly outputs: readonly [{
|
|
1723
|
+
readonly internalType: "uint256";
|
|
1724
|
+
readonly name: "";
|
|
1725
|
+
readonly type: "uint256";
|
|
1726
|
+
}];
|
|
1727
|
+
readonly stateMutability: "view";
|
|
1728
|
+
readonly type: "function";
|
|
1729
|
+
}, {
|
|
1730
|
+
readonly inputs: readonly [{
|
|
1731
|
+
readonly internalType: "uint32";
|
|
1732
|
+
readonly name: "chainSelector";
|
|
1733
|
+
readonly type: "uint32";
|
|
1734
|
+
}];
|
|
1735
|
+
readonly name: "stopMessagesFromChain";
|
|
1736
|
+
readonly outputs: readonly [];
|
|
1737
|
+
readonly stateMutability: "nonpayable";
|
|
1738
|
+
readonly type: "function";
|
|
1739
|
+
}, {
|
|
1740
|
+
readonly inputs: readonly [{
|
|
1741
|
+
readonly internalType: "uint32";
|
|
1742
|
+
readonly name: "chainSelector";
|
|
1743
|
+
readonly type: "uint32";
|
|
1744
|
+
}];
|
|
1745
|
+
readonly name: "stopMessagesToChain";
|
|
1746
|
+
readonly outputs: readonly [];
|
|
1747
|
+
readonly stateMutability: "nonpayable";
|
|
1748
|
+
readonly type: "function";
|
|
1749
|
+
}, {
|
|
1750
|
+
readonly inputs: readonly [{
|
|
1751
|
+
readonly internalType: "address";
|
|
1752
|
+
readonly name: "newOwner";
|
|
1753
|
+
readonly type: "address";
|
|
1754
|
+
}];
|
|
1755
|
+
readonly name: "transferOwnership";
|
|
1756
|
+
readonly outputs: readonly [];
|
|
1757
|
+
readonly stateMutability: "nonpayable";
|
|
1758
|
+
readonly type: "function";
|
|
1759
|
+
}, {
|
|
1760
|
+
readonly inputs: readonly [];
|
|
1761
|
+
readonly name: "unpause";
|
|
1762
|
+
readonly outputs: readonly [];
|
|
1763
|
+
readonly stateMutability: "nonpayable";
|
|
1764
|
+
readonly type: "function";
|
|
1765
|
+
}, {
|
|
1766
|
+
readonly inputs: readonly [];
|
|
1767
|
+
readonly name: "vault";
|
|
1768
|
+
readonly outputs: readonly [{
|
|
1769
|
+
readonly internalType: "contract BoringVault";
|
|
1770
|
+
readonly name: "";
|
|
1771
|
+
readonly type: "address";
|
|
1772
|
+
}];
|
|
1773
|
+
readonly stateMutability: "view";
|
|
1774
|
+
readonly type: "function";
|
|
1775
|
+
}];
|
|
1776
|
+
|
|
1777
|
+
/**
|
|
1778
|
+
* @file Deposit functionality for Nucleus vaults
|
|
1779
|
+
* @module vaults/deposit
|
|
1780
|
+
*/
|
|
1781
|
+
|
|
1782
|
+
/**
|
|
1783
|
+
* Result object containing transaction data for a deposit operation
|
|
1784
|
+
* @interface DepositTxData
|
|
1785
|
+
* @property {typeof TellerAbi} abi - ABI for the Teller contract
|
|
1786
|
+
* @property {Address} address - Address of the Teller contract
|
|
1787
|
+
* @property {'deposit'} functionName - Name of the function to call
|
|
1788
|
+
* @property {[Address, bigint, bigint]} args - Arguments for the deposit function:
|
|
1789
|
+
* [depositAsset, depositAmount, minimumMint]
|
|
1790
|
+
* @property {number} chainId - ID of the chain where the transaction should be executed
|
|
1791
|
+
*/
|
|
1792
|
+
interface DepositTxData {
|
|
1793
|
+
abi: typeof TellerAbi;
|
|
1794
|
+
address: Address;
|
|
1795
|
+
functionName: "deposit";
|
|
1796
|
+
args: [Address, bigint, bigint];
|
|
1797
|
+
chainId: number;
|
|
1798
|
+
}
|
|
1799
|
+
/**
|
|
1800
|
+
* Parameters for prepareDepositTransactionData()
|
|
1801
|
+
* Accepts yieldType, recipientAddress, depositToken, and chainId for automatic vault resolution
|
|
1802
|
+
* @interface PrepareDepositTxDataParams
|
|
1803
|
+
* @property {YieldType} yieldType - Yield strategy type (e.g., "PRIME", "TBILL", "LENDING")
|
|
1804
|
+
* @property {Address} recipientAddress - Ethereum address of the user (recipient of vault shares)
|
|
1805
|
+
* @property {Address} depositToken - Token contract address to deposit (matches vault's baseTokenAddress)
|
|
1806
|
+
* @property {string} depositAmount - Amount of assets to deposit as a decimal string (e.g., "1.5")
|
|
1807
|
+
* @property {number | string} chainId - ID of the chain where the deposit will occur
|
|
1808
|
+
* @property {number} [slippage] - Maximum acceptable slippage in basis points (e.g., 100 for 1%)
|
|
1809
|
+
*/
|
|
1810
|
+
interface PrepareDepositTxDataParams {
|
|
1811
|
+
yieldType: YieldType;
|
|
1812
|
+
recipientAddress: Address;
|
|
1813
|
+
depositToken: Address;
|
|
1814
|
+
depositAmount: string;
|
|
1815
|
+
chainId: ChainId;
|
|
1816
|
+
slippage?: number;
|
|
1817
|
+
}
|
|
1818
|
+
/**
|
|
1819
|
+
* Prepares the transaction data needed to deposit assets into a vault
|
|
1820
|
+
*
|
|
1821
|
+
* This function calculates the minimum amount of vault tokens to be minted based on
|
|
1822
|
+
* the current exchange rate and the specified slippage tolerance. It automatically
|
|
1823
|
+
* resolves the vault from yieldType, depositToken, and chainId parameters.
|
|
1824
|
+
*
|
|
1825
|
+
* ```typescript
|
|
1826
|
+
* const depositData = await prepareDepositTransactionData({
|
|
1827
|
+
* yieldType: 'PRIME',
|
|
1828
|
+
* recipientAddress: '0x1234...',
|
|
1829
|
+
* depositToken: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', // USDC
|
|
1830
|
+
* depositAmount: "1.0",
|
|
1831
|
+
* chainId: 1,
|
|
1832
|
+
* slippage: 100, // 1% slippage (100 bps)
|
|
1833
|
+
* });
|
|
1834
|
+
* ```
|
|
1835
|
+
*
|
|
1836
|
+
* @param {PrepareDepositTransactionDataParams} params - Parameters for the deposit operation
|
|
1837
|
+
* @returns {Promise<DepositTransactionData>} Promise resolving to the prepared transaction data
|
|
1838
|
+
* @throws {APIError} If vault cannot be resolved, asset not found, or contracts not configured
|
|
1839
|
+
*/
|
|
1840
|
+
declare function prepareDepositTxData(params: PrepareDepositTxDataParams): Promise<DepositTxData>;
|
|
1841
|
+
|
|
1842
|
+
/**
|
|
1843
|
+
* @file Deposit with permit functionality for Nucleus vaults
|
|
1844
|
+
* @module vaults/deposit/deposit-with-permit
|
|
1845
|
+
*/
|
|
1846
|
+
|
|
1847
|
+
/**
|
|
1848
|
+
* EIP-712 domain separator conforming to the EIP-712 TypedData JSON schema
|
|
1849
|
+
* Compatible with standard EIP-712 signing libraries (Privy, wagmi, ethers)
|
|
1850
|
+
*
|
|
1851
|
+
* This interface matches the domain type from SignTypedDataParams as defined in
|
|
1852
|
+
* the EIP-712 specification and implemented by signing libraries.
|
|
1853
|
+
*
|
|
1854
|
+
* @see {@link https://eips.ethereum.org/EIPS/eip-712#specification-of-the-eth_signtypeddata-json-rpc EIP-712 Specification}
|
|
1855
|
+
*
|
|
1856
|
+
* @property name - Human-readable name of the signing domain
|
|
1857
|
+
* @property version - Version of the signing domain
|
|
1858
|
+
* @property chainId - Ethereum chain ID as a number (not bigint)
|
|
1859
|
+
* @property verifyingContract - Address of the contract that will verify the signature
|
|
1860
|
+
* @property salt - Optional salt for disambiguation
|
|
1861
|
+
*/
|
|
1862
|
+
interface EIP712Domain {
|
|
1863
|
+
name?: string;
|
|
1864
|
+
version?: string;
|
|
1865
|
+
chainId?: number;
|
|
1866
|
+
verifyingContract?: string;
|
|
1867
|
+
salt?: ArrayBuffer;
|
|
1868
|
+
}
|
|
1869
|
+
/**
|
|
1870
|
+
* T008: EIP-2612 Permit type definition
|
|
1871
|
+
* Standard structure for permit typed data per EIP-2612 specification
|
|
1872
|
+
*/
|
|
1873
|
+
declare const PERMIT_TYPES: {
|
|
1874
|
+
Permit: {
|
|
1875
|
+
name: string;
|
|
1876
|
+
type: string;
|
|
1877
|
+
}[];
|
|
1878
|
+
};
|
|
1879
|
+
/**
|
|
1880
|
+
* T009: Complete EIP-712 typed data for permit signature
|
|
1881
|
+
* Returned by prepareDepositPermitSignature() ready for wallet signing
|
|
1882
|
+
*
|
|
1883
|
+
* @property domain - EIP-712 domain separator with numeric chainId
|
|
1884
|
+
* @property types - EIP-2612 Permit type structure (mutable for compatibility)
|
|
1885
|
+
* @property message - Permit message fields
|
|
1886
|
+
* @property primaryType - Always "Permit" for EIP-2612
|
|
1887
|
+
*/
|
|
1888
|
+
interface PermitSignatureData {
|
|
1889
|
+
domain: EIP712Domain;
|
|
1890
|
+
types: {
|
|
1891
|
+
Permit: Array<{
|
|
1892
|
+
name: string;
|
|
1893
|
+
type: string;
|
|
1894
|
+
}>;
|
|
1895
|
+
};
|
|
1896
|
+
message: {
|
|
1897
|
+
owner: Address;
|
|
1898
|
+
spender: Address;
|
|
1899
|
+
value: bigint;
|
|
1900
|
+
nonce: bigint;
|
|
1901
|
+
deadline: bigint;
|
|
1902
|
+
};
|
|
1903
|
+
primaryType: "Permit";
|
|
1904
|
+
}
|
|
1905
|
+
/**
|
|
1906
|
+
* T009: Parsed permit signature components
|
|
1907
|
+
* Returned by parsePermitSignature() after converting hex signature
|
|
1908
|
+
*
|
|
1909
|
+
* @property v - Recovery ID (27 or 28)
|
|
1910
|
+
* @property r - First 32 bytes of signature
|
|
1911
|
+
* @property s - Second 32 bytes of signature
|
|
1912
|
+
*/
|
|
1913
|
+
interface ParsedPermitSignature {
|
|
1914
|
+
v: number;
|
|
1915
|
+
r: Hex;
|
|
1916
|
+
s: Hex;
|
|
1917
|
+
}
|
|
1918
|
+
/**
|
|
1919
|
+
* T009: Parameters for prepareDepositPermitSignature
|
|
1920
|
+
* Input parameters for generating permit typed data
|
|
1921
|
+
*
|
|
1922
|
+
* @property yieldType - Vault yield strategy
|
|
1923
|
+
* @property depositToken - Token contract address to deposit
|
|
1924
|
+
* @property depositAmount - Deposit amount as decimal string
|
|
1925
|
+
* @property recipientAddress - User address (permit owner)
|
|
1926
|
+
* @property chainId - Blockchain network ID
|
|
1927
|
+
* @property deadline - Optional permit expiration (defaults to 1 hour)
|
|
1928
|
+
*/
|
|
1929
|
+
interface PrepareDepositPermitSignatureParams {
|
|
1930
|
+
yieldType: YieldType;
|
|
1931
|
+
depositToken: Address;
|
|
1932
|
+
depositAmount: string;
|
|
1933
|
+
recipientAddress: Address;
|
|
1934
|
+
chainId: number;
|
|
1935
|
+
deadline?: bigint;
|
|
1936
|
+
}
|
|
1937
|
+
/**
|
|
1938
|
+
* T009: Encoded transaction data for permit deposit
|
|
1939
|
+
* Returned by updated prepareDepositWithPermitTransactionData()
|
|
1940
|
+
*
|
|
1941
|
+
* @property abi - Contract ABI
|
|
1942
|
+
* @property functionName - Function name to call
|
|
1943
|
+
* @property args - Function arguments
|
|
1944
|
+
* @property address - Teller contract address
|
|
1945
|
+
* @property chainId - Chain ID for transaction
|
|
1946
|
+
*/
|
|
1947
|
+
interface UnencodedDepositWithPermitData {
|
|
1948
|
+
data: {
|
|
1949
|
+
abi: typeof TellerAbi;
|
|
1950
|
+
functionName: "depositWithPermit";
|
|
1951
|
+
args: [Address, bigint, bigint, bigint, number, Hex, Hex];
|
|
1952
|
+
};
|
|
1953
|
+
address: Address;
|
|
1954
|
+
chainId: number;
|
|
1955
|
+
}
|
|
1956
|
+
/**
|
|
1957
|
+
* T018-T030: Prepare complete EIP-712 typed data for permit signature
|
|
1958
|
+
*
|
|
1959
|
+
* Reads token metadata (name, version, nonce) from the blockchain and
|
|
1960
|
+
* constructs the complete EIP-712 structure for wallet signing.
|
|
1961
|
+
*
|
|
1962
|
+
* @param params - Permit signature parameters
|
|
1963
|
+
* @returns Complete EIP-712 typed data ready for signing
|
|
1964
|
+
* @throws {APIError} If token doesn't support EIP-2612, vault not found, or chain unsupported
|
|
1965
|
+
*
|
|
1966
|
+
* @example
|
|
1967
|
+
* ```typescript
|
|
1968
|
+
* const permitData = await prepareDepositPermitSignature({
|
|
1969
|
+
* yieldType: 'PRIME',
|
|
1970
|
+
* depositToken: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', // USDC
|
|
1971
|
+
* depositAmount: '1000.0',
|
|
1972
|
+
* recipientAddress: userAddress,
|
|
1973
|
+
* chainId: 1,
|
|
1974
|
+
* deadline: BigInt(Math.floor(Date.now() / 1000) + 3600),
|
|
1975
|
+
* });
|
|
1976
|
+
*
|
|
1977
|
+
* // Sign with wallet
|
|
1978
|
+
* const signature = await signTypedData(permitData);
|
|
1979
|
+
* ```
|
|
1980
|
+
*/
|
|
1981
|
+
declare function prepareDepositPermitSignature(params: PrepareDepositPermitSignatureParams): Promise<PermitSignatureData>;
|
|
1982
|
+
/**
|
|
1983
|
+
* T036-T040: Parse raw hex signature into v, r, s components
|
|
1984
|
+
*
|
|
1985
|
+
* Handles both v-based and yParity-based signature formats.
|
|
1986
|
+
* Converts yParity to v by adding 27 if needed.
|
|
1987
|
+
*
|
|
1988
|
+
* @param signature - Raw hex signature from wallet
|
|
1989
|
+
* @returns Parsed signature components (v, r, s)
|
|
1990
|
+
* @throws {APIError} If signature format is invalid
|
|
1991
|
+
*
|
|
1992
|
+
* @example
|
|
1993
|
+
* ```typescript
|
|
1994
|
+
* const signature = await signTypedData(permitData);
|
|
1995
|
+
* const { v, r, s } = parsePermitSignature(signature);
|
|
1996
|
+
* // Use v, r, s in smart contract call
|
|
1997
|
+
* ```
|
|
1998
|
+
*/
|
|
1999
|
+
declare function parsePermitSignature(signature: Hex): ParsedPermitSignature;
|
|
2000
|
+
/**
|
|
2001
|
+
* T048: Updated parameters for prepareDepositWithPermitTransactionData()
|
|
2002
|
+
* Now accepts raw signature and deadline for complete transaction encoding
|
|
2003
|
+
*
|
|
2004
|
+
* @interface PrepareDepositWithPermitTxDataParams
|
|
2005
|
+
* @property {YieldType} yieldType - Yield strategy type (e.g., "PRIME", "TBILL")
|
|
2006
|
+
* @property {Address} recipientAddress - Ethereum address of the user (recipient of vault shares)
|
|
2007
|
+
* @property {Address} depositToken - Token contract address to deposit (matches vault's baseTokenAddress)
|
|
2008
|
+
* @property {string} depositAmount - Amount of assets to deposit as a decimal string (e.g., "100.25")
|
|
2009
|
+
* @property {number | ChainId} chainId - ID of the chain where the deposit will occur
|
|
2010
|
+
* @property {Hex} signature - Raw hex signature from wallet signing
|
|
2011
|
+
* @property {bigint} deadline - Deadline timestamp (must match permit signature deadline)
|
|
2012
|
+
* @property {number} [slippage] - Maximum acceptable slippage in basis points (default: 100 for 1%)
|
|
2013
|
+
*
|
|
2014
|
+
* @example
|
|
2015
|
+
* ```typescript
|
|
2016
|
+
* const permitData = await prepareDepositPermitSignature({ ... });
|
|
2017
|
+
* const signature = await signTypedData(permitData);
|
|
2018
|
+
*
|
|
2019
|
+
* const params: PrepareDepositWithPermitTransactionDataParams = {
|
|
2020
|
+
* yieldType: "PRIME",
|
|
2021
|
+
* recipientAddress: "0x1234567890123456789012345678901234567890",
|
|
2022
|
+
* depositToken: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", // USDC
|
|
2023
|
+
* depositAmount: "100.25",
|
|
2024
|
+
* chainId: 1,
|
|
2025
|
+
* signature,
|
|
2026
|
+
* deadline: permitData.message.deadline,
|
|
2027
|
+
* slippage: 100, // 1%
|
|
2028
|
+
* };
|
|
2029
|
+
* ```
|
|
2030
|
+
*/
|
|
2031
|
+
interface PrepareDepositWithPermitTxDataParams {
|
|
2032
|
+
yieldType: YieldType;
|
|
2033
|
+
recipientAddress: Address;
|
|
2034
|
+
depositToken: Address;
|
|
2035
|
+
depositAmount: string;
|
|
2036
|
+
chainId: number | ChainId;
|
|
2037
|
+
signature: Hex;
|
|
2038
|
+
deadline: bigint;
|
|
2039
|
+
slippage?: number;
|
|
2040
|
+
}
|
|
2041
|
+
/**
|
|
2042
|
+
* T048-T057: Prepare complete deposit transaction with permit signature
|
|
2043
|
+
*
|
|
2044
|
+
* Accepts raw signature and deadline, parses signature internally,
|
|
2045
|
+
* resolves vault, calculates minimum mint with slippage, and
|
|
2046
|
+
* encodes the complete depositWithPermit function call.
|
|
2047
|
+
*
|
|
2048
|
+
* @param {PrepareDepositWithPermitTransactionDataParams} params - Deposit parameters including signature and deadline
|
|
2049
|
+
* @returns {Promise<UnencodedDepositWithPermitData>} Encoded transaction data ready for submission
|
|
2050
|
+
* @throws {APIError} If vault not found, invalid signature, or parameter validation fails
|
|
2051
|
+
*
|
|
2052
|
+
* // Submit transaction
|
|
2053
|
+
* await sendTransaction({
|
|
2054
|
+
* to: txData.address,
|
|
2055
|
+
* data: txData.data,
|
|
2056
|
+
* });
|
|
2057
|
+
* ```
|
|
2058
|
+
*/
|
|
2059
|
+
declare function prepareDepositWithPermitTransactionData(params: PrepareDepositWithPermitTxDataParams): Promise<UnencodedDepositWithPermitData>;
|
|
2060
|
+
|
|
2061
|
+
declare const BoringVaultAbi: readonly [{
|
|
2062
|
+
readonly type: "constructor";
|
|
2063
|
+
readonly inputs: readonly [{
|
|
2064
|
+
readonly name: "_owner";
|
|
2065
|
+
readonly type: "address";
|
|
2066
|
+
readonly internalType: "address";
|
|
2067
|
+
}, {
|
|
2068
|
+
readonly name: "_name";
|
|
2069
|
+
readonly type: "string";
|
|
2070
|
+
readonly internalType: "string";
|
|
2071
|
+
}, {
|
|
2072
|
+
readonly name: "_symbol";
|
|
2073
|
+
readonly type: "string";
|
|
2074
|
+
readonly internalType: "string";
|
|
2075
|
+
}, {
|
|
2076
|
+
readonly name: "_decimals";
|
|
2077
|
+
readonly type: "uint8";
|
|
2078
|
+
readonly internalType: "uint8";
|
|
2079
|
+
}];
|
|
2080
|
+
readonly stateMutability: "nonpayable";
|
|
2081
|
+
}, {
|
|
2082
|
+
readonly type: "receive";
|
|
2083
|
+
readonly stateMutability: "payable";
|
|
2084
|
+
}, {
|
|
2085
|
+
readonly type: "function";
|
|
2086
|
+
readonly name: "DOMAIN_SEPARATOR";
|
|
2087
|
+
readonly inputs: readonly [];
|
|
2088
|
+
readonly outputs: readonly [{
|
|
2089
|
+
readonly name: "";
|
|
2090
|
+
readonly type: "bytes32";
|
|
2091
|
+
readonly internalType: "bytes32";
|
|
2092
|
+
}];
|
|
2093
|
+
readonly stateMutability: "view";
|
|
2094
|
+
}, {
|
|
2095
|
+
readonly type: "function";
|
|
2096
|
+
readonly name: "allowance";
|
|
2097
|
+
readonly inputs: readonly [{
|
|
2098
|
+
readonly name: "";
|
|
2099
|
+
readonly type: "address";
|
|
2100
|
+
readonly internalType: "address";
|
|
2101
|
+
}, {
|
|
2102
|
+
readonly name: "";
|
|
2103
|
+
readonly type: "address";
|
|
2104
|
+
readonly internalType: "address";
|
|
2105
|
+
}];
|
|
2106
|
+
readonly outputs: readonly [{
|
|
2107
|
+
readonly name: "";
|
|
2108
|
+
readonly type: "uint256";
|
|
2109
|
+
readonly internalType: "uint256";
|
|
2110
|
+
}];
|
|
2111
|
+
readonly stateMutability: "view";
|
|
2112
|
+
}, {
|
|
2113
|
+
readonly type: "function";
|
|
2114
|
+
readonly name: "approve";
|
|
2115
|
+
readonly inputs: readonly [{
|
|
2116
|
+
readonly name: "spender";
|
|
2117
|
+
readonly type: "address";
|
|
2118
|
+
readonly internalType: "address";
|
|
2119
|
+
}, {
|
|
2120
|
+
readonly name: "amount";
|
|
2121
|
+
readonly type: "uint256";
|
|
2122
|
+
readonly internalType: "uint256";
|
|
2123
|
+
}];
|
|
2124
|
+
readonly outputs: readonly [{
|
|
2125
|
+
readonly name: "";
|
|
2126
|
+
readonly type: "bool";
|
|
2127
|
+
readonly internalType: "bool";
|
|
2128
|
+
}];
|
|
2129
|
+
readonly stateMutability: "nonpayable";
|
|
2130
|
+
}, {
|
|
2131
|
+
readonly type: "function";
|
|
2132
|
+
readonly name: "authority";
|
|
2133
|
+
readonly inputs: readonly [];
|
|
2134
|
+
readonly outputs: readonly [{
|
|
2135
|
+
readonly name: "";
|
|
2136
|
+
readonly type: "address";
|
|
2137
|
+
readonly internalType: "contract Authority";
|
|
2138
|
+
}];
|
|
2139
|
+
readonly stateMutability: "view";
|
|
2140
|
+
}, {
|
|
2141
|
+
readonly type: "function";
|
|
2142
|
+
readonly name: "balanceOf";
|
|
2143
|
+
readonly inputs: readonly [{
|
|
2144
|
+
readonly name: "";
|
|
2145
|
+
readonly type: "address";
|
|
2146
|
+
readonly internalType: "address";
|
|
2147
|
+
}];
|
|
2148
|
+
readonly outputs: readonly [{
|
|
2149
|
+
readonly name: "";
|
|
2150
|
+
readonly type: "uint256";
|
|
2151
|
+
readonly internalType: "uint256";
|
|
2152
|
+
}];
|
|
2153
|
+
readonly stateMutability: "view";
|
|
2154
|
+
}, {
|
|
2155
|
+
readonly type: "function";
|
|
2156
|
+
readonly name: "decimals";
|
|
2157
|
+
readonly inputs: readonly [];
|
|
2158
|
+
readonly outputs: readonly [{
|
|
2159
|
+
readonly name: "";
|
|
2160
|
+
readonly type: "uint8";
|
|
2161
|
+
readonly internalType: "uint8";
|
|
2162
|
+
}];
|
|
2163
|
+
readonly stateMutability: "view";
|
|
2164
|
+
}, {
|
|
2165
|
+
readonly type: "function";
|
|
2166
|
+
readonly name: "enter";
|
|
2167
|
+
readonly inputs: readonly [{
|
|
2168
|
+
readonly name: "from";
|
|
2169
|
+
readonly type: "address";
|
|
2170
|
+
readonly internalType: "address";
|
|
2171
|
+
}, {
|
|
2172
|
+
readonly name: "asset";
|
|
2173
|
+
readonly type: "address";
|
|
2174
|
+
readonly internalType: "contract ERC20";
|
|
2175
|
+
}, {
|
|
2176
|
+
readonly name: "assetAmount";
|
|
2177
|
+
readonly type: "uint256";
|
|
2178
|
+
readonly internalType: "uint256";
|
|
2179
|
+
}, {
|
|
2180
|
+
readonly name: "to";
|
|
2181
|
+
readonly type: "address";
|
|
2182
|
+
readonly internalType: "address";
|
|
2183
|
+
}, {
|
|
2184
|
+
readonly name: "shareAmount";
|
|
2185
|
+
readonly type: "uint256";
|
|
2186
|
+
readonly internalType: "uint256";
|
|
2187
|
+
}];
|
|
2188
|
+
readonly outputs: readonly [];
|
|
2189
|
+
readonly stateMutability: "nonpayable";
|
|
2190
|
+
}, {
|
|
2191
|
+
readonly type: "function";
|
|
2192
|
+
readonly name: "exit";
|
|
2193
|
+
readonly inputs: readonly [{
|
|
2194
|
+
readonly name: "to";
|
|
2195
|
+
readonly type: "address";
|
|
2196
|
+
readonly internalType: "address";
|
|
2197
|
+
}, {
|
|
2198
|
+
readonly name: "asset";
|
|
2199
|
+
readonly type: "address";
|
|
2200
|
+
readonly internalType: "contract ERC20";
|
|
2201
|
+
}, {
|
|
2202
|
+
readonly name: "assetAmount";
|
|
2203
|
+
readonly type: "uint256";
|
|
2204
|
+
readonly internalType: "uint256";
|
|
2205
|
+
}, {
|
|
2206
|
+
readonly name: "from";
|
|
2207
|
+
readonly type: "address";
|
|
2208
|
+
readonly internalType: "address";
|
|
2209
|
+
}, {
|
|
2210
|
+
readonly name: "shareAmount";
|
|
2211
|
+
readonly type: "uint256";
|
|
2212
|
+
readonly internalType: "uint256";
|
|
2213
|
+
}];
|
|
2214
|
+
readonly outputs: readonly [];
|
|
2215
|
+
readonly stateMutability: "nonpayable";
|
|
2216
|
+
}, {
|
|
2217
|
+
readonly type: "function";
|
|
2218
|
+
readonly name: "hook";
|
|
2219
|
+
readonly inputs: readonly [];
|
|
2220
|
+
readonly outputs: readonly [{
|
|
2221
|
+
readonly name: "";
|
|
2222
|
+
readonly type: "address";
|
|
2223
|
+
readonly internalType: "contract BeforeTransferHook";
|
|
2224
|
+
}];
|
|
2225
|
+
readonly stateMutability: "view";
|
|
2226
|
+
}, {
|
|
2227
|
+
readonly type: "function";
|
|
2228
|
+
readonly name: "manage";
|
|
2229
|
+
readonly inputs: readonly [{
|
|
2230
|
+
readonly name: "targets";
|
|
2231
|
+
readonly type: "address[]";
|
|
2232
|
+
readonly internalType: "address[]";
|
|
2233
|
+
}, {
|
|
2234
|
+
readonly name: "data";
|
|
2235
|
+
readonly type: "bytes[]";
|
|
2236
|
+
readonly internalType: "bytes[]";
|
|
2237
|
+
}, {
|
|
2238
|
+
readonly name: "values";
|
|
2239
|
+
readonly type: "uint256[]";
|
|
2240
|
+
readonly internalType: "uint256[]";
|
|
2241
|
+
}];
|
|
2242
|
+
readonly outputs: readonly [{
|
|
2243
|
+
readonly name: "results";
|
|
2244
|
+
readonly type: "bytes[]";
|
|
2245
|
+
readonly internalType: "bytes[]";
|
|
2246
|
+
}];
|
|
2247
|
+
readonly stateMutability: "nonpayable";
|
|
2248
|
+
}, {
|
|
2249
|
+
readonly type: "function";
|
|
2250
|
+
readonly name: "manage";
|
|
2251
|
+
readonly inputs: readonly [{
|
|
2252
|
+
readonly name: "target";
|
|
2253
|
+
readonly type: "address";
|
|
2254
|
+
readonly internalType: "address";
|
|
2255
|
+
}, {
|
|
2256
|
+
readonly name: "data";
|
|
2257
|
+
readonly type: "bytes";
|
|
2258
|
+
readonly internalType: "bytes";
|
|
2259
|
+
}, {
|
|
2260
|
+
readonly name: "value";
|
|
2261
|
+
readonly type: "uint256";
|
|
2262
|
+
readonly internalType: "uint256";
|
|
2263
|
+
}];
|
|
2264
|
+
readonly outputs: readonly [{
|
|
2265
|
+
readonly name: "result";
|
|
2266
|
+
readonly type: "bytes";
|
|
2267
|
+
readonly internalType: "bytes";
|
|
2268
|
+
}];
|
|
2269
|
+
readonly stateMutability: "nonpayable";
|
|
2270
|
+
}, {
|
|
2271
|
+
readonly type: "function";
|
|
2272
|
+
readonly name: "name";
|
|
2273
|
+
readonly inputs: readonly [];
|
|
2274
|
+
readonly outputs: readonly [{
|
|
2275
|
+
readonly name: "";
|
|
2276
|
+
readonly type: "string";
|
|
2277
|
+
readonly internalType: "string";
|
|
2278
|
+
}];
|
|
2279
|
+
readonly stateMutability: "view";
|
|
2280
|
+
}, {
|
|
2281
|
+
readonly type: "function";
|
|
2282
|
+
readonly name: "nonces";
|
|
2283
|
+
readonly inputs: readonly [{
|
|
2284
|
+
readonly name: "";
|
|
2285
|
+
readonly type: "address";
|
|
2286
|
+
readonly internalType: "address";
|
|
2287
|
+
}];
|
|
2288
|
+
readonly outputs: readonly [{
|
|
2289
|
+
readonly name: "";
|
|
2290
|
+
readonly type: "uint256";
|
|
2291
|
+
readonly internalType: "uint256";
|
|
2292
|
+
}];
|
|
2293
|
+
readonly stateMutability: "view";
|
|
2294
|
+
}, {
|
|
2295
|
+
readonly type: "function";
|
|
2296
|
+
readonly name: "onERC1155BatchReceived";
|
|
2297
|
+
readonly inputs: readonly [{
|
|
2298
|
+
readonly name: "";
|
|
2299
|
+
readonly type: "address";
|
|
2300
|
+
readonly internalType: "address";
|
|
2301
|
+
}, {
|
|
2302
|
+
readonly name: "";
|
|
2303
|
+
readonly type: "address";
|
|
2304
|
+
readonly internalType: "address";
|
|
2305
|
+
}, {
|
|
2306
|
+
readonly name: "";
|
|
2307
|
+
readonly type: "uint256[]";
|
|
2308
|
+
readonly internalType: "uint256[]";
|
|
2309
|
+
}, {
|
|
2310
|
+
readonly name: "";
|
|
2311
|
+
readonly type: "uint256[]";
|
|
2312
|
+
readonly internalType: "uint256[]";
|
|
2313
|
+
}, {
|
|
2314
|
+
readonly name: "";
|
|
2315
|
+
readonly type: "bytes";
|
|
2316
|
+
readonly internalType: "bytes";
|
|
2317
|
+
}];
|
|
2318
|
+
readonly outputs: readonly [{
|
|
2319
|
+
readonly name: "";
|
|
2320
|
+
readonly type: "bytes4";
|
|
2321
|
+
readonly internalType: "bytes4";
|
|
2322
|
+
}];
|
|
2323
|
+
readonly stateMutability: "nonpayable";
|
|
2324
|
+
}, {
|
|
2325
|
+
readonly type: "function";
|
|
2326
|
+
readonly name: "onERC1155Received";
|
|
2327
|
+
readonly inputs: readonly [{
|
|
2328
|
+
readonly name: "";
|
|
2329
|
+
readonly type: "address";
|
|
2330
|
+
readonly internalType: "address";
|
|
2331
|
+
}, {
|
|
2332
|
+
readonly name: "";
|
|
2333
|
+
readonly type: "address";
|
|
2334
|
+
readonly internalType: "address";
|
|
2335
|
+
}, {
|
|
2336
|
+
readonly name: "";
|
|
2337
|
+
readonly type: "uint256";
|
|
2338
|
+
readonly internalType: "uint256";
|
|
2339
|
+
}, {
|
|
2340
|
+
readonly name: "";
|
|
2341
|
+
readonly type: "uint256";
|
|
2342
|
+
readonly internalType: "uint256";
|
|
2343
|
+
}, {
|
|
2344
|
+
readonly name: "";
|
|
2345
|
+
readonly type: "bytes";
|
|
2346
|
+
readonly internalType: "bytes";
|
|
2347
|
+
}];
|
|
2348
|
+
readonly outputs: readonly [{
|
|
2349
|
+
readonly name: "";
|
|
2350
|
+
readonly type: "bytes4";
|
|
2351
|
+
readonly internalType: "bytes4";
|
|
2352
|
+
}];
|
|
2353
|
+
readonly stateMutability: "nonpayable";
|
|
2354
|
+
}, {
|
|
2355
|
+
readonly type: "function";
|
|
2356
|
+
readonly name: "onERC721Received";
|
|
2357
|
+
readonly inputs: readonly [{
|
|
2358
|
+
readonly name: "";
|
|
2359
|
+
readonly type: "address";
|
|
2360
|
+
readonly internalType: "address";
|
|
2361
|
+
}, {
|
|
2362
|
+
readonly name: "";
|
|
2363
|
+
readonly type: "address";
|
|
2364
|
+
readonly internalType: "address";
|
|
2365
|
+
}, {
|
|
2366
|
+
readonly name: "";
|
|
2367
|
+
readonly type: "uint256";
|
|
2368
|
+
readonly internalType: "uint256";
|
|
2369
|
+
}, {
|
|
2370
|
+
readonly name: "";
|
|
2371
|
+
readonly type: "bytes";
|
|
2372
|
+
readonly internalType: "bytes";
|
|
2373
|
+
}];
|
|
2374
|
+
readonly outputs: readonly [{
|
|
2375
|
+
readonly name: "";
|
|
2376
|
+
readonly type: "bytes4";
|
|
2377
|
+
readonly internalType: "bytes4";
|
|
2378
|
+
}];
|
|
2379
|
+
readonly stateMutability: "nonpayable";
|
|
2380
|
+
}, {
|
|
2381
|
+
readonly type: "function";
|
|
2382
|
+
readonly name: "owner";
|
|
2383
|
+
readonly inputs: readonly [];
|
|
2384
|
+
readonly outputs: readonly [{
|
|
2385
|
+
readonly name: "";
|
|
2386
|
+
readonly type: "address";
|
|
2387
|
+
readonly internalType: "address";
|
|
2388
|
+
}];
|
|
2389
|
+
readonly stateMutability: "view";
|
|
2390
|
+
}, {
|
|
2391
|
+
readonly type: "function";
|
|
2392
|
+
readonly name: "permit";
|
|
2393
|
+
readonly inputs: readonly [{
|
|
2394
|
+
readonly name: "owner";
|
|
2395
|
+
readonly type: "address";
|
|
2396
|
+
readonly internalType: "address";
|
|
2397
|
+
}, {
|
|
2398
|
+
readonly name: "spender";
|
|
2399
|
+
readonly type: "address";
|
|
2400
|
+
readonly internalType: "address";
|
|
2401
|
+
}, {
|
|
2402
|
+
readonly name: "value";
|
|
2403
|
+
readonly type: "uint256";
|
|
2404
|
+
readonly internalType: "uint256";
|
|
2405
|
+
}, {
|
|
2406
|
+
readonly name: "deadline";
|
|
2407
|
+
readonly type: "uint256";
|
|
2408
|
+
readonly internalType: "uint256";
|
|
2409
|
+
}, {
|
|
2410
|
+
readonly name: "v";
|
|
2411
|
+
readonly type: "uint8";
|
|
2412
|
+
readonly internalType: "uint8";
|
|
2413
|
+
}, {
|
|
2414
|
+
readonly name: "r";
|
|
2415
|
+
readonly type: "bytes32";
|
|
2416
|
+
readonly internalType: "bytes32";
|
|
2417
|
+
}, {
|
|
2418
|
+
readonly name: "s";
|
|
2419
|
+
readonly type: "bytes32";
|
|
2420
|
+
readonly internalType: "bytes32";
|
|
2421
|
+
}];
|
|
2422
|
+
readonly outputs: readonly [];
|
|
2423
|
+
readonly stateMutability: "nonpayable";
|
|
2424
|
+
}, {
|
|
2425
|
+
readonly type: "function";
|
|
2426
|
+
readonly name: "setAuthority";
|
|
2427
|
+
readonly inputs: readonly [{
|
|
2428
|
+
readonly name: "newAuthority";
|
|
2429
|
+
readonly type: "address";
|
|
2430
|
+
readonly internalType: "contract Authority";
|
|
2431
|
+
}];
|
|
2432
|
+
readonly outputs: readonly [];
|
|
2433
|
+
readonly stateMutability: "nonpayable";
|
|
2434
|
+
}, {
|
|
2435
|
+
readonly type: "function";
|
|
2436
|
+
readonly name: "setBeforeTransferHook";
|
|
2437
|
+
readonly inputs: readonly [{
|
|
2438
|
+
readonly name: "_hook";
|
|
2439
|
+
readonly type: "address";
|
|
2440
|
+
readonly internalType: "address";
|
|
2441
|
+
}];
|
|
2442
|
+
readonly outputs: readonly [];
|
|
2443
|
+
readonly stateMutability: "nonpayable";
|
|
2444
|
+
}, {
|
|
2445
|
+
readonly type: "function";
|
|
2446
|
+
readonly name: "supportsInterface";
|
|
2447
|
+
readonly inputs: readonly [{
|
|
2448
|
+
readonly name: "interfaceId";
|
|
2449
|
+
readonly type: "bytes4";
|
|
2450
|
+
readonly internalType: "bytes4";
|
|
2451
|
+
}];
|
|
2452
|
+
readonly outputs: readonly [{
|
|
2453
|
+
readonly name: "";
|
|
2454
|
+
readonly type: "bool";
|
|
2455
|
+
readonly internalType: "bool";
|
|
2456
|
+
}];
|
|
2457
|
+
readonly stateMutability: "view";
|
|
2458
|
+
}, {
|
|
2459
|
+
readonly type: "function";
|
|
2460
|
+
readonly name: "symbol";
|
|
2461
|
+
readonly inputs: readonly [];
|
|
2462
|
+
readonly outputs: readonly [{
|
|
2463
|
+
readonly name: "";
|
|
2464
|
+
readonly type: "string";
|
|
2465
|
+
readonly internalType: "string";
|
|
2466
|
+
}];
|
|
2467
|
+
readonly stateMutability: "view";
|
|
2468
|
+
}, {
|
|
2469
|
+
readonly type: "function";
|
|
2470
|
+
readonly name: "totalSupply";
|
|
2471
|
+
readonly inputs: readonly [];
|
|
2472
|
+
readonly outputs: readonly [{
|
|
2473
|
+
readonly name: "";
|
|
2474
|
+
readonly type: "uint256";
|
|
2475
|
+
readonly internalType: "uint256";
|
|
2476
|
+
}];
|
|
2477
|
+
readonly stateMutability: "view";
|
|
2478
|
+
}, {
|
|
2479
|
+
readonly type: "function";
|
|
2480
|
+
readonly name: "transfer";
|
|
2481
|
+
readonly inputs: readonly [{
|
|
2482
|
+
readonly name: "to";
|
|
2483
|
+
readonly type: "address";
|
|
2484
|
+
readonly internalType: "address";
|
|
2485
|
+
}, {
|
|
2486
|
+
readonly name: "amount";
|
|
2487
|
+
readonly type: "uint256";
|
|
2488
|
+
readonly internalType: "uint256";
|
|
2489
|
+
}];
|
|
2490
|
+
readonly outputs: readonly [{
|
|
2491
|
+
readonly name: "";
|
|
2492
|
+
readonly type: "bool";
|
|
2493
|
+
readonly internalType: "bool";
|
|
2494
|
+
}];
|
|
2495
|
+
readonly stateMutability: "nonpayable";
|
|
2496
|
+
}, {
|
|
2497
|
+
readonly type: "function";
|
|
2498
|
+
readonly name: "transferFrom";
|
|
2499
|
+
readonly inputs: readonly [{
|
|
2500
|
+
readonly name: "from";
|
|
2501
|
+
readonly type: "address";
|
|
2502
|
+
readonly internalType: "address";
|
|
2503
|
+
}, {
|
|
2504
|
+
readonly name: "to";
|
|
2505
|
+
readonly type: "address";
|
|
2506
|
+
readonly internalType: "address";
|
|
2507
|
+
}, {
|
|
2508
|
+
readonly name: "amount";
|
|
2509
|
+
readonly type: "uint256";
|
|
2510
|
+
readonly internalType: "uint256";
|
|
2511
|
+
}];
|
|
2512
|
+
readonly outputs: readonly [{
|
|
2513
|
+
readonly name: "";
|
|
2514
|
+
readonly type: "bool";
|
|
2515
|
+
readonly internalType: "bool";
|
|
2516
|
+
}];
|
|
2517
|
+
readonly stateMutability: "nonpayable";
|
|
2518
|
+
}, {
|
|
2519
|
+
readonly type: "function";
|
|
2520
|
+
readonly name: "transferOwnership";
|
|
2521
|
+
readonly inputs: readonly [{
|
|
2522
|
+
readonly name: "newOwner";
|
|
2523
|
+
readonly type: "address";
|
|
2524
|
+
readonly internalType: "address";
|
|
2525
|
+
}];
|
|
2526
|
+
readonly outputs: readonly [];
|
|
2527
|
+
readonly stateMutability: "nonpayable";
|
|
2528
|
+
}, {
|
|
2529
|
+
readonly type: "event";
|
|
2530
|
+
readonly name: "Approval";
|
|
2531
|
+
readonly inputs: readonly [{
|
|
2532
|
+
readonly name: "owner";
|
|
2533
|
+
readonly type: "address";
|
|
2534
|
+
readonly indexed: true;
|
|
2535
|
+
readonly internalType: "address";
|
|
2536
|
+
}, {
|
|
2537
|
+
readonly name: "spender";
|
|
2538
|
+
readonly type: "address";
|
|
2539
|
+
readonly indexed: true;
|
|
2540
|
+
readonly internalType: "address";
|
|
2541
|
+
}, {
|
|
2542
|
+
readonly name: "amount";
|
|
2543
|
+
readonly type: "uint256";
|
|
2544
|
+
readonly indexed: false;
|
|
2545
|
+
readonly internalType: "uint256";
|
|
2546
|
+
}];
|
|
2547
|
+
readonly anonymous: false;
|
|
2548
|
+
}, {
|
|
2549
|
+
readonly type: "event";
|
|
2550
|
+
readonly name: "AuthorityUpdated";
|
|
2551
|
+
readonly inputs: readonly [{
|
|
2552
|
+
readonly name: "user";
|
|
2553
|
+
readonly type: "address";
|
|
2554
|
+
readonly indexed: true;
|
|
2555
|
+
readonly internalType: "address";
|
|
2556
|
+
}, {
|
|
2557
|
+
readonly name: "newAuthority";
|
|
2558
|
+
readonly type: "address";
|
|
2559
|
+
readonly indexed: true;
|
|
2560
|
+
readonly internalType: "contract Authority";
|
|
2561
|
+
}];
|
|
2562
|
+
readonly anonymous: false;
|
|
2563
|
+
}, {
|
|
2564
|
+
readonly type: "event";
|
|
2565
|
+
readonly name: "Enter";
|
|
2566
|
+
readonly inputs: readonly [{
|
|
2567
|
+
readonly name: "from";
|
|
2568
|
+
readonly type: "address";
|
|
2569
|
+
readonly indexed: true;
|
|
2570
|
+
readonly internalType: "address";
|
|
2571
|
+
}, {
|
|
2572
|
+
readonly name: "asset";
|
|
2573
|
+
readonly type: "address";
|
|
2574
|
+
readonly indexed: true;
|
|
2575
|
+
readonly internalType: "address";
|
|
2576
|
+
}, {
|
|
2577
|
+
readonly name: "amount";
|
|
2578
|
+
readonly type: "uint256";
|
|
2579
|
+
readonly indexed: false;
|
|
2580
|
+
readonly internalType: "uint256";
|
|
2581
|
+
}, {
|
|
2582
|
+
readonly name: "to";
|
|
2583
|
+
readonly type: "address";
|
|
2584
|
+
readonly indexed: true;
|
|
2585
|
+
readonly internalType: "address";
|
|
2586
|
+
}, {
|
|
2587
|
+
readonly name: "shares";
|
|
2588
|
+
readonly type: "uint256";
|
|
2589
|
+
readonly indexed: false;
|
|
2590
|
+
readonly internalType: "uint256";
|
|
2591
|
+
}];
|
|
2592
|
+
readonly anonymous: false;
|
|
2593
|
+
}, {
|
|
2594
|
+
readonly type: "event";
|
|
2595
|
+
readonly name: "Exit";
|
|
2596
|
+
readonly inputs: readonly [{
|
|
2597
|
+
readonly name: "to";
|
|
2598
|
+
readonly type: "address";
|
|
2599
|
+
readonly indexed: true;
|
|
2600
|
+
readonly internalType: "address";
|
|
2601
|
+
}, {
|
|
2602
|
+
readonly name: "asset";
|
|
2603
|
+
readonly type: "address";
|
|
2604
|
+
readonly indexed: true;
|
|
2605
|
+
readonly internalType: "address";
|
|
2606
|
+
}, {
|
|
2607
|
+
readonly name: "amount";
|
|
2608
|
+
readonly type: "uint256";
|
|
2609
|
+
readonly indexed: false;
|
|
2610
|
+
readonly internalType: "uint256";
|
|
2611
|
+
}, {
|
|
2612
|
+
readonly name: "from";
|
|
2613
|
+
readonly type: "address";
|
|
2614
|
+
readonly indexed: true;
|
|
2615
|
+
readonly internalType: "address";
|
|
2616
|
+
}, {
|
|
2617
|
+
readonly name: "shares";
|
|
2618
|
+
readonly type: "uint256";
|
|
2619
|
+
readonly indexed: false;
|
|
2620
|
+
readonly internalType: "uint256";
|
|
2621
|
+
}];
|
|
2622
|
+
readonly anonymous: false;
|
|
2623
|
+
}, {
|
|
2624
|
+
readonly type: "event";
|
|
2625
|
+
readonly name: "OwnershipTransferred";
|
|
2626
|
+
readonly inputs: readonly [{
|
|
2627
|
+
readonly name: "user";
|
|
2628
|
+
readonly type: "address";
|
|
2629
|
+
readonly indexed: true;
|
|
2630
|
+
readonly internalType: "address";
|
|
2631
|
+
}, {
|
|
2632
|
+
readonly name: "newOwner";
|
|
2633
|
+
readonly type: "address";
|
|
2634
|
+
readonly indexed: true;
|
|
2635
|
+
readonly internalType: "address";
|
|
2636
|
+
}];
|
|
2637
|
+
readonly anonymous: false;
|
|
2638
|
+
}, {
|
|
2639
|
+
readonly type: "event";
|
|
2640
|
+
readonly name: "Transfer";
|
|
2641
|
+
readonly inputs: readonly [{
|
|
2642
|
+
readonly name: "from";
|
|
2643
|
+
readonly type: "address";
|
|
2644
|
+
readonly indexed: true;
|
|
2645
|
+
readonly internalType: "address";
|
|
2646
|
+
}, {
|
|
2647
|
+
readonly name: "to";
|
|
2648
|
+
readonly type: "address";
|
|
2649
|
+
readonly indexed: true;
|
|
2650
|
+
readonly internalType: "address";
|
|
2651
|
+
}, {
|
|
2652
|
+
readonly name: "amount";
|
|
2653
|
+
readonly type: "uint256";
|
|
2654
|
+
readonly indexed: false;
|
|
2655
|
+
readonly internalType: "uint256";
|
|
2656
|
+
}];
|
|
2657
|
+
readonly anonymous: false;
|
|
2658
|
+
}, {
|
|
2659
|
+
readonly type: "error";
|
|
2660
|
+
readonly name: "AddressEmptyCode";
|
|
2661
|
+
readonly inputs: readonly [{
|
|
2662
|
+
readonly name: "target";
|
|
2663
|
+
readonly type: "address";
|
|
2664
|
+
readonly internalType: "address";
|
|
2665
|
+
}];
|
|
2666
|
+
}, {
|
|
2667
|
+
readonly type: "error";
|
|
2668
|
+
readonly name: "AddressInsufficientBalance";
|
|
2669
|
+
readonly inputs: readonly [{
|
|
2670
|
+
readonly name: "account";
|
|
2671
|
+
readonly type: "address";
|
|
2672
|
+
readonly internalType: "address";
|
|
2673
|
+
}];
|
|
2674
|
+
}, {
|
|
2675
|
+
readonly type: "error";
|
|
2676
|
+
readonly name: "FailedInnerCall";
|
|
2677
|
+
readonly inputs: readonly [];
|
|
2678
|
+
}];
|
|
2679
|
+
|
|
2680
|
+
/**
|
|
2681
|
+
* Parameters required for preparing an approval transaction (NEW AmplifyVault schema)
|
|
2682
|
+
* @interface PrepareApproveWithdrawTokenTxParams
|
|
2683
|
+
* @property {YieldType} yieldType - Yield strategy type (PRIME, TBILL, or LENDING)
|
|
2684
|
+
* @property {Address} wantAssetAddress - Address of the want token
|
|
2685
|
+
* @property {string} [withdrawAmount] - Optional amount to approve (defaults to maximum approval)
|
|
2686
|
+
* @property {ChainId} chainId - ID of the chain where the approval will occur
|
|
2687
|
+
*/
|
|
2688
|
+
interface PrepareApproveWithdrawTokenTxParams {
|
|
2689
|
+
yieldType: YieldType;
|
|
2690
|
+
wantAssetAddress: Address;
|
|
2691
|
+
withdrawAmount?: string;
|
|
2692
|
+
chainId: ChainId;
|
|
2693
|
+
}
|
|
2694
|
+
/**
|
|
2695
|
+
* Result object containing transaction data for a vault shares approval operation
|
|
2696
|
+
* @interface ApproveWithdrawTokenTxData
|
|
2697
|
+
* @property {typeof BoringVaultAbi} abi - ABI for the BoringVault contract
|
|
2698
|
+
* @property {Address} address - Address of the BoringVault (shares token)
|
|
2699
|
+
* @property {'approve'} functionName - Name of the function to call
|
|
2700
|
+
* @property {[Address, bigint]} args - Arguments for the approve function:
|
|
2701
|
+
* [spender (AtomicQueue address), amount]
|
|
2702
|
+
*/
|
|
2703
|
+
interface ApproveWithdrawTokenTxData {
|
|
2704
|
+
abi: typeof BoringVaultAbi;
|
|
2705
|
+
address: Address;
|
|
2706
|
+
functionName: "approve";
|
|
2707
|
+
args: [Address, bigint];
|
|
2708
|
+
}
|
|
2709
|
+
/**
|
|
2710
|
+
* Prepares the transaction data needed to approve vault shares for the AtomicQueue contract
|
|
2711
|
+
*
|
|
2712
|
+
* This function prepares an ERC20 approval transaction that allows the AtomicQueue
|
|
2713
|
+
* contract to spend the user's vault shares. It uses the new AmplifyVault schema
|
|
2714
|
+
* with asset decimals from the API (no on-chain calls).
|
|
2715
|
+
*
|
|
2716
|
+
* @example
|
|
2717
|
+
* ```typescript
|
|
2718
|
+
* const vaults = await fetchVaults({ chainId: 1 });
|
|
2719
|
+
* const approveData = await prepareApproveWithdrawToken({
|
|
2720
|
+
* yieldType: 'PRIME',
|
|
2721
|
+
* wantAssetAddress: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', // USDC
|
|
2722
|
+
* withdrawAmount: "10.0", // Approve 10 vault shares
|
|
2723
|
+
* chainId: 1,
|
|
2724
|
+
* });
|
|
2725
|
+
* ```
|
|
2726
|
+
*
|
|
2727
|
+
* @param {PrepareApproveWithdrawTokenTxParams} params - Parameters for the approval operation
|
|
2728
|
+
* @param {YieldType} params.yieldType - Yield strategy type (PRIME, TBILL, or LENDING)
|
|
2729
|
+
* @param {Address} params.wantAssetAddress - Address of the want token
|
|
2730
|
+
* @param {string} [params.withdrawAmount] - Optional amount to approve as a decimal string (defaults to maximum approval)
|
|
2731
|
+
* @param {number | string} params.chainId - ID of the chain where the approval will occur
|
|
2732
|
+
*
|
|
2733
|
+
* @returns {Promise<ApproveWithdrawTokenTxData>} Promise resolving to the prepared transaction data
|
|
2734
|
+
* @throws {APIError} If the vault is not on the correct chain or contracts not configured
|
|
2735
|
+
*/
|
|
2736
|
+
declare function prepareApproveWithdrawTxData({ yieldType, wantAssetAddress, withdrawAmount, chainId, }: PrepareApproveWithdrawTokenTxParams): Promise<ApproveWithdrawTokenTxData>;
|
|
2737
|
+
|
|
2738
|
+
interface BulkWithdrawTxData {
|
|
2739
|
+
abi: typeof TellerAbi;
|
|
2740
|
+
address: Address;
|
|
2741
|
+
functionName: "bulkWithdraw";
|
|
2742
|
+
args: [
|
|
2743
|
+
withdrawAsset: Address,
|
|
2744
|
+
shareAmount: bigint,
|
|
2745
|
+
minimumAssets: bigint,
|
|
2746
|
+
to: Address
|
|
2747
|
+
];
|
|
2748
|
+
chainId: number;
|
|
2749
|
+
}
|
|
2750
|
+
interface PrepareBulkWithdrawTxDataParams {
|
|
2751
|
+
yieldType: YieldType;
|
|
2752
|
+
shareAmount: string;
|
|
2753
|
+
wantAssetAddress: Address;
|
|
2754
|
+
chainId: ChainId;
|
|
2755
|
+
slippage?: number;
|
|
2756
|
+
userAddress: Address;
|
|
2757
|
+
}
|
|
2758
|
+
/**
|
|
2759
|
+
* Prepares the transaction data needed to withdraw assets from a vault
|
|
2760
|
+
*
|
|
2761
|
+
* This function calculates the appropriate exchange rate with slippage protection
|
|
2762
|
+
* and prepares a user request for the AtomicQueue contract. It uses the new
|
|
2763
|
+
* AmplifyVault schema with asset decimals from the API (no on-chain calls).
|
|
2764
|
+
*
|
|
2765
|
+
* @example
|
|
2766
|
+
* ```typescript
|
|
2767
|
+
* const vaults = await fetchVaults({ chainId: 1 });
|
|
2768
|
+
* const wantAssets = await fetchSupportedAssets({ symbol: 'WETH' });
|
|
2769
|
+
* const withdrawData = await prepareBulkWithdrawTransactionData({
|
|
2770
|
+
* vault: vaults[0],
|
|
2771
|
+
* wantAsset: wantAssets[0],
|
|
2772
|
+
* chainId: 1,
|
|
2773
|
+
* userAddress: '0x1234...',
|
|
2774
|
+
* offerAmount: "1.0", // 1 vault share
|
|
2775
|
+
* deadline: Math.floor(Date.now() / 1000) + 3600, // 1 hour from now
|
|
2776
|
+
* slippage: 100, // 1% slippage (100 bps)
|
|
2777
|
+
* });
|
|
2778
|
+
* ```
|
|
2779
|
+
*
|
|
2780
|
+
* @param {PrepareBulkWithdrawTxDataParams} params - Parameters for the withdraw operation
|
|
2781
|
+
* @param {AmplifyVault} params.vault - Vault configuration from fetchVaults()
|
|
2782
|
+
* @param {SupportedAsset} params.wantAsset - Asset metadata from fetchSupportedAssets()
|
|
2783
|
+
* @param {ChainId} params.chainId - ID of the chain where the withdrawal will occur
|
|
2784
|
+
* @param {Address} params.userAddress - Ethereum address of the user making the withdrawal
|
|
2785
|
+
* @param {string} params.offerAmount - Amount of vault shares to withdraw as a decimal string
|
|
2786
|
+
* @param {number} [params.deadline] - Unix timestamp when the request expires
|
|
2787
|
+
* @param {number} [params.slippage] - Maximum acceptable slippage in basis points
|
|
2788
|
+
*
|
|
2789
|
+
* @returns {Promise<BulkWithdrawTxData>} Promise resolving to the prepared transaction data
|
|
2790
|
+
* @throws {APIError} If the vault is not on the correct chain, asset not supported, or contracts not configured
|
|
2791
|
+
*/
|
|
2792
|
+
declare function prepareBulkWithdrawTxData(params: PrepareBulkWithdrawTxDataParams): Promise<BulkWithdrawTxData>;
|
|
2793
|
+
|
|
2794
|
+
declare const AtomicQueueAbi: readonly [{
|
|
2795
|
+
readonly type: "function";
|
|
2796
|
+
readonly name: "getUserAtomicRequest";
|
|
2797
|
+
readonly inputs: readonly [{
|
|
2798
|
+
readonly name: "user";
|
|
2799
|
+
readonly type: "address";
|
|
2800
|
+
readonly internalType: "address";
|
|
2801
|
+
}, {
|
|
2802
|
+
readonly name: "offer";
|
|
2803
|
+
readonly type: "address";
|
|
2804
|
+
readonly internalType: "contract ERC20";
|
|
2805
|
+
}, {
|
|
2806
|
+
readonly name: "want";
|
|
2807
|
+
readonly type: "address";
|
|
2808
|
+
readonly internalType: "contract ERC20";
|
|
2809
|
+
}];
|
|
2810
|
+
readonly outputs: readonly [{
|
|
2811
|
+
readonly name: "";
|
|
2812
|
+
readonly type: "tuple";
|
|
2813
|
+
readonly internalType: "struct AtomicQueue.AtomicRequest";
|
|
2814
|
+
readonly components: readonly [{
|
|
2815
|
+
readonly name: "deadline";
|
|
2816
|
+
readonly type: "uint64";
|
|
2817
|
+
readonly internalType: "uint64";
|
|
2818
|
+
}, {
|
|
2819
|
+
readonly name: "atomicPrice";
|
|
2820
|
+
readonly type: "uint88";
|
|
2821
|
+
readonly internalType: "uint88";
|
|
2822
|
+
}, {
|
|
2823
|
+
readonly name: "offerAmount";
|
|
2824
|
+
readonly type: "uint96";
|
|
2825
|
+
readonly internalType: "uint96";
|
|
2826
|
+
}, {
|
|
2827
|
+
readonly name: "inSolve";
|
|
2828
|
+
readonly type: "bool";
|
|
2829
|
+
readonly internalType: "bool";
|
|
2830
|
+
}];
|
|
2831
|
+
}];
|
|
2832
|
+
readonly stateMutability: "view";
|
|
2833
|
+
}, {
|
|
2834
|
+
readonly type: "function";
|
|
2835
|
+
readonly name: "isAtomicRequestValid";
|
|
2836
|
+
readonly inputs: readonly [{
|
|
2837
|
+
readonly name: "offer";
|
|
2838
|
+
readonly type: "address";
|
|
2839
|
+
readonly internalType: "contract ERC20";
|
|
2840
|
+
}, {
|
|
2841
|
+
readonly name: "user";
|
|
2842
|
+
readonly type: "address";
|
|
2843
|
+
readonly internalType: "address";
|
|
2844
|
+
}, {
|
|
2845
|
+
readonly name: "userRequest";
|
|
2846
|
+
readonly type: "tuple";
|
|
2847
|
+
readonly internalType: "struct AtomicQueue.AtomicRequest";
|
|
2848
|
+
readonly components: readonly [{
|
|
2849
|
+
readonly name: "deadline";
|
|
2850
|
+
readonly type: "uint64";
|
|
2851
|
+
readonly internalType: "uint64";
|
|
2852
|
+
}, {
|
|
2853
|
+
readonly name: "atomicPrice";
|
|
2854
|
+
readonly type: "uint88";
|
|
2855
|
+
readonly internalType: "uint88";
|
|
2856
|
+
}, {
|
|
2857
|
+
readonly name: "offerAmount";
|
|
2858
|
+
readonly type: "uint96";
|
|
2859
|
+
readonly internalType: "uint96";
|
|
2860
|
+
}, {
|
|
2861
|
+
readonly name: "inSolve";
|
|
2862
|
+
readonly type: "bool";
|
|
2863
|
+
readonly internalType: "bool";
|
|
2864
|
+
}];
|
|
2865
|
+
}];
|
|
2866
|
+
readonly outputs: readonly [{
|
|
2867
|
+
readonly name: "";
|
|
2868
|
+
readonly type: "bool";
|
|
2869
|
+
readonly internalType: "bool";
|
|
2870
|
+
}];
|
|
2871
|
+
readonly stateMutability: "view";
|
|
2872
|
+
}, {
|
|
2873
|
+
readonly type: "function";
|
|
2874
|
+
readonly name: "solve";
|
|
2875
|
+
readonly inputs: readonly [{
|
|
2876
|
+
readonly name: "offer";
|
|
2877
|
+
readonly type: "address";
|
|
2878
|
+
readonly internalType: "contract ERC20";
|
|
2879
|
+
}, {
|
|
2880
|
+
readonly name: "want";
|
|
2881
|
+
readonly type: "address";
|
|
2882
|
+
readonly internalType: "contract ERC20";
|
|
2883
|
+
}, {
|
|
2884
|
+
readonly name: "users";
|
|
2885
|
+
readonly type: "address[]";
|
|
2886
|
+
readonly internalType: "address[]";
|
|
2887
|
+
}, {
|
|
2888
|
+
readonly name: "runData";
|
|
2889
|
+
readonly type: "bytes";
|
|
2890
|
+
readonly internalType: "bytes";
|
|
2891
|
+
}, {
|
|
2892
|
+
readonly name: "solver";
|
|
2893
|
+
readonly type: "address";
|
|
2894
|
+
readonly internalType: "address";
|
|
2895
|
+
}];
|
|
2896
|
+
readonly outputs: readonly [];
|
|
2897
|
+
readonly stateMutability: "nonpayable";
|
|
2898
|
+
}, {
|
|
2899
|
+
readonly type: "function";
|
|
2900
|
+
readonly name: "updateAtomicRequest";
|
|
2901
|
+
readonly inputs: readonly [{
|
|
2902
|
+
readonly name: "offer";
|
|
2903
|
+
readonly type: "address";
|
|
2904
|
+
readonly internalType: "contract ERC20";
|
|
2905
|
+
}, {
|
|
2906
|
+
readonly name: "want";
|
|
2907
|
+
readonly type: "address";
|
|
2908
|
+
readonly internalType: "contract ERC20";
|
|
2909
|
+
}, {
|
|
2910
|
+
readonly name: "userRequest";
|
|
2911
|
+
readonly type: "tuple";
|
|
2912
|
+
readonly internalType: "struct AtomicQueue.AtomicRequest";
|
|
2913
|
+
readonly components: readonly [{
|
|
2914
|
+
readonly name: "deadline";
|
|
2915
|
+
readonly type: "uint64";
|
|
2916
|
+
readonly internalType: "uint64";
|
|
2917
|
+
}, {
|
|
2918
|
+
readonly name: "atomicPrice";
|
|
2919
|
+
readonly type: "uint88";
|
|
2920
|
+
readonly internalType: "uint88";
|
|
2921
|
+
}, {
|
|
2922
|
+
readonly name: "offerAmount";
|
|
2923
|
+
readonly type: "uint96";
|
|
2924
|
+
readonly internalType: "uint96";
|
|
2925
|
+
}, {
|
|
2926
|
+
readonly name: "inSolve";
|
|
2927
|
+
readonly type: "bool";
|
|
2928
|
+
readonly internalType: "bool";
|
|
2929
|
+
}];
|
|
2930
|
+
}];
|
|
2931
|
+
readonly outputs: readonly [];
|
|
2932
|
+
readonly stateMutability: "nonpayable";
|
|
2933
|
+
}, {
|
|
2934
|
+
readonly type: "function";
|
|
2935
|
+
readonly name: "userAtomicRequest";
|
|
2936
|
+
readonly inputs: readonly [{
|
|
2937
|
+
readonly name: "";
|
|
2938
|
+
readonly type: "address";
|
|
2939
|
+
readonly internalType: "address";
|
|
2940
|
+
}, {
|
|
2941
|
+
readonly name: "";
|
|
2942
|
+
readonly type: "address";
|
|
2943
|
+
readonly internalType: "contract ERC20";
|
|
2944
|
+
}, {
|
|
2945
|
+
readonly name: "";
|
|
2946
|
+
readonly type: "address";
|
|
2947
|
+
readonly internalType: "contract ERC20";
|
|
2948
|
+
}];
|
|
2949
|
+
readonly outputs: readonly [{
|
|
2950
|
+
readonly name: "deadline";
|
|
2951
|
+
readonly type: "uint64";
|
|
2952
|
+
readonly internalType: "uint64";
|
|
2953
|
+
}, {
|
|
2954
|
+
readonly name: "atomicPrice";
|
|
2955
|
+
readonly type: "uint88";
|
|
2956
|
+
readonly internalType: "uint88";
|
|
2957
|
+
}, {
|
|
2958
|
+
readonly name: "offerAmount";
|
|
2959
|
+
readonly type: "uint96";
|
|
2960
|
+
readonly internalType: "uint96";
|
|
2961
|
+
}, {
|
|
2962
|
+
readonly name: "inSolve";
|
|
2963
|
+
readonly type: "bool";
|
|
2964
|
+
readonly internalType: "bool";
|
|
2965
|
+
}];
|
|
2966
|
+
readonly stateMutability: "view";
|
|
2967
|
+
}, {
|
|
2968
|
+
readonly type: "function";
|
|
2969
|
+
readonly name: "viewSolveMetaData";
|
|
2970
|
+
readonly inputs: readonly [{
|
|
2971
|
+
readonly name: "offer";
|
|
2972
|
+
readonly type: "address";
|
|
2973
|
+
readonly internalType: "contract ERC20";
|
|
2974
|
+
}, {
|
|
2975
|
+
readonly name: "want";
|
|
2976
|
+
readonly type: "address";
|
|
2977
|
+
readonly internalType: "contract ERC20";
|
|
2978
|
+
}, {
|
|
2979
|
+
readonly name: "users";
|
|
2980
|
+
readonly type: "address[]";
|
|
2981
|
+
readonly internalType: "address[]";
|
|
2982
|
+
}];
|
|
2983
|
+
readonly outputs: readonly [{
|
|
2984
|
+
readonly name: "metaData";
|
|
2985
|
+
readonly type: "tuple[]";
|
|
2986
|
+
readonly internalType: "struct AtomicQueue.SolveMetaData[]";
|
|
2987
|
+
readonly components: readonly [{
|
|
2988
|
+
readonly name: "user";
|
|
2989
|
+
readonly type: "address";
|
|
2990
|
+
readonly internalType: "address";
|
|
2991
|
+
}, {
|
|
2992
|
+
readonly name: "flags";
|
|
2993
|
+
readonly type: "uint8";
|
|
2994
|
+
readonly internalType: "uint8";
|
|
2995
|
+
}, {
|
|
2996
|
+
readonly name: "assetsToOffer";
|
|
2997
|
+
readonly type: "uint256";
|
|
2998
|
+
readonly internalType: "uint256";
|
|
2999
|
+
}, {
|
|
3000
|
+
readonly name: "assetsForWant";
|
|
3001
|
+
readonly type: "uint256";
|
|
3002
|
+
readonly internalType: "uint256";
|
|
3003
|
+
}];
|
|
3004
|
+
}, {
|
|
3005
|
+
readonly name: "totalAssetsForWant";
|
|
3006
|
+
readonly type: "uint256";
|
|
3007
|
+
readonly internalType: "uint256";
|
|
3008
|
+
}, {
|
|
3009
|
+
readonly name: "totalAssetsToOffer";
|
|
3010
|
+
readonly type: "uint256";
|
|
3011
|
+
readonly internalType: "uint256";
|
|
3012
|
+
}];
|
|
3013
|
+
readonly stateMutability: "view";
|
|
3014
|
+
}, {
|
|
3015
|
+
readonly type: "event";
|
|
3016
|
+
readonly name: "AtomicRequestFulfilled";
|
|
3017
|
+
readonly inputs: readonly [{
|
|
3018
|
+
readonly name: "user";
|
|
3019
|
+
readonly type: "address";
|
|
3020
|
+
readonly indexed: false;
|
|
3021
|
+
readonly internalType: "address";
|
|
3022
|
+
}, {
|
|
3023
|
+
readonly name: "offerToken";
|
|
3024
|
+
readonly type: "address";
|
|
3025
|
+
readonly indexed: false;
|
|
3026
|
+
readonly internalType: "address";
|
|
3027
|
+
}, {
|
|
3028
|
+
readonly name: "wantToken";
|
|
3029
|
+
readonly type: "address";
|
|
3030
|
+
readonly indexed: false;
|
|
3031
|
+
readonly internalType: "address";
|
|
3032
|
+
}, {
|
|
3033
|
+
readonly name: "offerAmountSpent";
|
|
3034
|
+
readonly type: "uint256";
|
|
3035
|
+
readonly indexed: false;
|
|
3036
|
+
readonly internalType: "uint256";
|
|
3037
|
+
}, {
|
|
3038
|
+
readonly name: "wantAmountReceived";
|
|
3039
|
+
readonly type: "uint256";
|
|
3040
|
+
readonly indexed: false;
|
|
3041
|
+
readonly internalType: "uint256";
|
|
3042
|
+
}, {
|
|
3043
|
+
readonly name: "timestamp";
|
|
3044
|
+
readonly type: "uint256";
|
|
3045
|
+
readonly indexed: false;
|
|
3046
|
+
readonly internalType: "uint256";
|
|
3047
|
+
}];
|
|
3048
|
+
readonly anonymous: false;
|
|
3049
|
+
}, {
|
|
3050
|
+
readonly type: "event";
|
|
3051
|
+
readonly name: "AtomicRequestUpdated";
|
|
3052
|
+
readonly inputs: readonly [{
|
|
3053
|
+
readonly name: "user";
|
|
3054
|
+
readonly type: "address";
|
|
3055
|
+
readonly indexed: false;
|
|
3056
|
+
readonly internalType: "address";
|
|
3057
|
+
}, {
|
|
3058
|
+
readonly name: "offerToken";
|
|
3059
|
+
readonly type: "address";
|
|
3060
|
+
readonly indexed: false;
|
|
3061
|
+
readonly internalType: "address";
|
|
3062
|
+
}, {
|
|
3063
|
+
readonly name: "wantToken";
|
|
3064
|
+
readonly type: "address";
|
|
3065
|
+
readonly indexed: false;
|
|
3066
|
+
readonly internalType: "address";
|
|
3067
|
+
}, {
|
|
3068
|
+
readonly name: "amount";
|
|
3069
|
+
readonly type: "uint256";
|
|
3070
|
+
readonly indexed: false;
|
|
3071
|
+
readonly internalType: "uint256";
|
|
3072
|
+
}, {
|
|
3073
|
+
readonly name: "deadline";
|
|
3074
|
+
readonly type: "uint256";
|
|
3075
|
+
readonly indexed: false;
|
|
3076
|
+
readonly internalType: "uint256";
|
|
3077
|
+
}, {
|
|
3078
|
+
readonly name: "minPrice";
|
|
3079
|
+
readonly type: "uint256";
|
|
3080
|
+
readonly indexed: false;
|
|
3081
|
+
readonly internalType: "uint256";
|
|
3082
|
+
}, {
|
|
3083
|
+
readonly name: "timestamp";
|
|
3084
|
+
readonly type: "uint256";
|
|
3085
|
+
readonly indexed: false;
|
|
3086
|
+
readonly internalType: "uint256";
|
|
3087
|
+
}];
|
|
3088
|
+
readonly anonymous: false;
|
|
3089
|
+
}, {
|
|
3090
|
+
readonly type: "error";
|
|
3091
|
+
readonly name: "AtomicQueue__RequestDeadlineExceeded";
|
|
3092
|
+
readonly inputs: readonly [{
|
|
3093
|
+
readonly name: "user";
|
|
3094
|
+
readonly type: "address";
|
|
3095
|
+
readonly internalType: "address";
|
|
3096
|
+
}];
|
|
3097
|
+
}, {
|
|
3098
|
+
readonly type: "error";
|
|
3099
|
+
readonly name: "AtomicQueue__UserNotInSolve";
|
|
3100
|
+
readonly inputs: readonly [{
|
|
3101
|
+
readonly name: "user";
|
|
3102
|
+
readonly type: "address";
|
|
3103
|
+
readonly internalType: "address";
|
|
3104
|
+
}];
|
|
3105
|
+
}, {
|
|
3106
|
+
readonly type: "error";
|
|
3107
|
+
readonly name: "AtomicQueue__UserRepeated";
|
|
3108
|
+
readonly inputs: readonly [{
|
|
3109
|
+
readonly name: "user";
|
|
3110
|
+
readonly type: "address";
|
|
3111
|
+
readonly internalType: "address";
|
|
3112
|
+
}];
|
|
3113
|
+
}, {
|
|
3114
|
+
readonly type: "error";
|
|
3115
|
+
readonly name: "AtomicQueue__ZeroOfferAmount";
|
|
3116
|
+
readonly inputs: readonly [{
|
|
3117
|
+
readonly name: "user";
|
|
3118
|
+
readonly type: "address";
|
|
3119
|
+
readonly internalType: "address";
|
|
3120
|
+
}];
|
|
3121
|
+
}];
|
|
3122
|
+
|
|
3123
|
+
/**
|
|
3124
|
+
* @file Withdraw functionality for Paxos Labs vaults
|
|
3125
|
+
* @module vaults/withdraw
|
|
3126
|
+
*/
|
|
3127
|
+
|
|
3128
|
+
/**
|
|
3129
|
+
* User request details for an atomic swap
|
|
3130
|
+
* @typedef {Object} UserRequest
|
|
3131
|
+
* @property {number} deadline - Unix timestamp when the request expires
|
|
3132
|
+
* @property {bigint} atomicPrice - Rate in quote with fee applied
|
|
3133
|
+
* @property {bigint} offerAmount - Amount of shares token to redeem
|
|
3134
|
+
* @property {boolean} inSolve - Whether the request is in solve mode (always false for new requests)
|
|
3135
|
+
*/
|
|
3136
|
+
type UserRequest = {
|
|
3137
|
+
deadline: bigint;
|
|
3138
|
+
atomicPrice: bigint;
|
|
3139
|
+
offerAmount: bigint;
|
|
3140
|
+
inSolve: boolean;
|
|
3141
|
+
};
|
|
3142
|
+
/**
|
|
3143
|
+
* Parameters for preparing a withdrawal transaction from a vault (NEW AmplifyVault schema)
|
|
3144
|
+
* @interface PrepareWithdrawTxDataParams
|
|
3145
|
+
* @property {YieldType} yieldType - Yield strategy type (PRIME, TBILL, or LENDING)
|
|
3146
|
+
* @property {Address} wantAssetAddress - Address of the want token
|
|
3147
|
+
* @property {ChainId} chainId - ID of the chain where the withdrawal will occur
|
|
3148
|
+
* @property {string} offerAmount - Amount of vault shares to withdraw as a decimal string
|
|
3149
|
+
* @property {Address} userAddress - Ethereum address of the user making the withdrawal
|
|
3150
|
+
* @property {number} [deadline] - Unix timestamp when the request expires (optional)
|
|
3151
|
+
* @property {number} [slippage] - Maximum acceptable slippage in basis points (optional, default: 100 for 1%)
|
|
3152
|
+
*
|
|
3153
|
+
* **Slippage Protection**:
|
|
3154
|
+
* The slippage parameter protects users from unfavorable price movements during the withdrawal.
|
|
3155
|
+
* It defines the maximum acceptable loss as a percentage of the initial share amount.
|
|
3156
|
+
*
|
|
3157
|
+
* - Default: 100 basis points (1% slippage tolerance)
|
|
3158
|
+
* - Range: 0-10000 basis points (0-100%)
|
|
3159
|
+
* - Formula: minimumAssets = shareAmount * (10000 - slippage) / 10000
|
|
3160
|
+
*
|
|
3161
|
+
* @example
|
|
3162
|
+
* ```typescript
|
|
3163
|
+
* // 1% slippage (default) - allows price to move 1% unfavorably
|
|
3164
|
+
* { slippage: 100 }
|
|
3165
|
+
*
|
|
3166
|
+
* // 0.5% slippage - conservative, tighter protection
|
|
3167
|
+
* { slippage: 50 }
|
|
3168
|
+
*
|
|
3169
|
+
* // 5% slippage - aggressive, more lenient
|
|
3170
|
+
* { slippage: 500 }
|
|
3171
|
+
*
|
|
3172
|
+
* // No slippage tolerance - transaction reverts if price changes at all
|
|
3173
|
+
* { slippage: 0 }
|
|
3174
|
+
* ```
|
|
3175
|
+
*/
|
|
3176
|
+
interface PrepareWithdrawTxDataParams {
|
|
3177
|
+
yieldType: YieldType;
|
|
3178
|
+
wantAssetAddress: Address;
|
|
3179
|
+
chainId: ChainId;
|
|
3180
|
+
offerAmount: string;
|
|
3181
|
+
userAddress: Address;
|
|
3182
|
+
deadline?: number;
|
|
3183
|
+
slippage?: number;
|
|
3184
|
+
}
|
|
3185
|
+
/**
|
|
3186
|
+
* Result object containing transaction data for a withdrawal operation
|
|
3187
|
+
* @interface WithdrawTxData
|
|
3188
|
+
* @property {typeof AtomicQueueAbi} abi - ABI for the AtomicQueue contract
|
|
3189
|
+
* @property {Address} address - Address of the AtomicQueue contract
|
|
3190
|
+
* @property {'updateAtomicRequest'} functionName - Name of the function to call
|
|
3191
|
+
* @property {[Address, Address, UserRequest]} args - Arguments for the updateAtomicRequest function:
|
|
3192
|
+
* [offer (vault shares address), want (want asset address), userRequest]
|
|
3193
|
+
* @property {number} chainId - ID of the chain where the transaction should be executed
|
|
3194
|
+
*/
|
|
3195
|
+
interface WithdrawTxData {
|
|
3196
|
+
abi: typeof AtomicQueueAbi;
|
|
3197
|
+
address: Address;
|
|
3198
|
+
functionName: "updateAtomicRequest";
|
|
3199
|
+
args: [offer: Address, want: Address, userRequest: UserRequest];
|
|
3200
|
+
chainId: number;
|
|
3201
|
+
}
|
|
3202
|
+
/**
|
|
3203
|
+
* Prepares the transaction data needed to withdraw assets from a vault
|
|
3204
|
+
*
|
|
3205
|
+
* This function calculates the appropriate exchange rate with slippage protection
|
|
3206
|
+
* and prepares a user request for the AtomicQueue contract. It uses the new
|
|
3207
|
+
* AmplifyVault schema with asset decimals from the API (no on-chain calls).
|
|
3208
|
+
*
|
|
3209
|
+
* @example
|
|
3210
|
+
* ```typescript
|
|
3211
|
+
* const withdrawData = await prepareWithdrawTransactionData({
|
|
3212
|
+
* yieldType: 'PRIME',
|
|
3213
|
+
* wantAssetAddress: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', // USDC
|
|
3214
|
+
* chainId: 1,
|
|
3215
|
+
* userAddress: '0x1234...',
|
|
3216
|
+
* offerAmount: "1.0", // 1 vault share
|
|
3217
|
+
* deadline: Math.floor(Date.now() / 1000) + 3600, // 1 hour from now
|
|
3218
|
+
* slippage: 100, // 1% slippage (100 bps)
|
|
3219
|
+
* });
|
|
3220
|
+
* ```
|
|
3221
|
+
*
|
|
3222
|
+
* @param {PrepareWithdrawTxDataParams} params - Parameters for the withdraw operation
|
|
3223
|
+
* @param {YieldType} params.yieldType - Yield strategy type (PRIME, TBILL, or LENDING)
|
|
3224
|
+
* @param {Address} params.wantAssetAddress - Address of the want token
|
|
3225
|
+
* @param {ChainId} params.chainId - ID of the chain where the withdrawal will occur
|
|
3226
|
+
* @param {Address} params.userAddress - Ethereum address of the user making the withdrawal
|
|
3227
|
+
* @param {string} params.offerAmount - Amount of vault shares to withdraw as a decimal string
|
|
3228
|
+
* @param {number} [params.deadline] - Unix timestamp when the request expires
|
|
3229
|
+
* @param {number} [params.slippage] - Maximum acceptable slippage in basis points
|
|
3230
|
+
*
|
|
3231
|
+
* @returns {Promise<WithdrawTxData>} Promise resolving to the prepared transaction data
|
|
3232
|
+
* @throws {APIError} If the vault is not on the correct chain, asset not supported, or contracts not configured
|
|
3233
|
+
*/
|
|
3234
|
+
declare const prepareWithdrawTxData: ({ yieldType, wantAssetAddress, chainId, offerAmount, deadline, slippage, }: PrepareWithdrawTxDataParams) => Promise<WithdrawTxData>;
|
|
3235
|
+
|
|
3236
|
+
export { AmplifyVault, type ApproveDepositTokenTxData, type ApproveWithdrawTokenTxData, AssetFilterOptions, type BulkWithdrawTxData, type DepositTxData, type EIP712Domain, type InitErrorCode, PERMIT_TYPES, type ParsedPermitSignature, type PermitSignatureData, type PrepareDepositPermitSignatureParams, type PrepareDepositWithPermitTxDataParams, type RequestHeaders, type SDKConfig, SupportedAsset, type UnencodedDepositWithPermitData, VaultFilterOptions, WithdrawSupportedAsset, type WithdrawTxData, YieldType, fetchSupportedAssets, fetchVaults, findVaultByConfig, getAssetsFromCache, getCache, getWithdrawSupportedAssets, initAmplifySDK, initializeCache, parsePermitSignature, prepareApproveDepositTokenTxData, prepareApproveWithdrawTxData, prepareBulkWithdrawTxData, prepareDepositPermitSignature, prepareDepositTxData, prepareDepositWithPermitTransactionData, prepareWithdrawTxData, refreshVaultCache };
|