@alleyboss/micropay-solana-x402-paywall 2.3.0 → 2.3.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.
@@ -0,0 +1,50 @@
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 };
@@ -0,0 +1,50 @@
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 };
@@ -2,7 +2,9 @@ import { S as SolanaClientConfig } from '../client-D-dteoJw.cjs';
2
2
  export { R as RpcConnectionWithFallback, g as getConnection, a as getConnectionWithFallback, i as isMainnet, r as resetConnection, t as toX402Network, w as withFallback } from '../client-D-dteoJw.cjs';
3
3
  import { S as SignatureStore } from '../memory-Daxkczti.cjs';
4
4
  import { d as PaymentAsset } from '../payment-BGp7eMQl.cjs';
5
- import { TransactionInstruction, Connection, PublicKey, AddressLookupTableAccount, VersionedTransaction } from '@solana/web3.js';
5
+ import { P as PriorityFeeConfig } from '../priority-fees-C-OH4Trr.cjs';
6
+ export { a as calculatePriorityFeeCost, c as createPriorityFeeInstructions, e as estimatePriorityFee } from '../priority-fees-C-OH4Trr.cjs';
7
+ import { Connection, PublicKey, TransactionInstruction, AddressLookupTableAccount, VersionedTransaction } from '@solana/web3.js';
6
8
 
7
9
  /** Result of transaction verification */
