@bosonprotocol/x402-core 0.1.0-alpha-0
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/LICENSE +201 -0
- package/README.md +26 -0
- package/dist/cjs/eip712/index.d.ts +142 -0
- package/dist/cjs/eip712/index.js +224 -0
- package/dist/cjs/eip712/index.js.map +1 -0
- package/dist/cjs/eip712/token-auth/index.d.ts +259 -0
- package/dist/cjs/eip712/token-auth/index.js +221 -0
- package/dist/cjs/eip712/token-auth/index.js.map +1 -0
- package/dist/cjs/index.d.ts +15 -0
- package/dist/cjs/index.js +8 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/package.json +3 -0
- package/dist/cjs/schemes/escrow/index.d.ts +1262 -0
- package/dist/cjs/schemes/escrow/index.js +228 -0
- package/dist/cjs/schemes/escrow/index.js.map +1 -0
- package/dist/cjs/state-machine/index.d.ts +86 -0
- package/dist/cjs/state-machine/index.js +146 -0
- package/dist/cjs/state-machine/index.js.map +1 -0
- package/dist/cjs/states-Q2FJASHh.d.ts +38 -0
- package/dist/esm/chunk-7IY3WEFZ.js +10 -0
- package/dist/esm/chunk-7IY3WEFZ.js.map +1 -0
- package/dist/esm/eip712/index.js +213 -0
- package/dist/esm/eip712/index.js.map +1 -0
- package/dist/esm/eip712/token-auth/index.js +189 -0
- package/dist/esm/eip712/token-auth/index.js.map +1 -0
- package/dist/esm/index.js +6 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/package.json +3 -0
- package/dist/esm/schemes/escrow/index.js +202 -0
- package/dist/esm/schemes/escrow/index.js.map +1 -0
- package/dist/esm/state-machine/index.js +127 -0
- package/dist/esm/state-machine/index.js.map +1 -0
- package/dist/schemas/next_actions.schema.json +87 -0
- package/dist/schemas/payment_payload.schema.json +156 -0
- package/dist/schemas/payment_requirements.schema.json +135 -0
- package/package.json +84 -0
|
@@ -0,0 +1,1262 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import * as _bosonprotocol_core_sdk_dist_cjs_subgraph_js from '@bosonprotocol/core-sdk/dist/cjs/subgraph.js';
|
|
3
|
+
import { E as ExchangeState, D as DisputeState } from '../../states-Q2FJASHh.js';
|
|
4
|
+
import '@bosonprotocol/core-sdk';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* CAIP-2 network identifier for an EVM chain. Constrained to `eip155:<chainId>`
|
|
8
|
+
* shape at runtime by the JSON Schema and zod regex; aliased to `string` here
|
|
9
|
+
* for the same reason as `Address` / `Hex` — the wire format is JSON, where
|
|
10
|
+
* everything is a string, and template-literal types cause friction with
|
|
11
|
+
* zod's regex-based validators.
|
|
12
|
+
*/
|
|
13
|
+
type EvmNetwork = string;
|
|
14
|
+
/** BPIP-12 token-authorization strategies. */
|
|
15
|
+
type TokenAuthStrategy = "none" | "erc3009" | "permit" | "permit2";
|
|
16
|
+
declare const TOKEN_AUTH_STRATEGIES: readonly TokenAuthStrategy[];
|
|
17
|
+
/** Boson commit-time action ids advertised by the server. */
|
|
18
|
+
type BosonCommitActionId = "boson-createOfferAndCommit" | "boson-createOfferCommitAndRedeem";
|
|
19
|
+
/** Channels through which a `nextAction` can be performed. */
|
|
20
|
+
type ActionChannel = "server" | "facilitator" | "onchain" | "mcp" | "xmtp";
|
|
21
|
+
declare const ACTION_CHANNELS: readonly ActionChannel[];
|
|
22
|
+
/**
|
|
23
|
+
* BPIP-10 FullOffer. Treated as opaque at this layer — the on-chain shape lives
|
|
24
|
+
* in `@bosonprotocol/core-sdk`, and validation against the protocol struct is
|
|
25
|
+
* the EIP-712 builder's job. Here it's just "an object echoed verbatim".
|
|
26
|
+
*/
|
|
27
|
+
type FullOffer = Record<string, unknown>;
|
|
28
|
+
/**
|
|
29
|
+
* 0x-prefixed hex string. Aliased to `string` in the wire format so JSON
|
|
30
|
+
* shapes are easy to construct; runtime validation is handled by the JSON
|
|
31
|
+
* Schema and zod regex. The strongly-typed `\`0x${string}\`` form is reserved
|
|
32
|
+
* for the EIP-712 builder layer where viem's brands matter.
|
|
33
|
+
*/
|
|
34
|
+
type Hex = string;
|
|
35
|
+
/** 0x-prefixed 40-char hex string. See `Hex` for typing rationale. */
|
|
36
|
+
type Address = string;
|
|
37
|
+
/** Off-chain offer reference signed by the seller. */
|
|
38
|
+
interface BosonOfferRef {
|
|
39
|
+
fullOffer: FullOffer;
|
|
40
|
+
sellerSig: Hex;
|
|
41
|
+
creator: Address;
|
|
42
|
+
}
|
|
43
|
+
interface FulfillmentOption {
|
|
44
|
+
id: string;
|
|
45
|
+
/** JSON-Schema-shaped `type: object` description of the data the buyer must supply, or `null` for schemaless channels. */
|
|
46
|
+
schema: Record<string, unknown> | null;
|
|
47
|
+
/** Channel-specific hints advertised to the client, such as endpoint URLs or public keys. */
|
|
48
|
+
metadata?: unknown;
|
|
49
|
+
}
|
|
50
|
+
interface FulfillmentRequirements {
|
|
51
|
+
required: boolean;
|
|
52
|
+
options: FulfillmentOption[];
|
|
53
|
+
}
|
|
54
|
+
interface NextAction {
|
|
55
|
+
id: string;
|
|
56
|
+
channels: ActionChannel[];
|
|
57
|
+
endpoints?: Record<string, string>;
|
|
58
|
+
/**
|
|
59
|
+
* ISO 8601 absolute timestamp by which the action must be invoked.
|
|
60
|
+
* Relevant for dispute-window-bounded actions like
|
|
61
|
+
* `boson-resolveDispute`, `boson-escalateDispute`,
|
|
62
|
+
* `boson-retractDispute`, and (post-commit) `boson-completeExchange`.
|
|
63
|
+
*/
|
|
64
|
+
deadline?: string;
|
|
65
|
+
}
|
|
66
|
+
interface OnchainHints {
|
|
67
|
+
/** Address of the Boson escrow contract. */
|
|
68
|
+
escrow: Address;
|
|
69
|
+
metaTxFacet: string;
|
|
70
|
+
/**
|
|
71
|
+
* Per-`tokenAuthStrategy` meta-tx entry points on `metaTxFacet`. The
|
|
72
|
+
* Boson Diamond exposes two functions on `MetaTransactionsHandlerFacet`:
|
|
73
|
+
*
|
|
74
|
+
* - `executeMetaTransaction` — legacy BPIP-9 entry point. Used when
|
|
75
|
+
* the buyer's `tokenAuthStrategy` is `none` (the buyer has
|
|
76
|
+
* pre-approved the Diamond, so no token-transfer authorization
|
|
77
|
+
* queue is needed). Also the right entry point for any
|
|
78
|
+
* post-commit action that doesn't move tokens (`redeem`,
|
|
79
|
+
* `complete`, dispute transitions).
|
|
80
|
+
* - `executeMetaTransactionWithTokenTransferAuthorization` — BPIP-12
|
|
81
|
+
* entry point. Carries the buyer's signed `MetaTransaction` *and*
|
|
82
|
+
* a queue of token-transfer authorizations. Used when
|
|
83
|
+
* `tokenAuthStrategy` is `erc3009`, `permit`, or `permit2`.
|
|
84
|
+
*
|
|
85
|
+
* Clients select the entry point by their chosen strategy at
|
|
86
|
+
* dispatch time.
|
|
87
|
+
*/
|
|
88
|
+
metaTxEntrypoints: Record<TokenAuthStrategy, string>;
|
|
89
|
+
actionFacets: Record<string, string>;
|
|
90
|
+
}
|
|
91
|
+
interface ActionsFallback {
|
|
92
|
+
xmtp?: string;
|
|
93
|
+
/**
|
|
94
|
+
* Identifier within the Boson MCP server (e.g. the
|
|
95
|
+
* `bosonprotocol/agentic-commerce` server) that the buyer's
|
|
96
|
+
* MCP-aware agent dispatches against. The MCP *server* is escrow-
|
|
97
|
+
* level (one BosonMCP serving every Boson seller); this value is the
|
|
98
|
+
* URI/identifier the BosonMCP routes to the right exchange / seller.
|
|
99
|
+
*/
|
|
100
|
+
mcp?: string;
|
|
101
|
+
onchainHints?: OnchainHints;
|
|
102
|
+
}
|
|
103
|
+
interface ActionsEnvelope {
|
|
104
|
+
next: NextAction[];
|
|
105
|
+
fallback?: ActionsFallback;
|
|
106
|
+
}
|
|
107
|
+
/** Boson protocol meta-transaction envelope (signed by the buyer). */
|
|
108
|
+
interface BosonMetaTx {
|
|
109
|
+
from: Address;
|
|
110
|
+
/** Decimal string. */
|
|
111
|
+
nonce: string;
|
|
112
|
+
functionName: string;
|
|
113
|
+
/**
|
|
114
|
+
* ABI-encoded function-call data as a `0x`-prefixed hex string. Named
|
|
115
|
+
* `functionSignature` to match the on-chain `MetaTransactionsHandlerFacet`
|
|
116
|
+
* struct field — the value is the encoded calldata, not just the function
|
|
117
|
+
* selector.
|
|
118
|
+
*/
|
|
119
|
+
functionSignature: Hex;
|
|
120
|
+
sig: {
|
|
121
|
+
v: number;
|
|
122
|
+
r: Hex;
|
|
123
|
+
s: Hex;
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
interface Erc3009AuthData {
|
|
127
|
+
from: Address;
|
|
128
|
+
to: Address;
|
|
129
|
+
/** Atomic units, decimal string. */
|
|
130
|
+
value: string;
|
|
131
|
+
validAfter: number;
|
|
132
|
+
validBefore: number;
|
|
133
|
+
/** 32-byte hex string. */
|
|
134
|
+
nonce: Hex;
|
|
135
|
+
v: number;
|
|
136
|
+
r: Hex;
|
|
137
|
+
s: Hex;
|
|
138
|
+
}
|
|
139
|
+
interface PermitAuthData {
|
|
140
|
+
owner: Address;
|
|
141
|
+
spender: Address;
|
|
142
|
+
/** Atomic units, decimal string. */
|
|
143
|
+
value: string;
|
|
144
|
+
deadline: number;
|
|
145
|
+
/** Token-internal sequential nonce, decimal string. */
|
|
146
|
+
nonce: string;
|
|
147
|
+
v: number;
|
|
148
|
+
r: Hex;
|
|
149
|
+
s: Hex;
|
|
150
|
+
}
|
|
151
|
+
interface Permit2AuthData {
|
|
152
|
+
permitted: {
|
|
153
|
+
token: Address;
|
|
154
|
+
amount: string;
|
|
155
|
+
};
|
|
156
|
+
spender: Address;
|
|
157
|
+
/** Permit2 word-bitmap nonce, decimal string. */
|
|
158
|
+
nonce: string;
|
|
159
|
+
deadline: number;
|
|
160
|
+
/** Concatenated 65-byte ECDSA signature. */
|
|
161
|
+
signature: Hex;
|
|
162
|
+
}
|
|
163
|
+
/** Discriminated union of all token-authorization payloads. `none` is encoded by the absence of this field on the payload. */
|
|
164
|
+
type BosonTokenAuth = {
|
|
165
|
+
kind: "erc3009";
|
|
166
|
+
data: Erc3009AuthData;
|
|
167
|
+
} | {
|
|
168
|
+
kind: "permit";
|
|
169
|
+
data: PermitAuthData;
|
|
170
|
+
} | {
|
|
171
|
+
kind: "permit2";
|
|
172
|
+
data: Permit2AuthData;
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* Wire-format type for the `escrow` PaymentRequirements that a server emits
|
|
177
|
+
* inside a 402 `accepts[]` entry. See docs/boson-impl-01-escrow-scheme.md §2
|
|
178
|
+
* for field semantics.
|
|
179
|
+
*/
|
|
180
|
+
interface EscrowPaymentRequirements {
|
|
181
|
+
scheme: "escrow";
|
|
182
|
+
network: EvmNetwork;
|
|
183
|
+
asset: Address;
|
|
184
|
+
/** Atomic units, decimal string. */
|
|
185
|
+
amount: string;
|
|
186
|
+
/** Address of the Boson escrow contract — the custodian. */
|
|
187
|
+
escrowAddress: Address;
|
|
188
|
+
/** Routing-only seller identifier. May be a numeric `sellerId`, a `did:boson:seller:N`, or a wallet address. */
|
|
189
|
+
recipientId: string;
|
|
190
|
+
maxTimeoutSeconds: number;
|
|
191
|
+
offer: BosonOfferRef;
|
|
192
|
+
tokenAuthStrategies: TokenAuthStrategy[];
|
|
193
|
+
fulfillment?: FulfillmentRequirements;
|
|
194
|
+
actions: ActionsEnvelope;
|
|
195
|
+
}
|
|
196
|
+
/** Zod validator paired with `payment_requirements.schema.json`. */
|
|
197
|
+
declare const escrowPaymentRequirementsSchema: z.ZodObject<{
|
|
198
|
+
scheme: z.ZodLiteral<"escrow">;
|
|
199
|
+
network: z.ZodString;
|
|
200
|
+
asset: z.ZodString;
|
|
201
|
+
amount: z.ZodString;
|
|
202
|
+
escrowAddress: z.ZodString;
|
|
203
|
+
recipientId: z.ZodString;
|
|
204
|
+
maxTimeoutSeconds: z.ZodNumber;
|
|
205
|
+
offer: z.ZodObject<{
|
|
206
|
+
fullOffer: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
207
|
+
sellerSig: z.ZodString;
|
|
208
|
+
creator: z.ZodString;
|
|
209
|
+
}, "strict", z.ZodTypeAny, {
|
|
210
|
+
fullOffer: Record<string, unknown>;
|
|
211
|
+
sellerSig: string;
|
|
212
|
+
creator: string;
|
|
213
|
+
}, {
|
|
214
|
+
fullOffer: Record<string, unknown>;
|
|
215
|
+
sellerSig: string;
|
|
216
|
+
creator: string;
|
|
217
|
+
}>;
|
|
218
|
+
tokenAuthStrategies: z.ZodEffects<z.ZodArray<z.ZodEnum<[TokenAuthStrategy, ...TokenAuthStrategy[]]>, "many">, TokenAuthStrategy[], TokenAuthStrategy[]>;
|
|
219
|
+
fulfillment: z.ZodOptional<z.ZodObject<{
|
|
220
|
+
required: z.ZodBoolean;
|
|
221
|
+
options: z.ZodArray<z.ZodObject<{
|
|
222
|
+
id: z.ZodString;
|
|
223
|
+
schema: z.ZodUnion<[z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodNull]>;
|
|
224
|
+
metadata: z.ZodOptional<z.ZodUnknown>;
|
|
225
|
+
}, "strict", z.ZodTypeAny, {
|
|
226
|
+
id: string;
|
|
227
|
+
schema: Record<string, unknown> | null;
|
|
228
|
+
metadata?: unknown;
|
|
229
|
+
}, {
|
|
230
|
+
id: string;
|
|
231
|
+
schema: Record<string, unknown> | null;
|
|
232
|
+
metadata?: unknown;
|
|
233
|
+
}>, "many">;
|
|
234
|
+
}, "strict", z.ZodTypeAny, {
|
|
235
|
+
options: {
|
|
236
|
+
id: string;
|
|
237
|
+
schema: Record<string, unknown> | null;
|
|
238
|
+
metadata?: unknown;
|
|
239
|
+
}[];
|
|
240
|
+
required: boolean;
|
|
241
|
+
}, {
|
|
242
|
+
options: {
|
|
243
|
+
id: string;
|
|
244
|
+
schema: Record<string, unknown> | null;
|
|
245
|
+
metadata?: unknown;
|
|
246
|
+
}[];
|
|
247
|
+
required: boolean;
|
|
248
|
+
}>>;
|
|
249
|
+
actions: z.ZodObject<{
|
|
250
|
+
next: z.ZodArray<z.ZodObject<{
|
|
251
|
+
id: z.ZodString;
|
|
252
|
+
channels: z.ZodEffects<z.ZodArray<z.ZodEnum<[ActionChannel, ...ActionChannel[]]>, "many">, ActionChannel[], ActionChannel[]>;
|
|
253
|
+
endpoints: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
254
|
+
deadline: z.ZodOptional<z.ZodString>;
|
|
255
|
+
}, "strict", z.ZodTypeAny, {
|
|
256
|
+
id: string;
|
|
257
|
+
channels: ActionChannel[];
|
|
258
|
+
endpoints?: Record<string, string> | undefined;
|
|
259
|
+
deadline?: string | undefined;
|
|
260
|
+
}, {
|
|
261
|
+
id: string;
|
|
262
|
+
channels: ActionChannel[];
|
|
263
|
+
endpoints?: Record<string, string> | undefined;
|
|
264
|
+
deadline?: string | undefined;
|
|
265
|
+
}>, "many">;
|
|
266
|
+
fallback: z.ZodOptional<z.ZodObject<{
|
|
267
|
+
xmtp: z.ZodOptional<z.ZodString>;
|
|
268
|
+
mcp: z.ZodOptional<z.ZodString>;
|
|
269
|
+
onchainHints: z.ZodOptional<z.ZodObject<{
|
|
270
|
+
escrow: z.ZodString;
|
|
271
|
+
metaTxFacet: z.ZodString;
|
|
272
|
+
metaTxEntrypoints: z.ZodObject<{
|
|
273
|
+
none: z.ZodString;
|
|
274
|
+
erc3009: z.ZodString;
|
|
275
|
+
permit: z.ZodString;
|
|
276
|
+
permit2: z.ZodString;
|
|
277
|
+
}, "strict", z.ZodTypeAny, {
|
|
278
|
+
none: string;
|
|
279
|
+
erc3009: string;
|
|
280
|
+
permit: string;
|
|
281
|
+
permit2: string;
|
|
282
|
+
}, {
|
|
283
|
+
none: string;
|
|
284
|
+
erc3009: string;
|
|
285
|
+
permit: string;
|
|
286
|
+
permit2: string;
|
|
287
|
+
}>;
|
|
288
|
+
actionFacets: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
289
|
+
}, "strict", z.ZodTypeAny, {
|
|
290
|
+
escrow: string;
|
|
291
|
+
metaTxFacet: string;
|
|
292
|
+
metaTxEntrypoints: {
|
|
293
|
+
none: string;
|
|
294
|
+
erc3009: string;
|
|
295
|
+
permit: string;
|
|
296
|
+
permit2: string;
|
|
297
|
+
};
|
|
298
|
+
actionFacets: Record<string, string>;
|
|
299
|
+
}, {
|
|
300
|
+
escrow: string;
|
|
301
|
+
metaTxFacet: string;
|
|
302
|
+
metaTxEntrypoints: {
|
|
303
|
+
none: string;
|
|
304
|
+
erc3009: string;
|
|
305
|
+
permit: string;
|
|
306
|
+
permit2: string;
|
|
307
|
+
};
|
|
308
|
+
actionFacets: Record<string, string>;
|
|
309
|
+
}>>;
|
|
310
|
+
}, "strict", z.ZodTypeAny, {
|
|
311
|
+
mcp?: string | undefined;
|
|
312
|
+
xmtp?: string | undefined;
|
|
313
|
+
onchainHints?: {
|
|
314
|
+
escrow: string;
|
|
315
|
+
metaTxFacet: string;
|
|
316
|
+
metaTxEntrypoints: {
|
|
317
|
+
none: string;
|
|
318
|
+
erc3009: string;
|
|
319
|
+
permit: string;
|
|
320
|
+
permit2: string;
|
|
321
|
+
};
|
|
322
|
+
actionFacets: Record<string, string>;
|
|
323
|
+
} | undefined;
|
|
324
|
+
}, {
|
|
325
|
+
mcp?: string | undefined;
|
|
326
|
+
xmtp?: string | undefined;
|
|
327
|
+
onchainHints?: {
|
|
328
|
+
escrow: string;
|
|
329
|
+
metaTxFacet: string;
|
|
330
|
+
metaTxEntrypoints: {
|
|
331
|
+
none: string;
|
|
332
|
+
erc3009: string;
|
|
333
|
+
permit: string;
|
|
334
|
+
permit2: string;
|
|
335
|
+
};
|
|
336
|
+
actionFacets: Record<string, string>;
|
|
337
|
+
} | undefined;
|
|
338
|
+
}>>;
|
|
339
|
+
}, "strict", z.ZodTypeAny, {
|
|
340
|
+
next: {
|
|
341
|
+
id: string;
|
|
342
|
+
channels: ActionChannel[];
|
|
343
|
+
endpoints?: Record<string, string> | undefined;
|
|
344
|
+
deadline?: string | undefined;
|
|
345
|
+
}[];
|
|
346
|
+
fallback?: {
|
|
347
|
+
mcp?: string | undefined;
|
|
348
|
+
xmtp?: string | undefined;
|
|
349
|
+
onchainHints?: {
|
|
350
|
+
escrow: string;
|
|
351
|
+
metaTxFacet: string;
|
|
352
|
+
metaTxEntrypoints: {
|
|
353
|
+
none: string;
|
|
354
|
+
erc3009: string;
|
|
355
|
+
permit: string;
|
|
356
|
+
permit2: string;
|
|
357
|
+
};
|
|
358
|
+
actionFacets: Record<string, string>;
|
|
359
|
+
} | undefined;
|
|
360
|
+
} | undefined;
|
|
361
|
+
}, {
|
|
362
|
+
next: {
|
|
363
|
+
id: string;
|
|
364
|
+
channels: ActionChannel[];
|
|
365
|
+
endpoints?: Record<string, string> | undefined;
|
|
366
|
+
deadline?: string | undefined;
|
|
367
|
+
}[];
|
|
368
|
+
fallback?: {
|
|
369
|
+
mcp?: string | undefined;
|
|
370
|
+
xmtp?: string | undefined;
|
|
371
|
+
onchainHints?: {
|
|
372
|
+
escrow: string;
|
|
373
|
+
metaTxFacet: string;
|
|
374
|
+
metaTxEntrypoints: {
|
|
375
|
+
none: string;
|
|
376
|
+
erc3009: string;
|
|
377
|
+
permit: string;
|
|
378
|
+
permit2: string;
|
|
379
|
+
};
|
|
380
|
+
actionFacets: Record<string, string>;
|
|
381
|
+
} | undefined;
|
|
382
|
+
} | undefined;
|
|
383
|
+
}>;
|
|
384
|
+
}, "strict", z.ZodTypeAny, {
|
|
385
|
+
scheme: "escrow";
|
|
386
|
+
network: string;
|
|
387
|
+
asset: string;
|
|
388
|
+
amount: string;
|
|
389
|
+
escrowAddress: string;
|
|
390
|
+
recipientId: string;
|
|
391
|
+
maxTimeoutSeconds: number;
|
|
392
|
+
offer: {
|
|
393
|
+
fullOffer: Record<string, unknown>;
|
|
394
|
+
sellerSig: string;
|
|
395
|
+
creator: string;
|
|
396
|
+
};
|
|
397
|
+
tokenAuthStrategies: TokenAuthStrategy[];
|
|
398
|
+
actions: {
|
|
399
|
+
next: {
|
|
400
|
+
id: string;
|
|
401
|
+
channels: ActionChannel[];
|
|
402
|
+
endpoints?: Record<string, string> | undefined;
|
|
403
|
+
deadline?: string | undefined;
|
|
404
|
+
}[];
|
|
405
|
+
fallback?: {
|
|
406
|
+
mcp?: string | undefined;
|
|
407
|
+
xmtp?: string | undefined;
|
|
408
|
+
onchainHints?: {
|
|
409
|
+
escrow: string;
|
|
410
|
+
metaTxFacet: string;
|
|
411
|
+
metaTxEntrypoints: {
|
|
412
|
+
none: string;
|
|
413
|
+
erc3009: string;
|
|
414
|
+
permit: string;
|
|
415
|
+
permit2: string;
|
|
416
|
+
};
|
|
417
|
+
actionFacets: Record<string, string>;
|
|
418
|
+
} | undefined;
|
|
419
|
+
} | undefined;
|
|
420
|
+
};
|
|
421
|
+
fulfillment?: {
|
|
422
|
+
options: {
|
|
423
|
+
id: string;
|
|
424
|
+
schema: Record<string, unknown> | null;
|
|
425
|
+
metadata?: unknown;
|
|
426
|
+
}[];
|
|
427
|
+
required: boolean;
|
|
428
|
+
} | undefined;
|
|
429
|
+
}, {
|
|
430
|
+
scheme: "escrow";
|
|
431
|
+
network: string;
|
|
432
|
+
asset: string;
|
|
433
|
+
amount: string;
|
|
434
|
+
escrowAddress: string;
|
|
435
|
+
recipientId: string;
|
|
436
|
+
maxTimeoutSeconds: number;
|
|
437
|
+
offer: {
|
|
438
|
+
fullOffer: Record<string, unknown>;
|
|
439
|
+
sellerSig: string;
|
|
440
|
+
creator: string;
|
|
441
|
+
};
|
|
442
|
+
tokenAuthStrategies: TokenAuthStrategy[];
|
|
443
|
+
actions: {
|
|
444
|
+
next: {
|
|
445
|
+
id: string;
|
|
446
|
+
channels: ActionChannel[];
|
|
447
|
+
endpoints?: Record<string, string> | undefined;
|
|
448
|
+
deadline?: string | undefined;
|
|
449
|
+
}[];
|
|
450
|
+
fallback?: {
|
|
451
|
+
mcp?: string | undefined;
|
|
452
|
+
xmtp?: string | undefined;
|
|
453
|
+
onchainHints?: {
|
|
454
|
+
escrow: string;
|
|
455
|
+
metaTxFacet: string;
|
|
456
|
+
metaTxEntrypoints: {
|
|
457
|
+
none: string;
|
|
458
|
+
erc3009: string;
|
|
459
|
+
permit: string;
|
|
460
|
+
permit2: string;
|
|
461
|
+
};
|
|
462
|
+
actionFacets: Record<string, string>;
|
|
463
|
+
} | undefined;
|
|
464
|
+
} | undefined;
|
|
465
|
+
};
|
|
466
|
+
fulfillment?: {
|
|
467
|
+
options: {
|
|
468
|
+
id: string;
|
|
469
|
+
schema: Record<string, unknown> | null;
|
|
470
|
+
metadata?: unknown;
|
|
471
|
+
}[];
|
|
472
|
+
required: boolean;
|
|
473
|
+
} | undefined;
|
|
474
|
+
}>;
|
|
475
|
+
/** Type-guard form. Returns the parsed value on success, throws on failure (with a `ZodError` carrying the field path). */
|
|
476
|
+
declare function parseEscrowPaymentRequirements(value: unknown): EscrowPaymentRequirements;
|
|
477
|
+
|
|
478
|
+
/** Inner `payload` field of `EscrowPaymentPayload`. */
|
|
479
|
+
interface EscrowPaymentPayloadInner {
|
|
480
|
+
action: string;
|
|
481
|
+
tokenAuthStrategy: TokenAuthStrategy;
|
|
482
|
+
offerRef: {
|
|
483
|
+
fullOffer: FullOffer;
|
|
484
|
+
sellerSig: Hex;
|
|
485
|
+
};
|
|
486
|
+
buyer: Address;
|
|
487
|
+
metaTx: BosonMetaTx;
|
|
488
|
+
/** Required iff `tokenAuthStrategy !== "none"`. */
|
|
489
|
+
tokenAuth?: BosonTokenAuth;
|
|
490
|
+
}
|
|
491
|
+
/**
|
|
492
|
+
* Wire-format type for the `escrow` PaymentPayload that a client base64's into
|
|
493
|
+
* the `X-PAYMENT` header. See docs/boson-impl-01-escrow-scheme.md §3.
|
|
494
|
+
*
|
|
495
|
+
* `fulfillment.option` is always the buyer's pick from the server-advertised
|
|
496
|
+
* option set (capability negotiation). `fulfillment.data` is action-conditional:
|
|
497
|
+
*
|
|
498
|
+
* - For atomic Flow B (`boson-createOfferCommitAndRedeem`), `data` MUST be
|
|
499
|
+
* present (or `null` when the option's schema is `null`). Atomic Flow B
|
|
500
|
+
* completes the redeem on-chain inside the commit transaction, so there's
|
|
501
|
+
* no later round trip in which the buyer could hand the seller delivery
|
|
502
|
+
* data — it must travel with `X-PAYMENT`.
|
|
503
|
+
* - For two-step Flow A (`boson-createOfferAndCommit`), `data` MUST be
|
|
504
|
+
* omitted. The buyer attaches it to the redeem-time POST body that
|
|
505
|
+
* accompanies `boson-redeem`, after a successful commit. See
|
|
506
|
+
* `docs/boson-impl-03-fulfillment-channels.md`.
|
|
507
|
+
*
|
|
508
|
+
* The Zod schema parses both shapes structurally; the action-conditional
|
|
509
|
+
* presence/absence rule is enforced by the server-side validator (rule 13).
|
|
510
|
+
*/
|
|
511
|
+
interface EscrowPaymentPayload {
|
|
512
|
+
x402Version: number;
|
|
513
|
+
scheme: "escrow";
|
|
514
|
+
network: EvmNetwork;
|
|
515
|
+
payload: EscrowPaymentPayloadInner;
|
|
516
|
+
fulfillment?: {
|
|
517
|
+
option: string;
|
|
518
|
+
data?: Record<string, unknown> | null;
|
|
519
|
+
};
|
|
520
|
+
}
|
|
521
|
+
/**
|
|
522
|
+
* Zod validator paired with `payment_payload.schema.json`. Note: this only
|
|
523
|
+
* validates structural shape; cross-field rules (per docs/boson-impl-01 §5)
|
|
524
|
+
* such as "tokenAuth must be omitted iff tokenAuthStrategy === 'none'" are
|
|
525
|
+
* enforced server-side and are not part of this schema.
|
|
526
|
+
*/
|
|
527
|
+
declare const escrowPaymentPayloadSchema: z.ZodObject<{
|
|
528
|
+
x402Version: z.ZodNumber;
|
|
529
|
+
scheme: z.ZodLiteral<"escrow">;
|
|
530
|
+
network: z.ZodString;
|
|
531
|
+
payload: z.ZodObject<{
|
|
532
|
+
action: z.ZodString;
|
|
533
|
+
tokenAuthStrategy: z.ZodEnum<[TokenAuthStrategy, ...TokenAuthStrategy[]]>;
|
|
534
|
+
offerRef: z.ZodObject<{
|
|
535
|
+
fullOffer: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
536
|
+
sellerSig: z.ZodString;
|
|
537
|
+
}, "strict", z.ZodTypeAny, {
|
|
538
|
+
fullOffer: Record<string, unknown>;
|
|
539
|
+
sellerSig: string;
|
|
540
|
+
}, {
|
|
541
|
+
fullOffer: Record<string, unknown>;
|
|
542
|
+
sellerSig: string;
|
|
543
|
+
}>;
|
|
544
|
+
buyer: z.ZodString;
|
|
545
|
+
metaTx: z.ZodObject<{
|
|
546
|
+
from: z.ZodString;
|
|
547
|
+
nonce: z.ZodString;
|
|
548
|
+
functionName: z.ZodString;
|
|
549
|
+
functionSignature: z.ZodString;
|
|
550
|
+
sig: z.ZodObject<{
|
|
551
|
+
v: z.ZodNumber;
|
|
552
|
+
r: z.ZodString;
|
|
553
|
+
s: z.ZodString;
|
|
554
|
+
}, "strict", z.ZodTypeAny, {
|
|
555
|
+
v: number;
|
|
556
|
+
r: string;
|
|
557
|
+
s: string;
|
|
558
|
+
}, {
|
|
559
|
+
v: number;
|
|
560
|
+
r: string;
|
|
561
|
+
s: string;
|
|
562
|
+
}>;
|
|
563
|
+
}, "strict", z.ZodTypeAny, {
|
|
564
|
+
functionSignature: string;
|
|
565
|
+
from: string;
|
|
566
|
+
sig: {
|
|
567
|
+
v: number;
|
|
568
|
+
r: string;
|
|
569
|
+
s: string;
|
|
570
|
+
};
|
|
571
|
+
functionName: string;
|
|
572
|
+
nonce: string;
|
|
573
|
+
}, {
|
|
574
|
+
functionSignature: string;
|
|
575
|
+
from: string;
|
|
576
|
+
sig: {
|
|
577
|
+
v: number;
|
|
578
|
+
r: string;
|
|
579
|
+
s: string;
|
|
580
|
+
};
|
|
581
|
+
functionName: string;
|
|
582
|
+
nonce: string;
|
|
583
|
+
}>;
|
|
584
|
+
tokenAuth: z.ZodOptional<z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
|
|
585
|
+
kind: z.ZodLiteral<"erc3009">;
|
|
586
|
+
data: z.ZodObject<{
|
|
587
|
+
from: z.ZodString;
|
|
588
|
+
to: z.ZodString;
|
|
589
|
+
value: z.ZodString;
|
|
590
|
+
validAfter: z.ZodNumber;
|
|
591
|
+
validBefore: z.ZodNumber;
|
|
592
|
+
nonce: z.ZodString;
|
|
593
|
+
v: z.ZodNumber;
|
|
594
|
+
r: z.ZodString;
|
|
595
|
+
s: z.ZodString;
|
|
596
|
+
}, "strict", z.ZodTypeAny, {
|
|
597
|
+
value: string;
|
|
598
|
+
from: string;
|
|
599
|
+
to: string;
|
|
600
|
+
nonce: string;
|
|
601
|
+
v: number;
|
|
602
|
+
r: string;
|
|
603
|
+
s: string;
|
|
604
|
+
validAfter: number;
|
|
605
|
+
validBefore: number;
|
|
606
|
+
}, {
|
|
607
|
+
value: string;
|
|
608
|
+
from: string;
|
|
609
|
+
to: string;
|
|
610
|
+
nonce: string;
|
|
611
|
+
v: number;
|
|
612
|
+
r: string;
|
|
613
|
+
s: string;
|
|
614
|
+
validAfter: number;
|
|
615
|
+
validBefore: number;
|
|
616
|
+
}>;
|
|
617
|
+
}, "strict", z.ZodTypeAny, {
|
|
618
|
+
data: {
|
|
619
|
+
value: string;
|
|
620
|
+
from: string;
|
|
621
|
+
to: string;
|
|
622
|
+
nonce: string;
|
|
623
|
+
v: number;
|
|
624
|
+
r: string;
|
|
625
|
+
s: string;
|
|
626
|
+
validAfter: number;
|
|
627
|
+
validBefore: number;
|
|
628
|
+
};
|
|
629
|
+
kind: "erc3009";
|
|
630
|
+
}, {
|
|
631
|
+
data: {
|
|
632
|
+
value: string;
|
|
633
|
+
from: string;
|
|
634
|
+
to: string;
|
|
635
|
+
nonce: string;
|
|
636
|
+
v: number;
|
|
637
|
+
r: string;
|
|
638
|
+
s: string;
|
|
639
|
+
validAfter: number;
|
|
640
|
+
validBefore: number;
|
|
641
|
+
};
|
|
642
|
+
kind: "erc3009";
|
|
643
|
+
}>, z.ZodObject<{
|
|
644
|
+
kind: z.ZodLiteral<"permit">;
|
|
645
|
+
data: z.ZodObject<{
|
|
646
|
+
owner: z.ZodString;
|
|
647
|
+
spender: z.ZodString;
|
|
648
|
+
value: z.ZodString;
|
|
649
|
+
deadline: z.ZodNumber;
|
|
650
|
+
nonce: z.ZodString;
|
|
651
|
+
v: z.ZodNumber;
|
|
652
|
+
r: z.ZodString;
|
|
653
|
+
s: z.ZodString;
|
|
654
|
+
}, "strict", z.ZodTypeAny, {
|
|
655
|
+
value: string;
|
|
656
|
+
deadline: number;
|
|
657
|
+
owner: string;
|
|
658
|
+
spender: string;
|
|
659
|
+
nonce: string;
|
|
660
|
+
v: number;
|
|
661
|
+
r: string;
|
|
662
|
+
s: string;
|
|
663
|
+
}, {
|
|
664
|
+
value: string;
|
|
665
|
+
deadline: number;
|
|
666
|
+
owner: string;
|
|
667
|
+
spender: string;
|
|
668
|
+
nonce: string;
|
|
669
|
+
v: number;
|
|
670
|
+
r: string;
|
|
671
|
+
s: string;
|
|
672
|
+
}>;
|
|
673
|
+
}, "strict", z.ZodTypeAny, {
|
|
674
|
+
data: {
|
|
675
|
+
value: string;
|
|
676
|
+
deadline: number;
|
|
677
|
+
owner: string;
|
|
678
|
+
spender: string;
|
|
679
|
+
nonce: string;
|
|
680
|
+
v: number;
|
|
681
|
+
r: string;
|
|
682
|
+
s: string;
|
|
683
|
+
};
|
|
684
|
+
kind: "permit";
|
|
685
|
+
}, {
|
|
686
|
+
data: {
|
|
687
|
+
value: string;
|
|
688
|
+
deadline: number;
|
|
689
|
+
owner: string;
|
|
690
|
+
spender: string;
|
|
691
|
+
nonce: string;
|
|
692
|
+
v: number;
|
|
693
|
+
r: string;
|
|
694
|
+
s: string;
|
|
695
|
+
};
|
|
696
|
+
kind: "permit";
|
|
697
|
+
}>, z.ZodObject<{
|
|
698
|
+
kind: z.ZodLiteral<"permit2">;
|
|
699
|
+
data: z.ZodObject<{
|
|
700
|
+
permitted: z.ZodObject<{
|
|
701
|
+
token: z.ZodString;
|
|
702
|
+
amount: z.ZodString;
|
|
703
|
+
}, "strict", z.ZodTypeAny, {
|
|
704
|
+
amount: string;
|
|
705
|
+
token: string;
|
|
706
|
+
}, {
|
|
707
|
+
amount: string;
|
|
708
|
+
token: string;
|
|
709
|
+
}>;
|
|
710
|
+
spender: z.ZodString;
|
|
711
|
+
nonce: z.ZodString;
|
|
712
|
+
deadline: z.ZodNumber;
|
|
713
|
+
signature: z.ZodString;
|
|
714
|
+
}, "strict", z.ZodTypeAny, {
|
|
715
|
+
deadline: number;
|
|
716
|
+
spender: string;
|
|
717
|
+
nonce: string;
|
|
718
|
+
signature: string;
|
|
719
|
+
permitted: {
|
|
720
|
+
amount: string;
|
|
721
|
+
token: string;
|
|
722
|
+
};
|
|
723
|
+
}, {
|
|
724
|
+
deadline: number;
|
|
725
|
+
spender: string;
|
|
726
|
+
nonce: string;
|
|
727
|
+
signature: string;
|
|
728
|
+
permitted: {
|
|
729
|
+
amount: string;
|
|
730
|
+
token: string;
|
|
731
|
+
};
|
|
732
|
+
}>;
|
|
733
|
+
}, "strict", z.ZodTypeAny, {
|
|
734
|
+
data: {
|
|
735
|
+
deadline: number;
|
|
736
|
+
spender: string;
|
|
737
|
+
nonce: string;
|
|
738
|
+
signature: string;
|
|
739
|
+
permitted: {
|
|
740
|
+
amount: string;
|
|
741
|
+
token: string;
|
|
742
|
+
};
|
|
743
|
+
};
|
|
744
|
+
kind: "permit2";
|
|
745
|
+
}, {
|
|
746
|
+
data: {
|
|
747
|
+
deadline: number;
|
|
748
|
+
spender: string;
|
|
749
|
+
nonce: string;
|
|
750
|
+
signature: string;
|
|
751
|
+
permitted: {
|
|
752
|
+
amount: string;
|
|
753
|
+
token: string;
|
|
754
|
+
};
|
|
755
|
+
};
|
|
756
|
+
kind: "permit2";
|
|
757
|
+
}>]>>;
|
|
758
|
+
}, "strict", z.ZodTypeAny, {
|
|
759
|
+
action: string;
|
|
760
|
+
buyer: string;
|
|
761
|
+
tokenAuthStrategy: TokenAuthStrategy;
|
|
762
|
+
offerRef: {
|
|
763
|
+
fullOffer: Record<string, unknown>;
|
|
764
|
+
sellerSig: string;
|
|
765
|
+
};
|
|
766
|
+
metaTx: {
|
|
767
|
+
functionSignature: string;
|
|
768
|
+
from: string;
|
|
769
|
+
sig: {
|
|
770
|
+
v: number;
|
|
771
|
+
r: string;
|
|
772
|
+
s: string;
|
|
773
|
+
};
|
|
774
|
+
functionName: string;
|
|
775
|
+
nonce: string;
|
|
776
|
+
};
|
|
777
|
+
tokenAuth?: {
|
|
778
|
+
data: {
|
|
779
|
+
value: string;
|
|
780
|
+
from: string;
|
|
781
|
+
to: string;
|
|
782
|
+
nonce: string;
|
|
783
|
+
v: number;
|
|
784
|
+
r: string;
|
|
785
|
+
s: string;
|
|
786
|
+
validAfter: number;
|
|
787
|
+
validBefore: number;
|
|
788
|
+
};
|
|
789
|
+
kind: "erc3009";
|
|
790
|
+
} | {
|
|
791
|
+
data: {
|
|
792
|
+
value: string;
|
|
793
|
+
deadline: number;
|
|
794
|
+
owner: string;
|
|
795
|
+
spender: string;
|
|
796
|
+
nonce: string;
|
|
797
|
+
v: number;
|
|
798
|
+
r: string;
|
|
799
|
+
s: string;
|
|
800
|
+
};
|
|
801
|
+
kind: "permit";
|
|
802
|
+
} | {
|
|
803
|
+
data: {
|
|
804
|
+
deadline: number;
|
|
805
|
+
spender: string;
|
|
806
|
+
nonce: string;
|
|
807
|
+
signature: string;
|
|
808
|
+
permitted: {
|
|
809
|
+
amount: string;
|
|
810
|
+
token: string;
|
|
811
|
+
};
|
|
812
|
+
};
|
|
813
|
+
kind: "permit2";
|
|
814
|
+
} | undefined;
|
|
815
|
+
}, {
|
|
816
|
+
action: string;
|
|
817
|
+
buyer: string;
|
|
818
|
+
tokenAuthStrategy: TokenAuthStrategy;
|
|
819
|
+
offerRef: {
|
|
820
|
+
fullOffer: Record<string, unknown>;
|
|
821
|
+
sellerSig: string;
|
|
822
|
+
};
|
|
823
|
+
metaTx: {
|
|
824
|
+
functionSignature: string;
|
|
825
|
+
from: string;
|
|
826
|
+
sig: {
|
|
827
|
+
v: number;
|
|
828
|
+
r: string;
|
|
829
|
+
s: string;
|
|
830
|
+
};
|
|
831
|
+
functionName: string;
|
|
832
|
+
nonce: string;
|
|
833
|
+
};
|
|
834
|
+
tokenAuth?: {
|
|
835
|
+
data: {
|
|
836
|
+
value: string;
|
|
837
|
+
from: string;
|
|
838
|
+
to: string;
|
|
839
|
+
nonce: string;
|
|
840
|
+
v: number;
|
|
841
|
+
r: string;
|
|
842
|
+
s: string;
|
|
843
|
+
validAfter: number;
|
|
844
|
+
validBefore: number;
|
|
845
|
+
};
|
|
846
|
+
kind: "erc3009";
|
|
847
|
+
} | {
|
|
848
|
+
data: {
|
|
849
|
+
value: string;
|
|
850
|
+
deadline: number;
|
|
851
|
+
owner: string;
|
|
852
|
+
spender: string;
|
|
853
|
+
nonce: string;
|
|
854
|
+
v: number;
|
|
855
|
+
r: string;
|
|
856
|
+
s: string;
|
|
857
|
+
};
|
|
858
|
+
kind: "permit";
|
|
859
|
+
} | {
|
|
860
|
+
data: {
|
|
861
|
+
deadline: number;
|
|
862
|
+
spender: string;
|
|
863
|
+
nonce: string;
|
|
864
|
+
signature: string;
|
|
865
|
+
permitted: {
|
|
866
|
+
amount: string;
|
|
867
|
+
token: string;
|
|
868
|
+
};
|
|
869
|
+
};
|
|
870
|
+
kind: "permit2";
|
|
871
|
+
} | undefined;
|
|
872
|
+
}>;
|
|
873
|
+
fulfillment: z.ZodOptional<z.ZodObject<{
|
|
874
|
+
option: z.ZodString;
|
|
875
|
+
data: z.ZodOptional<z.ZodUnion<[z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodNull]>>;
|
|
876
|
+
}, "strict", z.ZodTypeAny, {
|
|
877
|
+
option: string;
|
|
878
|
+
data?: Record<string, unknown> | null | undefined;
|
|
879
|
+
}, {
|
|
880
|
+
option: string;
|
|
881
|
+
data?: Record<string, unknown> | null | undefined;
|
|
882
|
+
}>>;
|
|
883
|
+
}, "strict", z.ZodTypeAny, {
|
|
884
|
+
scheme: "escrow";
|
|
885
|
+
network: string;
|
|
886
|
+
x402Version: number;
|
|
887
|
+
payload: {
|
|
888
|
+
action: string;
|
|
889
|
+
buyer: string;
|
|
890
|
+
tokenAuthStrategy: TokenAuthStrategy;
|
|
891
|
+
offerRef: {
|
|
892
|
+
fullOffer: Record<string, unknown>;
|
|
893
|
+
sellerSig: string;
|
|
894
|
+
};
|
|
895
|
+
metaTx: {
|
|
896
|
+
functionSignature: string;
|
|
897
|
+
from: string;
|
|
898
|
+
sig: {
|
|
899
|
+
v: number;
|
|
900
|
+
r: string;
|
|
901
|
+
s: string;
|
|
902
|
+
};
|
|
903
|
+
functionName: string;
|
|
904
|
+
nonce: string;
|
|
905
|
+
};
|
|
906
|
+
tokenAuth?: {
|
|
907
|
+
data: {
|
|
908
|
+
value: string;
|
|
909
|
+
from: string;
|
|
910
|
+
to: string;
|
|
911
|
+
nonce: string;
|
|
912
|
+
v: number;
|
|
913
|
+
r: string;
|
|
914
|
+
s: string;
|
|
915
|
+
validAfter: number;
|
|
916
|
+
validBefore: number;
|
|
917
|
+
};
|
|
918
|
+
kind: "erc3009";
|
|
919
|
+
} | {
|
|
920
|
+
data: {
|
|
921
|
+
value: string;
|
|
922
|
+
deadline: number;
|
|
923
|
+
owner: string;
|
|
924
|
+
spender: string;
|
|
925
|
+
nonce: string;
|
|
926
|
+
v: number;
|
|
927
|
+
r: string;
|
|
928
|
+
s: string;
|
|
929
|
+
};
|
|
930
|
+
kind: "permit";
|
|
931
|
+
} | {
|
|
932
|
+
data: {
|
|
933
|
+
deadline: number;
|
|
934
|
+
spender: string;
|
|
935
|
+
nonce: string;
|
|
936
|
+
signature: string;
|
|
937
|
+
permitted: {
|
|
938
|
+
amount: string;
|
|
939
|
+
token: string;
|
|
940
|
+
};
|
|
941
|
+
};
|
|
942
|
+
kind: "permit2";
|
|
943
|
+
} | undefined;
|
|
944
|
+
};
|
|
945
|
+
fulfillment?: {
|
|
946
|
+
option: string;
|
|
947
|
+
data?: Record<string, unknown> | null | undefined;
|
|
948
|
+
} | undefined;
|
|
949
|
+
}, {
|
|
950
|
+
scheme: "escrow";
|
|
951
|
+
network: string;
|
|
952
|
+
x402Version: number;
|
|
953
|
+
payload: {
|
|
954
|
+
action: string;
|
|
955
|
+
buyer: string;
|
|
956
|
+
tokenAuthStrategy: TokenAuthStrategy;
|
|
957
|
+
offerRef: {
|
|
958
|
+
fullOffer: Record<string, unknown>;
|
|
959
|
+
sellerSig: string;
|
|
960
|
+
};
|
|
961
|
+
metaTx: {
|
|
962
|
+
functionSignature: string;
|
|
963
|
+
from: string;
|
|
964
|
+
sig: {
|
|
965
|
+
v: number;
|
|
966
|
+
r: string;
|
|
967
|
+
s: string;
|
|
968
|
+
};
|
|
969
|
+
functionName: string;
|
|
970
|
+
nonce: string;
|
|
971
|
+
};
|
|
972
|
+
tokenAuth?: {
|
|
973
|
+
data: {
|
|
974
|
+
value: string;
|
|
975
|
+
from: string;
|
|
976
|
+
to: string;
|
|
977
|
+
nonce: string;
|
|
978
|
+
v: number;
|
|
979
|
+
r: string;
|
|
980
|
+
s: string;
|
|
981
|
+
validAfter: number;
|
|
982
|
+
validBefore: number;
|
|
983
|
+
};
|
|
984
|
+
kind: "erc3009";
|
|
985
|
+
} | {
|
|
986
|
+
data: {
|
|
987
|
+
value: string;
|
|
988
|
+
deadline: number;
|
|
989
|
+
owner: string;
|
|
990
|
+
spender: string;
|
|
991
|
+
nonce: string;
|
|
992
|
+
v: number;
|
|
993
|
+
r: string;
|
|
994
|
+
s: string;
|
|
995
|
+
};
|
|
996
|
+
kind: "permit";
|
|
997
|
+
} | {
|
|
998
|
+
data: {
|
|
999
|
+
deadline: number;
|
|
1000
|
+
spender: string;
|
|
1001
|
+
nonce: string;
|
|
1002
|
+
signature: string;
|
|
1003
|
+
permitted: {
|
|
1004
|
+
amount: string;
|
|
1005
|
+
token: string;
|
|
1006
|
+
};
|
|
1007
|
+
};
|
|
1008
|
+
kind: "permit2";
|
|
1009
|
+
} | undefined;
|
|
1010
|
+
};
|
|
1011
|
+
fulfillment?: {
|
|
1012
|
+
option: string;
|
|
1013
|
+
data?: Record<string, unknown> | null | undefined;
|
|
1014
|
+
} | undefined;
|
|
1015
|
+
}>;
|
|
1016
|
+
declare function parseEscrowPaymentPayload(value: unknown): EscrowPaymentPayload;
|
|
1017
|
+
|
|
1018
|
+
/**
|
|
1019
|
+
* Wire-format type for the post-commit `nextActions` envelope.
|
|
1020
|
+
*
|
|
1021
|
+
* The `exchangeState === DISPUTED ↔ disputeState present` invariant is
|
|
1022
|
+
* encoded structurally: `exchangeState: DISPUTED` requires
|
|
1023
|
+
* `disputeState`, and any other `exchangeState` forbids it. The zod
|
|
1024
|
+
* validator below enforces the same invariant at runtime.
|
|
1025
|
+
*
|
|
1026
|
+
* The wire field is named `exchangeState` (not `state`) for symmetry
|
|
1027
|
+
* with `disputeState` and to remove ambiguity with the `state` field
|
|
1028
|
+
* the subgraph entity itself carries.
|
|
1029
|
+
*/
|
|
1030
|
+
type EscrowNextActions = {
|
|
1031
|
+
exchangeId: string;
|
|
1032
|
+
next: NextAction[];
|
|
1033
|
+
fallback?: ActionsFallback;
|
|
1034
|
+
} & ({
|
|
1035
|
+
exchangeState: Exclude<ExchangeState, typeof ExchangeState.DISPUTED>;
|
|
1036
|
+
disputeState?: never;
|
|
1037
|
+
} | {
|
|
1038
|
+
exchangeState: typeof ExchangeState.DISPUTED;
|
|
1039
|
+
disputeState: DisputeState;
|
|
1040
|
+
});
|
|
1041
|
+
/** Zod validator paired with `next_actions.schema.json`. */
|
|
1042
|
+
declare const escrowNextActionsSchema: z.ZodEffects<z.ZodObject<{
|
|
1043
|
+
exchangeId: z.ZodString;
|
|
1044
|
+
exchangeState: z.ZodNativeEnum<typeof _bosonprotocol_core_sdk_dist_cjs_subgraph_js.ExchangeState>;
|
|
1045
|
+
disputeState: z.ZodOptional<z.ZodNativeEnum<typeof _bosonprotocol_core_sdk_dist_cjs_subgraph_js.DisputeState>>;
|
|
1046
|
+
next: z.ZodArray<z.ZodObject<{
|
|
1047
|
+
id: z.ZodString;
|
|
1048
|
+
channels: z.ZodEffects<z.ZodArray<z.ZodEnum<[ActionChannel, ...ActionChannel[]]>, "many">, ActionChannel[], ActionChannel[]>;
|
|
1049
|
+
endpoints: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
1050
|
+
deadline: z.ZodOptional<z.ZodString>;
|
|
1051
|
+
}, "strict", z.ZodTypeAny, {
|
|
1052
|
+
id: string;
|
|
1053
|
+
channels: ActionChannel[];
|
|
1054
|
+
endpoints?: Record<string, string> | undefined;
|
|
1055
|
+
deadline?: string | undefined;
|
|
1056
|
+
}, {
|
|
1057
|
+
id: string;
|
|
1058
|
+
channels: ActionChannel[];
|
|
1059
|
+
endpoints?: Record<string, string> | undefined;
|
|
1060
|
+
deadline?: string | undefined;
|
|
1061
|
+
}>, "many">;
|
|
1062
|
+
fallback: z.ZodOptional<z.ZodObject<{
|
|
1063
|
+
xmtp: z.ZodOptional<z.ZodString>;
|
|
1064
|
+
mcp: z.ZodOptional<z.ZodString>;
|
|
1065
|
+
onchainHints: z.ZodOptional<z.ZodObject<{
|
|
1066
|
+
escrow: z.ZodString;
|
|
1067
|
+
metaTxFacet: z.ZodString;
|
|
1068
|
+
metaTxEntrypoints: z.ZodObject<{
|
|
1069
|
+
none: z.ZodString;
|
|
1070
|
+
erc3009: z.ZodString;
|
|
1071
|
+
permit: z.ZodString;
|
|
1072
|
+
permit2: z.ZodString;
|
|
1073
|
+
}, "strict", z.ZodTypeAny, {
|
|
1074
|
+
none: string;
|
|
1075
|
+
erc3009: string;
|
|
1076
|
+
permit: string;
|
|
1077
|
+
permit2: string;
|
|
1078
|
+
}, {
|
|
1079
|
+
none: string;
|
|
1080
|
+
erc3009: string;
|
|
1081
|
+
permit: string;
|
|
1082
|
+
permit2: string;
|
|
1083
|
+
}>;
|
|
1084
|
+
actionFacets: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
1085
|
+
}, "strict", z.ZodTypeAny, {
|
|
1086
|
+
escrow: string;
|
|
1087
|
+
metaTxFacet: string;
|
|
1088
|
+
metaTxEntrypoints: {
|
|
1089
|
+
none: string;
|
|
1090
|
+
erc3009: string;
|
|
1091
|
+
permit: string;
|
|
1092
|
+
permit2: string;
|
|
1093
|
+
};
|
|
1094
|
+
actionFacets: Record<string, string>;
|
|
1095
|
+
}, {
|
|
1096
|
+
escrow: string;
|
|
1097
|
+
metaTxFacet: string;
|
|
1098
|
+
metaTxEntrypoints: {
|
|
1099
|
+
none: string;
|
|
1100
|
+
erc3009: string;
|
|
1101
|
+
permit: string;
|
|
1102
|
+
permit2: string;
|
|
1103
|
+
};
|
|
1104
|
+
actionFacets: Record<string, string>;
|
|
1105
|
+
}>>;
|
|
1106
|
+
}, "strict", z.ZodTypeAny, {
|
|
1107
|
+
mcp?: string | undefined;
|
|
1108
|
+
xmtp?: string | undefined;
|
|
1109
|
+
onchainHints?: {
|
|
1110
|
+
escrow: string;
|
|
1111
|
+
metaTxFacet: string;
|
|
1112
|
+
metaTxEntrypoints: {
|
|
1113
|
+
none: string;
|
|
1114
|
+
erc3009: string;
|
|
1115
|
+
permit: string;
|
|
1116
|
+
permit2: string;
|
|
1117
|
+
};
|
|
1118
|
+
actionFacets: Record<string, string>;
|
|
1119
|
+
} | undefined;
|
|
1120
|
+
}, {
|
|
1121
|
+
mcp?: string | undefined;
|
|
1122
|
+
xmtp?: string | undefined;
|
|
1123
|
+
onchainHints?: {
|
|
1124
|
+
escrow: string;
|
|
1125
|
+
metaTxFacet: string;
|
|
1126
|
+
metaTxEntrypoints: {
|
|
1127
|
+
none: string;
|
|
1128
|
+
erc3009: string;
|
|
1129
|
+
permit: string;
|
|
1130
|
+
permit2: string;
|
|
1131
|
+
};
|
|
1132
|
+
actionFacets: Record<string, string>;
|
|
1133
|
+
} | undefined;
|
|
1134
|
+
}>>;
|
|
1135
|
+
}, "strict", z.ZodTypeAny, {
|
|
1136
|
+
next: {
|
|
1137
|
+
id: string;
|
|
1138
|
+
channels: ActionChannel[];
|
|
1139
|
+
endpoints?: Record<string, string> | undefined;
|
|
1140
|
+
deadline?: string | undefined;
|
|
1141
|
+
}[];
|
|
1142
|
+
exchangeId: string;
|
|
1143
|
+
exchangeState: _bosonprotocol_core_sdk_dist_cjs_subgraph_js.ExchangeState;
|
|
1144
|
+
fallback?: {
|
|
1145
|
+
mcp?: string | undefined;
|
|
1146
|
+
xmtp?: string | undefined;
|
|
1147
|
+
onchainHints?: {
|
|
1148
|
+
escrow: string;
|
|
1149
|
+
metaTxFacet: string;
|
|
1150
|
+
metaTxEntrypoints: {
|
|
1151
|
+
none: string;
|
|
1152
|
+
erc3009: string;
|
|
1153
|
+
permit: string;
|
|
1154
|
+
permit2: string;
|
|
1155
|
+
};
|
|
1156
|
+
actionFacets: Record<string, string>;
|
|
1157
|
+
} | undefined;
|
|
1158
|
+
} | undefined;
|
|
1159
|
+
disputeState?: _bosonprotocol_core_sdk_dist_cjs_subgraph_js.DisputeState | undefined;
|
|
1160
|
+
}, {
|
|
1161
|
+
next: {
|
|
1162
|
+
id: string;
|
|
1163
|
+
channels: ActionChannel[];
|
|
1164
|
+
endpoints?: Record<string, string> | undefined;
|
|
1165
|
+
deadline?: string | undefined;
|
|
1166
|
+
}[];
|
|
1167
|
+
exchangeId: string;
|
|
1168
|
+
exchangeState: _bosonprotocol_core_sdk_dist_cjs_subgraph_js.ExchangeState;
|
|
1169
|
+
fallback?: {
|
|
1170
|
+
mcp?: string | undefined;
|
|
1171
|
+
xmtp?: string | undefined;
|
|
1172
|
+
onchainHints?: {
|
|
1173
|
+
escrow: string;
|
|
1174
|
+
metaTxFacet: string;
|
|
1175
|
+
metaTxEntrypoints: {
|
|
1176
|
+
none: string;
|
|
1177
|
+
erc3009: string;
|
|
1178
|
+
permit: string;
|
|
1179
|
+
permit2: string;
|
|
1180
|
+
};
|
|
1181
|
+
actionFacets: Record<string, string>;
|
|
1182
|
+
} | undefined;
|
|
1183
|
+
} | undefined;
|
|
1184
|
+
disputeState?: _bosonprotocol_core_sdk_dist_cjs_subgraph_js.DisputeState | undefined;
|
|
1185
|
+
}>, {
|
|
1186
|
+
next: {
|
|
1187
|
+
id: string;
|
|
1188
|
+
channels: ActionChannel[];
|
|
1189
|
+
endpoints?: Record<string, string> | undefined;
|
|
1190
|
+
deadline?: string | undefined;
|
|
1191
|
+
}[];
|
|
1192
|
+
exchangeId: string;
|
|
1193
|
+
exchangeState: _bosonprotocol_core_sdk_dist_cjs_subgraph_js.ExchangeState;
|
|
1194
|
+
fallback?: {
|
|
1195
|
+
mcp?: string | undefined;
|
|
1196
|
+
xmtp?: string | undefined;
|
|
1197
|
+
onchainHints?: {
|
|
1198
|
+
escrow: string;
|
|
1199
|
+
metaTxFacet: string;
|
|
1200
|
+
metaTxEntrypoints: {
|
|
1201
|
+
none: string;
|
|
1202
|
+
erc3009: string;
|
|
1203
|
+
permit: string;
|
|
1204
|
+
permit2: string;
|
|
1205
|
+
};
|
|
1206
|
+
actionFacets: Record<string, string>;
|
|
1207
|
+
} | undefined;
|
|
1208
|
+
} | undefined;
|
|
1209
|
+
disputeState?: _bosonprotocol_core_sdk_dist_cjs_subgraph_js.DisputeState | undefined;
|
|
1210
|
+
}, {
|
|
1211
|
+
next: {
|
|
1212
|
+
id: string;
|
|
1213
|
+
channels: ActionChannel[];
|
|
1214
|
+
endpoints?: Record<string, string> | undefined;
|
|
1215
|
+
deadline?: string | undefined;
|
|
1216
|
+
}[];
|
|
1217
|
+
exchangeId: string;
|
|
1218
|
+
exchangeState: _bosonprotocol_core_sdk_dist_cjs_subgraph_js.ExchangeState;
|
|
1219
|
+
fallback?: {
|
|
1220
|
+
mcp?: string | undefined;
|
|
1221
|
+
xmtp?: string | undefined;
|
|
1222
|
+
onchainHints?: {
|
|
1223
|
+
escrow: string;
|
|
1224
|
+
metaTxFacet: string;
|
|
1225
|
+
metaTxEntrypoints: {
|
|
1226
|
+
none: string;
|
|
1227
|
+
erc3009: string;
|
|
1228
|
+
permit: string;
|
|
1229
|
+
permit2: string;
|
|
1230
|
+
};
|
|
1231
|
+
actionFacets: Record<string, string>;
|
|
1232
|
+
} | undefined;
|
|
1233
|
+
} | undefined;
|
|
1234
|
+
disputeState?: _bosonprotocol_core_sdk_dist_cjs_subgraph_js.DisputeState | undefined;
|
|
1235
|
+
}>;
|
|
1236
|
+
/** Type-guard form. Returns the parsed value on success, throws on failure. */
|
|
1237
|
+
declare function parseEscrowNextActions(value: unknown): EscrowNextActions;
|
|
1238
|
+
|
|
1239
|
+
/** 0x-prefixed hex string, at least one nibble. */
|
|
1240
|
+
declare const HEX: RegExp;
|
|
1241
|
+
/** 0x-prefixed hex string, allowing the empty `0x` form for empty bytes. */
|
|
1242
|
+
declare const HEX_BYTES: RegExp;
|
|
1243
|
+
/** 0x-prefixed 32-byte (64-nibble) hex string. */
|
|
1244
|
+
declare const HEX32: RegExp;
|
|
1245
|
+
/** 0x-prefixed 20-byte (40-nibble) hex address. */
|
|
1246
|
+
declare const ADDRESS: RegExp;
|
|
1247
|
+
/** Decimal unsigned integer string, no leading zeros (except "0" itself). */
|
|
1248
|
+
declare const DECIMAL_UINT: RegExp;
|
|
1249
|
+
/** CAIP-2 EVM network identifier: `eip155:<chainId>`. */
|
|
1250
|
+
declare const EVM_NETWORK: RegExp;
|
|
1251
|
+
declare const addressSchema: z.ZodString;
|
|
1252
|
+
declare const hexSchema: z.ZodString;
|
|
1253
|
+
declare const hexBytesSchema: z.ZodString;
|
|
1254
|
+
declare const hex32Schema: z.ZodString;
|
|
1255
|
+
declare const decimalUintSchema: z.ZodString;
|
|
1256
|
+
declare const evmNetworkSchema: z.ZodString;
|
|
1257
|
+
|
|
1258
|
+
/** Stable identifier for the scheme. Use this in place of the raw string `"escrow"` to avoid typos. */
|
|
1259
|
+
declare const ESCROW_SCHEME: "escrow";
|
|
1260
|
+
type EscrowScheme = typeof ESCROW_SCHEME;
|
|
1261
|
+
|
|
1262
|
+
export { ACTION_CHANNELS, ADDRESS, type ActionChannel, type ActionsEnvelope, type ActionsFallback, type Address, type BosonCommitActionId, type BosonMetaTx, type BosonOfferRef, type BosonTokenAuth, DECIMAL_UINT, ESCROW_SCHEME, EVM_NETWORK, type Erc3009AuthData, type EscrowNextActions, type EscrowPaymentPayload, type EscrowPaymentPayloadInner, type EscrowPaymentRequirements, type EscrowScheme, type EvmNetwork, type FulfillmentOption, type FulfillmentRequirements, type FullOffer, HEX, HEX32, HEX_BYTES, type Hex, type NextAction, type OnchainHints, type Permit2AuthData, type PermitAuthData, TOKEN_AUTH_STRATEGIES, type TokenAuthStrategy, addressSchema, decimalUintSchema, escrowNextActionsSchema, escrowPaymentPayloadSchema, escrowPaymentRequirementsSchema, evmNetworkSchema, hex32Schema, hexBytesSchema, hexSchema, parseEscrowNextActions, parseEscrowPaymentPayload, parseEscrowPaymentRequirements };
|