@4mica/x402 1.2.2 → 1.2.3
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.
|
@@ -84,10 +84,10 @@ export function paymentMiddlewareFromHTTPServer(httpServer, tabConfig, paywallCo
|
|
|
84
84
|
const advertisedUrl = new URL(tabConfig.advertisedEndpoint);
|
|
85
85
|
if (req.path === advertisedUrl.pathname) {
|
|
86
86
|
// Parse the request body
|
|
87
|
-
const { userAddress, paymentRequirements } = req.body;
|
|
87
|
+
const { userAddress, paymentRequirements, x402Version } = req.body;
|
|
88
88
|
try {
|
|
89
89
|
// Call the facilitator to open the tab
|
|
90
|
-
const openTabResponse = await facilitatorClient.openTab(userAddress, paymentRequirements, tabConfig.ttlSeconds);
|
|
90
|
+
const openTabResponse = await facilitatorClient.openTab(userAddress, paymentRequirements, tabConfig.ttlSeconds, x402Version);
|
|
91
91
|
// Return the response
|
|
92
92
|
return res.json(openTabResponse);
|
|
93
93
|
}
|
|
@@ -33,7 +33,7 @@ export declare class OpenTabError extends Error {
|
|
|
33
33
|
}
|
|
34
34
|
export declare class FourMicaFacilitatorClient extends HTTPFacilitatorClient {
|
|
35
35
|
constructor(config?: FacilitatorConfig);
|
|
36
|
-
openTab(userAddress: string, paymentRequirements: PaymentRequirements, ttlSeconds?: number): Promise<OpenTabResponse>;
|
|
36
|
+
openTab(userAddress: string, paymentRequirements: PaymentRequirements, ttlSeconds?: number, guaranteeVersion?: number): Promise<OpenTabResponse>;
|
|
37
37
|
settle(paymentPayload: PaymentPayload, paymentRequirements: PaymentRequirements): Promise<FourMicaSettleResponse>;
|
|
38
38
|
/**
|
|
39
39
|
* Helper to convert objects to JSON-safe format.
|
|
@@ -12,7 +12,7 @@ export class FourMicaFacilitatorClient extends HTTPFacilitatorClient {
|
|
|
12
12
|
constructor(config) {
|
|
13
13
|
super({ ...config, url: config?.url ?? DEFAULT_FACILITATOR_URL });
|
|
14
14
|
}
|
|
15
|
-
async openTab(userAddress, paymentRequirements, ttlSeconds) {
|
|
15
|
+
async openTab(userAddress, paymentRequirements, ttlSeconds, guaranteeVersion) {
|
|
16
16
|
let headers = {
|
|
17
17
|
'Content-Type': 'application/json',
|
|
18
18
|
};
|
|
@@ -27,6 +27,7 @@ export class FourMicaFacilitatorClient extends HTTPFacilitatorClient {
|
|
|
27
27
|
network: paymentRequirements.network,
|
|
28
28
|
erc20Token: paymentRequirements.asset,
|
|
29
29
|
ttlSeconds,
|
|
30
|
+
guaranteeVersion: guaranteeVersion ?? 1,
|
|
30
31
|
})),
|
|
31
32
|
});
|
|
32
33
|
const data = await response.json();
|