8
10
  interface TransactionVerificationResult {
@@ -128,53 +130,6 @@ declare function verifySPLPayment(params: VerifySPLPaymentParams): Promise<SPLVe
128
130
  */
129
131
  declare function isNativeAsset(asset: PaymentAsset): asset is 'native';
130
132
 
131
- /** Configuration for priority fees */
132
- interface PriorityFeeConfig {
133
- /** Enable priority fees (default: false) */
134
- enabled?: boolean;
135
- /** Price per compute unit in micro-lamports (default: auto-estimate) */
136
- microLamports?: number;
137
- /** Maximum compute units for transaction (default: 200_000) */
138
- computeUnits?: number;
139
- }
140
- /**
141
- * Create compute budget instructions for priority fees
142
- *
143
- * @example
144
- * ```typescript
145
- * const priorityIxs = createPriorityFeeInstructions({
146
- * enabled: true,
147
- * microLamports: 5000,
148
- * computeUnits: 150_000,
149
- * });
150
- *
151
- * // Add to transaction
152
- * transaction.add(...priorityIxs, ...yourInstructions);
153
- * ```
154
- */
155
- declare function createPriorityFeeInstructions(config?: PriorityFeeConfig): TransactionInstruction[];
156
- /**
157
- * Estimate priority fee based on recent network activity
158
- * Returns micro-lamports per compute unit
159
- *
160
- * @example
161
- * ```typescript
162
- * const fee = await estimatePriorityFee(connection, [recipientPubkey]);
163
- * console.log(`Recommended fee: ${fee} micro-lamports/CU`);
164
- * ```
165
- */
166
- declare function estimatePriorityFee(connection: Connection, accounts?: PublicKey[]): Promise<number>;
167
- /**
168
- * Calculate total priority fee cost in lamports
169
- *
170
- * @example
171
- * ```typescript
172
- * const cost = calculatePriorityFeeCost(5000, 200_000);
173
- * console.log(`Priority fee: ${cost} lamports`);
174
- * ```
175
- */
176
- declare function calculatePriorityFeeCost(microLamportsPerCU: number, computeUnits: number): number;
177
-
178
133
  /** Configuration for building versioned transactions */
179
134
  interface VersionedTransactionConfig {
180
135
  /** Solana connection */
@@ -237,4 +192,4 @@ declare function fetchLookupTables(connection: Connection, addresses: PublicKey[
237
192
  */
238
193
  declare function isVersionedTransaction(tx: unknown): tx is VersionedTransaction;
239
194
 
240
- export { type PriorityFeeConfig, type SPLVerificationResult, SolanaClientConfig, type TransactionVerificationResult, type VerifyPaymentParams, type VerifySPLPaymentParams, type VersionedTransactionConfig, type VersionedTransactionResult, buildVersionedTransaction, calculatePriorityFeeCost, createPriorityFeeInstructions, estimatePriorityFee, fetchLookupTables, getTokenDecimals, getWalletTransactions, isNativeAsset, isVersionedTransaction, lamportsToSol, resolveMintAddress, solToLamports, verifyPayment, verifySPLPayment, waitForConfirmation };
195
+ export { PriorityFeeConfig, type SPLVerificationResult, SolanaClientConfig, type TransactionVerificationResult, type VerifyPaymentParams, type VerifySPLPaymentParams, type VersionedTransactionConfig, type VersionedTransactionResult, buildVersionedTransaction, fetchLookupTables, getTokenDecimals, getWalletTransactions, isNativeAsset, isVersionedTransaction, lamportsToSol, resolveMintAddress, solToLamports, verifyPayment, verifySPLPayment, waitForConfirmation };
@@ -2,7 +2,9 @@ import { S as SolanaClientConfig } from '../client-DfCIRrNG.js';
2
2
  export { R as RpcConnectionWithFallback, g as getConnection, a as getConnectionWithFallback, i as isMainnet, r as resetConnection, t as toX402Network, w as withFallback } from '../client-DfCIRrNG.js';
3
3
  import { S as SignatureStore } from '../memory-Daxkczti.js';
4
4
  import { d as PaymentAsset } from '../payment-BGp7eMQl.js';
5
- import { TransactionInstruction, Connection, PublicKey, AddressLookupTableAccount, VersionedTransaction } from '@solana/web3.js';
5
+ import { P as PriorityFeeConfig } from '../priority-fees-C-OH4Trr.js';
6
+ export { a as calculatePriorityFeeCost, c as createPriorityFeeInstructions, e as estimatePriorityFee } from '../priority-fees-C-OH4Trr.js';
7
+ import { Connection, PublicKey, TransactionInstruction, AddressLookupTableAccount, VersionedTransaction } from '@solana/web3.js';
6
8
 
7
9
  /** Result of transaction verification */
8
10
  interface TransactionVerificationResult {
@@ -128,53 +130,6 @@ declare function verifySPLPayment(params: VerifySPLPaymentParams): Promise<SPLVe
128
130
  */
129
131
  declare function isNativeAsset(asset: PaymentAsset): asset is 'native';
130
132
 
131
- /** Configuration for priority fees */
132
- interface PriorityFeeConfig {
133
- /** Enable priority fees (default: false) */
134
- enabled?: boolean;
135
- /** Price per compute unit in micro-lamports (default: auto-estimate) */
136
- microLamports?: number;
137
- /** Maximum compute units for transaction (default: 200_000) */
138
- computeUnits?: number;
139
- }
140
- /**
141
- * Create compute budget instructions for priority fees
142
- *
143
- * @example
144
- * ```typescript
145
- * const priorityIxs = createPriorityFeeInstructions({
146
- * enabled: true,
147
- * microLamports: 5000,
148
- * computeUnits: 150_000,
149
- * });
150
- *
151
- * // Add to transaction
152
- * transaction.add(...priorityIxs, ...yourInstructions);
153
- * ```
154
- */
155
- declare function createPriorityFeeInstructions(config?: PriorityFeeConfig): TransactionInstruction[];
156
- /**
157
- * Estimate priority fee based on recent network activity
158
- * Returns micro-lamports per compute unit
159
- *
160
- * @example
161
- * ```typescript
162
- * const fee = await estimatePriorityFee(connection, [recipientPubkey]);
163
- * console.log(`Recommended fee: ${fee} micro-lamports/CU`);
164
- * ```
165
- */
166
- declare function estimatePriorityFee(connection: Connection, accounts?: PublicKey[]): Promise<number>;
167
- /**
168
- * Calculate total priority fee cost in lamports
169
- *
170
- * @example
171
- * ```typescript
172
- * const cost = calculatePriorityFeeCost(5000, 200_000);
173
- * console.log(`Priority fee: ${cost} lamports`);
174
- * ```
175
- */
176
- declare function calculatePriorityFeeCost(microLamportsPerCU: number, computeUnits: number): number;
177
-
178
133
  /** Configuration for building versioned transactions */
179
134
  interface VersionedTransactionConfig {
180
135
  /** Solana connection */
@@ -237,4 +192,4 @@ declare function fetchLookupTables(connection: Connection, addresses: PublicKey[
237
192
  */
238
193
  declare function isVersionedTransaction(tx: unknown): tx is VersionedTransaction;
239
194
 
240
- export { type PriorityFeeConfig, type SPLVerificationResult, SolanaClientConfig, type TransactionVerificationResult, type VerifyPaymentParams, type VerifySPLPaymentParams, type VersionedTransactionConfig, type VersionedTransactionResult, buildVersionedTransaction, calculatePriorityFeeCost, createPriorityFeeInstructions, estimatePriorityFee, fetchLookupTables, getTokenDecimals, getWalletTransactions, isNativeAsset, isVersionedTransaction, lamportsToSol, resolveMintAddress, solToLamports, verifyPayment, verifySPLPayment, waitForConfirmation };
195
+ export { PriorityFeeConfig, type SPLVerificationResult, SolanaClientConfig, type TransactionVerificationResult, type VerifyPaymentParams, type VerifySPLPaymentParams, type VersionedTransactionConfig, type VersionedTransactionResult, buildVersionedTransaction, fetchLookupTables, getTokenDecimals, getWalletTransactions, isNativeAsset, isVersionedTransaction, lamportsToSol, resolveMintAddress, solToLamports, verifyPayment, verifySPLPayment, waitForConfirmation };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alleyboss/micropay-solana-x402-paywall",
3
- "version": "2.3.0",
3
+ "version": "2.3.1",
4
4
  "description": "Production-ready Solana micropayments library implementing x402 protocol with SPL token support, RPC fallback, priority fees, and versioned transactions",
5
5
  "author": "AlleyBoss",
6
6
  "license": "MIT",
@@ -115,6 +115,16 @@
115
115
  "types": "./dist/pricing/index.d.cts",
116
116
  "default": "./dist/pricing/index.cjs"
117
117
  }
118
+ },
119
+ "./agent": {
120
+ "import": {
121
+ "types": "./dist/agent/index.d.ts",
122
+ "default": "./dist/agent/index.js"
123
+ },
124
+ "require": {
125
+ "types": "./dist/agent/index.d.cts",
126
+ "default": "./dist/agent/index.cjs"
127
+ }
118
128
  }
119
129
  },
120
130
  "files": [