@paxoslabs/amplify-sdk 0.1.1 → 0.2.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/CHANGELOG.md +0 -2
  2. package/README.md +42 -0
  3. package/dist/{chunk-REKEQLQA.mjs → chunk-4ORV7PFT.mjs} +3 -3
  4. package/dist/{chunk-REKEQLQA.mjs.map → chunk-4ORV7PFT.mjs.map} +1 -1
  5. package/dist/{chunk-GS7TDQXA.js → chunk-76SRRIGW.js} +8 -8
  6. package/dist/{chunk-GS7TDQXA.js.map → chunk-76SRRIGW.js.map} +1 -1
  7. package/dist/{chunk-XXHRCCZS.mjs → chunk-AQFFMJX7.mjs} +3 -3
  8. package/dist/chunk-AQFFMJX7.mjs.map +1 -0
  9. package/dist/{chunk-B2QCI6ET.js → chunk-EWJDKRSY.js} +308 -30
  10. package/dist/chunk-EWJDKRSY.js.map +1 -0
  11. package/dist/{chunk-HI44AMLC.mjs → chunk-LJPJWJ2Y.mjs} +24 -19
  12. package/dist/chunk-LJPJWJ2Y.mjs.map +1 -0
  13. package/dist/{chunk-ITB7FXG4.js → chunk-OJOKPBK7.js} +3 -3
  14. package/dist/chunk-OJOKPBK7.js.map +1 -0
  15. package/dist/{chunk-KYR6BFAE.js → chunk-SMIA4ULA.js} +38 -33
  16. package/dist/chunk-SMIA4ULA.js.map +1 -0
  17. package/dist/{chunk-DTFLXAZJ.js → chunk-TF3S7T6P.js} +147 -5
  18. package/dist/chunk-TF3S7T6P.js.map +1 -0
  19. package/dist/{chunk-VIULRHK6.mjs → chunk-UURNMLRT.mjs} +3 -3
  20. package/dist/{chunk-VIULRHK6.mjs.map → chunk-UURNMLRT.mjs.map} +1 -1
  21. package/dist/{chunk-LSNRG5Z2.js → chunk-WWTNCRXX.js} +4 -4
  22. package/dist/{chunk-LSNRG5Z2.js.map → chunk-WWTNCRXX.js.map} +1 -1
  23. package/dist/{chunk-ZILA73XN.mjs → chunk-Y3QNUDV6.mjs} +144 -4
  24. package/dist/chunk-Y3QNUDV6.mjs.map +1 -0
  25. package/dist/{chunk-CUGK4ZBJ.mjs → chunk-YDMFT2R7.mjs} +304 -30
  26. package/dist/chunk-YDMFT2R7.mjs.map +1 -0
  27. package/dist/core.js +16 -16
  28. package/dist/core.js.map +1 -1
  29. package/dist/core.mjs +6 -6
  30. package/dist/core.mjs.map +1 -1
  31. package/dist/display.d.mts +1 -1
  32. package/dist/display.d.ts +1 -1
  33. package/dist/display.js +12 -12
  34. package/dist/display.mjs +4 -4
  35. package/dist/{exchange-rate-BfPH_fQt.d.mts → exchange-rate-DCB2CY9v.d.mts} +5 -0
  36. package/dist/{exchange-rate-Cp1ddpw4.d.ts → exchange-rate-DOmoqut9.d.ts} +5 -0
  37. package/dist/index.d.mts +456 -8
  38. package/dist/index.d.ts +456 -8
  39. package/dist/index.js +402 -215
  40. package/dist/index.js.map +1 -1
  41. package/dist/index.mjs +292 -123
  42. package/dist/index.mjs.map +1 -1
  43. package/dist/utils.js +5 -5
  44. package/dist/utils.mjs +2 -2
  45. package/package.json +2 -1
  46. package/dist/chunk-B2QCI6ET.js.map +0 -1
  47. package/dist/chunk-CUGK4ZBJ.mjs.map +0 -1
  48. package/dist/chunk-DTFLXAZJ.js.map +0 -1
  49. package/dist/chunk-HI44AMLC.mjs.map +0 -1
  50. package/dist/chunk-ITB7FXG4.js.map +0 -1
  51. package/dist/chunk-KYR6BFAE.js.map +0 -1
  52. package/dist/chunk-XXHRCCZS.mjs.map +0 -1
  53. package/dist/chunk-ZILA73XN.mjs.map +0 -1
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { Address, erc20Abi, Hex } from 'viem';
2
2
  import { A as AmplifyVault, S as SupportedAsset, a as AssetFilterOptions, V as VaultFilterOptions, W as WithdrawSupportedAsset } from './amplify-sdk-api-DGRgEybp.js';
