@alleyboss/micropay-solana-x402-paywall 2.3.1 → 3.0.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 (72) hide show
  1. package/README.md +85 -139
  2. package/dist/agent/index.cjs +1 -2
  3. package/dist/agent/index.cjs.map +1 -1
  4. package/dist/agent/index.d.cts +11 -2
  5. package/dist/agent/index.d.ts +11 -2
  6. package/dist/agent/index.js +1 -2
  7. package/dist/agent/index.js.map +1 -1
  8. package/dist/client/index.cjs +1 -1
  9. package/dist/client/index.cjs.map +1 -1
  10. package/dist/client/index.d.cts +10 -1
  11. package/dist/client/index.d.ts +10 -1
  12. package/dist/client/index.js +1 -1
  13. package/dist/client/index.js.map +1 -1
  14. package/dist/express/index.cjs +79 -0
  15. package/dist/express/index.cjs.map +1 -0
  16. package/dist/express/index.d.cts +40 -0
  17. package/dist/express/index.d.ts +40 -0
  18. package/dist/express/index.js +76 -0
  19. package/dist/express/index.js.map +1 -0
  20. package/dist/index.cjs +257 -1357
  21. package/dist/index.cjs.map +1 -1
  22. package/dist/index.d.cts +6 -12
  23. package/dist/index.d.ts +6 -12
  24. package/dist/index.js +239 -1319
  25. package/dist/index.js.map +1 -1
  26. package/dist/session/index.cjs.map +1 -1
  27. package/dist/session/index.d.cts +1 -1
  28. package/dist/session/index.d.ts +1 -1
  29. package/dist/session/index.js.map +1 -1
  30. package/dist/{session-D2IoWAWV.d.cts → types-BWYQMw03.d.cts} +1 -16
  31. package/dist/{session-D2IoWAWV.d.ts → types-BWYQMw03.d.ts} +1 -16
  32. package/package.json +28 -68
  33. package/dist/client-D-dteoJw.d.cts +0 -63
  34. package/dist/client-DfCIRrNG.d.ts +0 -63
  35. package/dist/memory-Daxkczti.d.cts +0 -29
  36. package/dist/memory-Daxkczti.d.ts +0 -29
  37. package/dist/middleware/index.cjs +0 -273
  38. package/dist/middleware/index.cjs.map +0 -1
  39. package/dist/middleware/index.d.cts +0 -91
  40. package/dist/middleware/index.d.ts +0 -91
  41. package/dist/middleware/index.js +0 -267
  42. package/dist/middleware/index.js.map +0 -1
  43. package/dist/nextjs-BDyOqGAq.d.cts +0 -81
  44. package/dist/nextjs-CbX8_9yK.d.ts +0 -81
  45. package/dist/payment-BGp7eMQl.d.cts +0 -103
  46. package/dist/payment-BGp7eMQl.d.ts +0 -103
  47. package/dist/priority-fees-C-OH4Trr.d.cts +0 -50
  48. package/dist/priority-fees-C-OH4Trr.d.ts +0 -50
  49. package/dist/solana/index.cjs +0 -589
  50. package/dist/solana/index.cjs.map +0 -1
  51. package/dist/solana/index.d.cts +0 -195
  52. package/dist/solana/index.d.ts +0 -195
  53. package/dist/solana/index.js +0 -567
  54. package/dist/solana/index.js.map +0 -1
  55. package/dist/store/index.cjs +0 -99
  56. package/dist/store/index.cjs.map +0 -1
  57. package/dist/store/index.d.cts +0 -38
  58. package/dist/store/index.d.ts +0 -38
  59. package/dist/store/index.js +0 -96
  60. package/dist/store/index.js.map +0 -1
  61. package/dist/utils/index.cjs +0 -68
  62. package/dist/utils/index.cjs.map +0 -1
  63. package/dist/utils/index.d.cts +0 -30
  64. package/dist/utils/index.d.ts +0 -30
  65. package/dist/utils/index.js +0 -65
  66. package/dist/utils/index.js.map +0 -1
  67. package/dist/x402/index.cjs +0 -387
  68. package/dist/x402/index.cjs.map +0 -1
  69. package/dist/x402/index.d.cts +0 -96
  70. package/dist/x402/index.d.ts +0 -96
  71. package/dist/x402/index.js +0 -375
  72. package/dist/x402/index.js.map +0 -1
