@paxoslabs/amplify-sdk 0.5.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/CHANGELOG.md +9 -1
  2. package/dist/{chain-utils-CpOJcWig.d.mts → chain-utils-D_b2LEEi.d.mts} +2 -0
  3. package/dist/{chain-utils-CpOJcWig.d.ts → chain-utils-D_b2LEEi.d.ts} +2 -0
  4. package/dist/{chunk-B5BII2XH.mjs → chunk-3D6EDR3Z.mjs} +5 -5
  5. package/dist/{chunk-B5BII2XH.mjs.map → chunk-3D6EDR3Z.mjs.map} +1 -1
  6. package/dist/{chunk-XS4SELWC.js → chunk-AUDMOT6F.js} +22 -15
  7. package/dist/chunk-AUDMOT6F.js.map +1 -0
  8. package/dist/{chunk-2ZJWWK6D.js → chunk-E5DH5YEE.js} +22 -5
  9. package/dist/chunk-E5DH5YEE.js.map +1 -0
  10. package/dist/{chunk-SXIBMN7X.mjs → chunk-E6SBQNDA.mjs} +3 -3
  11. package/dist/{chunk-SXIBMN7X.mjs.map → chunk-E6SBQNDA.mjs.map} +1 -1
  12. package/dist/{chunk-MPCRFKSD.mjs → chunk-JLZL25CY.mjs} +23 -7
  13. package/dist/chunk-JLZL25CY.mjs.map +1 -0
  14. package/dist/{chunk-KTLGSVD6.js → chunk-L5XT67QZ.js} +111 -111
  15. package/dist/{chunk-KTLGSVD6.js.map → chunk-L5XT67QZ.js.map} +1 -1
  16. package/dist/{chunk-GJPTAY5T.mjs → chunk-WJGSTAPB.mjs} +5 -5
  17. package/dist/{chunk-GJPTAY5T.mjs.map → chunk-WJGSTAPB.mjs.map} +1 -1
  18. package/dist/{chunk-N5UKVLSS.js → chunk-XVDK6J72.js} +62 -62
  19. package/dist/{chunk-N5UKVLSS.js.map → chunk-XVDK6J72.js.map} +1 -1
  20. package/dist/{chunk-XA653JS3.mjs → chunk-Y6RXVDQN.mjs} +15 -8
  21. package/dist/chunk-Y6RXVDQN.mjs.map +1 -0
  22. package/dist/{chunk-D7EMZAOQ.js → chunk-YAYUSBC6.js} +12 -12
  23. package/dist/{chunk-D7EMZAOQ.js.map → chunk-YAYUSBC6.js.map} +1 -1
  24. package/dist/core.d.mts +2 -2
  25. package/dist/core.d.ts +2 -2
  26. package/dist/core.js +16 -16
  27. package/dist/core.mjs +4 -4
  28. package/dist/display.d.mts +1 -1
  29. package/dist/display.d.ts +1 -1
  30. package/dist/display.js +10 -10
  31. package/dist/display.mjs +4 -4
  32. package/dist/index.d.mts +2 -2
  33. package/dist/index.d.ts +2 -2
  34. package/dist/index.js +57 -57
  35. package/dist/index.mjs +5 -5
  36. package/dist/utils.d.mts +1 -1
  37. package/dist/utils.d.ts +1 -1
  38. package/dist/utils.js +7 -7
  39. package/dist/utils.mjs +2 -2
  40. package/dist/vaults.d.mts +1 -1
  41. package/dist/vaults.d.ts +1 -1
  42. package/dist/vaults.js +25 -25
  43. package/dist/vaults.mjs +4 -4
  44. package/package.json +1 -1
  45. package/dist/chunk-2ZJWWK6D.js.map +0 -1
  46. package/dist/chunk-MPCRFKSD.mjs.map +0 -1
  47. package/dist/chunk-XA653JS3.mjs.map +0 -1
  48. package/dist/chunk-XS4SELWC.js.map +0 -1
@@ -1,9 +1,9 @@
1
1
  'use strict';
2
2
 
3
- var chunkXS4SELWC_js = require('./chunk-XS4SELWC.js');
4
- var chunkD7EMZAOQ_js = require('./chunk-D7EMZAOQ.js');
3
+ var chunkAUDMOT6F_js = require('./chunk-AUDMOT6F.js');
4
+ var chunkYAYUSBC6_js = require('./chunk-YAYUSBC6.js');
5
5
  var chunk3I3PYX2F_js = require('./chunk-3I3PYX2F.js');
6
- var chunk2ZJWWK6D_js = require('./chunk-2ZJWWK6D.js');
6
+ var chunkE5DH5YEE_js = require('./chunk-E5DH5YEE.js');
7
7
  var viem = require('viem');
8
8
 
