@paxoslabs/amplify-sdk 0.0.1-alpha.1 → 0.0.1-alpha.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 (35) hide show
  1. package/dist/{chunk-ZSFIOWWT.js → chunk-AIBI7ZQM.js} +8 -8
  2. package/dist/{chunk-ZSFIOWWT.js.map → chunk-AIBI7ZQM.js.map} +1 -1
  3. package/dist/{chunk-JLXNOGZB.js → chunk-BXUG3WDV.js} +46 -21
  4. package/dist/chunk-BXUG3WDV.js.map +1 -0
  5. package/dist/{chunk-GE2VQUPP.mjs → chunk-GBWBO6ZF.mjs} +4 -4
  6. package/dist/{chunk-GE2VQUPP.mjs.map → chunk-GBWBO6ZF.mjs.map} +1 -1
  7. package/dist/{chunk-BDXS57YH.js → chunk-IBNTWZ4S.js} +33 -6
  8. package/dist/chunk-IBNTWZ4S.js.map +1 -0
  9. package/dist/{chunk-AFWUOS3M.js → chunk-K4DL2AII.js} +4 -4
  10. package/dist/{chunk-AFWUOS3M.js.map → chunk-K4DL2AII.js.map} +1 -1
  11. package/dist/{chunk-SIR2TCAR.mjs → chunk-OPOYGPSS.mjs} +3 -3
  12. package/dist/{chunk-SIR2TCAR.mjs.map → chunk-OPOYGPSS.mjs.map} +1 -1
  13. package/dist/{chunk-ISO6Z7LD.mjs → chunk-WFCHKDDG.mjs} +33 -6
  14. package/dist/chunk-WFCHKDDG.mjs.map +1 -0
  15. package/dist/{chunk-ZZBZIDZP.mjs → chunk-YP2TR5RP.mjs} +44 -19
  16. package/dist/chunk-YP2TR5RP.mjs.map +1 -0
  17. package/dist/{chunk-O5P6SP2O.js → chunk-ZCVMGIMV.js} +20 -20
  18. package/dist/{chunk-O5P6SP2O.js.map → chunk-ZCVMGIMV.js.map} +1 -1
  19. package/dist/{chunk-FYNPQXCR.mjs → chunk-ZLS2AAMI.mjs} +3 -3
  20. package/dist/{chunk-FYNPQXCR.mjs.map → chunk-ZLS2AAMI.mjs.map} +1 -1
  21. package/dist/core.js +14 -14
  22. package/dist/core.mjs +4 -4
  23. package/dist/display.js +12 -12
  24. package/dist/display.mjs +4 -4
  25. package/dist/index.js +131 -98
  26. package/dist/index.js.map +1 -1
  27. package/dist/index.mjs +38 -5
  28. package/dist/index.mjs.map +1 -1
  29. package/dist/utils.js +5 -5
  30. package/dist/utils.mjs +2 -2
  31. package/package.json +2 -2
  32. package/dist/chunk-BDXS57YH.js.map +0 -1
  33. package/dist/chunk-ISO6Z7LD.mjs.map +0 -1
  34. package/dist/chunk-JLXNOGZB.js.map +0 -1
  35. package/dist/chunk-ZZBZIDZP.mjs.map +0 -1
package/dist/index.js CHANGED
@@ -1,13 +1,13 @@
1
1
  'use strict';
2
2
 
3
3
  var chunkITB7FXG4_js = require('./chunk-ITB7FXG4.js');
4
- var chunkO5P6SP2O_js = require('./chunk-O5P6SP2O.js');
5
- var chunkJLXNOGZB_js = require('./chunk-JLXNOGZB.js');
4
+ var chunkZCVMGIMV_js = require('./chunk-ZCVMGIMV.js');
5
+ var chunkBXUG3WDV_js = require('./chunk-BXUG3WDV.js');
6
6
  require('./chunk-ICKDAKVS.js');
7
7
  var chunkRUIAH5HY_js = require('./chunk-RUIAH5HY.js');
8
- var chunkAFWUOS3M_js = require('./chunk-AFWUOS3M.js');
8
+ var chunkK4DL2AII_js = require('./chunk-K4DL2AII.js');
9
9
  var chunk3I3PYX2F_js = require('./chunk-3I3PYX2F.js');
10
- var chunkBDXS57YH_js = require('./chunk-BDXS57YH.js');
10
+ var chunkIBNTWZ4S_js = require('./chunk-IBNTWZ4S.js');
11
11
  var viem = require('viem');
12
12
 