3
3
  export { b as APIError } from './amplify-sdk-api-DGRgEybp.js';
4
- export { g as getDepositExchangeRate, a as getWithdrawExchangeRate, i as isDepositSpendApproved, b as isWithdrawalSpendApproved } from './exchange-rate-Cp1ddpw4.js';
4
+ export { g as getDepositExchangeRate, a as getWithdrawExchangeRate, i as isDepositSpendApproved, b as isWithdrawalSpendApproved } from './exchange-rate-DOmoqut9.js';
5
5
  import { Y as YieldType } from './config-B-u3VqEX.js';
6
6
  import { C as ChainId } from './vault-config-BNzhv3QV.js';
7
7
  import './config-BQynVNDC.js';
@@ -375,11 +375,119 @@ declare function findVaultByConfig(params: {
375
375
  */
376
376
  declare function getWithdrawSupportedAssets(): Promise<WithdrawSupportedAsset[]>;
377
377
 
378
+ /**
379
+ * Telemetry Type Definitions
380
+ *
381
+ * Types for SDK telemetry, logging, and PostHog integration.
382
+ */
383
+ /**
384
+ * Log levels for controlling console output
385
+ *
386
+ * @example
387
+ * ```typescript
388
+ * import { LogLevel } from "@paxoslabs/amplify-sdk";
389
+ *
390
+ * // Only show errors (default)
391
+ * await initAmplifySDK(apiKey, { logLevel: LogLevel.ERROR });
392
+ *
393
+ * // Show all logs including debug
394
+ * await initAmplifySDK(apiKey, { logLevel: LogLevel.DEBUG });
395
+ * ```
396
+ */
397
+ declare const LogLevel: {
398
+ readonly DEBUG: 0;
399
+ readonly INFO: 1;
400
+ readonly WARN: 2;
401
+ readonly ERROR: 3;
402
+ readonly NONE: 4;
403
+ };
404
+ type LogLevel = (typeof LogLevel)[keyof typeof LogLevel];
405
+ /**
406
+ * Logger interface for consumer use
407
+ *
408
+ * Implement this interface to provide a custom logger.
409
+ * All methods receive a message and optional context object.
410
+ *
411
+ * @example
412
+ * ```typescript
413
+ * import { setLogger, Logger } from "@paxoslabs/amplify-sdk";
414
+ *
415
+ * const customLogger: Logger = {
416
+ * debug: (msg, ctx) => console.debug(`[MyApp] ${msg}`, ctx),
417
+ * info: (msg, ctx) => console.info(`[MyApp] ${msg}`, ctx),
418
+ * warn: (msg, ctx) => console.warn(`[MyApp] ${msg}`, ctx),
419
+ * error: (msg, ctx) => console.error(`[MyApp] ${msg}`, ctx),
420
+ * };
421
+ *
422
+ * setLogger(customLogger);
423
+ * ```
424
+ */
425
+ interface Logger {
426
+ /**
427
+ * Log debug message (verbose, development only)
428
+ */
429
+ debug(message: string, context?: Record<string, unknown>): void;
430
+ /**
431
+ * Log informational message
432
+ */
433
+ info(message: string, context?: Record<string, unknown>): void;
434
+ /**
435
+ * Log warning message
436
+ */
437
+ warn(message: string, context?: Record<string, unknown>): void;
438
+ /**
439
+ * Log error message
440
+ */
441
+ error(message: string, context?: Record<string, unknown>): void;
442
+ }
443
+
378
444
  /**
379
445
  * SDK Configuration Types
380
446
  *
381
447
  * Type definitions for SDK initialization and configuration management.
382
448
  */
449
+
450
+ /**
451
+ * SDK Initialization Options
452
+ *
453
+ * Options for configuring SDK behavior during initialization.
454
+ *
455
+ * @example
456
+ * ```typescript
457
+ * // Enable debug logging, disable telemetry
458
+ * await initAmplifySDK(apiKey, {
459
+ * telemetry: false,
460
+ * logLevel: LogLevel.DEBUG,
461
+ * });
462
+ * ```
463
+ */
464
+ interface SDKInitOptions {
465
+ /**
466
+ * Enable or disable telemetry (PostHog error tracking)
467
+ *
468
+ * When enabled (default), errors are tracked to PostHog for
469
+ * proactive monitoring. Disable for privacy or testing.
470
+ *
471
+ * @default true
472
+ */
473
+ telemetry?: boolean;
474
+ /**
475
+ * Console log level
476
+ *
477
+ * Controls which log messages are output to the console.
478
+ * Does not affect telemetry (errors are always tracked if enabled).
479
+ *
480
+ * @default LogLevel.ERROR
481
+ */
482
+ logLevel?: LogLevel;
483
+ /**
484
+ * Custom logger implementation
485
+ *
486
+ * Override the default console logger with a custom implementation.
487
+ * Useful for integrating with existing logging infrastructure.
488
+ */
489
+ logger?: Logger;
490
+ }
383
491
  /**
384
492
  * SDK Configuration State
385
493
  *
@@ -413,6 +521,11 @@ interface SDKConfig {
413
521
  * Allows concurrent calls to wait for same initialization
414
522
  */
415
523
  initPromise: Promise<void> | null;
524
+ /**
525
+ * Whether telemetry is enabled
526
+ * Set during initialization based on options
527
+ */
528
+ telemetryEnabled: boolean;
416
529
  }
417
530
  /**
418
531
  * Request headers for Paxos Labs API
@@ -439,19 +552,100 @@ type InitErrorCode = "INVALID_API_KEY" | "EMPTY_API_KEY" | "AUTH_FAILED" | "NETW
439
552
  * Initialize Amplify SDK with API key
440
553
  *
441
554
  * Validates API key, configures authentication headers, and pre-populates
442
- * the cache with vault and asset data.
555
+ * the cache with vault and asset data. Optionally initializes telemetry
556
+ * for error tracking.
443
557
  *
444
558
  * @param apiKey - API key obtained from Paxos Labs
559
+ * @param options - Optional configuration options
560
+ * @param options.telemetry - Enable/disable telemetry (default: true)
561
+ * @param options.logLevel - Console log level (default: LogLevel.ERROR)
562
+ * @param options.logger - Custom logger implementation
445
563
  * @throws {APIError} If initialization fails
446
564
  *
447
565
  * @example
448
566
  * ```typescript
449
567
  * import { initAmplifySDK } from "@paxoslabs/amplify-sdk";
450
568
  *
569
+ * // Basic initialization (telemetry enabled by default)
451
570
  * await initAmplifySDK("pxl_internal_your_api_key_here");
571
+ *
572
+ * // Disable telemetry
573
+ * await initAmplifySDK("pxl_your_api_key", { telemetry: false });
574
+ *
575
+ * // Enable debug logging
576
+ * await initAmplifySDK("pxl_your_api_key", { logLevel: LogLevel.DEBUG });
452
577
  * ```
453
578
  */
454
- declare function initAmplifySDK(apiKey: string): Promise<void>;
579
+ declare function initAmplifySDK(apiKey: string, options?: SDKInitOptions): Promise<void>;
580
+
581
+ /**
582
+ * Logger Module
583
+ *
584
+ * Provides a consumer-facing logger interface with configurable log levels.
585
+ * Default implementation logs errors only to console.
586
+ */
587
+
588
+ /**
589
+ * Set a custom logger implementation
590
+ *
591
+ * Replace the default console logger with a custom implementation.
592
+ * Useful for integrating with existing logging infrastructure.
593
+ *
594
+ * @param logger - Custom logger implementing the Logger interface
595
+ *
596
+ * @example
597
+ * ```typescript
598
+ * import { setLogger } from "@paxoslabs/amplify-sdk";
599
+ *
600
+ * // Use a custom logger
601
+ * setLogger({
602
+ * debug: (msg, ctx) => winston.debug(msg, ctx),
603
+ * info: (msg, ctx) => winston.info(msg, ctx),
604
+ * warn: (msg, ctx) => winston.warn(msg, ctx),
605
+ * error: (msg, ctx) => winston.error(msg, ctx),
606
+ * });
607
+ * ```
608
+ */
609
+ declare function setLogger(logger: Logger): void;
610
+ /**
611
+ * Get the current logger instance
612
+ *
613
+ * Returns the custom logger if set, otherwise the default console logger.
614
+ *
615
+ * @returns Current logger instance
616
+ *
617
+ * @example
618
+ * ```typescript
619
+ * import { getLogger } from "@paxoslabs/amplify-sdk";
620
+ *
621
+ * const logger = getLogger();
622
+ * logger.info("Processing deposit", { amount: "100" });
623
+ * ```
624
+ */
625
+ declare function getLogger(): Logger;
626
+ /**
627
+ * Set the log level for the default console logger
628
+ *
629
+ * Controls which log messages are output to the console.
630
+ * Has no effect if a custom logger is set.
631
+ *
632
+ * @param level - Minimum log level to output
633
+ *
634
+ * @example
635
+ * ```typescript
636
+ * import { setLogLevel, LogLevel } from "@paxoslabs/amplify-sdk";
637
+ *
638
+ * // Show all logs including debug
639
+ * setLogLevel(LogLevel.DEBUG);
640
+ *
641
+ * // Only show errors (default)
642
+ * setLogLevel(LogLevel.ERROR);
643
+ *
644
+ * // Disable all logging
645
+ * setLogLevel(LogLevel.NONE);
646
+ * ```
647
+ */
648
+ declare function setLogLevel(level: LogLevel): void;
455
649
 
456
650
  /**
457
651
  * @file Approve Asset for deposit functionality for Paxos Labs vaults
@@ -850,11 +1044,12 @@ interface DepositTxData {
850
1044
  * Accepts yieldType, recipientAddress, depositToken, and chainId for automatic vault resolution
851
1045
  * @interface PrepareDepositTxDataParams
852
1046
  * @property {YieldType} yieldType - Yield strategy type (e.g., "PRIME", "TBILL", "LENDING")
853
- * @property {Address} recipientAddress - Ethereum address of the user (recipient of vault shares)
854
- * @property {Address} depositToken - Token contract address to deposit (matches vault's baseTokenAddress)
1047
+ * @property {Address} recipientAddress - Ethereum address of the user. Must be the same as the address used to sign the deposit transaction.
1048
+ * @property {Address} depositToken - Token contract address to deposit. Must be supported by the vault.
855
1049
  * @property {string} depositAmount - Amount of assets to deposit as a decimal string (e.g., "1.5")
856
1050
  * @property {number | string} chainId - ID of the chain where the deposit will occur
857
- * @property {number} [slippage] - Maximum acceptable slippage in basis points (e.g., 100 for 1%)
1051
+ * @property {number} [slippage] - Optional (default is 50 (0.5%)): Maximum acceptable slippage in basis points (e.g., 100 for 1%).
1052
+ * @property {string} [partnerCode] - Optional (default is empty string): Partner code to credit deposit fees to the partner used for the deposit
858
1053
  */
859
1054
  interface PrepareDepositTxDataParams {
860
1055
  yieldType: YieldType;
@@ -880,6 +1075,7 @@ interface PrepareDepositTxDataParams {
880
1075
  * depositAmount: "1.0",
881
1076
  * chainId: 1,
882
1077
  * slippage: 100, // 1% slippage (100 bps)
1078
+ * partnerCode: 'my-partner-code',
883
1079
  * });
884
1080
  * ```
885
1081
  *
@@ -975,6 +1171,10 @@ interface ParsedPermitSignature {
975
1171
  * @property recipientAddress - User address (permit owner)
976
1172
  * @property chainId - Blockchain network ID
977
1173
  * @property deadline - Optional permit expiration (defaults to 1 hour)
1174
+ * @property nonce - Optional pre-fetched nonce (skips RPC call if provided)
1175
+ * @property decimals - Optional pre-fetched token decimals (skips RPC call)
1176
+ * @property tokenName - Optional pre-fetched token name (skips RPC call)
1177
+ * @property tokenVersion - Optional pre-fetched token version (skips RPC call)
978
1178
  */
979
1179
  interface PrepareDepositPermitSignatureParams {
980
1180
  yieldType: YieldType;
@@ -983,6 +1183,14 @@ interface PrepareDepositPermitSignatureParams {
983
1183
  recipientAddress: Address;
984
1184
  chainId: number;
985
1185
  deadline?: bigint;
1186
+ /** Pre-fetched nonce from getTokenPermitInfoWithAllowance */
1187
+ nonce?: bigint;
1188
+ /** Pre-fetched token decimals */
1189
+ decimals?: number;
1190
+ /** Pre-fetched token name for EIP-712 domain */
1191
+ tokenName?: string;
1192
+ /** Pre-fetched token version for EIP-712 domain (defaults to "1") */
1193
+ tokenVersion?: string;
986
1194
  }
987
1195
  /**
988
1196
  * T009: Encoded transaction data for permit deposit
@@ -1070,7 +1278,8 @@ declare function parsePermitSignature(signature: Hex): ParsedPermitSignature;
1070
1278
  * @property {number | ChainId} chainId - ID of the chain where the deposit will occur
1071
1279
  * @property {Hex} signature - Raw hex signature from wallet signing
1072
1280
  * @property {bigint} deadline - Deadline timestamp (must match permit signature deadline)
1073
- * @property {number} [slippage] - Maximum acceptable slippage in basis points (default: 100 for 1%)
1281
+ * @property {number} [slippage] - Optional (default is 50 (0.5%)): Maximum acceptable slippage in basis points (e.g., 100 for 1%).
1282
+ * @property {string} [partnerCode] - Optional (default is empty string): Partner code to credit deposit fees to the partner used for the deposit
1074
1283
  *
1075
1284
  * @example
1076
1285
  * ```typescript
@@ -1086,6 +1295,7 @@ declare function parsePermitSignature(signature: Hex): ParsedPermitSignature;
1086
1295
  * signature,
1087
1296
  * deadline: permitData.message.deadline,
1088
1297
  * slippage: 100, // 1%
1298
+ * partnerCode: "my-partner-code",
1089
1299
  * };