@@ -1,103 +0,0 @@
1
- /** x402 network identifiers for Solana */
2
- type X402Network = 'solana-devnet' | 'solana-mainnet';
3
- /** Solana network types */
4
- type SolanaNetwork = 'devnet' | 'mainnet-beta';
5
- /** SPL Token asset specification */
6
- interface SPLTokenAsset {
7
- /** Token mint address */
8
- mint: string;
9
- /** Token decimals (default: 6 for USDC/USDT) */
10
- decimals?: number;
11
- }
12
- /** Asset types for payments */
13
- type PaymentAsset = 'native' | 'usdc' | 'usdt' | SPLTokenAsset;
14
- /** Known SPL token mint addresses */
15
- declare const TOKEN_MINTS: {
16
- /** USDC on mainnet */
17
- readonly USDC_MAINNET: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v";
18
- /** USDC on devnet */
19
- readonly USDC_DEVNET: "4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU";
20
- /** USDT on mainnet */
21
- readonly USDT_MAINNET: "Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB";
22
- };
23
- /** Payment requirement for x402 protocol */
24
- interface PaymentRequirement {
25
- /** Payment scheme - currently only 'exact' is supported */
26
- scheme: 'exact';
27
- /** Network identifier for x402 */
28
- network: X402Network;
29
- /** Amount in smallest unit as string (lamports for SOL, base units for tokens) */
30
- maxAmountRequired: string;
31
- /** URL of the protected resource */
32
- resource: string;
33
- /** Human-readable description */
34
- description: string;
35
- /** MIME type of the resource */
36
- mimeType?: string;
37
- /** Recipient wallet address */
38
- payTo: string;
39
- /** Maximum time in seconds to complete payment */
40
- maxTimeoutSeconds: number;
41
- /** Asset type - 'native' for SOL, 'usdc', 'usdt', or custom mint */
42
- asset: PaymentAsset;
43
- /** Additional metadata */
44
- extra?: {
45
- name?: string;
46
- articleId?: string;
47
- [key: string]: unknown;
48
- };
49
- }
50
- /** Payment payload sent by client after transaction */
51
- interface PaymentPayload {
52
- /** x402 protocol version */
53
- x402Version: number;
54
- /** Payment scheme */
55
- scheme: 'exact';
56
- /** Network identifier */
57
- network: X402Network;
58
- /** Transaction details */
59
- payload: {
60
- /** Transaction signature (base58) */
61
- signature: string;
62
- /** Base64 encoded transaction (optional) */
63
- transaction?: string;
64
- };
65
- }
66
- /** Request to verify a payment */
67
- interface VerificationRequest {
68
- paymentPayload: PaymentPayload;
69
- paymentRequirements: PaymentRequirement;
70
- }
71
- /** Response from payment verification */
72
- interface VerificationResponse {
73
- /** Whether the payment is valid */
74
- valid: boolean;
75
- /** Reason for invalid payment */
76
- invalidReason?: string;
77
- /** Whether the transaction is settled on-chain */
78
- settled?: boolean;
79
- /** Sender wallet address (payer) */
80
- from?: string;
81
- /** Transaction details */
82
- transaction?: {
83
- signature: string;
84
- blockTime?: number;
85
- slot?: number;
86
- };
87
- }
88
- /** Payment status for tracking */
89
- interface PaymentStatus {
90
- status: 'pending' | 'confirmed' | 'failed' | 'expired';
91
- signature?: string;
92
- confirmations?: number;
93
- error?: string;
94
- }
95
- /** Configuration for article pricing */
96
- interface ArticlePaymentConfig {
97
- articleId: string;
98
- priceInLamports: bigint;
99
- title: string;
100
- description?: string;
101
- }
102
-
103
- export { type ArticlePaymentConfig as A, type PaymentRequirement as P, type SolanaNetwork as S, TOKEN_MINTS as T, type VerificationRequest as V, type X402Network as X, type PaymentPayload as a, type VerificationResponse as b, type PaymentStatus as c, type PaymentAsset as d, type SPLTokenAsset as e };
@@ -1,50 +0,0 @@
1
- import { TransactionInstruction, Connection, PublicKey } from '@solana/web3.js';
2
-
3
- /** Configuration for priority fees */
4
- interface PriorityFeeConfig {
5
- /** Enable priority fees (default: false) */
6
- enabled?: boolean;
7
- /** Price per compute unit in micro-lamports (default: auto-estimate) */
8
- microLamports?: number;
9
- /** Maximum compute units for transaction (default: 200_000) */
10
- computeUnits?: number;
11
- }
12
- /**
13
- * Create compute budget instructions for priority fees
14
- *
15
- * @example
16
- * ```typescript
17
- * const priorityIxs = createPriorityFeeInstructions({
18
- * enabled: true,
19
- * microLamports: 5000,
20
- * computeUnits: 150_000,
21
- * });
22
- *
23
- * // Add to transaction
24
- * transaction.add(...priorityIxs, ...yourInstructions);
25
- * ```
26
- */
27
- declare function createPriorityFeeInstructions(config?: PriorityFeeConfig): TransactionInstruction[];
28
- /**
29
- * Estimate priority fee based on recent network activity
30
- * Returns micro-lamports per compute unit
31
- *
32
- * @example
33
- * ```typescript
34
- * const fee = await estimatePriorityFee(connection, [recipientPubkey]);
35
- * console.log(`Recommended fee: ${fee} micro-lamports/CU`);
36
- * ```
37
- */
38
- declare function estimatePriorityFee(connection: Connection, accounts?: PublicKey[]): Promise<number>;
39
- /**
40
- * Calculate total priority fee cost in lamports
41
- *
42
- * @example
43
- * ```typescript
44
- * const cost = calculatePriorityFeeCost(5000, 200_000);
45
- * console.log(`Priority fee: ${cost} lamports`);
46
- * ```
47
- */
48
- declare function calculatePriorityFeeCost(microLamportsPerCU: number, computeUnits: number): number;
49
-
50
- export { type PriorityFeeConfig as P, calculatePriorityFeeCost as a, createPriorityFeeInstructions as c, estimatePriorityFee as e };
@@ -1,50 +0,0 @@
1
- import { TransactionInstruction, Connection, PublicKey } from '@solana/web3.js';
2
-
3
- /** Configuration for priority fees */
4
- interface PriorityFeeConfig {
5
- /** Enable priority fees (default: false) */
6
- enabled?: boolean;
7
- /** Price per compute unit in micro-lamports (default: auto-estimate) */
8
- microLamports?: number;
9
- /** Maximum compute units for transaction (default: 200_000) */
10
- computeUnits?: number;
11
- }
12
- /**
13
- * Create compute budget instructions for priority fees
14
- *
15
- * @example
16
- * ```typescript
17
- * const priorityIxs = createPriorityFeeInstructions({
18
- * enabled: true,
19
- * microLamports: 5000,
20
- * computeUnits: 150_000,
21
- * });
22
- *
23
- * // Add to transaction
24
- * transaction.add(...priorityIxs, ...yourInstructions);
25
- * ```
26
- */
27
- declare function createPriorityFeeInstructions(config?: PriorityFeeConfig): TransactionInstruction[];
28
- /**
29
- * Estimate priority fee based on recent network activity
30
- * Returns micro-lamports per compute unit
31
- *
32
- * @example
33
- * ```typescript
34
- * const fee = await estimatePriorityFee(connection, [recipientPubkey]);
35
- * console.log(`Recommended fee: ${fee} micro-lamports/CU`);
36
- * ```
37
- */
38
- declare function estimatePriorityFee(connection: Connection, accounts?: PublicKey[]): Promise<number>;
39
- /**
40
- * Calculate total priority fee cost in lamports
41
- *
42
- * @example
43
- * ```typescript
44
- * const cost = calculatePriorityFeeCost(5000, 200_000);
45
- * console.log(`Priority fee: ${cost} lamports`);
46
- * ```
47
- */
48
- declare function calculatePriorityFeeCost(microLamportsPerCU: number, computeUnits: number): number;
49
-
50
- export { type PriorityFeeConfig as P, calculatePriorityFeeCost as a, createPriorityFeeInstructions as c, estimatePriorityFee as e };