13
13
  async function prepareApproveDepositTokenTxData({
@@ -18,33 +18,33 @@ async function prepareApproveDepositTokenTxData({
18
18
  }) {
19
19
  const normalizedChainId = chunkRUIAH5HY_js.toChainId(chainId);
20
20
  try {
21
- const config = await chunkBDXS57YH_js.findVaultByConfig({
21
+ const config = await chunkIBNTWZ4S_js.findVaultByConfig({
22
22
  assetAddress: depositToken,
23
23
  yieldType,
24
24
  chainId: normalizedChainId
25
25
  });
26
26
  if (!config) {
27
- throw new chunkBDXS57YH_js.APIError(
27
+ throw new chunkIBNTWZ4S_js.APIError(
28
28
  `No vault found for token address ${depositToken} with yield type '${yieldType}' on chain ${normalizedChainId}. This combination may not be supported.`,
29
29
  { endpoint: "prepareApproveDepositToken" }
30
30
  );
31
31
  }
32
32
  const boringVaultAddress = config.vault.boringVaultAddress;
33
33
  if (!boringVaultAddress) {
34
- throw new chunkBDXS57YH_js.APIError(
34
+ throw new chunkIBNTWZ4S_js.APIError(
35
35
  `BoringVault contract address not configured for vault ${config.id}`,
36
36
  { endpoint: "prepareApproveDepositToken" }
37
37
  );
38
38
  }
39
- const assets = await chunkBDXS57YH_js.getAssetsFromCache({ address: depositToken });
39
+ const assets = await chunkIBNTWZ4S_js.getAssetsFromCache({ address: depositToken });
40
40
  if (assets.length === 0) {
41
- throw new chunkBDXS57YH_js.APIError(
41
+ throw new chunkIBNTWZ4S_js.APIError(
42
42
  `Asset metadata not found for token ${depositToken} on chain ${normalizedChainId}`,
43
43
  { endpoint: "prepareApproveDepositToken" }
44
44
  );
45
45
  }
46
46
  const decimals = assets[0].decimals;
47
- const amount = approvalAmount ? viem.parseUnits(approvalAmount, decimals) : chunkBDXS57YH_js.DEFAULT_APPROVAL_AMOUNT;
47
+ const amount = approvalAmount ? viem.parseUnits(approvalAmount, decimals) : chunkIBNTWZ4S_js.DEFAULT_APPROVAL_AMOUNT;
48
48
  return {
49
49
  abi: viem.erc20Abi,
50
50
  address: depositToken,
@@ -52,10 +52,10 @@ async function prepareApproveDepositTokenTxData({
52
52
  args: [boringVaultAddress, amount]
53
53
  };
54
54
  } catch (error) {
55
- if (error instanceof chunkBDXS57YH_js.APIError) {
55
+ if (error instanceof chunkIBNTWZ4S_js.APIError) {
56
56
  throw error;
57
57
  }
58
- throw new chunkBDXS57YH_js.APIError(
58
+ throw new chunkIBNTWZ4S_js.APIError(
59
59
  `Failed to prepare approval transaction: ${error instanceof Error ? error.message : String(error)}`,
60
60
  {
61
61
  endpoint: "prepareApproveDepositToken",
@@ -90,13 +90,13 @@ async function prepareDepositTxData(params) {
90
90
  const normalizedChainId = chunkRUIAH5HY_js.toChainId(chainId);
91
91
  let vault;
92
92
  try {
93
- vault = await chunkBDXS57YH_js.findVaultByConfig({
93
+ vault = await chunkIBNTWZ4S_js.findVaultByConfig({
94
94
  assetAddress: depositToken,
95
95
  yieldType,
96
96
  chainId: normalizedChainId
97
97
  });
98
98
  } catch (error) {
99
- throw new chunkBDXS57YH_js.APIError(
99
+ throw new chunkIBNTWZ4S_js.APIError(
100
100
  `Failed to resolve vault for token ${depositToken} with yield type ${yieldType} on chain ${normalizedChainId}: ${error instanceof Error ? error.message : "Unknown error"}`,
101
101
  {
102
102
  endpoint: "prepareDepositTransactionData",
@@ -105,7 +105,7 @@ async function prepareDepositTxData(params) {
105
105
  );
106
106
  }
107
107
  if (!vault) {
108
- throw new chunkBDXS57YH_js.APIError(
108
+ throw new chunkIBNTWZ4S_js.APIError(
109
109
  `No vault found for token address ${depositToken} with yield type '${yieldType}' on chain ${normalizedChainId}. This combination may not be supported.`,
110
110
  {
111
111
  endpoint: "prepareDepositTransactionData"
@@ -113,12 +113,12 @@ async function prepareDepositTxData(params) {
113
113
  );
114
114
  }
115
115
  let asset = null;
116
- const assets = await chunkBDXS57YH_js.getAssetsFromCache({ address: depositToken });
116
+ const assets = await chunkIBNTWZ4S_js.getAssetsFromCache({ address: depositToken });
117
117
  if (assets.length > 0) {
118
118
  asset = assets.find((a) => a.chains.includes(normalizedChainId)) || assets[0] || null;
119
119
  }
120
120
  if (!asset) {
121
- throw new chunkBDXS57YH_js.APIError(
121
+ throw new chunkIBNTWZ4S_js.APIError(
122
122
  `Asset metadata not found for token ${depositToken} on chain ${normalizedChainId}`,
123
123
  {
124
124
  endpoint: "prepareDepositTransactionData"
@@ -128,13 +128,13 @@ async function prepareDepositTxData(params) {
128
128
  const tellerAddress = vault.vault.tellerAddress;
129
129
  const accountantAddress = vault.vault.accountantAddress;
130
130
  const depositAssetAddress = asset.address;
131
- const [depositAssetDecimalsResult, rateInQuoteResult] = await chunkJLXNOGZB_js.getRateInQuoteWithAssetDecimals({
131
+ const [depositAssetDecimalsResult, rateInQuoteResult] = await chunkBXUG3WDV_js.getRateInQuoteWithAssetDecimals({
132
132
  assetAddress: depositAssetAddress,
133
133
  accountantAddress,
134
134
  chainId: normalizedChainId
135
135
  });
136
136
  if (depositAssetDecimalsResult.status === "failure") {
137
- throw new chunkBDXS57YH_js.APIError(
137
+ throw new chunkIBNTWZ4S_js.APIError(
138
138
  `Failed to get asset decimals: ${depositAssetDecimalsResult.error?.message || "Unknown error"}`,
139
139
  {
140
140
  endpoint: "prepareDepositTransactionData",
@@ -143,7 +143,7 @@ async function prepareDepositTxData(params) {
143
143
  );
144
144
  }
145
145
  if (rateInQuoteResult.status === "failure") {
146
- throw new chunkBDXS57YH_js.APIError(
146
+ throw new chunkIBNTWZ4S_js.APIError(
147
147
  `Failed to get exchange rate: ${rateInQuoteResult.error?.message || "Unknown error"}`,
148
148
  {
149
149
  endpoint: "prepareDepositTransactionData",
@@ -155,11 +155,11 @@ async function prepareDepositTxData(params) {
155
155
  depositAmount,
156
156
  depositAssetDecimalsResult.result
157
157
  );
158
- const vaultSharesAssets = await chunkBDXS57YH_js.fetchSupportedAssets({
158
+ const vaultSharesAssets = await chunkIBNTWZ4S_js.fetchSupportedAssets({
159
159
  address: vault.vault.boringVaultAddress
160
160
  });
161
161
  if (vaultSharesAssets.length === 0) {
162
- throw new chunkBDXS57YH_js.APIError(
162
+ throw new chunkIBNTWZ4S_js.APIError(
163
163
  `Vault shares token not found in supported assets: ${vault.vault.boringVaultAddress}`,
164
164
  { endpoint: "prepareDepositTransactionData" }
165
165
  );
@@ -171,17 +171,17 @@ async function prepareDepositTxData(params) {
171
171
  slippage
172
172
  );
173
173
  return {
174
- abi: chunkJLXNOGZB_js.TellerAbi,
174
+ abi: chunkBXUG3WDV_js.TellerAbi,
175
175
  address: tellerAddress,
176
176
  functionName: "deposit",
177
177
  args: [depositAssetAddress, depositAmountAsBigInt, minimumMint],
178
178
  chainId: normalizedChainId
179
179
  };
180
180
  } catch (error) {
181
- if (error instanceof chunkBDXS57YH_js.APIError) {
181
+ if (error instanceof chunkIBNTWZ4S_js.APIError) {
182
182
  throw error;
183
183
  }
184
- throw new chunkBDXS57YH_js.APIError(
184
+ throw new chunkIBNTWZ4S_js.APIError(
185
185
  `Failed to prepare deposit transaction: ${error instanceof Error ? error.message : String(error)}`,
186
186
  {
187
187
  endpoint: "prepareDepositTransactionData",
@@ -262,13 +262,13 @@ async function prepareDepositPermitSignature(params) {
262
262
  const normalizedChainId = chunkRUIAH5HY_js.toChainId(chainId);
263
263
  let vault;
264
264
  try {
265
- vault = await chunkBDXS57YH_js.findVaultByConfig({
265
+ vault = await chunkIBNTWZ4S_js.findVaultByConfig({
266
266
  assetAddress: depositToken,
267
267
  yieldType,
268
268
  chainId: normalizedChainId
269
269
  });
270
270
  } catch (error) {
271
- throw new chunkBDXS57YH_js.APIError(
271
+ throw new chunkIBNTWZ4S_js.APIError(
272
272
  `Failed to resolve vault for token ${depositToken} with yield type ${yieldType} on chain ${normalizedChainId}: ${error instanceof Error ? error.message : "Unknown error"}`,
273
273
  {
274
274
  endpoint: "prepareDepositPermitSignature",
@@ -277,7 +277,7 @@ async function prepareDepositPermitSignature(params) {
277
277
  );
278
278
  }
279
279
  if (!vault) {
280
- throw new chunkBDXS57YH_js.APIError(
280
+ throw new chunkIBNTWZ4S_js.APIError(
281
281
  `No vault found for token address ${depositToken} with yield type '${yieldType}' on chain ${normalizedChainId}. This combination may not be supported.`,
282
282
  {
283
283
  endpoint: "prepareDepositPermitSignature"
@@ -285,7 +285,7 @@ async function prepareDepositPermitSignature(params) {
285
285
  );
286
286
  }
287
287
  const tellerAddress = vault.vault.tellerAddress;
288
- const client = await chunkJLXNOGZB_js.getClient(normalizedChainId);
288
+ const client = await chunkBXUG3WDV_js.getClient(normalizedChainId);
289
289
  let tokenName;
290
290
  let tokenVersion;
291
291
  let nonce;
@@ -313,7 +313,7 @@ async function prepareDepositPermitSignature(params) {
313
313
  if (nameResult.status === "fulfilled") {
314
314
  tokenName = nameResult.value;
315
315
  } else {
316
- throw new chunkBDXS57YH_js.APIError(`Failed to read token name from ${depositToken}`, {
316
+ throw new chunkIBNTWZ4S_js.APIError(`Failed to read token name from ${depositToken}`, {
317
317
  endpoint: "prepareDepositPermitSignature",
318
318
  cause: nameResult.reason
319
319
  });
@@ -326,7 +326,7 @@ async function prepareDepositPermitSignature(params) {
326
326
  if (nonceResult.status === "fulfilled") {
327
327
  nonce = nonceResult.value;
328
328
  } else {
329
- throw new chunkBDXS57YH_js.APIError(
329
+ throw new chunkIBNTWZ4S_js.APIError(
330
330
  `Token ${depositToken} does not support EIP-2612 permit. Missing required function: nonces()`,
331
331
  {
332
332
  endpoint: "prepareDepositPermitSignature",
@@ -335,10 +335,10 @@ async function prepareDepositPermitSignature(params) {
335
335
  );
336
336
  }
337
337
  } catch (error) {
338
- if (error instanceof chunkBDXS57YH_js.APIError) {
338
+ if (error instanceof chunkIBNTWZ4S_js.APIError) {
339
339
  throw error;
340
340
  }
341
- throw new chunkBDXS57YH_js.APIError(
341
+ throw new chunkIBNTWZ4S_js.APIError(
342
342
  `Failed to read token metadata: ${error instanceof Error ? error.message : "Unknown error"}`,
343
343
  {
344
344
  endpoint: "prepareDepositPermitSignature",
@@ -347,9 +347,9 @@ async function prepareDepositPermitSignature(params) {
347
347
  );
348
348
  }
349
349
  const permitDeadline = deadline ?? BigInt(Math.floor(Date.now() / 1e3) + 3600);
350
- const assets = await chunkBDXS57YH_js.fetchSupportedAssets({ address: depositToken });
350
+ const assets = await chunkIBNTWZ4S_js.fetchSupportedAssets({ address: depositToken });
351
351
  if (assets.length === 0) {
352
- throw new chunkBDXS57YH_js.APIError(`Asset metadata not found for token ${depositToken}`, {
352
+ throw new chunkIBNTWZ4S_js.APIError(`Asset metadata not found for token ${depositToken}`, {
353
353
  endpoint: "prepareDepositPermitSignature"
354
354
  });
355
355
  }
@@ -375,10 +375,10 @@ async function prepareDepositPermitSignature(params) {
375
375
  types: PERMIT_TYPES
376
376
  };
377
377
  } catch (error) {
378
- if (error instanceof chunkBDXS57YH_js.APIError) {
378
+ if (error instanceof chunkIBNTWZ4S_js.APIError) {
379
379
  throw error;
380
380
  }
381
- throw new chunkBDXS57YH_js.APIError(
381
+ throw new chunkIBNTWZ4S_js.APIError(
382
382
  `Failed to prepare permit signature: ${error instanceof Error ? error.message : String(error)}`,
383
383
  {
384
384
  endpoint: "prepareDepositPermitSignature",
@@ -404,7 +404,7 @@ function parsePermitSignature(signature) {
404
404
  s: parsed.s
405
405
  };
406
406
  } catch (error) {
407
- throw new chunkBDXS57YH_js.APIError(
407
+ throw new chunkIBNTWZ4S_js.APIError(
408
408
  `Invalid permit signature format. Expected hex string but received: ${signature}. ${error instanceof Error ? error.message : "Unknown error"}`,
409
409
  {
410
410
  endpoint: "parsePermitSignature",
@@ -423,10 +423,18 @@ async function prepareDepositWithPermitTransactionData(params) {
423
423
  deadline,
424
424
  slippage = chunkITB7FXG4_js.DEFAULT_SLIPPAGE_BPS
425
425
  } = params;
426
+ console.log("[Amplify SDK] prepareDepositWithPermitTransactionData called", {
427
+ yieldType,
428
+ depositToken,
429
+ depositAmount,
430
+ chainId,
431
+ deadline: deadline.toString(),
432
+ slippage
433
+ });
426
434
  try {
427
435
  const { v, r, s } = parsePermitSignature(signature);
428
436
  if (slippage < 0 || slippage > 1e4) {
429
- throw new chunkBDXS57YH_js.APIError(
437
+ throw new chunkIBNTWZ4S_js.APIError(
430
438
  `Invalid slippage value: ${slippage}. Slippage must be between 0 and 10000 basis points.`,
431
439
  {
432
440
  endpoint: "prepareDepositWithPermitTransactionData"
@@ -434,15 +442,18 @@ async function prepareDepositWithPermitTransactionData(params) {
434
442
  );
435
443
  }
436
444
  const normalizedChainId = chunkRUIAH5HY_js.toChainId(chainId);
445
+ console.log("[Amplify SDK] Normalized chainId:", normalizedChainId);
437
446
  let vault;
438
447
  try {
439
- vault = await chunkBDXS57YH_js.findVaultByConfig({
448
+ console.log("[Amplify SDK] Resolving vault with findVaultByConfig...");
449
+ vault = await chunkIBNTWZ4S_js.findVaultByConfig({
440
450
  assetAddress: depositToken,
441
451
  yieldType,
442
452
  chainId: normalizedChainId
443
453
  });
454
+ console.log("[Amplify SDK] Vault resolved:", vault ? "Found" : "Not found");
444
455
  } catch (error) {
445
- throw new chunkBDXS57YH_js.APIError(
456
+ throw new chunkIBNTWZ4S_js.APIError(
446
457
  `Failed to resolve vault for token ${depositToken} with yield type ${yieldType} on chain ${normalizedChainId}: ${error instanceof Error ? error.message : "Unknown error"}`,
447
458
  {
448
459
  endpoint: "prepareDepositWithPermitTransactionData",
@@ -451,20 +462,22 @@ async function prepareDepositWithPermitTransactionData(params) {
451
462
  );
452
463
  }
453
464
  if (!vault) {
454
- throw new chunkBDXS57YH_js.APIError(
465
+ throw new chunkIBNTWZ4S_js.APIError(
455
466
  `No vault found for token address ${depositToken} with yield type '${yieldType}' on chain ${normalizedChainId}. This combination may not be supported.`,
456
467
  {
457
468
  endpoint: "prepareDepositWithPermitTransactionData"
458
469
  }
459
470
  );
460
471
  }
472
+ console.log("[Amplify SDK] Fetching supported assets for depositToken:", depositToken);
461
473
  let asset = null;
462
- const assets = await chunkBDXS57YH_js.fetchSupportedAssets({ address: depositToken });
474
+ const assets = await chunkIBNTWZ4S_js.fetchSupportedAssets({ address: depositToken });
475
+ console.log("[Amplify SDK] Supported assets found:", assets.length);
463
476
  if (assets.length > 0) {
464
477
  asset = assets.find((a) => a.chains.includes(normalizedChainId)) || assets[0] || null;
465
478
  }
466
479
  if (!asset) {
467
- throw new chunkBDXS57YH_js.APIError(
480
+ throw new chunkIBNTWZ4S_js.APIError(
468
481
  `Asset metadata not found for token ${depositToken} on chain ${normalizedChainId}`,
469
482
  {
470
483
  endpoint: "prepareDepositWithPermitTransactionData"
@@ -472,7 +485,7 @@ async function prepareDepositWithPermitTransactionData(params) {
472
485
  );
473
486
  }
474
487
  if (!asset.chains || !asset.chains.includes(normalizedChainId)) {
475
- throw new chunkBDXS57YH_js.APIError(
488
+ throw new chunkIBNTWZ4S_js.APIError(
476
489
  `Token ${asset.symbol || depositToken} not supported on chain ${normalizedChainId}`,
477
490
  {
478
491
  endpoint: "prepareDepositWithPermitTransactionData"
@@ -482,13 +495,23 @@ async function prepareDepositWithPermitTransactionData(params) {
482
495
  const tellerAddress = vault.vault.tellerAddress;
483
496
  const accountantAddress = vault.vault.accountantAddress;
484
497
  const depositAssetAddress = asset.address;
485
- const [depositAssetDecimalsResult, rateInQuoteResult] = await chunkJLXNOGZB_js.getRateInQuoteWithAssetDecimals({
498
+ console.log("[Amplify SDK] Contract addresses:", {
499
+ tellerAddress,
500
+ accountantAddress,
501
+ depositAssetAddress
502
+ });
503
+ console.log("[Amplify SDK] Calling getRateInQuoteWithAssetDecimals...");
504
+ const [depositAssetDecimalsResult, rateInQuoteResult] = await chunkBXUG3WDV_js.getRateInQuoteWithAssetDecimals({
486
505
  assetAddress: depositAssetAddress,
487
506
  accountantAddress,
488
507
  chainId: normalizedChainId
489
508
  });
509
+ console.log("[Amplify SDK] getRateInQuoteWithAssetDecimals completed", {
510
+ decimalsStatus: depositAssetDecimalsResult.status,
511
+ rateStatus: rateInQuoteResult.status
512
+ });
490
513
  if (depositAssetDecimalsResult.status === "failure") {
491
- throw new chunkBDXS57YH_js.APIError(
514
+ throw new chunkIBNTWZ4S_js.APIError(
492
515
  `Failed to get asset decimals: ${depositAssetDecimalsResult.error?.message || "Unknown error"}`,
493
516
  {
494
517
  endpoint: "prepareDepositWithPermitTransactionData",
@@ -497,7 +520,7 @@ async function prepareDepositWithPermitTransactionData(params) {
497
520
  );
498
521
  }
499
522
  if (rateInQuoteResult.status === "failure") {
500
- throw new chunkBDXS57YH_js.APIError(
523
+ throw new chunkIBNTWZ4S_js.APIError(
501
524
  `Failed to get exchange rate: ${rateInQuoteResult.error?.message || "Unknown error"}`,
502
525
  {
503
526
  endpoint: "prepareDepositWithPermitTransactionData",
@@ -506,24 +529,34 @@ async function prepareDepositWithPermitTransactionData(params) {
506
529
  );
507
530
  }
508
531
  const depositAmountAsBigInt = viem.parseUnits(depositAmount, asset.decimals);
509
- const vaultSharesAssets = await chunkBDXS57YH_js.fetchSupportedAssets({
532
+ console.log("[Amplify SDK] Fetching vault shares asset:", vault.vault.boringVaultAddress);
533
+ const vaultSharesAssets = await chunkIBNTWZ4S_js.fetchSupportedAssets({
510
534
  address: vault.vault.boringVaultAddress
511
535
  });
536
+ console.log("[Amplify SDK] Vault shares assets found:", vaultSharesAssets.length);
512
537
  if (vaultSharesAssets.length === 0) {
513
- throw new chunkBDXS57YH_js.APIError(
538
+ throw new chunkIBNTWZ4S_js.APIError(
514
539
  `Vault shares token not found in supported assets: ${vault.vault.boringVaultAddress}`,
515
540
  { endpoint: "prepareDepositWithPermitTransactionData" }
516
541
  );
517
542
  }
543
+ console.log("[Amplify SDK] Calculating minimumMint...", {
544
+ depositAmountAsBigInt: depositAmountAsBigInt.toString(),
545
+ rateInQuote: rateInQuoteResult.result.toString(),
546
+ vaultSharesDecimals: vaultSharesAssets[0].decimals,
547
+ slippage
548
+ });
518
549
  const minimumMint = calculateMinimumMint(
519
550
  depositAmountAsBigInt,
520
551
  rateInQuoteResult.result,
521
552
  vaultSharesAssets[0].decimals,
522
553
  slippage
523
554
  );
555
+ console.log("[Amplify SDK] minimumMint calculated:", minimumMint.toString());
556
+ console.log("[Amplify SDK] Returning transaction data successfully");
524
557
  return {
525
558
  data: {
526
- abi: chunkJLXNOGZB_js.TellerAbi,
559
+ abi: chunkBXUG3WDV_js.TellerAbi,
527
560
  functionName: "depositWithPermit",
528
561
  args: [
529
562
  depositAssetAddress,
@@ -539,10 +572,10 @@ async function prepareDepositWithPermitTransactionData(params) {
539
572
  chainId: normalizedChainId
540
573
  };
541
574
  } catch (error) {
542
- if (error instanceof chunkBDXS57YH_js.APIError) {
575
+ if (error instanceof chunkIBNTWZ4S_js.APIError) {
543
576
  throw error;
544
577
  }
545
- throw new chunkBDXS57YH_js.APIError(
578
+ throw new chunkIBNTWZ4S_js.APIError(
546
579
  `Failed to prepare deposit with permit transaction: ${error instanceof Error ? error.message : String(error)}`,
547
580
  {
548
581
  endpoint: "prepareDepositWithPermitTransactionData",
@@ -559,45 +592,45 @@ async function prepareApproveWithdrawTxData({
559
592
  }) {
560
593
  try {
561
594
  const normalizedChainId = chunkRUIAH5HY_js.toChainId(chainId);
562
- const config = await chunkBDXS57YH_js.findVaultByConfig({
595
+ const config = await chunkIBNTWZ4S_js.findVaultByConfig({
563
596
  assetAddress: wantAssetAddress,
564
597
  yieldType,
565
598
  chainId: normalizedChainId
566
599
  });
567
600
  if (!config || config.chainId !== normalizedChainId) {
568
- throw new chunkBDXS57YH_js.APIError(
601
+ throw new chunkIBNTWZ4S_js.APIError(
569
602
  `Vault chain mismatch: vault is on chain ${config?.chainId}, requested chain ${normalizedChainId}`,
570
603
  { endpoint: "prepareApproveWithdrawToken" }
571
604
  );
572
605
  }
573
606
  if (!config.vault.boringVaultAddress) {
574
- throw new chunkBDXS57YH_js.APIError(
607
+ throw new chunkIBNTWZ4S_js.APIError(
575
608
  `BoringVault contract address not configured for vault ${config.id}`,
576
609
  { endpoint: "prepareApproveWithdrawToken" }
577
610
  );
578
611
  }
579
612
  const boringVaultAddress = config.vault.boringVaultAddress;
580
- const vaultSharesAssets = await chunkBDXS57YH_js.getAssetsFromCache({
613
+ const vaultSharesAssets = await chunkIBNTWZ4S_js.getAssetsFromCache({
581
614
  address: boringVaultAddress
582
615
  });
583
616
  if (vaultSharesAssets.length === 0) {
584
- throw new chunkBDXS57YH_js.APIError(
617
+ throw new chunkIBNTWZ4S_js.APIError(
585
618
  `Vault shares token not found in supported assets: ${boringVaultAddress}`,
586
619
  { endpoint: "prepareApproveWithdrawToken" }
587
620
  );
588
621
  }
589
- const withdrawAmountAsBigInt = withdrawAmount ? viem.parseUnits(withdrawAmount, vaultSharesAssets[0].decimals) : chunkBDXS57YH_js.DEFAULT_APPROVAL_AMOUNT;
622
+ const withdrawAmountAsBigInt = withdrawAmount ? viem.parseUnits(withdrawAmount, vaultSharesAssets[0].decimals) : chunkIBNTWZ4S_js.DEFAULT_APPROVAL_AMOUNT;
590
623
  return {
591
- abi: chunkJLXNOGZB_js.BoringVaultAbi,
624
+ abi: chunkBXUG3WDV_js.BoringVaultAbi,
592
625
  address: boringVaultAddress,
593
626
  functionName: "approve",
594
- args: [chunkBDXS57YH_js.ATOMIC_QUEUE_CONTRACT_ADDRESS, withdrawAmountAsBigInt]
627
+ args: [chunkIBNTWZ4S_js.ATOMIC_QUEUE_CONTRACT_ADDRESS, withdrawAmountAsBigInt]
595
628
  };
596
629
  } catch (error) {
597
- if (error instanceof chunkBDXS57YH_js.APIError) {
630
+ if (error instanceof chunkIBNTWZ4S_js.APIError) {
598
631
  throw error;
599
632
  }
600
- throw new chunkBDXS57YH_js.APIError(
633
+ throw new chunkIBNTWZ4S_js.APIError(
601
634
  `Failed to prepare approval transaction: ${error instanceof Error ? error.message : String(error)}`,
602
635
  {
603
636
  endpoint: "prepareApproveWithdrawToken",
@@ -609,7 +642,7 @@ async function prepareApproveWithdrawTxData({
609
642
 
610
643
  // src/vaults/withdraw/utils.ts
611
644
  var prepareUserRequest = (offerAmount, atomicPrice, deadline) => {
612
- const deadlineTimeStamp = chunkAFWUOS3M_js.calculateDeadline(deadline);
645
+ const deadlineTimeStamp = chunkK4DL2AII_js.calculateDeadline(deadline);
613
646
  return {
614
647
  deadline: deadlineTimeStamp,
615
648
  atomicPrice,
@@ -635,30 +668,30 @@ async function prepareBulkWithdrawTxData(params) {
635
668
  } = params;
636
669
  try {
637
670
  const normalizedChainId = chunkRUIAH5HY_js.toChainId(chainId);
638
- const vault = await chunkBDXS57YH_js.findVaultByConfig({
671
+ const vault = await chunkIBNTWZ4S_js.findVaultByConfig({
639
672
  assetAddress: wantAssetAddress,
640
673
  yieldType,
641
674
  chainId: normalizedChainId
642
675
  });
643
676
  if (vault && vault.chainId !== normalizedChainId) {
644
- throw new chunkBDXS57YH_js.APIError(
677
+ throw new chunkIBNTWZ4S_js.APIError(
645
678
  `Vault chain mismatch: vault is on chain ${vault.chainId}, requested chain ${normalizedChainId}`,
646
679
  { endpoint: "prepareBulkWithdrawTransactionData" }
647
680
  );
648
681
  }
649
682
  if (!vault || !vault.vault.boringVaultAddress) {
650
- throw new chunkBDXS57YH_js.APIError(
683
+ throw new chunkIBNTWZ4S_js.APIError(
651
684
  `BoringVault contract address not configured for vault ${vault?.vault.boringVaultAddress}`,
652
685
  { endpoint: "prepareBulkWithdrawTransactionData" }
653
686
  );
654
687
  }
655
688
  const boringVaultAddress = vault.vault.boringVaultAddress;
656
689
  const accountantAddress = vault.vault.accountantAddress;
657
- const wantAsset = await chunkBDXS57YH_js.getAssetsFromCache({
690
+ const wantAsset = await chunkIBNTWZ4S_js.getAssetsFromCache({
658
691
  address: wantAssetAddress
659
692
  });
660
693
  if (wantAsset.length === 0) {
661
- throw new chunkBDXS57YH_js.APIError(
694
+ throw new chunkIBNTWZ4S_js.APIError(
662
695
  `Vault shares token not found in supported assets: ${boringVaultAddress}`,
663
696
  { endpoint: "prepareBulkWithdrawTransactionData" }
664
697
  );
@@ -667,14 +700,14 @@ async function prepareBulkWithdrawTxData(params) {
667
700
  wantAssetDecimalsResult,
668
701
  sharesAssetDecimalsResult,
669
702
  rateInQuoteResult
670
- ] = await chunkJLXNOGZB_js.getRateInQuoteAndSharesAndWantAssetDecimals({
703
+ ] = await chunkBXUG3WDV_js.getRateInQuoteAndSharesAndWantAssetDecimals({
671
704
  sharesAssetAddress: boringVaultAddress,
672
705
  wantAssetAddress,
673
706
  accountantAddress,
674
707
  chainId: normalizedChainId
675
708
  });
676
709
  if (rateInQuoteResult.status === "failure" || wantAssetDecimalsResult.status === "failure" || sharesAssetDecimalsResult.status === "failure") {
677
- throw new chunkBDXS57YH_js.APIError(
710
+ throw new chunkIBNTWZ4S_js.APIError(
678
711
  `Failed to get exchange rate: ${rateInQuoteResult?.error?.message || wantAssetDecimalsResult?.error?.message || sharesAssetDecimalsResult?.error?.message}`,
679
712
  {
680
713
  endpoint: "prepareBulkWithdrawTransactionData",
@@ -695,17 +728,17 @@ async function prepareBulkWithdrawTxData(params) {
695
728
  );
696
729
  const minimumAssets = atomicPrice * offerAmountAsBigInt / BigInt(10 ** sharesAssetDecimalsResult.result);
697
730
  return {
698
- abi: chunkJLXNOGZB_js.TellerAbi,
731
+ abi: chunkBXUG3WDV_js.TellerAbi,
699
732
  address: vault.vault.tellerAddress,
700
733
  functionName: "bulkWithdraw",
701
734
  args: [wantAssetAddress, offerAmountAsBigInt, minimumAssets, userAddress],
702
735
  chainId: normalizedChainId
703
736
  };
704
737
  } catch (error) {
705
- if (error instanceof chunkBDXS57YH_js.APIError) {
738
+ if (error instanceof chunkIBNTWZ4S_js.APIError) {
706
739
  throw error;
707
740
  }
708
- throw new chunkBDXS57YH_js.APIError(
741
+ throw new chunkIBNTWZ4S_js.APIError(
709
742
  `Failed to prepare withdrawal transaction: ${error instanceof Error ? error.message : String(error)}`,
710
743
  {
711
744
  endpoint: "prepareBulkWithdrawTransactionData",
@@ -956,30 +989,30 @@ var prepareWithdrawTxData = async ({
956
989
  wantAssetAddress,
957
990
  chainId,
958
991
  offerAmount,
959
- deadline = chunkBDXS57YH_js.DEFAULT_DEADLINE,
992
+ deadline = chunkIBNTWZ4S_js.DEFAULT_DEADLINE,
960
993
  slippage = chunkITB7FXG4_js.DEFAULT_SLIPPAGE_BPS
961
994
  }) => {
962
995
  try {
963
996
  const normalizedChainId = chunkRUIAH5HY_js.toChainId(chainId);
964
- const config = await chunkBDXS57YH_js.findVaultByConfig({
997
+ const config = await chunkIBNTWZ4S_js.findVaultByConfig({
965
998
  assetAddress: wantAssetAddress,
966
999
  yieldType,
967
1000
  chainId: normalizedChainId
968
1001
  });
969
1002
  if (config && config.chainId !== normalizedChainId) {
970
- throw new chunkBDXS57YH_js.APIError(
1003
+ throw new chunkIBNTWZ4S_js.APIError(
971
1004
  `Vault chain mismatch: vault is on chain ${config.chainId}, requested chain ${normalizedChainId}`,
972
1005
  { endpoint: "prepareWithdrawTransactionData" }
973
1006
  );
974
1007
  }
975
1008
  if (!config || !config.vault.boringVaultAddress) {
976
- throw new chunkBDXS57YH_js.APIError(
1009
+ throw new chunkIBNTWZ4S_js.APIError(
977
1010
  `BoringVault contract address not configured for vault ${config?.id}`,
978
1011
  { endpoint: "prepareWithdrawTransactionData" }
979
1012
  );
980
1013
  }
981
1014
  if (!config.vault.accountantAddress) {
982
- throw new chunkBDXS57YH_js.APIError(
1015
+ throw new chunkIBNTWZ4S_js.APIError(
983
1016
  `Accountant contract address not configured for vault ${config.id}`,
984
1017
  { endpoint: "prepareWithdrawTransactionData" }
985
1018
  );
@@ -990,14 +1023,14 @@ var prepareWithdrawTxData = async ({
990
1023
  wantAssetDecimalsResult,
991
1024
  sharesAssetDecimalsResult,
992
1025
  rateInQuoteResult
993
- ] = await chunkJLXNOGZB_js.getRateInQuoteAndSharesAndWantAssetDecimals({
1026
+ ] = await chunkBXUG3WDV_js.getRateInQuoteAndSharesAndWantAssetDecimals({
994
1027
  sharesAssetAddress: boringVaultAddress,
995
1028
  wantAssetAddress,
996
1029
  accountantAddress,
997
1030
  chainId: normalizedChainId
998
1031
  });
999
1032
  if (rateInQuoteResult?.status === "failure" || wantAssetDecimalsResult?.status === "failure" || sharesAssetDecimalsResult?.status === "failure") {
1000
- throw new chunkBDXS57YH_js.APIError(
1033
+ throw new chunkIBNTWZ4S_js.APIError(
1001
1034
  `Failed to get exchange rate: ${rateInQuoteResult?.error?.message || wantAssetDecimalsResult?.error?.message || sharesAssetDecimalsResult?.error?.message}`,
1002
1035
  {
1003
1036
  endpoint: "prepareWithdrawTransactionData",
@@ -1023,16 +1056,16 @@ var prepareWithdrawTxData = async ({
1023
1056
  );
1024
1057
  return {
1025
1058
  abi: AtomicQueueAbi,
1026
- address: chunkBDXS57YH_js.ATOMIC_QUEUE_CONTRACT_ADDRESS,
1059
+ address: chunkIBNTWZ4S_js.ATOMIC_QUEUE_CONTRACT_ADDRESS,
1027
1060
  functionName: "updateAtomicRequest",
1028
1061
  args: [boringVaultAddress, wantAssetAddress, userRequest],
1029
1062
  chainId: normalizedChainId
1030
1063
  };
1031
1064
  } catch (error) {
1032
- if (error instanceof chunkBDXS57YH_js.APIError) {
1065
+ if (error instanceof chunkIBNTWZ4S_js.APIError) {
1033
1066
  throw error;
1034
1067
  }
1035
- throw new chunkBDXS57YH_js.APIError(
1068
+ throw new chunkIBNTWZ4S_js.APIError(
1036
1069
  `Failed to prepare withdrawal transaction: ${error instanceof Error ? error.message : String(error)}`,
1037
1070
  {
1038
1071
  endpoint: "prepareWithdrawTransactionData",
@@ -1048,59 +1081,59 @@ Object.defineProperty(exports, "YieldType", {
1048
1081
  });
1049
1082
  Object.defineProperty(exports, "getDepositExchangeRate", {
1050
1083
  enumerable: true,
1051
- get: function () { return chunkO5P6SP2O_js.getDepositExchangeRate; }
1084
+ get: function () { return chunkZCVMGIMV_js.getDepositExchangeRate; }
1052
1085
  });
1053
1086
  Object.defineProperty(exports, "getWithdrawExchangeRate", {
1054
1087
  enumerable: true,
1055
- get: function () { return chunkO5P6SP2O_js.getWithdrawExchangeRate; }
1088
+ get: function () { return chunkZCVMGIMV_js.getWithdrawExchangeRate; }
1056
1089
  });
1057
1090
  Object.defineProperty(exports, "isDepositSpendApproved", {
1058
1091
  enumerable: true,
1059
- get: function () { return chunkO5P6SP2O_js.isDepositSpendApproved; }
1092
+ get: function () { return chunkZCVMGIMV_js.isDepositSpendApproved; }
1060
1093
  });
1061
1094
  Object.defineProperty(exports, "isWithdrawalSpendApproved", {
1062
1095
  enumerable: true,
1063
- get: function () { return chunkO5P6SP2O_js.isWithdrawalSpendApproved; }
1096
+ get: function () { return chunkZCVMGIMV_js.isWithdrawalSpendApproved; }
1064
1097
  });
1065
1098
  Object.defineProperty(exports, "APIError", {
1066
1099
  enumerable: true,
1067
- get: function () { return chunkBDXS57YH_js.APIError; }
1100
+ get: function () { return chunkIBNTWZ4S_js.APIError; }
1068
1101
  });
1069
1102
  Object.defineProperty(exports, "fetchSupportedAssets", {
1070
1103
  enumerable: true,
1071
- get: function () { return chunkBDXS57YH_js.fetchSupportedAssets; }
1104
+ get: function () { return chunkIBNTWZ4S_js.fetchSupportedAssets; }
1072
1105
  });
1073
1106
  Object.defineProperty(exports, "fetchVaults", {
1074
1107
  enumerable: true,
1075
- get: function () { return chunkBDXS57YH_js.fetchVaults; }
1108
+ get: function () { return chunkIBNTWZ4S_js.fetchVaults; }
1076
1109
  });
1077
1110
  Object.defineProperty(exports, "findVaultByConfig", {
1078
1111
  enumerable: true,
1079
- get: function () { return chunkBDXS57YH_js.findVaultByConfig; }
1112
+ get: function () { return chunkIBNTWZ4S_js.findVaultByConfig; }
1080
1113
  });
1081
1114
  Object.defineProperty(exports, "getAssetsFromCache", {
1082
1115
  enumerable: true,
1083
- get: function () { return chunkBDXS57YH_js.getAssetsFromCache; }
1116
+ get: function () { return chunkIBNTWZ4S_js.getAssetsFromCache; }
1084
1117
  });
1085
1118
  Object.defineProperty(exports, "getCache", {
1086
1119
  enumerable: true,
1087
- get: function () { return chunkBDXS57YH_js.getCache; }
1120
+ get: function () { return chunkIBNTWZ4S_js.getCache; }
1088
1121
  });
1089
1122
  Object.defineProperty(exports, "getWithdrawSupportedAssets", {
1090
1123
  enumerable: true,
1091
- get: function () { return chunkBDXS57YH_js.getWithdrawSupportedAssets; }
1124
+ get: function () { return chunkIBNTWZ4S_js.getWithdrawSupportedAssets; }
1092
1125
  });
1093
1126
  Object.defineProperty(exports, "initAmplifySDK", {
1094
1127
  enumerable: true,
1095
- get: function () { return chunkBDXS57YH_js.initAmplifySDK; }
1128
+ get: function () { return chunkIBNTWZ4S_js.initAmplifySDK; }
1096
1129
  });
1097
1130
  Object.defineProperty(exports, "initializeCache", {
1098
1131
  enumerable: true,
1099
- get: function () { return chunkBDXS57YH_js.initializeCache; }
1132
+ get: function () { return chunkIBNTWZ4S_js.initializeCache; }
1100
1133
  });
1101
1134
  Object.defineProperty(exports, "refreshVaultCache", {
1102
1135
  enumerable: true,
1103
- get: function () { return chunkBDXS57YH_js.refreshVaultCache; }
1136
+ get: function () { return chunkIBNTWZ4S_js.refreshVaultCache; }
1104
1137
  });
1105
1138
  exports.PERMIT_TYPES = PERMIT_TYPES;
1106
1139
  exports.parsePermitSignature = parsePermitSignature;