1090
1300
  * ```
1091
1301
  */
@@ -1120,6 +1330,244 @@ interface PrepareDepositWithPermitTxDataParams {
1120
1330
  */
1121
1331
  declare function prepareDepositWithPermitTxData(params: PrepareDepositWithPermitTxDataParams): Promise<UnencodedDepositWithPermitData>;
1122
1332
 
1333
+ /**
1334
+ * @file Unified deposit module with wrapper functions
1335
+ * @module vaults/deposit
1336
+ *
1337
+ * Provides high-level wrapper functions for deposit authorization and execution:
1338
+ * - `prepareDepositAuthorization`: Determines optimal authorization method (permit/approval)
1339
+ * - `prepareDeposit`: Unified deposit preparation with automatic routing
1340
+ */
1341
+
1342
+ /**
1343
+ * Authorization methods for deposit operations
1344
+ *
1345
+ * Extensible const object for current and future authorization mechanisms:
1346
+ * - PERMIT: EIP-2612 off-chain signature (gas efficient, single transaction)
1347
+ * - APPROVAL: Traditional ERC20 approval (two transactions)
1348
+ * - ALREADY_APPROVED: Existing allowance is sufficient (no action needed)
1349
+ *
1350
+ * @example
1351
+ * ```typescript
1352
+ * import { DepositAuthMethod } from "@paxoslabs/amplify-sdk";
1353
+ *
1354
+ * if (result.method === DepositAuthMethod.PERMIT) {
1355
+ * // Handle permit flow
1356
+ * }
1357
+ * ```
1358
+ */
1359
+ declare const DepositAuthMethod: {
1360
+ readonly PERMIT: "permit";
1361
+ readonly APPROVAL: "approval";
1362
+ readonly ALREADY_APPROVED: "already_approved";
1363
+ };
1364
+ type DepositAuthMethod = (typeof DepositAuthMethod)[keyof typeof DepositAuthMethod];
1365
+ /**
1366
+ * Permit authorization result
1367
+ * Returned when token supports EIP-2612 permit
1368
+ */
1369
+ interface PermitAuthorizationResult {
1370
+ method: typeof DepositAuthMethod.PERMIT;
1371
+ /** EIP-712 typed data ready for wallet signing */
1372
+ permitData: PermitSignatureData;
1373
+ }
1374
+ /**
1375
+ * Approval authorization result
1376
+ * Returned when an ERC20 approval transaction is needed
1377
+ */
1378
+ interface ApprovalAuthorizationResult {
1379
+ method: typeof DepositAuthMethod.APPROVAL;
1380
+ /** Transaction data for ERC20 approve() call */
1381
+ txData: ApproveDepositTokenTxData;
1382
+ /** Current allowance (human-readable) */
1383
+ currentAllowance: string;
1384
+ /** Current allowance as BigInt string */
1385
+ currentAllowanceAsBigInt: string;
1386
+ }
1387
+ /**
1388
+ * Already approved authorization result
1389
+ * Returned when existing allowance is sufficient for the deposit
1390
+ */
1391
+ interface AlreadyApprovedAuthorizationResult {
1392
+ method: typeof DepositAuthMethod.ALREADY_APPROVED;
1393
+ /** Current allowance (human-readable) */
1394
+ allowance: string;
1395
+ /** Current allowance as BigInt string */
1396
+ allowanceAsBigInt: string;
1397
+ }
1398
+ /**
1399
+ * Discriminated union of all authorization result types
1400
+ *
1401
+ * Use type narrowing with `result.method` to access specific fields:
1402
+ *
1403
+ * @example
1404
+ * ```typescript
1405
+ * const result = await prepareDepositAuthorization({...});
1406
+ *
1407
+ * switch (result.method) {
1408
+ * case DepositAuthMethod.PERMIT:
1409
+ * // TypeScript knows result.permitData exists
1410
+ * const signature = await signTypedData(result.permitData);
1411
+ * break;
1412
+ * case DepositAuthMethod.APPROVAL:
1413
+ * // TypeScript knows result.txData exists
1414
+ * await writeContract(result.txData);
1415
+ * break;
1416
+ * case DepositAuthMethod.ALREADY_APPROVED:
1417
+ * // TypeScript knows result.allowance exists
1418
+ * console.log(`Already approved: ${result.allowance}`);
1419
+ * break;
1420
+ * }
1421
+ * ```
1422
+ */
1423
+ type DepositAuthorizationResult = PermitAuthorizationResult | ApprovalAuthorizationResult | AlreadyApprovedAuthorizationResult;
1424
+ /**
1425
+ * Parameters for prepareDepositAuthorization
1426
+ */
1427
+ interface PrepareDepositAuthorizationParams {
1428
+ /** Yield strategy type (e.g., "PRIME", "TBILL", "LENDING") */
1429
+ yieldType: YieldType;
1430
+ /** Token contract address to deposit */
1431
+ depositToken: Address;
1432
+ /** Amount of assets to deposit as decimal string (e.g., "100.25") */
1433
+ depositAmount: string;
1434
+ /** User's wallet address (permit owner / approval sender) */
1435
+ recipientAddress: Address;
1436
+ /** Blockchain network ID */
1437
+ chainId: ChainId;
1438
+ /** Optional deadline for permit signature (defaults to 1 hour from now) */
1439
+ deadline?: bigint;
1440
+ /** Force specific authorization method (bypasses automatic detection) */
1441
+ forceMethod?: "permit" | "approval";
1442
+ }
1443
+ /**
1444
+ * Parameters for prepareDeposit
1445
+ * Unified deposit function accepting optional permit signature
1446
+ */
1447
+ interface PrepareDepositParams {
1448
+ /** Yield strategy type (e.g., "PRIME", "TBILL", "LENDING") */
1449
+ yieldType: YieldType;
1450
+ /** Token contract address to deposit */
1451
+ depositToken: Address;
1452
+ /** Amount of assets to deposit as decimal string (e.g., "100.25") */
1453
+ depositAmount: string;
1454
+ /** Recipient address for vault shares */
1455
+ recipientAddress: Address;
1456
+ /** Blockchain network ID */
1457
+ chainId: ChainId;
1458
+ /** Optional slippage in basis points (default: 50 = 0.5%) */
1459
+ slippage?: number;
1460
+ /** Optional partner code for fee attribution */
1461
+ partnerCode?: string;
1462
+ /** Optional permit signature (hex string from wallet signing) */
1463
+ signature?: Hex;
1464
+ /** Optional permit deadline (must match signature deadline) */
1465
+ deadline?: bigint;
1466
+ /** Force deposit method (bypasses automatic routing) */
1467
+ forceMethod?: "permit" | "approval";
1468
+ }
1469
+ /**
1470
+ * Standard deposit result (approval flow)
1471
+ */
1472
+ interface StandardDepositResult {
1473
+ method: typeof DepositAuthMethod.APPROVAL;
1474
+ txData: DepositTxData;
1475
+ }
1476
+ /**
1477
+ * Permit deposit result
1478
+ */
1479
+ interface PermitDepositResult {
1480
+ method: typeof DepositAuthMethod.PERMIT;
1481
+ txData: UnencodedDepositWithPermitData;
1482
+ }
1483
+ /**
1484
+ * Unified deposit result
1485
+ * Returns either standard deposit or permit deposit transaction data
1486
+ */
1487
+ type PrepareDepositResult = StandardDepositResult | PermitDepositResult;
1488
+ /**
1489
+ * Prepares authorization for a deposit operation
1490
+ *
1491
+ * Intelligently determines the best authorization method:
1492
+ * 1. Check if token supports EIP-2612 permit → return permit signature data
1493
+ * 2. Check existing allowance → if sufficient, return "already approved"
1494
+ * 3. Otherwise → return approval transaction data
1495
+ *
1496
+ * Supports force override via `forceMethod` parameter.
1497
+ *
1498
+ * @param params - Authorization parameters
1499
+ * @returns Discriminated union of authorization results
1500
+ * @throws {APIError} If vault not found, chain not supported, or token invalid
1501
+ *
1502
+ * @example
1503
+ * ```typescript
1504
+ * import { prepareDepositAuthorization, DepositAuthMethod } from "@paxoslabs/amplify-sdk";
1505
+ *
1506
+ * const authResult = await prepareDepositAuthorization({
1507
+ * yieldType: "PRIME",
1508
+ * depositToken: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", // USDC
1509
+ * depositAmount: "1000.0",
1510
+ * recipientAddress: "0x1234...",
1511
+ * chainId: 1,
1512
+ * });
1513
+ *
1514
+ * if (authResult.method === DepositAuthMethod.PERMIT) {
1515
+ * const signature = await signTypedData(authResult.permitData);
1516
+ * // Use signature in prepareDeposit
1517
+ * } else if (authResult.method === DepositAuthMethod.APPROVAL) {
1518
+ * await writeContract(authResult.txData);
1519
+ * // Wait for confirmation, then call prepareDeposit
1520
+ * } else {
1521
+ * // Already approved, proceed directly to deposit
1522
+ * console.log(`Approved amount: ${authResult.allowance}`);
1523
+ * }
1524
+ * ```
1525
+ */
1526
+ declare function prepareDepositAuthorization(params: PrepareDepositAuthorizationParams): Promise<DepositAuthorizationResult>;
1527
+ /**
1528
+ * Unified deposit preparation function
1529
+ *
1530
+ * Intelligently routes to permit deposit or standard deposit based on:
1531
+ * 1. Presence of signature/deadline parameters → permit deposit
1532
+ * 2. Force method override → specified method
1533
+ * 3. Otherwise → standard deposit
1534
+ *
1535
+ * @param params - Deposit parameters with optional permit signature
1536
+ * @returns Discriminated union of deposit transaction data
1537
+ * @throws {APIError} If vault not found, invalid signature, or validation fails
1538
+ *
1539
+ * @example
1540
+ * ```typescript
1541
+ * import { prepareDeposit, DepositAuthMethod } from "@paxoslabs/amplify-sdk";
1542
+ *
1543
+ * // Scenario 1: Permit deposit (with signature from prepareDepositAuthorization)
1544
+ * const permitDeposit = await prepareDeposit({
1545
+ * yieldType: "PRIME",
1546
+ * depositToken: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
1547
+ * depositAmount: "1000.0",
1548
+ * recipientAddress: "0x1234...",
1549
+ * chainId: 1,
1550
+ * signature: "0xabc...",
1551
+ * deadline: 1234567890n,
1552
+ * });
1553
+ * // permitDeposit.method === DepositAuthMethod.PERMIT
1554
+ *
1555
+ * // Scenario 2: Standard deposit (after approval)
1556
+ * const standardDeposit = await prepareDeposit({
1557
+ * yieldType: "PRIME",
1558
+ * depositToken: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
1559
+ * depositAmount: "1000.0",
1560
+ * recipientAddress: "0x1234...",
1561
+ * chainId: 1,
1562
+ * });
1563
+ * // standardDeposit.method === DepositAuthMethod.APPROVAL
1564
+ *
1565
+ * // Submit transaction
1566
+ * await writeContract(standardDeposit.txData);
1567
+ * ```
1568
+ */
1569
+ declare function prepareDeposit(params: PrepareDepositParams): Promise<PrepareDepositResult>;
1570
+
1123
1571
  declare const BoringVaultAbi: readonly [{
1124
1572
  readonly type: "constructor";
1125
1573
  readonly inputs: readonly [{
@@ -3557,4 +4005,4 @@ interface WithdrawTxData {
3557
4005
  */
3558
4006
  declare const prepareWithdrawTxData: ({ yieldType, wantAssetAddress, chainId, offerAmount, deadline, slippage, }: PrepareWithdrawTxDataParams) => Promise<WithdrawTxData>;
3559
4007
 
3560
- export { AmplifyVault, type ApproveDepositTokenTxData, type ApproveWithdrawTokenTxData, AssetFilterOptions, type BulkWithdrawTxData, type DepositTxData, type EIP712Domain, type InitErrorCode, PERMIT_TYPES, type ParsedPermitSignature, type PermitSignatureData, type PrepareDepositPermitSignatureParams, type PrepareDepositWithPermitTxDataParams, type RequestHeaders, type SDKConfig, SupportedAsset, type UnencodedDepositWithPermitData, VaultFilterOptions, WithdrawSupportedAsset, type WithdrawTxData, YieldType, fetchSupportedAssets, fetchVaults, findVaultByConfig, getAssetsFromCache, getCache, getWithdrawSupportedAssets, initAmplifySDK, initializeCache, parsePermitSignature, prepareApproveDepositTokenTxData, prepareApproveWithdrawTxData, prepareBulkWithdrawTxData, prepareDepositPermitSignature, prepareDepositTxData, prepareDepositWithPermitTxData, prepareWithdrawTxData, refreshVaultCache };
4008
+ export { type AlreadyApprovedAuthorizationResult, AmplifyVault, type ApprovalAuthorizationResult, type ApproveDepositTokenTxData, type ApproveWithdrawTokenTxData, AssetFilterOptions, type BulkWithdrawTxData, DepositAuthMethod, type DepositAuthorizationResult, type DepositTxData, type EIP712Domain, type InitErrorCode, LogLevel, type Logger, PERMIT_TYPES, type ParsedPermitSignature, type PermitAuthorizationResult, type PermitDepositResult, type PermitSignatureData, type PrepareDepositAuthorizationParams, type PrepareDepositParams, type PrepareDepositPermitSignatureParams, type PrepareDepositResult, type PrepareDepositWithPermitTxDataParams, type RequestHeaders, type SDKConfig, type SDKInitOptions, type StandardDepositResult, SupportedAsset, type UnencodedDepositWithPermitData, VaultFilterOptions, WithdrawSupportedAsset, type WithdrawTxData, YieldType, fetchSupportedAssets, fetchVaults, findVaultByConfig, getAssetsFromCache, getCache, getLogger, getWithdrawSupportedAssets, initAmplifySDK, initializeCache, parsePermitSignature, prepareApproveDepositTokenTxData, prepareApproveWithdrawTxData, prepareBulkWithdrawTxData, prepareDeposit, prepareDepositAuthorization, prepareDepositPermitSignature, prepareDepositTxData, prepareDepositWithPermitTxData, prepareWithdrawTxData, refreshVaultCache, setLogLevel, setLogger };