9
9
  var isDepositSpendApproved = async ({
@@ -13,8 +13,8 @@ var isDepositSpendApproved = async ({
13
13
  recipientAddress
14
14
  }) => {
15
15
  try {
16
- const normalizedChainId = chunk2ZJWWK6D_js.toChainId(chainId);
17
- const config = await chunkXS4SELWC_js.resolveVault({
16
+ const normalizedChainId = chunkE5DH5YEE_js.toChainId(chainId);
17
+ const config = await chunkAUDMOT6F_js.resolveVault({
18
18
  vaultName,
19
19
  chainId: normalizedChainId,
20
20
  assetAddress: depositAssetAddress,
@@ -22,7 +22,7 @@ var isDepositSpendApproved = async ({
22
22
  });
23
23
  const communityCodeDepositorAddress = config.vault.communityCodeDepositorAddress;
24
24
  if (!communityCodeDepositorAddress) {
25
- throw new chunk2ZJWWK6D_js.APIError(
25
+ throw new chunkE5DH5YEE_js.APIError(
26
26
  `Community code depositor contract address not configured for vault ${config.id}`,
27
27
  {
28
28
  endpoint: "isDepositSpendApproved"
@@ -37,7 +37,7 @@ var isDepositSpendApproved = async ({
37
37
  domainSeparator,
38
38
  tokenName,
39
39
  tokenVersion
40
- } = await chunkD7EMZAOQ_js.getTokenPermitInfoWithAllowance({
40
+ } = await chunkYAYUSBC6_js.getTokenPermitInfoWithAllowance({
41
41
  chainId: normalizedChainId,
42
42
  tokenAddress: depositAssetAddress,
43
43
  owner: recipientAddress,
@@ -56,10 +56,10 @@ var isDepositSpendApproved = async ({
56
56
  error: null
57
57
  };
58
58
  } catch (error) {
59
- if (error instanceof chunk2ZJWWK6D_js.APIError) {
59
+ if (error instanceof chunkE5DH5YEE_js.APIError) {
60
60
  throw error;
61
61
  }
62
- throw new chunk2ZJWWK6D_js.APIError(
62
+ throw new chunkE5DH5YEE_js.APIError(
63
63
  `Failed to check deposit approval: ${error instanceof Error ? error.message : String(error)}`,
64
64
  {
65
65
  endpoint: "isDepositSpendApproved",
@@ -75,8 +75,8 @@ var isWithdrawalSpendApproved = async ({
75
75
  recipientAddress
76
76
  }) => {
77
77
  try {
78
- const normalizedChainId = chunk2ZJWWK6D_js.toChainId(chainId);
79
- const config = await chunkXS4SELWC_js.resolveVault({
78
+ const normalizedChainId = chunkE5DH5YEE_js.toChainId(chainId);
79
+ const config = await chunkAUDMOT6F_js.resolveVault({
80
80
  vaultName,
81
81
  chainId: normalizedChainId,
82
82
  assetAddress: wantAssetAddress,
@@ -84,7 +84,7 @@ var isWithdrawalSpendApproved = async ({
84
84
  });
85
85
  const boringVaultAddress = config.vault.boringVaultAddress;
86
86
  if (!boringVaultAddress) {
87
- throw new chunk2ZJWWK6D_js.APIError(
87
+ throw new chunkE5DH5YEE_js.APIError(
88
88
  `BoringVault contract address not configured for vault ${config.id}`,
89
89
  {
90
90
  endpoint: "isWithdrawalSpendApproved"
@@ -93,14 +93,14 @@ var isWithdrawalSpendApproved = async ({
93
93
  }
94
94
  const withdrawQueueAddress = config.vault.withdrawQueueAddress;
95
95
  if (!withdrawQueueAddress) {
96
- throw new chunk2ZJWWK6D_js.APIError(
96
+ throw new chunkE5DH5YEE_js.APIError(
97
97
  `WithdrawQueue contract address not configured for vault ${config.id}`,
98
98
  {
99
99
  endpoint: "isWithdrawalSpendApproved"
100
100
  }
101
101
  );
102
102
  }
103
- const [allowance, decimals] = await chunkD7EMZAOQ_js.getErc20AllowanceWithDecimals({
103
+ const [allowance, decimals] = await chunkYAYUSBC6_js.getErc20AllowanceWithDecimals({
104
104
  chainId: normalizedChainId,
105
105
  tokenAddress: boringVaultAddress,
106
106
  recipientAddress,
@@ -123,10 +123,10 @@ var isWithdrawalSpendApproved = async ({
123
123
  error: null
124
124
  };
125
125
  } catch (error) {
126
- if (error instanceof chunk2ZJWWK6D_js.APIError) {
126
+ if (error instanceof chunkE5DH5YEE_js.APIError) {
127
127
  throw error;
128
128
  }
129
- throw new chunk2ZJWWK6D_js.APIError(
129
+ throw new chunkE5DH5YEE_js.APIError(
130
130
  `Failed to check withdrawal approval: ${error instanceof Error ? error.message : String(error)}`,
131
131
  { endpoint: "isWithdrawalSpendApproved", cause: error }
132
132
  );
@@ -138,9 +138,9 @@ async function prepareApproveDepositTokenTxData({
138
138
  approvalAmount,
139
139
  chainId
140
140
  }) {
141
- const normalizedChainId = chunk2ZJWWK6D_js.toChainId(chainId);
141
+ const normalizedChainId = chunkE5DH5YEE_js.toChainId(chainId);
142
142
  try {
143
- const config = await chunkXS4SELWC_js.resolveVault({
143
+ const config = await chunkAUDMOT6F_js.resolveVault({
144
144
  vaultName,
145
145
  assetAddress: depositAsset,
146
146
  chainId: normalizedChainId,
@@ -148,14 +148,14 @@ async function prepareApproveDepositTokenTxData({
148
148
  });
149
149
  const communityCodeDepositorAddress = config.vault.communityCodeDepositorAddress;
150
150
  if (!communityCodeDepositorAddress) {
151
- throw new chunk2ZJWWK6D_js.APIError(
151
+ throw new chunkE5DH5YEE_js.APIError(
152
152
  `Community Code Depositor contract address not configured for vault ${config.id}`,
153
153
  { endpoint: "prepareApproveDepositToken" }
154
154
  );
155
155
  }
156
- const assets = await chunk2ZJWWK6D_js.getSupportedAssets({ address: depositAsset });
156
+ const assets = await chunkE5DH5YEE_js.getSupportedAssets({ address: depositAsset });
157
157
  if (assets.length === 0) {
158
- throw new chunk2ZJWWK6D_js.APIError(
158
+ throw new chunkE5DH5YEE_js.APIError(
159
159
  `Asset metadata not found for token ${depositAsset} on chain ${normalizedChainId}`,
160
160
  { endpoint: "prepareApproveDepositToken" }
161
161
  );
@@ -164,13 +164,13 @@ async function prepareApproveDepositTokenTxData({
164
164
  (asset) => asset.address.toLowerCase() === depositAsset.toLowerCase() && asset.chains.includes(normalizedChainId)
165
165
  );
166
166
  if (!verifiedAsset) {
167
- throw new chunk2ZJWWK6D_js.APIError(
167
+ throw new chunkE5DH5YEE_js.APIError(
168
168
  `Asset ${depositAsset} not verified on chain ${normalizedChainId}`,
169
169
  { endpoint: "prepareApproveDepositToken" }
170
170
  );
171
171
  }
172
172
  const decimals = verifiedAsset.decimals;
173
- const amount = approvalAmount ? viem.parseUnits(approvalAmount, decimals) : chunk2ZJWWK6D_js.DEFAULT_APPROVAL_AMOUNT;
173
+ const amount = approvalAmount ? viem.parseUnits(approvalAmount, decimals) : chunkE5DH5YEE_js.DEFAULT_APPROVAL_AMOUNT;
174
174
  return {
175
175
  abi: viem.erc20Abi,
176
176
  address: depositAsset,
@@ -178,10 +178,10 @@ async function prepareApproveDepositTokenTxData({
178
178
  args: [communityCodeDepositorAddress, amount]
179
179
  };
180
180
  } catch (error) {
181
- if (error instanceof chunk2ZJWWK6D_js.APIError) {
181
+ if (error instanceof chunkE5DH5YEE_js.APIError) {
182
182
  throw error;
183
183
  }
184
- throw new chunk2ZJWWK6D_js.APIError(
184
+ throw new chunkE5DH5YEE_js.APIError(
185
185
  `Failed to prepare approval transaction: ${error instanceof Error ? error.message : String(error)}`,
186
186
  {
187
187
  endpoint: "prepareApproveDepositToken",
@@ -422,7 +422,7 @@ var CommunityCodeDepositorAbi = [
422
422
 
423
423
  // src/vaults/deposit/utils.ts
424
424
  var calculateMinimumMint = (depositAmount, rate, vaultTokenDecimals, slippage) => {
425
- const slippageValue = slippage ?? chunk2ZJWWK6D_js.DEFAULT_SLIPPAGE_BPS;
425
+ const slippageValue = slippage ?? chunkE5DH5YEE_js.DEFAULT_SLIPPAGE_BPS;
426
426
  const slippageAsBigInt = BigInt(slippageValue) * chunk3I3PYX2F_js.WAD.bigint / BigInt(1e4);
427
427
  const minimumMint = depositAmount * chunk3I3PYX2F_js.WAD.bigint / rate;
428
428
  const slippageAmount = minimumMint * slippageAsBigInt / chunk3I3PYX2F_js.WAD.bigint;
@@ -439,22 +439,22 @@ async function prepareDepositTxData(params) {
439
439
  depositAsset,
440
440
  depositAmount,
441
441
  chainId,
442
- slippage = chunk2ZJWWK6D_js.DEFAULT_SLIPPAGE_BPS,
442
+ slippage = chunkE5DH5YEE_js.DEFAULT_SLIPPAGE_BPS,
443
443
  to,
444
444
  distributorCode
445
445
  } = params;
446
446
  try {
447
- const normalizedChainId = chunk2ZJWWK6D_js.toChainId(chainId);
448
- const vault = await chunkXS4SELWC_js.resolveVault({
447
+ const normalizedChainId = chunkE5DH5YEE_js.toChainId(chainId);
448
+ const vault = await chunkAUDMOT6F_js.resolveVault({
449
449
  vaultName,
450
450
  assetAddress: depositAsset,
451
451
  chainId: normalizedChainId,
452
452
  callerEndpoint: "prepareDepositTransactionData"
453
453
  });
454
- const assets = await chunk2ZJWWK6D_js.getSupportedAssets({ address: depositAsset });
454
+ const assets = await chunkE5DH5YEE_js.getSupportedAssets({ address: depositAsset });
455
455
  const asset = assets.find((a) => a.chains.includes(normalizedChainId)) || assets.find((a) => a.address.toLowerCase() === depositAsset.toLowerCase());
456
456
  if (!asset) {
457
- throw new chunk2ZJWWK6D_js.APIError(
457
+ throw new chunkE5DH5YEE_js.APIError(
458
458
  `Asset metadata not found for token ${depositAsset} on chain ${normalizedChainId}`,
459
459
  {
460
460
  endpoint: "prepareDepositTransactionData"
@@ -463,26 +463,26 @@ async function prepareDepositTxData(params) {
463
463
  }
464
464
  const communityCodeDepositorAddress = vault.vault.communityCodeDepositorAddress;
465
465
  if (!communityCodeDepositorAddress) {
466
- throw new chunk2ZJWWK6D_js.APIError(
466
+ throw new chunkE5DH5YEE_js.APIError(
467
467
  `Community Code Depositor contract address not found for vault ${vault.id}`,
468
468
  { endpoint: "prepareDepositTransactionData" }
469
469
  );
470
470
  }
471
471
  const accountantAddress = vault.vault.accountantAddress;
472
472
  if (!accountantAddress) {
473
- throw new chunk2ZJWWK6D_js.APIError(
473
+ throw new chunkE5DH5YEE_js.APIError(
474
474
  `Accountant contract address not found for vault ${vault.id}`,
475
475
  { endpoint: "prepareDepositTransactionData" }
476
476
  );
477
477
  }
478
478
  const depositAssetAddress = asset.address;
479
- const [depositAssetDecimalsResult, rateInQuoteResult] = await chunkD7EMZAOQ_js.getRateInQuoteWithAssetDecimals({
479
+ const [depositAssetDecimalsResult, rateInQuoteResult] = await chunkYAYUSBC6_js.getRateInQuoteWithAssetDecimals({
480
480
  assetAddress: depositAssetAddress,
481
481
  accountantAddress,
482
482
  chainId: normalizedChainId
483
483
  });
484
484
  if (depositAssetDecimalsResult.status === "failure") {
485
- throw new chunk2ZJWWK6D_js.APIError(
485
+ throw new chunkE5DH5YEE_js.APIError(
486
486
  `Failed to get asset decimals: ${depositAssetDecimalsResult.error?.message || "Unknown error"}`,
487
487
  {
488
488
  endpoint: "prepareDepositTransactionData",
@@ -491,7 +491,7 @@ async function prepareDepositTxData(params) {
491
491
  );
492
492
  }
493
493
  if (rateInQuoteResult.status === "failure") {
494
- throw new chunk2ZJWWK6D_js.APIError(
494
+ throw new chunkE5DH5YEE_js.APIError(
495
495
  `Failed to get exchange rate: ${rateInQuoteResult.error?.message || "Unknown error"}`,
496
496
  {
497
497
  endpoint: "prepareDepositTransactionData",
@@ -510,7 +510,7 @@ async function prepareDepositTxData(params) {
510
510
  slippage
511
511
  );
512
512
  if (!communityCodeDepositorAddress) {
513
- throw new chunk2ZJWWK6D_js.APIError(
513
+ throw new chunkE5DH5YEE_js.APIError(
514
514
  `CommunityCodeDepositor contract address not found for vault ${vault.id}`,
515
515
  { endpoint: "prepareDepositTransactionData" }
516
516
  );
@@ -529,10 +529,10 @@ async function prepareDepositTxData(params) {
529
529
  chainId: normalizedChainId
530
530
  };
531
531
  } catch (error) {
532
- if (error instanceof chunk2ZJWWK6D_js.APIError) {
532
+ if (error instanceof chunkE5DH5YEE_js.APIError) {
533
533
  throw error;
534
534
  }
535
- throw new chunk2ZJWWK6D_js.APIError(
535
+ throw new chunkE5DH5YEE_js.APIError(
536
536
  `Failed to prepare deposit transaction: ${error instanceof Error ? error.message : String(error)}`,
537
537
  {
538
538
  endpoint: "prepareDepositTransactionData",
@@ -588,8 +588,8 @@ async function prepareDepositPermitSignature(params) {
588
588
  tokenVersion: prefetchedTokenVersion
589
589
  } = params;
590
590
  try {
591
- const normalizedChainId = chunk2ZJWWK6D_js.toChainId(chainId);
592
- const vault = await chunkXS4SELWC_js.resolveVault({
591
+ const normalizedChainId = chunkE5DH5YEE_js.toChainId(chainId);
592
+ const vault = await chunkAUDMOT6F_js.resolveVault({
593
593
  vaultName,
594
594
  assetAddress: depositAsset,
595
595
  chainId: normalizedChainId,
@@ -597,7 +597,7 @@ async function prepareDepositPermitSignature(params) {
597
597
  });
598
598
  const communityCodeDepositorAddress = vault.vault.communityCodeDepositorAddress;
599
599
  if (!communityCodeDepositorAddress) {
600
- throw new chunk2ZJWWK6D_js.APIError(
600
+ throw new chunkE5DH5YEE_js.APIError(
601
601
  `CommunityCodeDepositor contract address not found for vault ${vault.id}`,
602
602
  { endpoint: "prepareDepositPermitSignature" }
603
603
  );
@@ -611,24 +611,24 @@ async function prepareDepositPermitSignature(params) {
611
611
  resolvedTokenVersion = prefetchedTokenVersion;
612
612
  resolvedNonce = prefetchedNonce;
613
613
  } else {
614
- const client = await chunk2ZJWWK6D_js.getClient(normalizedChainId);
614
+ const client = await chunkE5DH5YEE_js.getClient(normalizedChainId);
615
615
  try {
616
616
  const [nameResult, versionResult, nonceResult] = await client.multicall(
617
617
  {
618
618
  contracts: [
619
619
  {
620
620
  address: depositAsset,
621
- abi: chunkD7EMZAOQ_js.erc2612Abi,
621
+ abi: chunkYAYUSBC6_js.erc2612Abi,
622
622
  functionName: "name"
623
623
  },
624
624
  {
625
625
  address: depositAsset,
626
- abi: chunkD7EMZAOQ_js.erc2612Abi,
626
+ abi: chunkYAYUSBC6_js.erc2612Abi,
627
627
  functionName: "version"
628
628
  },
629
629
  {
630
630
  address: depositAsset,
631
- abi: chunkD7EMZAOQ_js.erc2612Abi,
631
+ abi: chunkYAYUSBC6_js.erc2612Abi,
632
632
  functionName: "nonces",
633
633
  args: [to]
634
634
  }
@@ -640,7 +640,7 @@ async function prepareDepositPermitSignature(params) {
640
640
  } else if (nameResult.status === "success") {
641
641
  resolvedTokenName = nameResult.result;
642
642
  } else {
643
- throw new chunk2ZJWWK6D_js.APIError(`Failed to read token name from ${depositAsset}`, {
643
+ throw new chunkE5DH5YEE_js.APIError(`Failed to read token name from ${depositAsset}`, {
644
644
  endpoint: "prepareDepositPermitSignature",
645
645
  cause: nameResult.error
646
646
  });
@@ -657,7 +657,7 @@ async function prepareDepositPermitSignature(params) {
657
657
  } else if (nonceResult.status === "success") {
658
658
  resolvedNonce = nonceResult.result;
659
659
  } else {
660
- throw new chunk2ZJWWK6D_js.APIError(
660
+ throw new chunkE5DH5YEE_js.APIError(
661
661
  `Token ${depositAsset} does not support EIP-2612 permit. Missing required function: nonces()`,
662
662
  {
663
663
  endpoint: "prepareDepositPermitSignature",
@@ -666,10 +666,10 @@ async function prepareDepositPermitSignature(params) {
666
666
  );
667
667
  }
668
668
  } catch (error) {
669
- if (error instanceof chunk2ZJWWK6D_js.APIError) {
669
+ if (error instanceof chunkE5DH5YEE_js.APIError) {
670
670
  throw error;
671
671
  }
672
- throw new chunk2ZJWWK6D_js.APIError(
672
+ throw new chunkE5DH5YEE_js.APIError(
673
673
  `Failed to read token metadata: ${error instanceof Error ? error.message : "Unknown error"}`,
674
674
  {
675
675
  endpoint: "prepareDepositPermitSignature",
@@ -683,7 +683,7 @@ async function prepareDepositPermitSignature(params) {
683
683
  if (prefetchedDecimals !== void 0) {
684
684
  resolvedDecimals = prefetchedDecimals;
685
685
  } else {
686
- resolvedDecimals = await chunkD7EMZAOQ_js.getErc20Decimals({
686
+ resolvedDecimals = await chunkYAYUSBC6_js.getErc20Decimals({
687
687
  tokenAddress: depositAsset,
688
688
  chainId: normalizedChainId
689
689
  });
@@ -710,10 +710,10 @@ async function prepareDepositPermitSignature(params) {
710
710
  message
711
711
  };
712
712
  } catch (error) {
713
- if (error instanceof chunk2ZJWWK6D_js.APIError) {
713
+ if (error instanceof chunkE5DH5YEE_js.APIError) {
714
714
  throw error;
715
715
  }
716
- throw new chunk2ZJWWK6D_js.APIError(
716
+ throw new chunkE5DH5YEE_js.APIError(
717
717
  `Failed to prepare permit signature: ${error instanceof Error ? error.message : String(error)}`,
718
718
  {
719
719
  endpoint: "prepareDepositPermitSignature",
@@ -739,7 +739,7 @@ function parsePermitSignature(signature) {
739
739
  s: parsed.s
740
740
  };
741
741
  } catch (error) {
742
- throw new chunk2ZJWWK6D_js.APIError(
742
+ throw new chunkE5DH5YEE_js.APIError(
743
743
  `Invalid permit signature format. Expected hex string but received: ${signature}. ${error instanceof Error ? error.message : "Unknown error"}`,
744
744
  {
745
745
  endpoint: "parsePermitSignature",
@@ -756,34 +756,34 @@ async function prepareDepositWithPermitTxData(params) {
756
756
  chainId,
757
757
  signature,
758
758
  deadline,
759
- slippage = chunk2ZJWWK6D_js.DEFAULT_SLIPPAGE_BPS,
759
+ slippage = chunkE5DH5YEE_js.DEFAULT_SLIPPAGE_BPS,
760
760
  to,
761
761
  distributorCode
762
762
  } = params;
763
763
  try {
764
764
  const { v, r, s } = parsePermitSignature(signature);
765
765
  if (slippage < 0 || slippage > 1e4) {
766
- throw new chunk2ZJWWK6D_js.APIError(
766
+ throw new chunkE5DH5YEE_js.APIError(
767
767
  `Invalid slippage value: ${slippage}. Slippage must be between 0 and 10000 basis points.`,
768
768
  {
769
769
  endpoint: "prepareDepositWithPermitTxData"
770
770
  }
771
771
  );
772
772
  }
773
- const normalizedChainId = chunk2ZJWWK6D_js.toChainId(chainId);
774
- const vault = await chunkXS4SELWC_js.resolveVault({
773
+ const normalizedChainId = chunkE5DH5YEE_js.toChainId(chainId);
774
+ const vault = await chunkAUDMOT6F_js.resolveVault({
775
775
  vaultName,
776
776
  assetAddress: depositAsset,
777
777
  chainId: normalizedChainId,
778
778
  callerEndpoint: "prepareDepositWithPermitTxData"
779
779
  });
780
780
  let asset = null;
781
- const assets = await chunk2ZJWWK6D_js.getSupportedAssets({ address: depositAsset });
781
+ const assets = await chunkE5DH5YEE_js.getSupportedAssets({ address: depositAsset });
782
782
  if (assets.length > 0) {
783
783
  asset = assets.find((a) => a.chains.includes(normalizedChainId)) || assets[0] || null;
784
784
  }
785
785
  if (!asset) {
786
- throw new chunk2ZJWWK6D_js.APIError(
786
+ throw new chunkE5DH5YEE_js.APIError(
787
787
  `Asset metadata not found for token ${depositAsset} on chain ${normalizedChainId}`,
788
788
  {
789
789
  endpoint: "prepareDepositWithPermitTxData"
@@ -791,7 +791,7 @@ async function prepareDepositWithPermitTxData(params) {
791
791
  );
792
792
  }
793
793
  if (!asset.chains || !asset.chains.includes(normalizedChainId)) {
794
- throw new chunk2ZJWWK6D_js.APIError(
794
+ throw new chunkE5DH5YEE_js.APIError(
795
795
  `Token ${asset.symbol || depositAsset} not supported on chain ${normalizedChainId}`,
796
796
  {
797
797
  endpoint: "prepareDepositWithPermitTxData"
@@ -802,25 +802,25 @@ async function prepareDepositWithPermitTxData(params) {
802
802
  const accountantAddress = vault.vault.accountantAddress;
803
803
  const depositAssetAddress = depositAsset;
804
804
  if (!communityCodeDepositorAddress) {
805
- throw new chunk2ZJWWK6D_js.APIError(
805
+ throw new chunkE5DH5YEE_js.APIError(
806
806
  `CommunityCodeDepositor contract address not found for vault ${vault.id}`,
807
807
  { endpoint: "prepareDepositWithPermitTxData" }
808
808
  );
809
809
  }
810
810
  if (!accountantAddress) {
811
- throw new chunk2ZJWWK6D_js.APIError(
811
+ throw new chunkE5DH5YEE_js.APIError(
812
812
  `Accountant contract address not found for vault ${vault.id}`,
813
813
  { endpoint: "prepareDepositWithPermitTxData" }
814
814
  );
815
815
  }
816
- const rateAndDecimalResults = await chunkD7EMZAOQ_js.getRateInQuoteWithAssetDecimals({
816
+ const rateAndDecimalResults = await chunkYAYUSBC6_js.getRateInQuoteWithAssetDecimals({
817
817
  assetAddress: depositAssetAddress,
818
818
  accountantAddress,
819
819
  chainId: normalizedChainId
820
820
  });
821
821
  const [depositAssetDecimalsResult, rateInQuoteResult] = rateAndDecimalResults;
822
822
  if (depositAssetDecimalsResult.status === "failure") {
823
- throw new chunk2ZJWWK6D_js.APIError(
823
+ throw new chunkE5DH5YEE_js.APIError(
824
824
  `Failed to get asset decimals: ${depositAssetDecimalsResult.error?.message || "Unknown error"}`,
825
825
  {
826
826
  endpoint: "prepareDepositWithPermitTxData",
@@ -829,7 +829,7 @@ async function prepareDepositWithPermitTxData(params) {
829
829
  );
830
830
  }
831
831
  if (rateInQuoteResult.status === "failure") {
832
- throw new chunk2ZJWWK6D_js.APIError(
832
+ throw new chunkE5DH5YEE_js.APIError(
833
833
  `Failed to get exchange rate: ${rateInQuoteResult.error?.message || "Unknown error"}`,
834
834
  {
835
835
  endpoint: "prepareDepositWithPermitTxData",
@@ -868,10 +868,10 @@ async function prepareDepositWithPermitTxData(params) {
868
868
  chainId: normalizedChainId
869
869
  };
870
870
  } catch (error) {
871
- if (error instanceof chunk2ZJWWK6D_js.APIError) {
871
+ if (error instanceof chunkE5DH5YEE_js.APIError) {
872
872
  throw error;
873
873
  }
874
- throw new chunk2ZJWWK6D_js.APIError(
874
+ throw new chunkE5DH5YEE_js.APIError(
875
875
  `Failed to prepare deposit with permit transaction: ${error instanceof Error ? error.message : String(error)}`,
876
876
  {
877
877
  endpoint: "prepareDepositWithPermitTxData",
@@ -883,7 +883,7 @@ async function prepareDepositWithPermitTxData(params) {
883
883
 
884
884
  // src/utils/wallet.ts
885
885
  async function isSmartContractWallet(address, chainId) {
886
- const client = await chunk2ZJWWK6D_js.getClient(chainId);
886
+ const client = await chunkE5DH5YEE_js.getClient(chainId);
887
887
  const code = await client.getCode({ address });
888
888
  return !!code && code !== "0x";
889
889
  }
@@ -914,8 +914,8 @@ async function prepareDepositAuthorization(params) {
914
914
  forceMethod
915
915
  } = params;
916
916
  try {
917
- const normalizedChainId = chunk2ZJWWK6D_js.toChainId(chainId);
918
- const vault = await chunkXS4SELWC_js.resolveVault({
917
+ const normalizedChainId = chunkE5DH5YEE_js.toChainId(chainId);
918
+ const vault = await chunkAUDMOT6F_js.resolveVault({
919
919
  vaultName,
920
920
  assetAddress: depositAsset,
921
921
  chainId: normalizedChainId,
@@ -1017,10 +1017,10 @@ async function prepareDepositAuthorization(params) {
1017
1017
  txData
1018
1018
  };
1019
1019
  } catch (error) {
1020
- if (error instanceof chunk2ZJWWK6D_js.APIError) {
1020
+ if (error instanceof chunkE5DH5YEE_js.APIError) {
1021
1021
  throw error;
1022
1022
  }
1023
- throw new chunk2ZJWWK6D_js.APIError(
1023
+ throw new chunkE5DH5YEE_js.APIError(
1024
1024
  `Failed to prepare deposit authorization: ${error instanceof Error ? error.message : String(error)}`,
1025
1025
  {
1026
1026
  endpoint: "prepareDepositAuthorization",
@@ -1044,7 +1044,7 @@ async function prepareDeposit(params) {
1044
1044
  } = params;
1045
1045
  try {
1046
1046
  if (forceMethod === "permit" && (!signature || deadline === void 0)) {
1047
- throw new chunk2ZJWWK6D_js.APIError(
1047
+ throw new chunkE5DH5YEE_js.APIError(
1048
1048
  "Permit deposit requires both signature and deadline parameters when forceMethod is 'permit'",
1049
1049
  { endpoint: "prepareDeposit" }
1050
1050
  );
@@ -1052,7 +1052,7 @@ async function prepareDeposit(params) {
1052
1052
  const usePermit = forceMethod === "permit" || forceMethod !== "approval" && signature !== void 0 && deadline !== void 0;
1053
1053
  if (usePermit) {
1054
1054
  if (!signature || deadline === void 0) {
1055
- throw new chunk2ZJWWK6D_js.APIError(
1055
+ throw new chunkE5DH5YEE_js.APIError(
1056
1056
  "Permit deposit requires both signature and deadline parameters",
1057
1057
  { endpoint: "prepareDeposit" }
1058
1058
  );
@@ -1087,10 +1087,10 @@ async function prepareDeposit(params) {
1087
1087
  txData
1088
1088
  };
1089
1089
  } catch (error) {
1090
- if (error instanceof chunk2ZJWWK6D_js.APIError) {
1090
+ if (error instanceof chunkE5DH5YEE_js.APIError) {
1091
1091
  throw error;
1092
1092
  }
1093
- throw new chunk2ZJWWK6D_js.APIError(
1093
+ throw new chunkE5DH5YEE_js.APIError(
1094
1094
  `Failed to prepare deposit: ${error instanceof Error ? error.message : String(error)}`,
1095
1095
  {
1096
1096
  endpoint: "prepareDeposit",
@@ -1107,43 +1107,43 @@ async function prepareApproveWithdrawOrderTxData({
1107
1107
  shareDecimals
1108
1108
  }) {
1109
1109
  try {
1110
- const normalizedChainId = chunk2ZJWWK6D_js.toChainId(chainId);
1111
- const config = await chunkXS4SELWC_js.resolveVault({
1110
+ const normalizedChainId = chunkE5DH5YEE_js.toChainId(chainId);
1111
+ const config = await chunkAUDMOT6F_js.resolveVault({
1112
1112
  vaultName,
1113
1113
  assetAddress: wantAssetAddress,
1114
1114
  chainId: normalizedChainId,
1115
1115
  callerEndpoint: "prepareApproveWithdrawOrderTxData"
1116
1116
  });
1117
1117
  if (!config.vault.boringVaultAddress) {
1118
- throw new chunk2ZJWWK6D_js.APIError(
1118
+ throw new chunkE5DH5YEE_js.APIError(
1119
1119
  `BoringVault contract address not configured for vault ${config.id}`,
1120
1120
  { endpoint: "prepareApproveWithdrawOrderTxData" }
1121
1121
  );
1122
1122
  }
1123
1123
  if (!config.vault.withdrawQueueAddress) {
1124
- throw new chunk2ZJWWK6D_js.APIError(
1124
+ throw new chunkE5DH5YEE_js.APIError(
1125
1125
  `WithdrawQueue contract address not configured for vault ${config.id}`,
1126
1126
  { endpoint: "prepareApproveWithdrawOrderTxData" }
1127
1127
  );
1128
1128
  }
1129
1129
  const boringVaultAddress = config.vault.boringVaultAddress;
1130
1130
  const withdrawQueueAddress = config.vault.withdrawQueueAddress;
1131
- const decimals = shareDecimals ?? await chunkD7EMZAOQ_js.getErc20Decimals({
1131
+ const decimals = shareDecimals ?? await chunkYAYUSBC6_js.getErc20Decimals({
1132
1132
  tokenAddress: boringVaultAddress,
1133
1133
  chainId: normalizedChainId
1134
1134
  });
1135
- const withdrawAmountAsBigInt = withdrawAmount ? viem.parseUnits(withdrawAmount, decimals) : chunk2ZJWWK6D_js.DEFAULT_APPROVAL_AMOUNT;
1135
+ const withdrawAmountAsBigInt = withdrawAmount ? viem.parseUnits(withdrawAmount, decimals) : chunkE5DH5YEE_js.DEFAULT_APPROVAL_AMOUNT;
1136
1136
  return {
1137
- abi: chunkD7EMZAOQ_js.BoringVaultAbi,
1137
+ abi: chunkYAYUSBC6_js.BoringVaultAbi,
1138
1138
  address: boringVaultAddress,
1139
1139
  functionName: "approve",
1140
1140
  args: [withdrawQueueAddress, withdrawAmountAsBigInt]
1141
1141
  };
1142
1142
  } catch (error) {
1143
- if (error instanceof chunk2ZJWWK6D_js.APIError) {
1143
+ if (error instanceof chunkE5DH5YEE_js.APIError) {
1144
1144
  throw error;
1145
1145
  }
1146
- throw new chunk2ZJWWK6D_js.APIError(
1146
+ throw new chunkE5DH5YEE_js.APIError(
1147
1147
  `Failed to prepare approval transaction: ${error instanceof Error ? error.message : String(error)}`,
1148
1148
  {
1149
1149
  endpoint: "prepareApproveWithdrawOrderTxData",
@@ -1161,37 +1161,37 @@ var prepareCancelWithdrawOrderTxData = async ({
1161
1161
  orderIndex
1162
1162
  }) => {
1163
1163
  try {
1164
- const normalizedChainId = chunk2ZJWWK6D_js.toChainId(chainId);
1165
- const config = await chunkXS4SELWC_js.resolveVault({
1164
+ const normalizedChainId = chunkE5DH5YEE_js.toChainId(chainId);
1165
+ const config = await chunkAUDMOT6F_js.resolveVault({
1166
1166
  vaultName,
1167
1167
  assetAddress: wantAsset,
1168
1168
  chainId: normalizedChainId,
1169
1169
  callerEndpoint: "prepareCancelWithdrawOrderTxData"
1170
1170
  });
1171
1171
  if (config.chainId !== normalizedChainId) {
1172
- throw new chunk2ZJWWK6D_js.APIError(
1172
+ throw new chunkE5DH5YEE_js.APIError(
1173
1173
  `Vault chain mismatch: vault is on chain ${config.chainId}, requested chain ${normalizedChainId}`,
1174
1174
  { endpoint: "prepareCancelWithdrawOrderTxData" }
1175
1175
  );
1176
1176
  }
1177
1177
  if (!config.vault.withdrawQueueAddress) {
1178
- throw new chunk2ZJWWK6D_js.APIError(
1178
+ throw new chunkE5DH5YEE_js.APIError(
1179
1179
  `WithdrawQueue contract address not configured for vault ${config.id}`,
1180
1180
  { endpoint: "prepareCancelWithdrawOrderTxData" }
1181
1181
  );
1182
1182
  }
1183
1183
  return {
1184
- abi: chunkXS4SELWC_js.WithdrawQueueAbi,
1184
+ abi: chunkAUDMOT6F_js.WithdrawQueueAbi,
1185
1185
  address: config.vault.withdrawQueueAddress,
1186
1186
  functionName: "cancelOrder",
1187
1187
  args: [orderIndex],
1188
1188
  chainId: normalizedChainId
1189
1189
  };
1190
1190
  } catch (error) {
1191
- if (error instanceof chunk2ZJWWK6D_js.APIError) {
1191
+ if (error instanceof chunkE5DH5YEE_js.APIError) {
1192
1192
  throw error;
1193
1193
  }
1194
- throw new chunk2ZJWWK6D_js.APIError(
1194
+ throw new chunkE5DH5YEE_js.APIError(
1195
1195
  `Failed to prepare cancel order transaction: ${error instanceof Error ? error.message : String(error)}`,
1196
1196
  {
1197
1197
  endpoint: "prepareCancelWithdrawOrderTxData",
@@ -1220,38 +1220,38 @@ var prepareWithdrawOrderTxData = async ({
1220
1220
  amountOffer
1221
1221
  }) => {
1222
1222
  try {
1223
- const normalizedChainId = chunk2ZJWWK6D_js.toChainId(chainId);
1224
- const config = await chunkXS4SELWC_js.resolveVault({
1223
+ const normalizedChainId = chunkE5DH5YEE_js.toChainId(chainId);
1224
+ const config = await chunkAUDMOT6F_js.resolveVault({
1225
1225
  vaultName,
1226
1226
  assetAddress: wantAsset,
1227
1227
  chainId: normalizedChainId,
1228
1228
  callerEndpoint: "prepareWithdrawOrderTxData"
1229
1229
  });
1230
1230
  if (config.chainId !== normalizedChainId) {
1231
- throw new chunk2ZJWWK6D_js.APIError(
1231
+ throw new chunkE5DH5YEE_js.APIError(
1232
1232
  `Vault chain mismatch: vault is on chain ${config.chainId}, requested chain ${normalizedChainId}`,
1233
1233
  { endpoint: "prepareWithdrawOrderTxData" }
1234
1234
  );
1235
1235
  }
1236
1236
  if (!config.vault.withdrawQueueAddress) {
1237
- throw new chunk2ZJWWK6D_js.APIError(
1237
+ throw new chunkE5DH5YEE_js.APIError(
1238
1238
  `WithdrawQueue contract address not configured for vault ${config.id}`,
1239
1239
  { endpoint: "prepareWithdrawOrderTxData" }
1240
1240
  );
1241
1241
  }
1242
1242
  if (!config.vault.boringVaultAddress) {
1243
- throw new chunk2ZJWWK6D_js.APIError(
1243
+ throw new chunkE5DH5YEE_js.APIError(
1244
1244
  `BoringVault contract address not configured for vault ${config.id}`,
1245
1245
  { endpoint: "prepareWithdrawOrderTxData" }
1246
1246
  );
1247
1247
  }
1248
- const sharesDecimals = await chunkD7EMZAOQ_js.getErc20Decimals({
1248
+ const sharesDecimals = await chunkYAYUSBC6_js.getErc20Decimals({
1249
1249
  tokenAddress: config.vault.boringVaultAddress,
1250
1250
  chainId: normalizedChainId
1251
1251
  });
1252
1252
  const formattedAmountOffer = viem.parseUnits(amountOffer, sharesDecimals);
1253
1253
  return {
1254
- abi: chunkXS4SELWC_js.WithdrawQueueAbi,
1254
+ abi: chunkAUDMOT6F_js.WithdrawQueueAbi,
1255
1255
  address: config.vault.withdrawQueueAddress,
1256
1256
  functionName: "submitOrder",
1257
1257
  args: [
@@ -1267,10 +1267,10 @@ var prepareWithdrawOrderTxData = async ({
1267
1267
  chainId: normalizedChainId
1268
1268
  };
1269
1269
  } catch (error) {
1270
- if (error instanceof chunk2ZJWWK6D_js.APIError) {
1270
+ if (error instanceof chunkE5DH5YEE_js.APIError) {
1271
1271
  throw error;
1272
1272
  }
1273
- throw new chunk2ZJWWK6D_js.APIError(
1273
+ throw new chunkE5DH5YEE_js.APIError(
1274
1274
  `Failed to prepare withdraw order transaction: ${error instanceof Error ? error.message : String(error)}`,
1275
1275
  {
1276
1276
  endpoint: "prepareWithdrawOrderTxData",
@@ -1300,10 +1300,10 @@ async function prepareWithdrawal(params) {
1300
1300
  amountOffer: withdrawAmount
1301
1301
  });
1302
1302
  } catch (error) {
1303
- if (error instanceof chunk2ZJWWK6D_js.APIError) {
1303
+ if (error instanceof chunkE5DH5YEE_js.APIError) {
1304
1304
  throw error;
1305
1305
  }
1306
- throw new chunk2ZJWWK6D_js.APIError(
1306
+ throw new chunkE5DH5YEE_js.APIError(
1307
1307
  `Failed to prepare withdrawal: ${error instanceof Error ? error.message : String(error)}`,
1308
1308
  {
1309
1309
  endpoint: "prepareWithdrawal",
@@ -1322,8 +1322,8 @@ async function prepareWithdrawalAuthorization(params) {
1322
1322
  forceMethod
1323
1323
  } = params;
1324
1324
  try {
1325
- const normalizedChainId = chunk2ZJWWK6D_js.toChainId(chainId);
1326
- const vault = await chunkXS4SELWC_js.resolveVault({
1325
+ const normalizedChainId = chunkE5DH5YEE_js.toChainId(chainId);
1326
+ const vault = await chunkAUDMOT6F_js.resolveVault({
1327
1327
  vaultName,
1328
1328
  assetAddress: wantAsset,
1329
1329
  chainId: normalizedChainId,
@@ -1366,7 +1366,7 @@ async function prepareWithdrawalAuthorization(params) {
1366
1366
  recipientAddress: userAddress
1367
1367
  });
1368
1368
  if (approvalInfo.error) {
1369
- throw new chunk2ZJWWK6D_js.APIError(
1369
+ throw new chunkE5DH5YEE_js.APIError(
1370
1370
  `Failed to check withdrawal approval: ${approvalInfo.error}`,
1371
1371
  { endpoint: "prepareWithdrawalAuthorization" }
1372
1372
  );
@@ -1395,10 +1395,10 @@ async function prepareWithdrawalAuthorization(params) {
1395
1395
  txData
1396
1396
  };
1397
1397
  } catch (error) {
1398
- if (error instanceof chunk2ZJWWK6D_js.APIError) {
1398
+ if (error instanceof chunkE5DH5YEE_js.APIError) {
1399
1399
  throw error;
1400
1400
  }
1401
- throw new chunk2ZJWWK6D_js.APIError(
1401
+ throw new chunkE5DH5YEE_js.APIError(
1402
1402
  `Failed to prepare withdrawal authorization: ${error instanceof Error ? error.message : String(error)}`,
1403
1403
  {
1404
1404
  endpoint: "prepareWithdrawalAuthorization",
@@ -1431,5 +1431,5 @@ exports.prepareWithdrawOrderTxData = prepareWithdrawOrderTxData;
1431
1431
  exports.prepareWithdrawal = prepareWithdrawal;
1432
1432
  exports.prepareWithdrawalAuthorization = prepareWithdrawalAuthorization;
1433
1433
  exports.toEthSignTypedDataV4 = toEthSignTypedDataV4;
1434
- //# sourceMappingURL=chunk-KTLGSVD6.js.map
1435
- //# sourceMappingURL=chunk-KTLGSVD6.js.map
1434
+ //# sourceMappingURL=chunk-L5XT67QZ.js.map
1435
+ //# sourceMappingURL=chunk-L5XT67QZ.js.map