@4mica/x402 1.2.2 → 1.2.4

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();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@4mica/x402",
3
- "version": "1.2.2",
3
+ "version": "1.2.4",
4
4
  "type": "module",
5
5
  "description": "TypeScript x402 utilities for interacting with the 4Mica payment network",
6
6
  "license": "MIT",
@@ -13,7 +13,7 @@ import { SUPPORTED_NETWORKS } from '../server/scheme.js'
13
13
  const NETWORK_RPC_URLS: Record<Network, string> = {
14
14
  'eip155:11155111': 'https://ethereum.sepolia.api.4mica.xyz',
15
15
  'eip155:84532': 'https://base.sepolia.api.4mica.xyz',
16
- 'eip155:80002': 'https://api.4mica.xyz',
16
+ 'eip155:8453': 'https://base.api.4mica.xyz',
17
17
  }
18
18
 
19
19
  export class FourMicaEvmScheme implements SchemeNetworkClient {
@@ -7,7 +7,7 @@ import {
7
7
  MoneyParser,
8
8
  } from '@x402/core/types'
9
9
 
10
- export const SUPPORTED_NETWORKS: Network[] = ['eip155:11155111', 'eip155:84532', 'eip155:80002']
10
+ export const SUPPORTED_NETWORKS: Network[] = ['eip155:11155111', 'eip155:84532', 'eip155:8453']
11
11
 
12
12
  /**
13
13
  * EVM server implementation for the 4mica payment scheme.
@@ -211,12 +211,12 @@ export class FourMicaEvmScheme implements SchemeNetworkServer {
211
211
  version: '2',
212
212
  decimals: 6,
213
213
  }, // Base Sepolia USDC
214
- 'eip155:80002': {
215
- address: '0x41E94Eb019C0762f9Bfcf9Fb1E58725BfB0e7582',
214
+ 'eip155:8453': {
215
+ address: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913',
216
216
  name: 'USDC',
217
217
  version: '2',
218
218
  decimals: 6,
219
- }, // Polygon PoS Amoy USDC
219
+ }, // Base mainnet USDC
220
220
  }
221
221
 
222
222
  const assetInfo = stablecoins[network]