@nullclear/x402-arbiter 1.0.0 → 1.1.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.
package/dist/index.cjs CHANGED
@@ -162,6 +162,8 @@ var NullClearEscrowAbortedError = class extends Error {
162
162
  score;
163
163
  upstreamStatus;
164
164
  reason;
165
+ failoverAttempts;
166
+ failedCandidates;
165
167
  constructor(message, details) {
166
168
  super(message);
167
169
  this.name = "NullClearEscrowAbortedError";
@@ -275,8 +277,12 @@ function createNullClearFetch(config) {
275
277
  expectedStatus: [200],
276
278
  jsonSchema,
277
279
  requiredFields: init?.nullclear?.requiredFields,
278
- sha256Match: init?.nullclear?.sha256Match
279
- }
280
+ sha256Match: init?.nullclear?.sha256Match,
281
+ rejectRefusals: init?.nullclear?.rejectRefusals ?? true,
282
+ invariants: init?.nullclear?.invariants
283
+ },
284
+ fallbacks: init?.nullclear?.fallbacks,
285
+ spendPolicy: init?.nullclear?.spendPolicy
280
286
  };
281
287
  const arbiterRes = await customFetch(`${arbiterUrl}/v1/clear`, {
282
288
  method: "POST",
@@ -305,7 +311,9 @@ function createNullClearFetch(config) {
305
311
  validationErrors: arbiterData.validationErrors || [],
306
312
  score: arbiterData.score,
307
313
  upstreamStatus: arbiterData.upstreamStatus,
308
- reason: arbiterData.reason || arbiterData.error
314
+ reason: arbiterData.reason || arbiterData.error,
315
+ failoverAttempts: arbiterData.failoverAttempts,
316
+ failedCandidates: arbiterData.failedCandidates
309
317
  }
310
318
  );
311
319
  };
package/dist/index.d.cts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { PrivateKeyAccount } from 'viem/accounts';
2
2
  import { WalletClient } from 'viem';
3
- import { X402PaymentOption, KYAMandate } from '@nullclear/shared';
3
+ import { X402PaymentOption, ValidationConfig, FallbackTarget, SpendPolicy, KYAMandate, InvariantRule } from '@nullclear/shared';
4
4
  import { z } from 'zod';
5
5
 
