@alleyboss/micropay-solana-x402-paywall 3.0.4 → 3.0.5
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.
- package/dist/index.cjs +6 -0
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +6 -1
- package/dist/pricing/index.cjs +6 -0
- package/dist/pricing/index.d.cts +4 -4
- package/dist/pricing/index.d.ts +4 -4
- package/dist/pricing/index.js +6 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -459,6 +459,11 @@ async function getRemainingCredits(token, secret) {
|
|
|
459
459
|
};
|
|
460
460
|
}
|
|
461
461
|
|
|
462
|
+
// src/pricing/utils.ts
|
|
463
|
+
function lamportsToSol(lamports) {
|
|
464
|
+
return Number(lamports) / 1e9;
|
|
465
|
+
}
|
|
466
|
+
|
|
462
467
|
// src/pricing/index.ts
|
|
463
468
|
var cachedPrice = null;
|
|
464
469
|
var config = {};
|
|
@@ -607,6 +612,7 @@ exports.getRemainingCredits = getRemainingCredits;
|
|
|
607
612
|
exports.getSolPrice = getSolPrice;
|
|
608
613
|
exports.hasAgentSufficientBalance = hasAgentSufficientBalance;
|
|
609
614
|
exports.keypairFromBase58 = keypairFromBase58;
|
|
615
|
+
exports.lamportsToSol = lamportsToSol;
|
|
610
616
|
exports.lamportsToUsd = lamportsToUsd;
|
|
611
617
|
exports.usdToLamports = usdToLamports;
|
|
612
618
|
exports.useCredit = useCredit;
|
package/dist/index.d.cts
CHANGED
|
@@ -4,6 +4,6 @@ export * from '@x402/core/client';
|
|
|
4
4
|
export * from '@x402/svm';
|
|
5
5
|
export { PaymentFlowConfig, SolanaPayUrlParams, buildSolanaPayUrl, createPaymentFlow, createPaymentReference, createX402AuthorizationHeader } from './client/index.cjs';
|
|
6
6
|
export { AgentPaymentResult, CreditSessionClaims, CreditSessionConfig, CreditSessionData, CreditValidation, ExecuteAgentPaymentParams, UseCreditResult, addCredits, createCreditSession, executeAgentPayment, generateAgentKeypair, getAgentBalance, getRemainingCredits, hasAgentSufficientBalance, keypairFromBase58, useCredit, validateCreditSession } from './agent/index.cjs';
|
|
7
|
-
export { CustomPriceProvider, PriceConfig, PriceData, clearPriceCache, configurePricing, formatPriceDisplay, formatPriceSync, getProviders, getSolPrice, lamportsToUsd, usdToLamports } from './pricing/index.cjs';
|
|
7
|
+
export { CustomPriceProvider, PriceConfig, PriceData, clearPriceCache, configurePricing, formatPriceDisplay, formatPriceSync, getProviders, getSolPrice, lamportsToSol, lamportsToUsd, usdToLamports } from './pricing/index.cjs';
|
|
8
8
|
import '@solana/web3.js';
|
|
9
9
|
import './types-BWYQMw03.cjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,6 @@ export * from '@x402/core/client';
|
|
|
4
4
|
export * from '@x402/svm';
|
|
5
5
|
export { PaymentFlowConfig, SolanaPayUrlParams, buildSolanaPayUrl, createPaymentFlow, createPaymentReference, createX402AuthorizationHeader } from './client/index.js';
|
|
6
6
|
export { AgentPaymentResult, CreditSessionClaims, CreditSessionConfig, CreditSessionData, CreditValidation, ExecuteAgentPaymentParams, UseCreditResult, addCredits, createCreditSession, executeAgentPayment, generateAgentKeypair, getAgentBalance, getRemainingCredits, hasAgentSufficientBalance, keypairFromBase58, useCredit, validateCreditSession } from './agent/index.js';
|
|
7
|
-
export { CustomPriceProvider, PriceConfig, PriceData, clearPriceCache, configurePricing, formatPriceDisplay, formatPriceSync, getProviders, getSolPrice, lamportsToUsd, usdToLamports } from './pricing/index.js';
|
|
7
|
+
export { CustomPriceProvider, PriceConfig, PriceData, clearPriceCache, configurePricing, formatPriceDisplay, formatPriceSync, getProviders, getSolPrice, lamportsToSol, lamportsToUsd, usdToLamports } from './pricing/index.js';
|
|
8
8
|
import '@solana/web3.js';
|
|
9
9
|
import './types-BWYQMw03.js';
|
package/dist/index.js
CHANGED
|
@@ -457,6 +457,11 @@ async function getRemainingCredits(token, secret) {
|
|
|
457
457
|
};
|
|
458
458
|
}
|
|
459
459
|
|
|
460
|
+
// src/pricing/utils.ts
|
|
461
|
+
function lamportsToSol(lamports) {
|
|
462
|
+
return Number(lamports) / 1e9;
|
|
463
|
+
}
|
|
464
|
+
|
|
460
465
|
// src/pricing/index.ts
|
|
461
466
|
var cachedPrice = null;
|
|
462
467
|
var config = {};
|
|
@@ -587,4 +592,4 @@ function getProviders() {
|
|
|
587
592
|
return PROVIDERS.map((p) => ({ name: p.name, url: p.url }));
|
|
588
593
|
}
|
|
589
594
|
|
|
590
|
-
export { addCredits, buildSolanaPayUrl, clearPriceCache, configurePricing, createCreditSession, createPaymentFlow, createPaymentReference, createX402AuthorizationHeader, executeAgentPayment, formatPriceDisplay, formatPriceSync, generateAgentKeypair, getAgentBalance, getProviders, getRemainingCredits, getSolPrice, hasAgentSufficientBalance, keypairFromBase58, lamportsToUsd, usdToLamports, useCredit, validateCreditSession };
|
|
595
|
+
export { addCredits, buildSolanaPayUrl, clearPriceCache, configurePricing, createCreditSession, createPaymentFlow, createPaymentReference, createX402AuthorizationHeader, executeAgentPayment, formatPriceDisplay, formatPriceSync, generateAgentKeypair, getAgentBalance, getProviders, getRemainingCredits, getSolPrice, hasAgentSufficientBalance, keypairFromBase58, lamportsToSol, lamportsToUsd, usdToLamports, useCredit, validateCreditSession };
|
package/dist/pricing/index.cjs
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
// src/pricing/utils.ts
|
|
4
|
+
function lamportsToSol(lamports) {
|
|
5
|
+
return Number(lamports) / 1e9;
|
|
6
|
+
}
|
|
7
|
+
|
|
3
8
|
// src/pricing/index.ts
|
|
4
9
|
var cachedPrice = null;
|
|
5
10
|
var config = {};
|
|
@@ -136,5 +141,6 @@ exports.formatPriceDisplay = formatPriceDisplay;
|
|
|
136
141
|
exports.formatPriceSync = formatPriceSync;
|
|
137
142
|
exports.getProviders = getProviders;
|
|
138
143
|
exports.getSolPrice = getSolPrice;
|
|
144
|
+
exports.lamportsToSol = lamportsToSol;
|
|
139
145
|
exports.lamportsToUsd = lamportsToUsd;
|
|
140
146
|
exports.usdToLamports = usdToLamports;
|
package/dist/pricing/index.d.cts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
declare function lamportsToSol(lamports: bigint | number): number;
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* Price data from API
|
|
3
5
|
*/
|
|
@@ -100,12 +102,10 @@ declare function formatPriceSync(lamports: bigint, solPrice: number): {
|
|
|
100
102
|
* Clear the price cache (for testing or manual refresh)
|
|
101
103
|
*/
|
|
102
104
|
declare function clearPriceCache(): void;
|
|
103
|
-
|
|
104
|
-
* Get list of available built-in providers
|
|
105
|
-
*/
|
|
105
|
+
|
|
106
106
|
declare function getProviders(): {
|
|
107
107
|
name: string;
|
|
108
108
|
url: string;
|
|
109
109
|
}[];
|
|
110
110
|
|
|
111
|
-
export { type CustomPriceProvider, type PriceConfig, type PriceData, clearPriceCache, configurePricing, formatPriceDisplay, formatPriceSync, getProviders, getSolPrice, lamportsToUsd, usdToLamports };
|
|
111
|
+
export { type CustomPriceProvider, type PriceConfig, type PriceData, clearPriceCache, configurePricing, formatPriceDisplay, formatPriceSync, getProviders, getSolPrice, lamportsToSol, lamportsToUsd, usdToLamports };
|
package/dist/pricing/index.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
declare function lamportsToSol(lamports: bigint | number): number;
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* Price data from API
|
|
3
5
|
*/
|
|
@@ -100,12 +102,10 @@ declare function formatPriceSync(lamports: bigint, solPrice: number): {
|
|
|
100
102
|
* Clear the price cache (for testing or manual refresh)
|
|
101
103
|
*/
|
|
102
104
|
declare function clearPriceCache(): void;
|
|
103
|
-
|
|
104
|
-
* Get list of available built-in providers
|
|
105
|
-
*/
|
|
105
|
+
|
|
106
106
|
declare function getProviders(): {
|
|
107
107
|
name: string;
|
|
108
108
|
url: string;
|
|
109
109
|
}[];
|
|
110
110
|
|
|
111
|
-
export { type CustomPriceProvider, type PriceConfig, type PriceData, clearPriceCache, configurePricing, formatPriceDisplay, formatPriceSync, getProviders, getSolPrice, lamportsToUsd, usdToLamports };
|
|
111
|
+
export { type CustomPriceProvider, type PriceConfig, type PriceData, clearPriceCache, configurePricing, formatPriceDisplay, formatPriceSync, getProviders, getSolPrice, lamportsToSol, lamportsToUsd, usdToLamports };
|
package/dist/pricing/index.js
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
// src/pricing/utils.ts
|
|
2
|
+
function lamportsToSol(lamports) {
|
|
3
|
+
return Number(lamports) / 1e9;
|
|
4
|
+
}
|
|
5
|
+
|
|
1
6
|
// src/pricing/index.ts
|
|
2
7
|
var cachedPrice = null;
|
|
3
8
|
var config = {};
|
|
@@ -128,4 +133,4 @@ function getProviders() {
|
|
|
128
133
|
return PROVIDERS.map((p) => ({ name: p.name, url: p.url }));
|
|
129
134
|
}
|
|
130
135
|
|
|
131
|
-
export { clearPriceCache, configurePricing, formatPriceDisplay, formatPriceSync, getProviders, getSolPrice, lamportsToUsd, usdToLamports };
|
|
136
|
+
export { clearPriceCache, configurePricing, formatPriceDisplay, formatPriceSync, getProviders, getSolPrice, lamportsToSol, lamportsToUsd, usdToLamports };
|
package/package.json
CHANGED