@4mica/x402 1.0.1 → 1.0.2

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/README.md CHANGED
@@ -156,6 +156,22 @@ The recommended middleware factory for most use cases. Automatically configures
156
156
  6. **`paywall`** (optional): Custom paywall provider
157
157
  7. **`syncFacilitatorOnStart`** (optional): Whether to sync with facilitator on startup (defaults to true)
158
158
 
159
+ #### V2 Requirements Extra
160
+
161
+ When using x402 V2, `paymentRequirements.extra` must include the validation policy fields expected by the 4mica SDKs and facilitator:
162
+
163
+ ```typescript
164
+ const extra = {
165
+ validationRegistryAddress: '0x3333333333333333333333333333333333333333',
166
+ validatorAddress: '0x4444444444444444444444444444444444444444',
167
+ validatorAgentId: '7',
168
+ minValidationScore: 80,
169
+ jobHash: '0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
170
+ requiredValidationTag: 'hard-finality', // optional
171
+ tabEndpoint: 'https://api.example.com/tabs/open',
172
+ }
173
+ ```
174
+
159
175
  #### Supported Networks
160
176
 
161
177
  - `eip155:11155111` - Ethereum Sepolia
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@4mica/x402",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "type": "module",
5
5
  "description": "TypeScript x402 utilities for interacting with the 4Mica payment network",
6
6
  "license": "MIT",
package/src/index.ts CHANGED
@@ -5,3 +5,5 @@ export type {
5
5
  Network,
6
6
  SchemeNetworkServer,
7
7
  } from '@x402/core/types'
8
+
9
+ export type { FourMicaPaymentRequirementsV2, FourMicaV2RequirementsExtra } from './types.js'
package/src/types.ts ADDED
@@ -0,0 +1,24 @@
1
+ import { PaymentRequirements } from '@x402/core/types'
2
+
3
+ /**
4
+ * Extra fields required by the 4mica V2 validation policy.
5
+ */
6
+ export type FourMicaV2RequirementsExtra = {
7
+ validationRegistryAddress: string
8
+ validatorAddress: string
9
+ validatorAgentId: string | number
10
+ minValidationScore: number
11
+ jobHash: string
12
+ requiredValidationTag?: string
13
+ tabEndpoint?: string
14
+ rpcUrl?: string
15
+ resource?: {
16
+ url?: string
17
+ description?: string
18
+ mimeType?: string
19
+ }
20
+ }
21
+
22
+ export type FourMicaPaymentRequirementsV2 = PaymentRequirements & {
23
+ extra: FourMicaV2RequirementsExtra
24
+ }
@@ -39,6 +39,7 @@ describe('FourMicaEvmScheme', () => {
39
39
  validatorAgentId: '7',
40
40
  minValidationScore: 80,
41
41
  requiredValidationTag: 'hard-finality',
42
+ jobHash: '0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
42
43
  resource: {
43
44
  url: 'https://api.example.com/premium',
44
45
  description: 'Premium dataset',
@@ -73,6 +74,7 @@ describe('FourMicaEvmScheme', () => {
73
74
  validatorAgentId: '7',
74
75
  minValidationScore: 80,
75
76
  requiredValidationTag: 'hard-finality',
77
+ jobHash: '0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
76
78
  })
77
79
  })
78
80