@x402/paywall 0.0.1 → 2.1.0

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.
@@ -0,0 +1,8 @@
1
+ import { P as PaywallNetworkHandler } from '../types-CHiWR9_p.cjs';
2
+
3
+ /**
4
+ * SVM paywall handler that supports Solana-based networks (CAIP-2 format only)
5
+ */
6
+ declare const svmPaywall: PaywallNetworkHandler;
7
+
8
+ export { svmPaywall };
@@ -0,0 +1,75 @@
1
+ /**
2
+ * Configuration options for the paywall
3
+ */
4
+ interface PaywallConfig {
5
+ appName?: string;
6
+ appLogo?: string;
7
+ currentUrl?: string;
8
+ testnet?: boolean;
9
+ }
10
+ /**
11
+ * Payment requirements structure (supports both v1 and v2)
12
+ */
13
+ interface PaymentRequirements {
14
+ scheme: string;
15
+ network: string;
16
+ asset: string;
17
+ payTo: string;
18
+ maxTimeoutSeconds: number;
19
+ extra?: Record<string, unknown>;
20
+ maxAmountRequired?: string;
21
+ description?: string;
22
+ resource?: string;
23
+ mimeType?: string;
24
+ amount?: string;
25
+ }
26
+ /**
27
+ * Payment required response structure
28
+ */
29
+ interface PaymentRequired {
30
+ x402Version: number;
31
+ error?: string;
32
+ resource?: {
33
+ url: string;
34
+ description: string;
35
+ mimeType: string;
36
+ };
37
+ accepts: PaymentRequirements[];
38
+ extensions?: Record<string, unknown>;
39
+ }
40
+ /**
41
+ * Paywall provider interface for generating HTML
42
+ */
43
+ interface PaywallProvider {
44
+ /**
45
+ * Generate HTML for a payment required response
46
+ *
47
+ * @param paymentRequired - Payment required response with accepts array
48
+ * @param config - Optional runtime configuration
49
+ * @returns HTML string for the paywall page
50
+ */
51
+ generateHtml(paymentRequired: PaymentRequired, config?: PaywallConfig): string;
52
+ }
53
+ /**
54
+ * Network-specific paywall handler
55
+ */
56
+ interface PaywallNetworkHandler {
57
+ /**
58
+ * Check if this handler supports the given payment requirement
59
+ *
60
+ * @param requirement - Payment requirement to check
61
+ * @returns True if this handler can process this requirement
62
+ */
63
+ supports(requirement: PaymentRequirements): boolean;
64
+ /**
65
+ * Generate HTML for this network's paywall
66
+ *
67
+ * @param requirement - The selected payment requirement
68
+ * @param paymentRequired - Full payment required response
69
+ * @param config - Paywall configuration
70
+ * @returns HTML string for the paywall page
71
+ */
72
+ generateHtml(requirement: PaymentRequirements, paymentRequired: PaymentRequired, config: PaywallConfig): string;
73
+ }
74
+
75
+ export type { PaywallNetworkHandler as P, PaywallConfig as a, PaywallProvider as b, PaymentRequired as c, PaymentRequirements as d };
@@ -0,0 +1,8 @@
1
+ import { P as PaywallNetworkHandler } from '../types-CHiWR9_p.js';
2
+
3
+ /**
4
+ * EVM paywall handler that supports EVM-based networks (CAIP-2 format only)
5
+ */
6
+ declare const evmPaywall: PaywallNetworkHandler;
7
+
8
+ export { evmPaywall };