@paxoslabs/amplify-sdk 0.5.2 → 0.5.3

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.
Files changed (58) hide show
  1. package/dist/{chain-utils-BdJecHBA.d.mts → chain-utils-5r2UnCDS.d.mts} +47 -1
  2. package/dist/{chain-utils-BdJecHBA.d.ts → chain-utils-5r2UnCDS.d.ts} +47 -1
  3. package/dist/{chunk-5OK753GA.js → chunk-4NQPS3JC.js} +470 -358
  4. package/dist/chunk-4NQPS3JC.js.map +1 -0
  5. package/dist/chunk-6JLKHV6O.js +128 -0
  6. package/dist/chunk-6JLKHV6O.js.map +1 -0
  7. package/dist/{chunk-NNDY5TID.js → chunk-FHE43NKY.js} +12 -12
  8. package/dist/{chunk-NNDY5TID.js.map → chunk-FHE43NKY.js.map} +1 -1
  9. package/dist/chunk-GOJQYEJQ.js +3212 -0
  10. package/dist/chunk-GOJQYEJQ.js.map +1 -0
  11. package/dist/{chunk-HU5CTL4C.mjs → chunk-LMNADWTH.mjs} +364 -253
  12. package/dist/chunk-LMNADWTH.mjs.map +1 -0
  13. package/dist/chunk-ODXJYXUH.mjs +3168 -0
  14. package/dist/chunk-ODXJYXUH.mjs.map +1 -0
  15. package/dist/{chunk-QZHI2T7O.mjs → chunk-QMFYPHX5.mjs} +280 -47
  16. package/dist/chunk-QMFYPHX5.mjs.map +1 -0
  17. package/dist/{chunk-Q5FXJU5Y.mjs → chunk-UY2WD7MF.mjs} +3 -3
  18. package/dist/{chunk-Q5FXJU5Y.mjs.map → chunk-UY2WD7MF.mjs.map} +1 -1
  19. package/dist/chunk-WD6QFSXZ.js +701 -0
  20. package/dist/chunk-WD6QFSXZ.js.map +1 -0
  21. package/dist/chunk-Y5LBT2WT.mjs +118 -0
  22. package/dist/chunk-Y5LBT2WT.mjs.map +1 -0
  23. package/dist/core.d.mts +50 -7
  24. package/dist/core.d.ts +50 -7
  25. package/dist/core.js +32 -16
  26. package/dist/core.mjs +4 -4
  27. package/dist/display.d.mts +211 -2
  28. package/dist/display.d.ts +211 -2
  29. package/dist/display.js +26 -10
  30. package/dist/display.mjs +4 -4
  31. package/dist/{index-DXXA8gEA.d.mts → index-D8RtV9cB.d.mts} +498 -410
  32. package/dist/{index-aE5lTOUH.d.ts → index-ev_V5sjt.d.ts} +498 -410
  33. package/dist/index.d.mts +40 -5
  34. package/dist/index.d.ts +40 -5
  35. package/dist/index.js +80 -60
  36. package/dist/index.mjs +5 -5
  37. package/dist/utils.d.mts +1 -1
  38. package/dist/utils.d.ts +1 -1
  39. package/dist/utils.js +7 -7
  40. package/dist/utils.mjs +2 -2
  41. package/dist/vaults.d.mts +2 -2
  42. package/dist/vaults.d.ts +2 -2
  43. package/dist/vaults.js +25 -25
  44. package/dist/vaults.mjs +4 -4
  45. package/package.json +1 -1
  46. package/dist/chunk-5OK753GA.js.map +0 -1
  47. package/dist/chunk-7JQQ2TH4.mjs +0 -1231
  48. package/dist/chunk-7JQQ2TH4.mjs.map +0 -1
  49. package/dist/chunk-HU5CTL4C.mjs.map +0 -1
  50. package/dist/chunk-QZHI2T7O.mjs.map +0 -1
  51. package/dist/chunk-SWUG4PTB.js +0 -464
  52. package/dist/chunk-SWUG4PTB.js.map +0 -1
  53. package/dist/chunk-WK7EJRBB.mjs +0 -1482
  54. package/dist/chunk-WK7EJRBB.mjs.map +0 -1
  55. package/dist/chunk-WYBYBPX5.js +0 -1518
  56. package/dist/chunk-WYBYBPX5.js.map +0 -1
  57. package/dist/chunk-ZKDXRGI5.js +0 -1239
  58. package/dist/chunk-ZKDXRGI5.js.map +0 -1
@@ -1,11 +1,113 @@
1
1
  'use strict';
2
2
 
3
- var chunkZKDXRGI5_js = require('./chunk-ZKDXRGI5.js');
4
- var chunkNNDY5TID_js = require('./chunk-NNDY5TID.js');
3
+ var chunk6JLKHV6O_js = require('./chunk-6JLKHV6O.js');
4
+ var chunkFHE43NKY_js = require('./chunk-FHE43NKY.js');
5
5
  var chunkTNL23CO2_js = require('./chunk-TNL23CO2.js');
6
- var chunkWYBYBPX5_js = require('./chunk-WYBYBPX5.js');
6
+ var chunkGOJQYEJQ_js = require('./chunk-GOJQYEJQ.js');
7
7
  var viem = require('viem');
8
8
 