6
6
  type SignerInput = `0x${string}` | PrivateKeyAccount | {
@@ -27,12 +27,10 @@ interface ClearRequest {
27
27
  paymentSignatureHeader: string;
28
28
  sellerAgentId?: string;
29
29
  minTrustScore?: number;
30
- validation?: {
31
- expectedStatus?: number[];
32
- jsonSchema?: Record<string, unknown>;
33
- requiredFields?: string[];
34
- sha256Match?: string;
35
- };
30
+ twoPhaseRelease?: boolean;
31
+ validation?: ValidationConfig;
32
+ fallbacks?: FallbackTarget[];
33
+ spendPolicy?: SpendPolicy;
36
34
  }
37
35
  interface ClearResult<T = unknown> {
38
36
  cleared: boolean;
@@ -40,12 +38,21 @@ interface ClearResult<T = unknown> {
40
38
  clearingId?: string;
41
39
  buyerCharged: string;
42
40
  clearingFee?: string;
41
+ settlementRouting?: string;
43
42
  transaction?: `0x${string}`;
44
43
  attestation?: unknown;
45
44
  data?: T;
46
45
  stage?: string;
47
46
  error?: string;
48
47
  validationErrors?: string[];
48
+ failoverAttempts?: number;
49
+ winningSellerAgentId?: string;
50
+ failedCandidates?: Array<{
51
+ targetUrl: string;
52
+ sellerAgentId?: string;
53
+ stage: string;
54
+ reason: string;
55
+ }>;
49
56
  }
50
57
  declare class NullClearClient {
51
58
  private arbiterUrl;
@@ -65,6 +72,13 @@ declare class NullClearEscrowAbortedError extends Error {
65
72
  score?: number;
66
73
  upstreamStatus?: number;
67
74
  reason?: string;
75
+ failoverAttempts?: number;
76
+ failedCandidates?: Array<{
77
+ targetUrl: string;
78
+ sellerAgentId?: string;
79
+ stage: string;
80
+ reason: string;
81
+ }>;
68
82
  constructor(message: string, details: {
69
83
  stage: string;
70
84
  buyerCharged?: string;
@@ -72,6 +86,13 @@ declare class NullClearEscrowAbortedError extends Error {
72
86
  score?: number;
73
87
  upstreamStatus?: number;
74
88
  reason?: string;
89
+ failoverAttempts?: number;
90
+ failedCandidates?: Array<{
91
+ targetUrl: string;
92
+ sellerAgentId?: string;
93
+ stage: string;
94
+ reason: string;
95
+ }>;
75
96
  });
76
97
  }
77
98
  /**
@@ -84,6 +105,10 @@ interface NullClearOptions {
84
105
  schema?: z.ZodTypeAny | Record<string, unknown>;
85
106
  requiredFields?: string[];
86
107
  sha256Match?: string;
108
+ invariants?: InvariantRule[];
109
+ rejectRefusals?: boolean;
110
+ fallbacks?: FallbackTarget[];
111
+ spendPolicy?: SpendPolicy;
87
112
  }
88
113
  interface NullClearFetchConfig {
89
114
  accountOrPrivateKey: SignerInput;
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { PrivateKeyAccount } from 'viem/accounts';
2
2
  import { WalletClient } from 'viem';
3
- import { X402PaymentOption, KYAMandate } from '@nullclear/shared';
3
+ import { X402PaymentOption, ValidationConfig, FallbackTarget, SpendPolicy, KYAMandate, InvariantRule } from '@nullclear/shared';
4
4
  import { z } from 'zod';
5
5
 
6
6
  type SignerInput = `0x${string}` | PrivateKeyAccount | {
@@ -27,12 +27,10 @@ interface ClearRequest {
27
27
  paymentSignatureHeader: string;
28
28
  sellerAgentId?: string;
29
29
  minTrustScore?: number;
30
- validation?: {
31
- expectedStatus?: number[];
32
- jsonSchema?: Record<string, unknown>;
33
- requiredFields?: string[];
34
- sha256Match?: string;
35
- };
30
+ twoPhaseRelease?: boolean;
31
+ validation?: ValidationConfig;
32
+ fallbacks?: FallbackTarget[];
33
+ spendPolicy?: SpendPolicy;
36
34
  }
37
35
  interface ClearResult<T = unknown> {
38
36
  cleared: boolean;
@@ -40,12 +38,21 @@ interface ClearResult<T = unknown> {
40
38
  clearingId?: string;
41
39
  buyerCharged: string;
42
40
  clearingFee?: string;
41
+ settlementRouting?: string;
43
42
  transaction?: `0x${string}`;
44
43
  attestation?: unknown;
45
44
  data?: T;
46
45
  stage?: string;
47
46
  error?: string;
48
47
  validationErrors?: string[];
48
+ failoverAttempts?: number;
49
+ winningSellerAgentId?: string;
50
+ failedCandidates?: Array<{
51
+ targetUrl: string;
52
+ sellerAgentId?: string;
53
+ stage: string;
54
+ reason: string;
55
+ }>;
49
56
  }
50
57
  declare class NullClearClient {
51
58
  private arbiterUrl;
@@ -65,6 +72,13 @@ declare class NullClearEscrowAbortedError extends Error {
65
72
  score?: number;
66
73
  upstreamStatus?: number;
67
74
  reason?: string;
75
+ failoverAttempts?: number;
76
+ failedCandidates?: Array<{
77
+ targetUrl: string;
78
+ sellerAgentId?: string;
79
+ stage: string;
80
+ reason: string;
81
+ }>;
68
82
  constructor(message: string, details: {
69
83
  stage: string;
70
84
  buyerCharged?: string;
@@ -72,6 +86,13 @@ declare class NullClearEscrowAbortedError extends Error {
72
86
  score?: number;
73
87
  upstreamStatus?: number;
74
88
  reason?: string;
89
+ failoverAttempts?: number;
90
+ failedCandidates?: Array<{
91
+ targetUrl: string;
92
+ sellerAgentId?: string;
93
+ stage: string;
94
+ reason: string;
95
+ }>;
75
96
  });
76
97
  }
77
98
  /**
@@ -84,6 +105,10 @@ interface NullClearOptions {
84
105
  schema?: z.ZodTypeAny | Record<string, unknown>;
85
106
  requiredFields?: string[];
86
107
  sha256Match?: string;
108
+ invariants?: InvariantRule[];
109
+ rejectRefusals?: boolean;
110
+ fallbacks?: FallbackTarget[];
111
+ spendPolicy?: SpendPolicy;
87
112
  }
88
113
  interface NullClearFetchConfig {
89
114
  accountOrPrivateKey: SignerInput;
package/dist/index.js CHANGED
@@ -138,6 +138,8 @@ var NullClearEscrowAbortedError = class extends Error {
138
138
  score;
139
139
  upstreamStatus;
140
140
  reason;
141
+ failoverAttempts;
142
+ failedCandidates;
141
143
  constructor(message, details) {
142
144
  super(message);
143
145
  this.name = "NullClearEscrowAbortedError";
@@ -251,8 +253,12 @@ function createNullClearFetch(config) {
251
253
  expectedStatus: [200],
252
254
  jsonSchema,
253
255
  requiredFields: init?.nullclear?.requiredFields,
254
- sha256Match: init?.nullclear?.sha256Match
255
- }
256
+ sha256Match: init?.nullclear?.sha256Match,
257
+ rejectRefusals: init?.nullclear?.rejectRefusals ?? true,
258
+ invariants: init?.nullclear?.invariants
259
+ },
260
+ fallbacks: init?.nullclear?.fallbacks,
261
+ spendPolicy: init?.nullclear?.spendPolicy
256
262
  };
257
263
  const arbiterRes = await customFetch(`${arbiterUrl}/v1/clear`, {
258
264
  method: "POST",
@@ -281,7 +287,9 @@ function createNullClearFetch(config) {
281
287
  validationErrors: arbiterData.validationErrors || [],
282
288
  score: arbiterData.score,
283
289
  upstreamStatus: arbiterData.upstreamStatus,
284
- reason: arbiterData.reason || arbiterData.error
290
+ reason: arbiterData.reason || arbiterData.error,
291
+ failoverAttempts: arbiterData.failoverAttempts,
292
+ failedCandidates: arbiterData.failedCandidates
285
293
  }
286
294
  );
287
295
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nullclear/x402-arbiter",
3
- "version": "1.0.0",
3
+ "version": "1.1.1",
4
4
  "description": "NullClear Developer and Agent SDK for safe x402 calls with deferred schema escrow",
5
5
  "license": "MIT",
6
6
  "homepage": "https://nullclear.dev",
@@ -27,12 +27,12 @@
27
27
  }
28
28
  },
29
29
  "dependencies": {
30
- "@nullclear/shared": "1.0.0",
30
+ "@nullclear/shared": "1.1.1",
31
31
  "viem": "^2.23.0",
32
32
  "zod": "^3.24.2"
33
33
  },
34
34
  "devDependencies": {
35
- "@nullclear/worker-arbiter": "1.0.0",
35
+ "@nullclear/worker-arbiter": "1.1.1",
36
36
  "tsup": "^8.3.6",
37
37
  "typescript": "^5.7.3",
38
38
  "vitest": "^3.0.5"