@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.mjs CHANGED
@@ -1,13 +1,13 @@
1
1
  import { DEFAULT_SLIPPAGE_BPS } from './chunk-XXHRCCZS.mjs';
2
2
  export { YieldType } from './chunk-XXHRCCZS.mjs';
3
- export { getDepositExchangeRate, getWithdrawExchangeRate, isDepositSpendApproved, isWithdrawalSpendApproved } from './chunk-GE2VQUPP.mjs';
4
- import { getRateInQuoteWithAssetDecimals, TellerAbi, getClient, BoringVaultAbi, getRateInQuoteAndSharesAndWantAssetDecimals } from './chunk-ZZBZIDZP.mjs';
3
+ export { getDepositExchangeRate, getWithdrawExchangeRate, isDepositSpendApproved, isWithdrawalSpendApproved } from './chunk-GBWBO6ZF.mjs';
4
+ import { getRateInQuoteWithAssetDecimals, TellerAbi, getClient, BoringVaultAbi, getRateInQuoteAndSharesAndWantAssetDecimals } from './chunk-YP2TR5RP.mjs';
5
5
  import './chunk-R663BFAZ.mjs';
6
6
  import { toChainId } from './chunk-J3662HYT.mjs';
7
- import { calculateDeadline } from './chunk-SIR2TCAR.mjs';
7
+ import { calculateDeadline } from './chunk-OPOYGPSS.mjs';
8
8
  import { WAD } from './chunk-7RWWVUHP.mjs';
9
- import { findVaultByConfig, APIError, getAssetsFromCache, DEFAULT_APPROVAL_AMOUNT, fetchSupportedAssets, ATOMIC_QUEUE_CONTRACT_ADDRESS, DEFAULT_DEADLINE } from './chunk-ISO6Z7LD.mjs';
10
- export { APIError, fetchSupportedAssets, fetchVaults, findVaultByConfig, getAssetsFromCache, getCache, getWithdrawSupportedAssets, initAmplifySDK, initializeCache, refreshVaultCache } from './chunk-ISO6Z7LD.mjs';
9
+ import { findVaultByConfig, APIError, getAssetsFromCache, DEFAULT_APPROVAL_AMOUNT, fetchSupportedAssets, ATOMIC_QUEUE_CONTRACT_ADDRESS, DEFAULT_DEADLINE } from './chunk-WFCHKDDG.mjs';
10
+ export { APIError, fetchSupportedAssets, fetchVaults, findVaultByConfig, getAssetsFromCache, getCache, getWithdrawSupportedAssets, initAmplifySDK, initializeCache, refreshVaultCache } from './chunk-WFCHKDDG.mjs';
11
11
  import { parseUnits, erc20Abi, hexToSignature } from 'viem';
12
12
 
13
13
  async function prepareApproveDepositTokenTxData({
@@ -423,6 +423,14 @@ async function prepareDepositWithPermitTransactionData(params) {
423
423
  deadline,
424
424
  slippage = 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) {
@@ -434,13 +442,16 @@ async function prepareDepositWithPermitTransactionData(params) {
434
442
  );
435
443
  }
436
444
  const normalizedChainId = toChainId(chainId);
445
+ console.log("[Amplify SDK] Normalized chainId:", normalizedChainId);
437
446
  let vault;
438
447
  try {
448
+ console.log("[Amplify SDK] Resolving vault with findVaultByConfig...");
439
449
  vault = await 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
456
  throw new APIError(
446
457
  `Failed to resolve vault for token ${depositToken} with yield type ${yieldType} on chain ${normalizedChainId}: ${error instanceof Error ? error.message : "Unknown error"}`,
@@ -458,8 +469,10 @@ async function prepareDepositWithPermitTransactionData(params) {
458
469
  }
459
470
  );
460
471
  }
472
+ console.log("[Amplify SDK] Fetching supported assets for depositToken:", depositToken);
461
473
  let asset = null;
462
474
  const assets = await 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
  }
@@ -482,11 +495,21 @@ async function prepareDepositWithPermitTransactionData(params) {
482
495
  const tellerAddress = vault.vault.tellerAddress;
483
496
  const accountantAddress = vault.vault.accountantAddress;
484
497
  const depositAssetAddress = asset.address;
498
+ console.log("[Amplify SDK] Contract addresses:", {
499
+ tellerAddress,
500
+ accountantAddress,
501
+ depositAssetAddress
502
+ });
503
+ console.log("[Amplify SDK] Calling getRateInQuoteWithAssetDecimals...");
485
504
  const [depositAssetDecimalsResult, rateInQuoteResult] = await 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
514
  throw new APIError(
492
515
  `Failed to get asset decimals: ${depositAssetDecimalsResult.error?.message || "Unknown error"}`,
@@ -506,21 +529,31 @@ async function prepareDepositWithPermitTransactionData(params) {
506
529
  );
507
530
  }
508
531
  const depositAmountAsBigInt = parseUnits(depositAmount, asset.decimals);
532
+ console.log("[Amplify SDK] Fetching vault shares asset:", vault.vault.boringVaultAddress);
509
533
  const vaultSharesAssets = await 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
538
  throw new 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
559
  abi: TellerAbi,