9
+ // src/client/kyt-client.ts
10
+ var CHAIN_ID_TO_PREDICATE_CHAIN = {
11
+ 1: "ethereum",
12
+ 11155111: "sepolia",
13
+ 8453: "base",
14
+ 84532: "base-sepolia",
15
+ 999: "hyperevm",
16
+ 2201: "stable-testnet"
17
+ };
18
+ async function fetchKytAttestation(params) {
19
+ const { to, from, chainId } = params;
20
+ const logger = chunkGOJQYEJQ_js.getLogger();
21
+ const chain = CHAIN_ID_TO_PREDICATE_CHAIN[chainId];
22
+ if (!chain) {
23
+ throw new chunkGOJQYEJQ_js.APIError(
24
+ `KYT attestation not supported for chain ID ${chainId}. Supported chains: ${Object.keys(CHAIN_ID_TO_PREDICATE_CHAIN).join(", ")}`,
25
+ { endpoint: "kytAttestation" }
26
+ );
27
+ }
28
+ const url = `${chunkGOJQYEJQ_js.getRestV2BaseURL()}/kytAttestation`;
29
+ const headers = chunkGOJQYEJQ_js.getRequestHeaders();
30
+ logger.debug("Fetching KYT attestation", { to, from, chain });
31
+ let response;
32
+ try {
33
+ response = await fetch(url, {
34
+ method: "POST",
35
+ headers,
36
+ body: JSON.stringify({ to, from, chain }),
37
+ signal: chunkGOJQYEJQ_js.createTimeoutSignal(chunkGOJQYEJQ_js.DEFAULT_TIMEOUT)
38
+ });
39
+ } catch (error) {
40
+ if (error instanceof Error && error.name === "AbortError") {
41
+ throw new chunkGOJQYEJQ_js.APIError("KYT attestation request timed out", {
42
+ endpoint: "kytAttestation",
43
+ cause: error
44
+ });
45
+ }
46
+ throw new chunkGOJQYEJQ_js.APIError(
47
+ `KYT attestation request failed: ${error instanceof Error ? error.message : String(error)}`,
48
+ { endpoint: "kytAttestation", cause: error }
49
+ );
50
+ }
51
+ if (!response.ok) {
52
+ let serverMessage;
53
+ try {
54
+ const errorBody = await response.json();
55
+ serverMessage = errorBody?.error?.message;
56
+ } catch {
57
+ }
58
+ if (response.status === 403) {
59
+ throw new chunkGOJQYEJQ_js.APIError(
60
+ serverMessage ?? "Deposit blocked: transaction is not compliant with KYT policy",
61
+ { endpoint: "kytAttestation", statusCode: 403 }
62
+ );
63
+ }
64
+ if (response.status === 400) {
65
+ throw new chunkGOJQYEJQ_js.APIError(
66
+ serverMessage ?? "KYT attestation request was rejected: invalid parameters",
67
+ { endpoint: "kytAttestation", statusCode: 400 }
68
+ );
69
+ }
70
+ throw new chunkGOJQYEJQ_js.APIError(
71
+ serverMessage ?? `KYT attestation request failed (HTTP ${response.status})`,
72
+ { endpoint: "kytAttestation", statusCode: response.status }
73
+ );
74
+ }
75
+ let body;
76
+ try {
77
+ body = await response.json();
78
+ } catch (error) {
79
+ throw new chunkGOJQYEJQ_js.APIError("KYT attestation response contained invalid JSON", {
80
+ endpoint: "kytAttestation",
81
+ cause: error
82
+ });
83
+ }
84
+ if (!body.attestation) {
85
+ throw new chunkGOJQYEJQ_js.APIError("KYT attestation response missing attestation field", {
86
+ endpoint: "kytAttestation"
87
+ });
88
+ }
89
+ const { attestation } = body;
90
+ const missingFields = ["uuid", "attester", "signature", "expiration"].filter((f) => attestation[f] == null);
91
+ if (missingFields.length > 0) {
92
+ throw new chunkGOJQYEJQ_js.APIError(
93
+ `KYT attestation response missing required fields: ${missingFields.join(", ")}`,
94
+ { endpoint: "kytAttestation" }
95
+ );
96
+ }
97
+ if (typeof attestation.expiration !== "number" && typeof attestation.expiration !== "string") {
98
+ throw new chunkGOJQYEJQ_js.APIError(
99
+ "KYT attestation response has invalid expiration value",
100
+ { endpoint: "kytAttestation" }
101
+ );
102
+ }
103
+ const sig = attestation.signature.startsWith("0x") ? attestation.signature : `0x${attestation.signature}`;
104
+ return {
105
+ uuid: attestation.uuid,
106
+ expiration: BigInt(attestation.expiration),
107
+ attester: attestation.attester,
108
+ signature: sig
109
+ };
110
+ }
9
111
  var isDepositSpendApproved = async ({
10
112
  vaultName,
11
113
  chainId,
@@ -13,8 +115,8 @@ var isDepositSpendApproved = async ({
13
115
  recipientAddress
14
116
  }) => {
15
117
  try {
16
- const normalizedChainId = chunkWYBYBPX5_js.toChainId(chainId);
17
- const config = await chunkZKDXRGI5_js.resolveVault({
118
+ const normalizedChainId = chunkGOJQYEJQ_js.toChainId(chainId);
119
+ const config = await chunk6JLKHV6O_js.resolveVault({
18
120
  vaultName,
19
121
  chainId: normalizedChainId,
20
122
  assetAddress: depositAssetAddress,
@@ -22,7 +124,7 @@ var isDepositSpendApproved = async ({
22
124
  });
23
125
  const communityCodeDepositorAddress = config.vault.communityCodeDepositorAddress;
24
126
  if (!communityCodeDepositorAddress) {
25
- throw new chunkWYBYBPX5_js.APIError(
127
+ throw new chunkGOJQYEJQ_js.APIError(
26
128
  `Community code depositor contract address not configured for vault ${config.id}`,
27
129
  {
28
130
  endpoint: "isDepositSpendApproved"
@@ -37,7 +139,7 @@ var isDepositSpendApproved = async ({
37
139
  domainSeparator,
38
140
  tokenName,
39
141
  tokenVersion
40
- } = await chunkNNDY5TID_js.getTokenPermitInfoWithAllowance({
142
+ } = await chunkFHE43NKY_js.getTokenPermitInfoWithAllowance({
41
143
  chainId: normalizedChainId,
42
144
  tokenAddress: depositAssetAddress,
43
145
  owner: recipientAddress,
@@ -56,10 +158,10 @@ var isDepositSpendApproved = async ({
56
158
  error: null
57
159
  };
58
160
  } catch (error) {
59
- if (error instanceof chunkWYBYBPX5_js.APIError) {
161
+ if (error instanceof chunkGOJQYEJQ_js.APIError) {
60
162
  throw error;
61
163
  }
62
- throw new chunkWYBYBPX5_js.APIError(
164
+ throw new chunkGOJQYEJQ_js.APIError(
63
165
  `Failed to check deposit approval: ${error instanceof Error ? error.message : String(error)}`,
64
166
  {
65
167
  endpoint: "isDepositSpendApproved",
@@ -75,8 +177,8 @@ var isWithdrawalSpendApproved = async ({
75
177
  recipientAddress
76
178
  }) => {
77
179
  try {
78
- const normalizedChainId = chunkWYBYBPX5_js.toChainId(chainId);
79
- const config = await chunkZKDXRGI5_js.resolveVault({
180
+ const normalizedChainId = chunkGOJQYEJQ_js.toChainId(chainId);
181
+ const config = await chunk6JLKHV6O_js.resolveVault({
80
182
  vaultName,
81
183
  chainId: normalizedChainId,
82
184
  assetAddress: wantAssetAddress,
@@ -84,7 +186,7 @@ var isWithdrawalSpendApproved = async ({
84
186
  });
85
187
  const boringVaultAddress = config.vault.boringVaultAddress;
86
188
  if (!boringVaultAddress) {
87
- throw new chunkWYBYBPX5_js.APIError(
189
+ throw new chunkGOJQYEJQ_js.APIError(
88
190
  `BoringVault contract address not configured for vault ${config.id}`,
89
191
  {
90
192
  endpoint: "isWithdrawalSpendApproved"
@@ -93,14 +195,14 @@ var isWithdrawalSpendApproved = async ({
93
195
  }
94
196
  const withdrawQueueAddress = config.vault.withdrawQueueAddress;
95
197
  if (!withdrawQueueAddress) {
96
- throw new chunkWYBYBPX5_js.APIError(
198
+ throw new chunkGOJQYEJQ_js.APIError(
97
199
  `WithdrawQueue contract address not configured for vault ${config.id}`,
98
200
  {
99
201
  endpoint: "isWithdrawalSpendApproved"
100
202
  }
101
203
  );
102
204
  }
103
- const [allowance, decimals] = await chunkNNDY5TID_js.getErc20AllowanceWithDecimals({
205
+ const [allowance, decimals] = await chunkFHE43NKY_js.getErc20AllowanceWithDecimals({
104
206
  chainId: normalizedChainId,
105
207
  tokenAddress: boringVaultAddress,
106
208
  recipientAddress,
@@ -123,10 +225,10 @@ var isWithdrawalSpendApproved = async ({
123
225
  error: null
124
226
  };
125
227
  } catch (error) {
126
- if (error instanceof chunkWYBYBPX5_js.APIError) {
228
+ if (error instanceof chunkGOJQYEJQ_js.APIError) {
127
229
  throw error;
128
230
  }
129
- throw new chunkWYBYBPX5_js.APIError(
231
+ throw new chunkGOJQYEJQ_js.APIError(
130
232
  `Failed to check withdrawal approval: ${error instanceof Error ? error.message : String(error)}`,
131
233
  { endpoint: "isWithdrawalSpendApproved", cause: error }
132
234
  );
@@ -138,9 +240,9 @@ async function prepareApproveDepositTokenTxData({
138
240
  approvalAmount,
139
241
  chainId
140
242
  }) {
141
- const normalizedChainId = chunkWYBYBPX5_js.toChainId(chainId);
243
+ const normalizedChainId = chunkGOJQYEJQ_js.toChainId(chainId);
142
244
  try {
143
- const config = await chunkZKDXRGI5_js.resolveVault({
245
+ const config = await chunk6JLKHV6O_js.resolveVault({
144
246
  vaultName,
145
247
  assetAddress: depositAsset,
146
248
  chainId: normalizedChainId,
@@ -148,14 +250,14 @@ async function prepareApproveDepositTokenTxData({
148
250
  });
149
251
  const communityCodeDepositorAddress = config.vault.communityCodeDepositorAddress;
150
252
  if (!communityCodeDepositorAddress) {
151
- throw new chunkWYBYBPX5_js.APIError(
253
+ throw new chunkGOJQYEJQ_js.APIError(
152
254
  `Community Code Depositor contract address not configured for vault ${config.id}`,
153
255
  { endpoint: "prepareApproveDepositToken" }
154
256
  );
155
257
  }
156
- const assets = await chunkWYBYBPX5_js.getSupportedAssets({ address: depositAsset });
258
+ const assets = await chunkGOJQYEJQ_js.getSupportedAssets({ address: depositAsset });
157
259
  if (assets.length === 0) {
158
- throw new chunkWYBYBPX5_js.APIError(
260
+ throw new chunkGOJQYEJQ_js.APIError(
159
261
  `Asset metadata not found for token ${depositAsset} on chain ${normalizedChainId}`,
160
262
  { endpoint: "prepareApproveDepositToken" }
161
263
  );
@@ -164,13 +266,13 @@ async function prepareApproveDepositTokenTxData({
164
266
  (asset) => asset.address.toLowerCase() === depositAsset.toLowerCase() && asset.chains.includes(normalizedChainId)
165
267
  );
166
268
  if (!verifiedAsset) {
167
- throw new chunkWYBYBPX5_js.APIError(
269
+ throw new chunkGOJQYEJQ_js.APIError(
168
270
  `Asset ${depositAsset} not verified on chain ${normalizedChainId}`,
169
271
  { endpoint: "prepareApproveDepositToken" }
170
272
  );
171
273
  }
172
274
  const decimals = verifiedAsset.decimals;
173
- const amount = approvalAmount ? viem.parseUnits(approvalAmount, decimals) : chunkWYBYBPX5_js.DEFAULT_APPROVAL_AMOUNT;
275
+ const amount = approvalAmount ? viem.parseUnits(approvalAmount, decimals) : chunkGOJQYEJQ_js.DEFAULT_APPROVAL_AMOUNT;
174
276
  return {
175
277
  abi: viem.erc20Abi,
176
278
  address: depositAsset,
@@ -178,10 +280,10 @@ async function prepareApproveDepositTokenTxData({
178
280
  args: [communityCodeDepositorAddress, amount]
179
281
  };
180
282
  } catch (error) {
181
- if (error instanceof chunkWYBYBPX5_js.APIError) {
283
+ if (error instanceof chunkGOJQYEJQ_js.APIError) {
182
284
  throw error;
183
285
  }
184
- throw new chunkWYBYBPX5_js.APIError(
286
+ throw new chunkGOJQYEJQ_js.APIError(
185
287
  `Failed to prepare approval transaction: ${error instanceof Error ? error.message : String(error)}`,
186
288
  {
187
289
  endpoint: "prepareApproveDepositToken",
@@ -191,235 +293,6 @@ async function prepareApproveDepositTokenTxData({
191
293
  }
192
294
  }
193
295
 
194
- // src/abi/distributor-code-depositor-abi-v0.ts
195
- var DistributorCodeDepositorAbiV0 = [
196
- {
197
- inputs: [
198
- {
199
- internalType: "contract TellerWithMultiAssetSupport",
200
- name: "_teller",
201
- type: "address"
202
- },
203
- {
204
- internalType: "contract INativeWrapper",
205
- name: "_nativeWrapper",
206
- type: "address"
207
- },
208
- {
209
- internalType: "contract Authority",
210
- name: "_rolesAuthority",
211
- type: "address"
212
- },
213
- { internalType: "bool", name: "_isNativeDepositSupported", type: "bool" },
214
- { internalType: "address", name: "_owner", type: "address" }
215
- ],
216
- stateMutability: "nonpayable",
217
- type: "constructor"
218
- },
219
- { inputs: [], name: "IncorrectNativeDepositAmount", type: "error" },
220
- { inputs: [], name: "NativeDepositNotSupported", type: "error" },
221
- {
222
- inputs: [],
223
- name: "NativeWrapperAccountantDecimalsMismatch",
224
- type: "error"
225
- },
226
- { inputs: [], name: "PermitFailedAndAllowanceTooLow", type: "error" },
227
- { inputs: [], name: "ZeroAddress", type: "error" },
228
- {
229
- anonymous: false,
230
- inputs: [
231
- { indexed: true, internalType: "address", name: "user", type: "address" },
232
- {
233
- indexed: true,
234
- internalType: "contract Authority",
235
- name: "newAuthority",
236
- type: "address"
237
- }
238
- ],
239
- name: "AuthorityUpdated",
240
- type: "event"
241
- },
242
- {
243
- anonymous: false,
244
- inputs: [
245
- {
246
- indexed: true,
247
- internalType: "address",
248
- name: "depositor",
249
- type: "address"
250
- },
251
- {
252
- indexed: true,
253
- internalType: "contract ERC20",
254
- name: "depositAsset",
255
- type: "address"
256
- },
257
- {
258
- indexed: false,
259
- internalType: "uint256",
260
- name: "depositAmount",
261
- type: "uint256"
262
- },
263
- {
264
- indexed: false,
265
- internalType: "uint256",
266
- name: "minimumMint",
267
- type: "uint256"
268
- },
269
- { indexed: false, internalType: "address", name: "to", type: "address" },
270
- {
271
- indexed: false,
272
- internalType: "bytes32",
273
- name: "depositHash",
274
- type: "bytes32"
275
- },
276
- {
277
- indexed: true,
278
- internalType: "bytes",
279
- name: "distributorCode",
280
- type: "bytes"
281
- }
282
- ],
283
- name: "DepositWithDistributorCode",
284
- type: "event"
285
- },
286
- {
287
- anonymous: false,
288
- inputs: [
289
- { indexed: true, internalType: "address", name: "user", type: "address" },
290
- {
291
- indexed: true,
292
- internalType: "address",
293
- name: "newOwner",
294
- type: "address"
295
- }
296
- ],
297
- name: "OwnershipTransferred",
298
- type: "event"
299
- },
300
- {
301
- inputs: [],
302
- name: "authority",
303
- outputs: [
304
- { internalType: "contract Authority", name: "", type: "address" }
305
- ],
306
- stateMutability: "view",
307
- type: "function"
308
- },
309
- {
310
- inputs: [],
311
- name: "boringVault",
312
- outputs: [{ internalType: "address", name: "", type: "address" }],
313
- stateMutability: "view",
314
- type: "function"
315
- },
316
- {
317
- inputs: [
318
- { internalType: "contract ERC20", name: "depositAsset", type: "address" },
319
- { internalType: "uint256", name: "depositAmount", type: "uint256" },
320
- { internalType: "uint256", name: "minimumMint", type: "uint256" },
321
- { internalType: "address", name: "to", type: "address" },
322
- { internalType: "bytes", name: "distributorCode", type: "bytes" }
323
- ],
324
- name: "deposit",
325
- outputs: [{ internalType: "uint256", name: "shares", type: "uint256" }],
326
- stateMutability: "nonpayable",
327
- type: "function"
328
- },
329
- {
330
- inputs: [
331
- { internalType: "uint256", name: "depositAmount", type: "uint256" },
332
- { internalType: "uint256", name: "minimumMint", type: "uint256" },
333
- { internalType: "address", name: "to", type: "address" },
334
- { internalType: "bytes", name: "distributorCode", type: "bytes" }
335
- ],
336
- name: "depositNative",
337
- outputs: [{ internalType: "uint256", name: "shares", type: "uint256" }],
338
- stateMutability: "payable",
339
- type: "function"
340
- },
341
- {
342
- inputs: [],
343
- name: "depositNonce",
344
- outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
345
- stateMutability: "view",
346
- type: "function"
347
- },
348
- {
349
- inputs: [
350
- { internalType: "contract ERC20", name: "depositAsset", type: "address" },
351
- { internalType: "uint256", name: "depositAmount", type: "uint256" },
352
- { internalType: "uint256", name: "minimumMint", type: "uint256" },
353
- { internalType: "address", name: "to", type: "address" },
354
- { internalType: "bytes", name: "distributorCode", type: "bytes" },
355
- { internalType: "uint256", name: "deadline", type: "uint256" },
356
- { internalType: "uint8", name: "v", type: "uint8" },
357
- { internalType: "bytes32", name: "r", type: "bytes32" },
358
- { internalType: "bytes32", name: "s", type: "bytes32" }
359
- ],
360
- name: "depositWithPermit",
361
- outputs: [{ internalType: "uint256", name: "shares", type: "uint256" }],
362
- stateMutability: "nonpayable",
363
- type: "function"
364
- },
365
- {
366
- inputs: [],
367
- name: "isNativeDepositSupported",
368
- outputs: [{ internalType: "bool", name: "", type: "bool" }],
369
- stateMutability: "view",
370
- type: "function"
371
- },
372
- {
373
- inputs: [],
374
- name: "nativeWrapper",
375
- outputs: [
376
- { internalType: "contract INativeWrapper", name: "", type: "address" }
377
- ],
378
- stateMutability: "view",
379
- type: "function"
380
- },
381
- {
382
- inputs: [],
383
- name: "owner",
384
- outputs: [{ internalType: "address", name: "", type: "address" }],
385
- stateMutability: "view",
386
- type: "function"
387
- },
388
- {
389
- inputs: [
390
- {
391
- internalType: "contract Authority",
392
- name: "newAuthority",
393
- type: "address"
394
- }
395
- ],
396
- name: "setAuthority",
397
- outputs: [],
398
- stateMutability: "nonpayable",
399
- type: "function"
400
- },
401
- {
402
- inputs: [],
403
- name: "teller",
404
- outputs: [
405
- {
406
- internalType: "contract TellerWithMultiAssetSupport",
407
- name: "",
408
- type: "address"
409
- }
410
- ],
411
- stateMutability: "view",
412
- type: "function"
413
- },
414
- {
415
- inputs: [{ internalType: "address", name: "newOwner", type: "address" }],
416
- name: "transferOwnership",
417
- outputs: [],
418
- stateMutability: "nonpayable",
419
- type: "function"
420
- }
421
- ];
422
-
423
296
  // src/abi/distributor-code-depositor-abi-v1.ts
424
297
  var DistributorCodeDepositorAbiV1 = [
425
298
  {
@@ -912,10 +785,8 @@ var DistributorCodeDepositorAbiV1 = [
912
785
  type: "function"
913
786
  }
914
787
  ];
915
-
916
- // src/vaults/deposit/utils.ts
917
788
  var calculateMinimumMint = (depositAmount, rate, vaultTokenDecimals, slippage) => {
918
- const slippageValue = slippage ?? chunkWYBYBPX5_js.DEFAULT_SLIPPAGE_BPS;
789
+ const slippageValue = slippage ?? chunkGOJQYEJQ_js.DEFAULT_SLIPPAGE_BPS;
919
790
  const slippageAsBigInt = BigInt(slippageValue) * chunkTNL23CO2_js.WAD.bigint / BigInt(1e4);
920
791
  const minimumMint = depositAmount * chunkTNL23CO2_js.WAD.bigint / rate;
921
792
  const slippageAmount = minimumMint * slippageAsBigInt / chunkTNL23CO2_js.WAD.bigint;
@@ -924,6 +795,75 @@ var calculateMinimumMint = (depositAmount, rate, vaultTokenDecimals, slippage) =
924
795
  }
925
796
  return (minimumMint - slippageAmount) / BigInt(10) ** (BigInt(18) - BigInt(vaultTokenDecimals));
926
797
  };
798
+ async function getDepositFeeForAmount(depositFeeModuleAddress, depositAsset, depositAmount, chainId) {
799
+ if (!depositFeeModuleAddress || depositFeeModuleAddress === viem.zeroAddress) {
800
+ return 0n;
801
+ }
802
+ const { feePercentage, flatFee, oneHundredPercent } = await chunkGOJQYEJQ_js.readDepositFeeStructure(
803
+ depositFeeModuleAddress,
804
+ depositAsset,
805
+ chainId
806
+ );
807
+ const variableFee = oneHundredPercent > 0n ? depositAmount * feePercentage / oneHundredPercent : 0n;
808
+ return variableFee + flatFee;
809
+ }
810
+ async function assertDepositWithinCap(vault, depositAmountRaw, depositAssetAddress, chainId, callerEndpoint) {
811
+ let supplyCapInBase = null;
812
+ let hasDepositCap = false;
813
+ if (vault.depositCap) {
814
+ supplyCapInBase = vault.depositCap.supplyCapInBase;
815
+ hasDepositCap = vault.depositCap.hasDepositCap;
816
+ } else if (vault.vault.communityCodeDepositorAddress && vault.vault.depositFeeModuleAddress) {
817
+ const onChainCap = await chunkGOJQYEJQ_js.readSupplyCapInBase(
818
+ vault.vault.communityCodeDepositorAddress,
819
+ chainId
820
+ );
821
+ supplyCapInBase = onChainCap;
822
+ hasDepositCap = onChainCap !== 0n && onChainCap !== viem.maxUint256;
823
+ }
824
+ if (!hasDepositCap || supplyCapInBase == null) return;
825
+ const client = await chunkGOJQYEJQ_js.getClient(chainId);
826
+ const [supplyResult, baseRateResult, quoteRateResult, decResult] = await client.multicall({
827
+ contracts: [
828
+ {
829
+ abi: chunkFHE43NKY_js.BoringVaultAbi,
830
+ address: vault.vault.boringVaultAddress,
831
+ functionName: "totalSupply"
832
+ },
833
+ {
834
+ abi: chunkFHE43NKY_js.AccountantAbi,
835
+ address: vault.vault.accountantAddress,
836
+ functionName: "getRate"
837
+ },
838
+ {
839
+ abi: chunkFHE43NKY_js.AccountantAbi,
840
+ address: vault.vault.accountantAddress,
841
+ functionName: "getRateInQuote",
842
+ args: [depositAssetAddress]
843
+ },
844
+ {
845
+ abi: chunkFHE43NKY_js.AccountantAbi,
846
+ address: vault.vault.accountantAddress,
847
+ functionName: "decimals"
848
+ }
849
+ ]
850
+ });
851
+ if (supplyResult.status !== "success" || baseRateResult.status !== "success" || quoteRateResult.status !== "success" || decResult.status !== "success") {
852
+ throw new chunkGOJQYEJQ_js.APIError(
853
+ "Unable to verify deposit against supply cap: on-chain read failed",
854
+ { endpoint: callerEndpoint }
855
+ );
856
+ }
857
+ const currentValueInBase = supplyResult.result * baseRateResult.result / 10n ** BigInt(decResult.result);
858
+ const depositAmountInBase = quoteRateResult.result > 0n ? depositAmountRaw * baseRateResult.result / quoteRateResult.result : depositAmountRaw;
859
+ const remaining = supplyCapInBase > currentValueInBase ? supplyCapInBase - currentValueInBase : 0n;
860
+ if (depositAmountInBase > remaining) {
861
+ throw new chunkGOJQYEJQ_js.APIError(
862
+ `Deposit would exceed vault supply cap. Remaining capacity: ${remaining}, deposit amount (in base): ${depositAmountInBase}`,
863
+ { endpoint: callerEndpoint }
864
+ );
865
+ }
866
+ }
927
867
 
928
868
  // src/vaults/deposit/deposit.ts
929
869
  var DepositType = {
@@ -942,27 +882,27 @@ async function prepareDepositTxData(params) {
942
882
  depositAsset,
943
883
  depositAmount,
944
884
  chainId,
945
- slippage = chunkWYBYBPX5_js.DEFAULT_SLIPPAGE_BPS,
885
+ slippage = chunkGOJQYEJQ_js.DEFAULT_SLIPPAGE_BPS,
946
886
  to,
947
887
  distributorCode
948
888
  } = params;
949
889
  try {
950
- const normalizedChainId = chunkWYBYBPX5_js.toChainId(chainId);
951
- const vault = await chunkZKDXRGI5_js.resolveVault({
890
+ const normalizedChainId = chunkGOJQYEJQ_js.toChainId(chainId);
891
+ const vault = await chunk6JLKHV6O_js.resolveVault({
952
892
  vaultName,
953
893
  assetAddress: depositAsset,
954
894
  chainId: normalizedChainId,
955
895
  callerEndpoint: "prepareDepositTransactionData"
956
896
  });
957
897
  if (vault.inDeprecation) {
958
- chunkWYBYBPX5_js.getLogger().warn(
898
+ chunkGOJQYEJQ_js.getLogger().warn(
959
899
  `Vault "${vault.name}" is being deprecated. Please contact the Paxos Labs team for migration guidance.`
960
900
  );
961
901
  }
962
- const assets = await chunkWYBYBPX5_js.getSupportedAssets({ address: depositAsset });
902
+ const assets = await chunkGOJQYEJQ_js.getSupportedAssets({ address: depositAsset });
963
903
  const asset = assets.find((a) => a.chains.includes(normalizedChainId)) || assets.find((a) => a.address.toLowerCase() === depositAsset.toLowerCase());
964
904
  if (!asset) {
965
- throw new chunkWYBYBPX5_js.APIError(
905
+ throw new chunkGOJQYEJQ_js.APIError(
966
906
  `Asset metadata not found for token ${depositAsset} on chain ${normalizedChainId}`,
967
907
  {
968
908
  endpoint: "prepareDepositTransactionData"
@@ -971,26 +911,26 @@ async function prepareDepositTxData(params) {
971
911
  }
972
912
  const communityCodeDepositorAddress = vault.vault.communityCodeDepositorAddress;
973
913
  if (!communityCodeDepositorAddress) {
974
- throw new chunkWYBYBPX5_js.APIError(
914
+ throw new chunkGOJQYEJQ_js.APIError(
975
915
  `Community Code Depositor contract address not found for vault ${vault.id}`,
976
916
  { endpoint: "prepareDepositTransactionData" }
977
917
  );
978
918
  }
979
919
  const accountantAddress = vault.vault.accountantAddress;
980
920
  if (!accountantAddress) {
981
- throw new chunkWYBYBPX5_js.APIError(
921
+ throw new chunkGOJQYEJQ_js.APIError(
982
922
  `Accountant contract address not found for vault ${vault.id}`,
983
923
  { endpoint: "prepareDepositTransactionData" }
984
924
  );
985
925
  }
986
926
  const depositAssetAddress = asset.address;
987
- const [depositAssetDecimalsResult, rateInQuoteResult] = await chunkNNDY5TID_js.getRateInQuoteWithAssetDecimals({
927
+ const [depositAssetDecimalsResult, rateInQuoteResult] = await chunkFHE43NKY_js.getRateInQuoteWithAssetDecimals({
988
928
  assetAddress: depositAssetAddress,
989
929
  accountantAddress,
990
930
  chainId: normalizedChainId
991
931
  });
992
932
  if (depositAssetDecimalsResult.status === "failure") {
993
- throw new chunkWYBYBPX5_js.APIError(
933
+ throw new chunkGOJQYEJQ_js.APIError(
994
934
  `Failed to get asset decimals: ${depositAssetDecimalsResult.error?.message || "Unknown error"}`,
995
935
  {
996
936
  endpoint: "prepareDepositTransactionData",
@@ -999,7 +939,7 @@ async function prepareDepositTxData(params) {
999
939
  );
1000
940
  }
1001
941
  if (rateInQuoteResult.status === "failure") {
1002
- throw new chunkWYBYBPX5_js.APIError(
942
+ throw new chunkGOJQYEJQ_js.APIError(
1003
943
  `Failed to get exchange rate: ${rateInQuoteResult.error?.message || "Unknown error"}`,
1004
944
  {
1005
945
  endpoint: "prepareDepositTransactionData",
@@ -1011,15 +951,52 @@ async function prepareDepositTxData(params) {
1011
951
  depositAmount,
1012
952
  depositAssetDecimalsResult.result
1013
953
  );
1014
- const minimumMint = calculateMinimumMint(
954
+ const totalFee = await getDepositFeeForAmount(
955
+ vault.vault.depositFeeModuleAddress,
956
+ depositAssetAddress,
1015
957
  depositAmountAsBigInt,
958
+ normalizedChainId
959
+ );
960
+ if (totalFee >= depositAmountAsBigInt) {
961
+ throw new chunkGOJQYEJQ_js.APIError(
962
+ "Deposit amount is entirely consumed by fees. Increase the deposit amount.",
963
+ { endpoint: "prepareDepositTransactionData" }
964
+ );
965
+ }
966
+ const depositAmountAfterFees = depositAmountAsBigInt - totalFee;
967
+ await assertDepositWithinCap(
968
+ vault,
969
+ depositAmountAfterFees,
970
+ depositAssetAddress,
971
+ normalizedChainId,
972
+ "prepareDepositTransactionData"
973
+ );
974
+ const minimumMint = calculateMinimumMint(
975
+ depositAmountAfterFees,
1016
976
  rateInQuoteResult.result,
1017
977
  depositAssetDecimalsResult.result,
1018
978
  slippage
1019
979
  );
1020
980
  const distributorCodeHex = viem.stringToHex(distributorCode || "");
1021
- if (vault.enterpriseConfig?.predicatePolicyId != null) {
1022
- const attestation = {
981
+ const policyId = vault.enterpriseConfig?.predicatePolicyId;
982
+ if (policyId === void 0) {
983
+ return {
984
+ depositType: DepositType.STANDARD,
985
+ abi: chunkGOJQYEJQ_js.DistributorCodeDepositorAbiV0,
986
+ address: communityCodeDepositorAddress,
987
+ functionName: "deposit",
988
+ args: [
989
+ depositAssetAddress,
990
+ depositAmountAsBigInt,
991
+ minimumMint,
992
+ to,
993
+ distributorCodeHex
994
+ ],
995
+ chainId: normalizedChainId
996
+ };
997
+ }
998
+ if (policyId === null) {
999
+ const emptyAttestation = {
1023
1000
  uuid: "",
1024
1001
  expiration: 0n,
1025
1002
  attester: viem.zeroAddress,
@@ -1036,30 +1013,36 @@ async function prepareDepositTxData(params) {
1036
1013
  minimumMint,
1037
1014
  to,
1038
1015
  distributorCodeHex,
1039
- attestation
1016
+ emptyAttestation
1040
1017
  ],
1041
1018
  chainId: normalizedChainId
1042
1019
  };
1043
1020
  }
1021
+ const attestation = await fetchKytAttestation({
1022
+ to: communityCodeDepositorAddress,
1023
+ from: to,
1024
+ chainId: normalizedChainId
1025
+ });
1044
1026
  return {
1045
- depositType: DepositType.STANDARD,
1046
- abi: DistributorCodeDepositorAbiV0,
1027
+ depositType: DepositType.KYT,
1047
1028
  address: communityCodeDepositorAddress,
1029
+ abi: DistributorCodeDepositorAbiV1,
1048
1030
  functionName: "deposit",
1049
1031
  args: [
1050
1032
  depositAssetAddress,
1051
1033
  depositAmountAsBigInt,
1052
1034
  minimumMint,
1053
1035
  to,
1054
- distributorCodeHex
1036
+ distributorCodeHex,
1037
+ attestation
1055
1038
  ],
1056
1039
  chainId: normalizedChainId
1057
1040
  };
1058
1041
  } catch (error) {
1059
- if (error instanceof chunkWYBYBPX5_js.APIError) {
1042
+ if (error instanceof chunkGOJQYEJQ_js.APIError) {
1060
1043
  throw error;
1061
1044
  }
1062
- throw new chunkWYBYBPX5_js.APIError(
1045
+ throw new chunkGOJQYEJQ_js.APIError(
1063
1046
  `Failed to prepare deposit transaction: ${error instanceof Error ? error.message : String(error)}`,
1064
1047
  {
1065
1048
  endpoint: "prepareDepositTransactionData",
@@ -1115,8 +1098,8 @@ async function prepareDepositPermitSignature(params) {
1115
1098
  tokenVersion: prefetchedTokenVersion
1116
1099
  } = params;
1117
1100
  try {
1118
- const normalizedChainId = chunkWYBYBPX5_js.toChainId(chainId);
1119
- const vault = await chunkZKDXRGI5_js.resolveVault({
1101
+ const normalizedChainId = chunkGOJQYEJQ_js.toChainId(chainId);
1102
+ const vault = await chunk6JLKHV6O_js.resolveVault({
1120
1103
  vaultName,
1121
1104
  assetAddress: depositAsset,
1122
1105
  chainId: normalizedChainId,
@@ -1124,7 +1107,7 @@ async function prepareDepositPermitSignature(params) {
1124
1107
  });
1125
1108
  const communityCodeDepositorAddress = vault.vault.communityCodeDepositorAddress;
1126
1109
  if (!communityCodeDepositorAddress) {
1127
- throw new chunkWYBYBPX5_js.APIError(
1110
+ throw new chunkGOJQYEJQ_js.APIError(
1128
1111
  `CommunityCodeDepositor contract address not found for vault ${vault.id}`,
1129
1112
  { endpoint: "prepareDepositPermitSignature" }
1130
1113
  );
@@ -1138,24 +1121,24 @@ async function prepareDepositPermitSignature(params) {
1138
1121
  resolvedTokenVersion = prefetchedTokenVersion;
1139
1122
  resolvedNonce = prefetchedNonce;
1140
1123
  } else {
1141
- const client = await chunkWYBYBPX5_js.getClient(normalizedChainId);
1124
+ const client = await chunkGOJQYEJQ_js.getClient(normalizedChainId);
1142
1125
  try {
1143
1126
  const [nameResult, versionResult, nonceResult] = await client.multicall(
1144
1127
  {
1145
1128
  contracts: [
1146
1129
  {
1147
1130
  address: depositAsset,
1148
- abi: chunkNNDY5TID_js.erc2612Abi,
1131
+ abi: chunkFHE43NKY_js.erc2612Abi,
1149
1132
  functionName: "name"
1150
1133
  },
1151
1134
  {
1152
1135
  address: depositAsset,
1153
- abi: chunkNNDY5TID_js.erc2612Abi,
1136
+ abi: chunkFHE43NKY_js.erc2612Abi,
1154
1137
  functionName: "version"
1155
1138
  },
1156
1139
  {
1157
1140
  address: depositAsset,
1158
- abi: chunkNNDY5TID_js.erc2612Abi,
1141
+ abi: chunkFHE43NKY_js.erc2612Abi,
1159
1142
  functionName: "nonces",
1160
1143
  args: [to]
1161
1144
  }
@@ -1167,7 +1150,7 @@ async function prepareDepositPermitSignature(params) {
1167
1150
  } else if (nameResult.status === "success") {
1168
1151
  resolvedTokenName = nameResult.result;
1169
1152
  } else {
1170
- throw new chunkWYBYBPX5_js.APIError(`Failed to read token name from ${depositAsset}`, {
1153
+ throw new chunkGOJQYEJQ_js.APIError(`Failed to read token name from ${depositAsset}`, {
1171
1154
  endpoint: "prepareDepositPermitSignature",
1172
1155
  cause: nameResult.error
1173
1156
  });
@@ -1184,7 +1167,7 @@ async function prepareDepositPermitSignature(params) {
1184
1167
  } else if (nonceResult.status === "success") {
1185
1168
  resolvedNonce = nonceResult.result;
1186
1169
  } else {
1187
- throw new chunkWYBYBPX5_js.APIError(
1170
+ throw new chunkGOJQYEJQ_js.APIError(
1188
1171
  `Token ${depositAsset} does not support EIP-2612 permit. Missing required function: nonces()`,
1189
1172
  {
1190
1173
  endpoint: "prepareDepositPermitSignature",
@@ -1193,10 +1176,10 @@ async function prepareDepositPermitSignature(params) {
1193
1176
  );
1194
1177
  }
1195
1178
  } catch (error) {
1196
- if (error instanceof chunkWYBYBPX5_js.APIError) {
1179
+ if (error instanceof chunkGOJQYEJQ_js.APIError) {
1197
1180
  throw error;
1198
1181
  }
1199
- throw new chunkWYBYBPX5_js.APIError(
1182
+ throw new chunkGOJQYEJQ_js.APIError(
1200
1183
  `Failed to read token metadata: ${error instanceof Error ? error.message : "Unknown error"}`,
1201
1184
  {
1202
1185
  endpoint: "prepareDepositPermitSignature",
@@ -1210,7 +1193,7 @@ async function prepareDepositPermitSignature(params) {
1210
1193
  if (prefetchedDecimals !== void 0) {
1211
1194
  resolvedDecimals = prefetchedDecimals;
1212
1195
  } else {
1213
- resolvedDecimals = await chunkNNDY5TID_js.getErc20Decimals({
1196
+ resolvedDecimals = await chunkFHE43NKY_js.getErc20Decimals({
1214
1197
  tokenAddress: depositAsset,
1215
1198
  chainId: normalizedChainId
1216
1199
  });
@@ -1237,10 +1220,10 @@ async function prepareDepositPermitSignature(params) {
1237
1220
  message
1238
1221
  };
1239
1222
  } catch (error) {
1240
- if (error instanceof chunkWYBYBPX5_js.APIError) {
1223
+ if (error instanceof chunkGOJQYEJQ_js.APIError) {
1241
1224
  throw error;
1242
1225
  }
1243
- throw new chunkWYBYBPX5_js.APIError(
1226
+ throw new chunkGOJQYEJQ_js.APIError(
1244
1227
  `Failed to prepare permit signature: ${error instanceof Error ? error.message : String(error)}`,
1245
1228
  {
1246
1229
  endpoint: "prepareDepositPermitSignature",
@@ -1266,7 +1249,7 @@ function parsePermitSignature(signature) {
1266
1249
  s: parsed.s
1267
1250
  };
1268
1251
  } catch (error) {
1269
- throw new chunkWYBYBPX5_js.APIError(
1252
+ throw new chunkGOJQYEJQ_js.APIError(
1270
1253
  `Invalid permit signature format. Expected hex string but received: ${signature}. ${error instanceof Error ? error.message : "Unknown error"}`,
1271
1254
  {
1272
1255
  endpoint: "parsePermitSignature",
@@ -1283,39 +1266,39 @@ async function prepareDepositWithPermitTxData(params) {
1283
1266
  chainId,
1284
1267
  signature,
1285
1268
  deadline,
1286
- slippage = chunkWYBYBPX5_js.DEFAULT_SLIPPAGE_BPS,
1269
+ slippage = chunkGOJQYEJQ_js.DEFAULT_SLIPPAGE_BPS,
1287
1270
  to,
1288
1271
  distributorCode
1289
1272
  } = params;
1290
1273
  try {
1291
1274
  const { v, r, s } = parsePermitSignature(signature);
1292
1275
  if (slippage < 0 || slippage > 1e4) {
1293
- throw new chunkWYBYBPX5_js.APIError(
1276
+ throw new chunkGOJQYEJQ_js.APIError(
1294
1277
  `Invalid slippage value: ${slippage}. Slippage must be between 0 and 10000 basis points.`,
1295
1278
  {
1296
1279
  endpoint: "prepareDepositWithPermitTxData"
1297
1280
  }
1298
1281
  );
1299
1282
  }
1300
- const normalizedChainId = chunkWYBYBPX5_js.toChainId(chainId);
1301
- const vault = await chunkZKDXRGI5_js.resolveVault({
1283
+ const normalizedChainId = chunkGOJQYEJQ_js.toChainId(chainId);
1284
+ const vault = await chunk6JLKHV6O_js.resolveVault({
1302
1285
  vaultName,
1303
1286
  assetAddress: depositAsset,
1304
1287
  chainId: normalizedChainId,
1305
1288
  callerEndpoint: "prepareDepositWithPermitTxData"
1306
1289
  });
1307
1290
  if (vault.inDeprecation) {
1308
- chunkWYBYBPX5_js.getLogger().warn(
1291
+ chunkGOJQYEJQ_js.getLogger().warn(
1309
1292
  `Vault "${vault.name}" is being deprecated. Please contact the Paxos Labs team for migration guidance.`
1310
1293
  );
1311
1294
  }
1312
1295
  let asset = null;
1313
- const assets = await chunkWYBYBPX5_js.getSupportedAssets({ address: depositAsset });
1296
+ const assets = await chunkGOJQYEJQ_js.getSupportedAssets({ address: depositAsset });
1314
1297
  if (assets.length > 0) {
1315
1298
  asset = assets.find((a) => a.chains.includes(normalizedChainId)) || assets[0] || null;
1316
1299
  }
1317
1300
  if (!asset) {
1318
- throw new chunkWYBYBPX5_js.APIError(
1301
+ throw new chunkGOJQYEJQ_js.APIError(
1319
1302
  `Asset metadata not found for token ${depositAsset} on chain ${normalizedChainId}`,
1320
1303
  {
1321
1304
  endpoint: "prepareDepositWithPermitTxData"
@@ -1323,7 +1306,7 @@ async function prepareDepositWithPermitTxData(params) {
1323
1306
  );
1324
1307
  }
1325
1308
  if (!asset.chains || !asset.chains.includes(normalizedChainId)) {
1326
- throw new chunkWYBYBPX5_js.APIError(
1309
+ throw new chunkGOJQYEJQ_js.APIError(
1327
1310
  `Token ${asset.symbol || depositAsset} not supported on chain ${normalizedChainId}`,
1328
1311
  {
1329
1312
  endpoint: "prepareDepositWithPermitTxData"
@@ -1334,25 +1317,25 @@ async function prepareDepositWithPermitTxData(params) {
1334
1317
  const accountantAddress = vault.vault.accountantAddress;
1335
1318
  const depositAssetAddress = depositAsset;
1336
1319
  if (!communityCodeDepositorAddress) {
1337
- throw new chunkWYBYBPX5_js.APIError(
1320
+ throw new chunkGOJQYEJQ_js.APIError(
1338
1321
  `CommunityCodeDepositor contract address not found for vault ${vault.id}`,
1339
1322
  { endpoint: "prepareDepositWithPermitTxData" }
1340
1323
  );
1341
1324
  }
1342
1325
  if (!accountantAddress) {
1343
- throw new chunkWYBYBPX5_js.APIError(
1326
+ throw new chunkGOJQYEJQ_js.APIError(
1344
1327
  `Accountant contract address not found for vault ${vault.id}`,
1345
1328
  { endpoint: "prepareDepositWithPermitTxData" }
1346
1329
  );
1347
1330
  }
1348
- const rateAndDecimalResults = await chunkNNDY5TID_js.getRateInQuoteWithAssetDecimals({
1331
+ const rateAndDecimalResults = await chunkFHE43NKY_js.getRateInQuoteWithAssetDecimals({
1349
1332
  assetAddress: depositAssetAddress,
1350
1333
  accountantAddress,
1351
1334
  chainId: normalizedChainId
1352
1335
  });
1353
1336
  const [depositAssetDecimalsResult, rateInQuoteResult] = rateAndDecimalResults;
1354
1337
  if (depositAssetDecimalsResult.status === "failure") {
1355
- throw new chunkWYBYBPX5_js.APIError(
1338
+ throw new chunkGOJQYEJQ_js.APIError(
1356
1339
  `Failed to get asset decimals: ${depositAssetDecimalsResult.error?.message || "Unknown error"}`,
1357
1340
  {
1358
1341
  endpoint: "prepareDepositWithPermitTxData",
@@ -1361,7 +1344,7 @@ async function prepareDepositWithPermitTxData(params) {
1361
1344
  );
1362
1345
  }
1363
1346
  if (rateInQuoteResult.status === "failure") {
1364
- throw new chunkWYBYBPX5_js.APIError(
1347
+ throw new chunkGOJQYEJQ_js.APIError(
1365
1348
  `Failed to get exchange rate: ${rateInQuoteResult.error?.message || "Unknown error"}`,
1366
1349
  {
1367
1350
  endpoint: "prepareDepositWithPermitTxData",
@@ -1371,15 +1354,56 @@ async function prepareDepositWithPermitTxData(params) {
1371
1354
  }
1372
1355
  const onChainDecimals = depositAssetDecimalsResult.result;
1373
1356
  const depositAmountAsBigInt = viem.parseUnits(depositAmount, onChainDecimals);
1374
- const minimumMint = calculateMinimumMint(
1357
+ const totalFee = await getDepositFeeForAmount(
1358
+ vault.vault.depositFeeModuleAddress,
1359
+ depositAssetAddress,
1375
1360
  depositAmountAsBigInt,
1361
+ normalizedChainId
1362
+ );
1363
+ if (totalFee >= depositAmountAsBigInt) {
1364
+ throw new chunkGOJQYEJQ_js.APIError(
1365
+ "Deposit amount is entirely consumed by fees. Increase the deposit amount.",
1366
+ { endpoint: "prepareDepositWithPermitTxData" }
1367
+ );
1368
+ }
1369
+ const depositAmountAfterFees = depositAmountAsBigInt - totalFee;
1370
+ await assertDepositWithinCap(
1371
+ vault,
1372
+ depositAmountAfterFees,
1373
+ depositAssetAddress,
1374
+ normalizedChainId,
1375
+ "prepareDepositWithPermitTxData"
1376
+ );
1377
+ const minimumMint = calculateMinimumMint(
1378
+ depositAmountAfterFees,
1376
1379
  rateInQuoteResult.result,
1377
1380
  onChainDecimals,
1378
1381
  slippage
1379
1382
  );
1380
1383
  const distributorCodeHex = viem.stringToHex(distributorCode || "");
1381
- if (vault.enterpriseConfig?.predicatePolicyId != null) {
1382
- const attestation = {
1384
+ const policyId = vault.enterpriseConfig?.predicatePolicyId;
1385
+ if (policyId === void 0) {
1386
+ return {
1387
+ depositType: DepositType.STANDARD,
1388
+ abi: chunkGOJQYEJQ_js.DistributorCodeDepositorAbiV0,
1389
+ address: communityCodeDepositorAddress,
1390
+ functionName: "depositWithPermit",
1391
+ args: [
1392
+ depositAssetAddress,
1393
+ depositAmountAsBigInt,
1394
+ minimumMint,
1395
+ to,
1396
+ distributorCodeHex,
1397
+ deadline,
1398
+ v,
1399
+ r,
1400
+ s
1401
+ ],
1402
+ chainId: normalizedChainId
1403
+ };
1404
+ }
1405
+ if (policyId === null) {
1406
+ const emptyAttestation = {
1383
1407
  uuid: "",
1384
1408
  expiration: 0n,
1385
1409
  attester: viem.zeroAddress,
@@ -1396,7 +1420,7 @@ async function prepareDepositWithPermitTxData(params) {
1396
1420
  minimumMint,
1397
1421
  to,
1398
1422
  distributorCodeHex,
1399
- attestation,
1423
+ emptyAttestation,
1400
1424
  deadline,
1401
1425
  v,
1402
1426
  r,
@@ -1405,9 +1429,14 @@ async function prepareDepositWithPermitTxData(params) {
1405
1429
  chainId: normalizedChainId
1406
1430
  };
1407
1431
  }
1432
+ const attestation = await fetchKytAttestation({
1433
+ to: communityCodeDepositorAddress,
1434
+ from: to,
1435
+ chainId: normalizedChainId
1436
+ });
1408
1437
  return {
1409
- depositType: DepositType.STANDARD,
1410
- abi: DistributorCodeDepositorAbiV0,
1438
+ depositType: DepositType.KYT,
1439
+ abi: DistributorCodeDepositorAbiV1,
1411
1440
  address: communityCodeDepositorAddress,
1412
1441
  functionName: "depositWithPermit",
1413
1442
  args: [
@@ -1416,6 +1445,7 @@ async function prepareDepositWithPermitTxData(params) {
1416
1445
  minimumMint,
1417
1446
  to,
1418
1447
  distributorCodeHex,
1448
+ attestation,
1419
1449
  deadline,
1420
1450
  v,
1421
1451
  r,
@@ -1424,10 +1454,10 @@ async function prepareDepositWithPermitTxData(params) {
1424
1454
  chainId: normalizedChainId
1425
1455
  };
1426
1456
  } catch (error) {
1427
- if (error instanceof chunkWYBYBPX5_js.APIError) {
1457
+ if (error instanceof chunkGOJQYEJQ_js.APIError) {
1428
1458
  throw error;
1429
1459
  }
1430
- throw new chunkWYBYBPX5_js.APIError(
1460
+ throw new chunkGOJQYEJQ_js.APIError(
1431
1461
  `Failed to prepare deposit with permit transaction: ${error instanceof Error ? error.message : String(error)}`,
1432
1462
  {
1433
1463
  endpoint: "prepareDepositWithPermitTxData",
@@ -1439,7 +1469,7 @@ async function prepareDepositWithPermitTxData(params) {
1439
1469
 
1440
1470
  // src/utils/wallet.ts
1441
1471
  async function isSmartContractWallet(address, chainId) {
1442
- const client = await chunkWYBYBPX5_js.getClient(chainId);
1472
+ const client = await chunkGOJQYEJQ_js.getClient(chainId);
1443
1473
  const code = await client.getCode({ address });
1444
1474
  return !!code && code !== "0x";
1445
1475
  }
@@ -1470,8 +1500,8 @@ async function prepareDepositAuthorization(params) {
1470
1500
  forceMethod
1471
1501
  } = params;
1472
1502
  try {
1473
- const normalizedChainId = chunkWYBYBPX5_js.toChainId(chainId);
1474
- const vault = await chunkZKDXRGI5_js.resolveVault({
1503
+ const normalizedChainId = chunkGOJQYEJQ_js.toChainId(chainId);
1504
+ const vault = await chunk6JLKHV6O_js.resolveVault({
1475
1505
  vaultName,
1476
1506
  assetAddress: depositAsset,
1477
1507
  chainId: normalizedChainId,
@@ -1570,10 +1600,10 @@ async function prepareDepositAuthorization(params) {
1570
1600
  txData
1571
1601
  };
1572
1602
  } catch (error) {
1573
- if (error instanceof chunkWYBYBPX5_js.APIError) {
1603
+ if (error instanceof chunkGOJQYEJQ_js.APIError) {
1574
1604
  throw error;
1575
1605
  }
1576
- throw new chunkWYBYBPX5_js.APIError(
1606
+ throw new chunkGOJQYEJQ_js.APIError(
1577
1607
  `Failed to prepare deposit authorization: ${error instanceof Error ? error.message : String(error)}`,
1578
1608
  {
1579
1609
  endpoint: "prepareDepositAuthorization",
@@ -1597,7 +1627,7 @@ async function prepareDeposit(params) {
1597
1627
  } = params;
1598
1628
  try {
1599
1629
  if (forceMethod === "permit" && (!signature || deadline === void 0)) {
1600
- throw new chunkWYBYBPX5_js.APIError(
1630
+ throw new chunkGOJQYEJQ_js.APIError(
1601
1631
  "Permit deposit requires both signature and deadline parameters when forceMethod is 'permit'",
1602
1632
  { endpoint: "prepareDeposit" }
1603
1633
  );
@@ -1605,7 +1635,7 @@ async function prepareDeposit(params) {
1605
1635
  const usePermit = forceMethod === "permit" || forceMethod !== "approval" && signature !== void 0 && deadline !== void 0;
1606
1636
  if (usePermit) {
1607
1637
  if (!signature || deadline === void 0) {
1608
- throw new chunkWYBYBPX5_js.APIError(
1638
+ throw new chunkGOJQYEJQ_js.APIError(
1609
1639
  "Permit deposit requires both signature and deadline parameters",
1610
1640
  { endpoint: "prepareDeposit" }
1611
1641
  );
@@ -1640,10 +1670,10 @@ async function prepareDeposit(params) {
1640
1670
  txData
1641
1671
  };
1642
1672
  } catch (error) {
1643
- if (error instanceof chunkWYBYBPX5_js.APIError) {
1673
+ if (error instanceof chunkGOJQYEJQ_js.APIError) {
1644
1674
  throw error;
1645
1675
  }
1646
- throw new chunkWYBYBPX5_js.APIError(
1676
+ throw new chunkGOJQYEJQ_js.APIError(
1647
1677
  `Failed to prepare deposit: ${error instanceof Error ? error.message : String(error)}`,
1648
1678
  {
1649
1679
  endpoint: "prepareDeposit",
@@ -1660,43 +1690,43 @@ async function prepareApproveWithdrawOrderTxData({
1660
1690
  shareDecimals
1661
1691
  }) {
1662
1692
  try {
1663
- const normalizedChainId = chunkWYBYBPX5_js.toChainId(chainId);
1664
- const config = await chunkZKDXRGI5_js.resolveVault({
1693
+ const normalizedChainId = chunkGOJQYEJQ_js.toChainId(chainId);
1694
+ const config = await chunk6JLKHV6O_js.resolveVault({
1665
1695
  vaultName,
1666
1696
  assetAddress: wantAssetAddress,
1667
1697
  chainId: normalizedChainId,
1668
1698
  callerEndpoint: "prepareApproveWithdrawOrderTxData"
1669
1699
  });
1670
1700
  if (!config.vault.boringVaultAddress) {
1671
- throw new chunkWYBYBPX5_js.APIError(
1701
+ throw new chunkGOJQYEJQ_js.APIError(
1672
1702
  `BoringVault contract address not configured for vault ${config.id}`,
1673
1703
  { endpoint: "prepareApproveWithdrawOrderTxData" }
1674
1704
  );
1675
1705
  }
1676
1706
  if (!config.vault.withdrawQueueAddress) {
1677
- throw new chunkWYBYBPX5_js.APIError(
1707
+ throw new chunkGOJQYEJQ_js.APIError(
1678
1708
  `WithdrawQueue contract address not configured for vault ${config.id}`,
1679
1709
  { endpoint: "prepareApproveWithdrawOrderTxData" }
1680
1710
  );
1681
1711
  }
1682
1712
  const boringVaultAddress = config.vault.boringVaultAddress;
1683
1713
  const withdrawQueueAddress = config.vault.withdrawQueueAddress;
1684
- const decimals = shareDecimals ?? await chunkNNDY5TID_js.getErc20Decimals({
1714
+ const decimals = shareDecimals ?? await chunkFHE43NKY_js.getErc20Decimals({
1685
1715
  tokenAddress: boringVaultAddress,
1686
1716
  chainId: normalizedChainId
1687
1717
  });
1688
- const withdrawAmountAsBigInt = withdrawAmount ? viem.parseUnits(withdrawAmount, decimals) : chunkWYBYBPX5_js.DEFAULT_APPROVAL_AMOUNT;
1718
+ const withdrawAmountAsBigInt = withdrawAmount ? viem.parseUnits(withdrawAmount, decimals) : chunkGOJQYEJQ_js.DEFAULT_APPROVAL_AMOUNT;
1689
1719
  return {
1690
- abi: chunkNNDY5TID_js.BoringVaultAbi,
1720
+ abi: chunkFHE43NKY_js.BoringVaultAbi,
1691
1721
  address: boringVaultAddress,
1692
1722
  functionName: "approve",
1693
1723
  args: [withdrawQueueAddress, withdrawAmountAsBigInt]
1694
1724
  };
1695
1725
  } catch (error) {
1696
- if (error instanceof chunkWYBYBPX5_js.APIError) {
1726
+ if (error instanceof chunkGOJQYEJQ_js.APIError) {
1697
1727
  throw error;
1698
1728
  }
1699
- throw new chunkWYBYBPX5_js.APIError(
1729
+ throw new chunkGOJQYEJQ_js.APIError(
1700
1730
  `Failed to prepare approval transaction: ${error instanceof Error ? error.message : String(error)}`,
1701
1731
  {
1702
1732
  endpoint: "prepareApproveWithdrawOrderTxData",
@@ -1714,37 +1744,37 @@ var prepareCancelWithdrawOrderTxData = async ({
1714
1744
  orderIndex
1715
1745
  }) => {
1716
1746
  try {
1717
- const normalizedChainId = chunkWYBYBPX5_js.toChainId(chainId);
1718
- const config = await chunkZKDXRGI5_js.resolveVault({
1747
+ const normalizedChainId = chunkGOJQYEJQ_js.toChainId(chainId);
1748
+ const config = await chunk6JLKHV6O_js.resolveVault({
1719
1749
  vaultName,
1720
1750
  assetAddress: wantAsset,
1721
1751
  chainId: normalizedChainId,
1722
1752
  callerEndpoint: "prepareCancelWithdrawOrderTxData"
1723
1753
  });
1724
1754
  if (config.chainId !== normalizedChainId) {
1725
- throw new chunkWYBYBPX5_js.APIError(
1755
+ throw new chunkGOJQYEJQ_js.APIError(
1726
1756
  `Vault chain mismatch: vault is on chain ${config.chainId}, requested chain ${normalizedChainId}`,
1727
1757
  { endpoint: "prepareCancelWithdrawOrderTxData" }
1728
1758
  );
1729
1759
  }
1730
1760
  if (!config.vault.withdrawQueueAddress) {
1731
- throw new chunkWYBYBPX5_js.APIError(
1761
+ throw new chunkGOJQYEJQ_js.APIError(
1732
1762
  `WithdrawQueue contract address not configured for vault ${config.id}`,
1733
1763
  { endpoint: "prepareCancelWithdrawOrderTxData" }
1734
1764
  );
1735
1765
  }
1736
1766
  return {
1737
- abi: chunkZKDXRGI5_js.WithdrawQueueAbi,
1767
+ abi: chunkGOJQYEJQ_js.WithdrawQueueAbi,
1738
1768
  address: config.vault.withdrawQueueAddress,
1739
1769
  functionName: "cancelOrder",
1740
1770
  args: [orderIndex],
1741
1771
  chainId: normalizedChainId
1742
1772
  };
1743
1773
  } catch (error) {
1744
- if (error instanceof chunkWYBYBPX5_js.APIError) {
1774
+ if (error instanceof chunkGOJQYEJQ_js.APIError) {
1745
1775
  throw error;
1746
1776
  }
1747
- throw new chunkWYBYBPX5_js.APIError(
1777
+ throw new chunkGOJQYEJQ_js.APIError(
1748
1778
  `Failed to prepare cancel order transaction: ${error instanceof Error ? error.message : String(error)}`,
1749
1779
  {
1750
1780
  endpoint: "prepareCancelWithdrawOrderTxData",
@@ -1773,38 +1803,38 @@ var prepareWithdrawOrderTxData = async ({
1773
1803
  amountOffer
1774
1804
  }) => {
1775
1805
  try {
1776
- const normalizedChainId = chunkWYBYBPX5_js.toChainId(chainId);
1777
- const config = await chunkZKDXRGI5_js.resolveVault({
1806
+ const normalizedChainId = chunkGOJQYEJQ_js.toChainId(chainId);
1807
+ const config = await chunk6JLKHV6O_js.resolveVault({
1778
1808
  vaultName,
1779
1809
  assetAddress: wantAsset,
1780
1810
  chainId: normalizedChainId,
1781
1811
  callerEndpoint: "prepareWithdrawOrderTxData"
1782
1812
  });
1783
1813
  if (config.chainId !== normalizedChainId) {
1784
- throw new chunkWYBYBPX5_js.APIError(
1814
+ throw new chunkGOJQYEJQ_js.APIError(
1785
1815
  `Vault chain mismatch: vault is on chain ${config.chainId}, requested chain ${normalizedChainId}`,
1786
1816
  { endpoint: "prepareWithdrawOrderTxData" }
1787
1817
  );
1788
1818
  }
1789
1819
  if (!config.vault.withdrawQueueAddress) {
1790
- throw new chunkWYBYBPX5_js.APIError(
1820
+ throw new chunkGOJQYEJQ_js.APIError(
1791
1821
  `WithdrawQueue contract address not configured for vault ${config.id}`,
1792
1822
  { endpoint: "prepareWithdrawOrderTxData" }
1793
1823
  );
1794
1824
  }
1795
1825
  if (!config.vault.boringVaultAddress) {
1796
- throw new chunkWYBYBPX5_js.APIError(
1826
+ throw new chunkGOJQYEJQ_js.APIError(
1797
1827
  `BoringVault contract address not configured for vault ${config.id}`,
1798
1828
  { endpoint: "prepareWithdrawOrderTxData" }
1799
1829
  );
1800
1830
  }
1801
- const sharesDecimals = await chunkNNDY5TID_js.getErc20Decimals({
1831
+ const sharesDecimals = await chunkFHE43NKY_js.getErc20Decimals({
1802
1832
  tokenAddress: config.vault.boringVaultAddress,
1803
1833
  chainId: normalizedChainId
1804
1834
  });
1805
1835
  const formattedAmountOffer = viem.parseUnits(amountOffer, sharesDecimals);
1806
1836
  return {
1807
- abi: chunkZKDXRGI5_js.WithdrawQueueAbi,
1837
+ abi: chunkGOJQYEJQ_js.WithdrawQueueAbi,
1808
1838
  address: config.vault.withdrawQueueAddress,
1809
1839
  functionName: "submitOrder",
1810
1840
  args: [
@@ -1820,10 +1850,10 @@ var prepareWithdrawOrderTxData = async ({
1820
1850
  chainId: normalizedChainId
1821
1851
  };
1822
1852
  } catch (error) {
1823
- if (error instanceof chunkWYBYBPX5_js.APIError) {
1853
+ if (error instanceof chunkGOJQYEJQ_js.APIError) {
1824
1854
  throw error;
1825
1855
  }
1826
- throw new chunkWYBYBPX5_js.APIError(
1856
+ throw new chunkGOJQYEJQ_js.APIError(
1827
1857
  `Failed to prepare withdraw order transaction: ${error instanceof Error ? error.message : String(error)}`,
1828
1858
  {
1829
1859
  endpoint: "prepareWithdrawOrderTxData",
@@ -1832,6 +1862,79 @@ var prepareWithdrawOrderTxData = async ({
1832
1862
  );
1833
1863
  }
1834
1864
  };
1865
+ var prepareAtomicWithdrawOrderTxData = async ({
1866
+ vaultName,
1867
+ wantAsset,
1868
+ userAddress,
1869
+ chainId,
1870
+ amountOffer
1871
+ }) => {
1872
+ try {
1873
+ const normalizedChainId = chunkGOJQYEJQ_js.toChainId(chainId);
1874
+ const config = await chunk6JLKHV6O_js.resolveVault({
1875
+ vaultName,
1876
+ assetAddress: wantAsset,
1877
+ chainId: normalizedChainId,
1878
+ callerEndpoint: "prepareAtomicWithdrawOrderTxData"
1879
+ });
1880
+ if (config.chainId !== normalizedChainId) {
1881
+ throw new chunk6JLKHV6O_js.InvalidChainIdError(
1882
+ `Vault chain mismatch: vault is on chain ${config.chainId}, requested chain ${normalizedChainId}`,
1883
+ {
1884
+ vaultId: config.id,
1885
+ vaultChainId: config.chainId,
1886
+ requestedChainId: normalizedChainId
1887
+ }
1888
+ );
1889
+ }
1890
+ if (!config.vault.withdrawQueueAddress) {
1891
+ throw new chunk6JLKHV6O_js.TransactionDataError(
1892
+ `WithdrawQueue contract address not configured for vault ${config.id}`,
1893
+ { vaultId: config.id, field: "withdrawQueueAddress" }
1894
+ );
1895
+ }
1896
+ if (!config.vault.boringVaultAddress) {
1897
+ throw new chunk6JLKHV6O_js.TransactionDataError(
1898
+ `BoringVault contract address not configured for vault ${config.id}`,
1899
+ { vaultId: config.id, field: "boringVaultAddress" }
1900
+ );
1901
+ }
1902
+ const sharesDecimals = await chunkFHE43NKY_js.getErc20Decimals({
1903
+ tokenAddress: config.vault.boringVaultAddress,
1904
+ chainId: normalizedChainId
1905
+ });
1906
+ const formattedAmountOffer = viem.parseUnits(amountOffer, sharesDecimals);
1907
+ return {
1908
+ abi: chunkGOJQYEJQ_js.WithdrawQueueAbi,
1909
+ address: config.vault.withdrawQueueAddress,
1910
+ functionName: "submitOrderAndProcessAll",
1911
+ args: [
1912
+ {
1913
+ amountOffer: formattedAmountOffer,
1914
+ wantAsset,
1915
+ intendedDepositor: userAddress,
1916
+ receiver: userAddress,
1917
+ refundReceiver: userAddress,
1918
+ signatureParams: EMPTY_SIGNATURE_PARAMS
1919
+ }
1920
+ ],
1921
+ chainId: normalizedChainId
1922
+ };
1923
+ } catch (error) {
1924
+ if (error instanceof chunk6JLKHV6O_js.WithdrawError) {
1925
+ throw error;
1926
+ }
1927
+ throw new chunk6JLKHV6O_js.TransactionDataError(
1928
+ `Failed to prepare atomic withdraw order transaction: ${error instanceof Error ? error.message : String(error)}`,
1929
+ {
1930
+ endpoint: "prepareAtomicWithdrawOrderTxData",
1931
+ cause: error
1932
+ }
1933
+ );
1934
+ }
1935
+ };
1936
+
1937
+ // src/vaults/withdraw/index.ts
1835
1938
  var WithdrawAuthMethod = {
1836
1939
  APPROVAL: "approval",
1837
1940
  ALREADY_APPROVED: "already_approved"
@@ -1845,18 +1948,26 @@ function isWithdrawAlreadyApprovedAuth(result) {
1845
1948
  async function prepareWithdrawal(params) {
1846
1949
  const { vaultName, wantAsset, withdrawAmount, userAddress, chainId } = params;
1847
1950
  try {
1848
- return await prepareWithdrawOrderTxData({
1951
+ const normalizedChainId = chunkGOJQYEJQ_js.toChainId(chainId);
1952
+ const vault = await chunk6JLKHV6O_js.resolveVault({
1953
+ vaultName,
1954
+ assetAddress: wantAsset,
1955
+ chainId: normalizedChainId,
1956
+ callerEndpoint: "prepareWithdrawal"
1957
+ });
1958
+ const builderParams = {
1849
1959
  vaultName,
1850
1960
  wantAsset,
1851
1961
  userAddress,
1852
1962
  chainId,
1853
1963
  amountOffer: withdrawAmount
1854
- });
1964
+ };
1965
+ return vault.atomicWithdrawal ? await prepareAtomicWithdrawOrderTxData(builderParams) : await prepareWithdrawOrderTxData(builderParams);
1855
1966
  } catch (error) {
1856
- if (error instanceof chunkWYBYBPX5_js.APIError) {
1967
+ if (error instanceof chunkGOJQYEJQ_js.APIError) {
1857
1968
  throw error;
1858
1969
  }
1859
- throw new chunkWYBYBPX5_js.APIError(
1970
+ throw new chunkGOJQYEJQ_js.APIError(
1860
1971
  `Failed to prepare withdrawal: ${error instanceof Error ? error.message : String(error)}`,
1861
1972
  {
1862
1973
  endpoint: "prepareWithdrawal",
@@ -1875,8 +1986,8 @@ async function prepareWithdrawalAuthorization(params) {
1875
1986
  forceMethod
1876
1987
  } = params;
1877
1988
  try {
1878
- const normalizedChainId = chunkWYBYBPX5_js.toChainId(chainId);
1879
- const vault = await chunkZKDXRGI5_js.resolveVault({
1989
+ const normalizedChainId = chunkGOJQYEJQ_js.toChainId(chainId);
1990
+ const vault = await chunk6JLKHV6O_js.resolveVault({
1880
1991
  vaultName,
1881
1992
  assetAddress: wantAsset,
1882
1993
  chainId: normalizedChainId,
@@ -1919,7 +2030,7 @@ async function prepareWithdrawalAuthorization(params) {
1919
2030
  recipientAddress: userAddress
1920
2031
  });
1921
2032
  if (approvalInfo.error) {
1922
- throw new chunkWYBYBPX5_js.APIError(
2033
+ throw new chunkGOJQYEJQ_js.APIError(
1923
2034
  `Failed to check withdrawal approval: ${approvalInfo.error}`,
1924
2035
  { endpoint: "prepareWithdrawalAuthorization" }
1925
2036
  );
@@ -1946,10 +2057,10 @@ async function prepareWithdrawalAuthorization(params) {
1946
2057
  txData
1947
2058
  };
1948
2059
  } catch (error) {
1949
- if (error instanceof chunkWYBYBPX5_js.APIError) {
2060
+ if (error instanceof chunkGOJQYEJQ_js.APIError) {
1950
2061
  throw error;
1951
2062
  }
1952
- throw new chunkWYBYBPX5_js.APIError(
2063
+ throw new chunkGOJQYEJQ_js.APIError(
1953
2064
  `Failed to prepare withdrawal authorization: ${error instanceof Error ? error.message : String(error)}`,
1954
2065
  {
1955
2066
  endpoint: "prepareWithdrawalAuthorization",
@@ -1963,6 +2074,7 @@ exports.DepositAuthMethod = DepositAuthMethod;
1963
2074
  exports.DepositType = DepositType;
1964
2075
  exports.PERMIT_TYPES = PERMIT_TYPES;
1965
2076
  exports.WithdrawAuthMethod = WithdrawAuthMethod;
2077
+ exports.fetchKytAttestation = fetchKytAttestation;
1966
2078
  exports.isAlreadyApprovedAuth = isAlreadyApprovedAuth;
1967
2079
  exports.isApprovalAuth = isApprovalAuth;
1968
2080
  exports.isDepositSpendApproved = isDepositSpendApproved;
@@ -1985,5 +2097,5 @@ exports.prepareWithdrawOrderTxData = prepareWithdrawOrderTxData;
1985
2097
  exports.prepareWithdrawal = prepareWithdrawal;
1986
2098
  exports.prepareWithdrawalAuthorization = prepareWithdrawalAuthorization;
1987
2099
  exports.toEthSignTypedDataV4 = toEthSignTypedDataV4;
1988
- //# sourceMappingURL=chunk-5OK753GA.js.map
1989
- //# sourceMappingURL=chunk-5OK753GA.js.map
2100
+ //# sourceMappingURL=chunk-4NQPS3JC.js.map
2101
+ //# sourceMappingURL=chunk-4NQPS3JC.js.map