opentool 0.6.5 → 0.7.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/README.md +30 -25
- package/dist/cli/index.d.ts +3 -3
- package/dist/cli/index.js +38 -10
- package/dist/cli/index.js.map +1 -1
- package/dist/index-D_bCF2Bf.d.ts +487 -0
- package/dist/index.d.ts +3 -3
- package/dist/index.js +11 -11
- package/dist/index.js.map +1 -1
- package/dist/payment/index.d.ts +1 -1
- package/dist/payment/index.js +2 -2
- package/dist/payment/index.js.map +1 -1
- package/dist/validate-CqB2Juma.d.ts +216 -0
- package/package.json +10 -5
- package/dist/index-D3DaM5Rs.d.ts +0 -1693
- package/dist/validate-BLlooEBK.d.ts +0 -842
|
@@ -0,0 +1,487 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
declare const PAYMENT_SCHEMA_VERSION: 1;
|
|
4
|
+
declare const paymentSchemaVersionSchema: z.ZodLiteral<1>;
|
|
5
|
+
type PaymentSchemaVersion = z.infer<typeof paymentSchemaVersionSchema>;
|
|
6
|
+
declare const decimalStringSchema: z.ZodString;
|
|
7
|
+
declare const currencySchema: z.ZodObject<{
|
|
8
|
+
code: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
9
|
+
symbol: z.ZodOptional<z.ZodString>;
|
|
10
|
+
decimals: z.ZodOptional<z.ZodNumber>;
|
|
11
|
+
kind: z.ZodOptional<z.ZodDefault<z.ZodEnum<{
|
|
12
|
+
fiat: "fiat";
|
|
13
|
+
crypto: "crypto";
|
|
14
|
+
}>>>;
|
|
15
|
+
description: z.ZodOptional<z.ZodString>;
|
|
16
|
+
}, z.core.$strip>;
|
|
17
|
+
type Currency = z.infer<typeof currencySchema>;
|
|
18
|
+
declare const paymentAmountSchema: z.ZodObject<{
|
|
19
|
+
value: z.ZodString;
|
|
20
|
+
currency: z.ZodObject<{
|
|
21
|
+
code: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
22
|
+
symbol: z.ZodOptional<z.ZodString>;
|
|
23
|
+
decimals: z.ZodOptional<z.ZodNumber>;
|
|
24
|
+
kind: z.ZodOptional<z.ZodDefault<z.ZodEnum<{
|
|
25
|
+
fiat: "fiat";
|
|
26
|
+
crypto: "crypto";
|
|
27
|
+
}>>>;
|
|
28
|
+
description: z.ZodOptional<z.ZodString>;
|
|
29
|
+
}, z.core.$strip>;
|
|
30
|
+
display: z.ZodOptional<z.ZodString>;
|
|
31
|
+
}, z.core.$strip>;
|
|
32
|
+
type PaymentAmount = z.infer<typeof paymentAmountSchema>;
|
|
33
|
+
declare const cryptoAssetSchema: z.ZodObject<{
|
|
34
|
+
symbol: z.ZodString;
|
|
35
|
+
network: z.ZodOptional<z.ZodString>;
|
|
36
|
+
chainId: z.ZodOptional<z.ZodNumber>;
|
|
37
|
+
address: z.ZodOptional<z.ZodString>;
|
|
38
|
+
decimals: z.ZodOptional<z.ZodNumber>;
|
|
39
|
+
standard: z.ZodOptional<z.ZodDefault<z.ZodEnum<{
|
|
40
|
+
erc20: "erc20";
|
|
41
|
+
spl: "spl";
|
|
42
|
+
custom: "custom";
|
|
43
|
+
}>>>;
|
|
44
|
+
description: z.ZodOptional<z.ZodString>;
|
|
45
|
+
}, z.core.$strip>;
|
|
46
|
+
type CryptoAsset = z.infer<typeof cryptoAssetSchema>;
|
|
47
|
+
declare const facilitatorConfigSchema: z.ZodObject<{
|
|
48
|
+
url: z.ZodString;
|
|
49
|
+
vendor: z.ZodOptional<z.ZodString>;
|
|
50
|
+
verifyPath: z.ZodOptional<z.ZodDefault<z.ZodString>>;
|
|
51
|
+
settlePath: z.ZodOptional<z.ZodDefault<z.ZodString>>;
|
|
52
|
+
apiKey: z.ZodOptional<z.ZodString>;
|
|
53
|
+
apiKeyEnv: z.ZodOptional<z.ZodString>;
|
|
54
|
+
apiKeyHeader: z.ZodOptional<z.ZodDefault<z.ZodString>>;
|
|
55
|
+
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
56
|
+
timeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
57
|
+
}, z.core.$strip>;
|
|
58
|
+
type FacilitatorConfig = z.infer<typeof facilitatorConfigSchema>;
|
|
59
|
+
declare const settlementTermsSchema: z.ZodObject<{
|
|
60
|
+
windowSeconds: z.ZodOptional<z.ZodNumber>;
|
|
61
|
+
targetConfirmations: z.ZodOptional<z.ZodNumber>;
|
|
62
|
+
finalityDescription: z.ZodOptional<z.ZodString>;
|
|
63
|
+
slaDescription: z.ZodOptional<z.ZodString>;
|
|
64
|
+
}, z.core.$strip>;
|
|
65
|
+
type SettlementTerms = z.infer<typeof settlementTermsSchema>;
|
|
66
|
+
declare const paymentFieldSchema: z.ZodObject<{
|
|
67
|
+
key: z.ZodString;
|
|
68
|
+
label: z.ZodString;
|
|
69
|
+
required: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
70
|
+
description: z.ZodOptional<z.ZodString>;
|
|
71
|
+
example: z.ZodOptional<z.ZodString>;
|
|
72
|
+
}, z.core.$strip>;
|
|
73
|
+
type PaymentField = z.infer<typeof paymentFieldSchema>;
|
|
74
|
+
declare const x402ProofSchema: z.ZodObject<{
|
|
75
|
+
mode: z.ZodLiteral<"x402">;
|
|
76
|
+
scheme: z.ZodString;
|
|
77
|
+
network: z.ZodString;
|
|
78
|
+
version: z.ZodOptional<z.ZodNumber>;
|
|
79
|
+
facilitator: z.ZodOptional<z.ZodObject<{
|
|
80
|
+
url: z.ZodString;
|
|
81
|
+
vendor: z.ZodOptional<z.ZodString>;
|
|
82
|
+
verifyPath: z.ZodOptional<z.ZodDefault<z.ZodString>>;
|
|
83
|
+
settlePath: z.ZodOptional<z.ZodDefault<z.ZodString>>;
|
|
84
|
+
apiKey: z.ZodOptional<z.ZodString>;
|
|
85
|
+
apiKeyEnv: z.ZodOptional<z.ZodString>;
|
|
86
|
+
apiKeyHeader: z.ZodOptional<z.ZodDefault<z.ZodString>>;
|
|
87
|
+
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
88
|
+
timeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
89
|
+
}, z.core.$strip>>;
|
|
90
|
+
verifier: z.ZodOptional<z.ZodString>;
|
|
91
|
+
}, z.core.$strip>;
|
|
92
|
+
type X402ProofConfig = z.infer<typeof x402ProofSchema>;
|
|
93
|
+
declare const directProofSchema: z.ZodObject<{
|
|
94
|
+
mode: z.ZodLiteral<"direct">;
|
|
95
|
+
proofTypes: z.ZodArray<z.ZodString>;
|
|
96
|
+
verifier: z.ZodOptional<z.ZodString>;
|
|
97
|
+
instructions: z.ZodOptional<z.ZodString>;
|
|
98
|
+
fields: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
99
|
+
key: z.ZodString;
|
|
100
|
+
label: z.ZodString;
|
|
101
|
+
required: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
102
|
+
description: z.ZodOptional<z.ZodString>;
|
|
103
|
+
example: z.ZodOptional<z.ZodString>;
|
|
104
|
+
}, z.core.$strip>>>;
|
|
105
|
+
allowsManualReview: z.ZodOptional<z.ZodBoolean>;
|
|
106
|
+
}, z.core.$strip>;
|
|
107
|
+
type DirectProofConfig = z.infer<typeof directProofSchema>;
|
|
108
|
+
declare const paymentProofSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
109
|
+
mode: z.ZodLiteral<"x402">;
|
|
110
|
+
scheme: z.ZodString;
|
|
111
|
+
network: z.ZodString;
|
|
112
|
+
version: z.ZodOptional<z.ZodNumber>;
|
|
113
|
+
facilitator: z.ZodOptional<z.ZodObject<{
|
|
114
|
+
url: z.ZodString;
|
|
115
|
+
vendor: z.ZodOptional<z.ZodString>;
|
|
116
|
+
verifyPath: z.ZodOptional<z.ZodDefault<z.ZodString>>;
|
|
117
|
+
settlePath: z.ZodOptional<z.ZodDefault<z.ZodString>>;
|
|
118
|
+
apiKey: z.ZodOptional<z.ZodString>;
|
|
119
|
+
apiKeyEnv: z.ZodOptional<z.ZodString>;
|
|
120
|
+
apiKeyHeader: z.ZodOptional<z.ZodDefault<z.ZodString>>;
|
|
121
|
+
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
122
|
+
timeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
123
|
+
}, z.core.$strip>>;
|
|
124
|
+
verifier: z.ZodOptional<z.ZodString>;
|
|
125
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
126
|
+
mode: z.ZodLiteral<"direct">;
|
|
127
|
+
proofTypes: z.ZodArray<z.ZodString>;
|
|
128
|
+
verifier: z.ZodOptional<z.ZodString>;
|
|
129
|
+
instructions: z.ZodOptional<z.ZodString>;
|
|
130
|
+
fields: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
131
|
+
key: z.ZodString;
|
|
132
|
+
label: z.ZodString;
|
|
133
|
+
required: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
134
|
+
description: z.ZodOptional<z.ZodString>;
|
|
135
|
+
example: z.ZodOptional<z.ZodString>;
|
|
136
|
+
}, z.core.$strip>>>;
|
|
137
|
+
allowsManualReview: z.ZodOptional<z.ZodBoolean>;
|
|
138
|
+
}, z.core.$strip>], "mode">;
|
|
139
|
+
type PaymentProofConfig = z.infer<typeof paymentProofSchema>;
|
|
140
|
+
declare const paymentOptionSchema: z.ZodObject<{
|
|
141
|
+
id: z.ZodString;
|
|
142
|
+
title: z.ZodString;
|
|
143
|
+
description: z.ZodOptional<z.ZodString>;
|
|
144
|
+
amount: z.ZodObject<{
|
|
145
|
+
value: z.ZodString;
|
|
146
|
+
currency: z.ZodObject<{
|
|
147
|
+
code: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
148
|
+
symbol: z.ZodOptional<z.ZodString>;
|
|
149
|
+
decimals: z.ZodOptional<z.ZodNumber>;
|
|
150
|
+
kind: z.ZodOptional<z.ZodDefault<z.ZodEnum<{
|
|
151
|
+
fiat: "fiat";
|
|
152
|
+
crypto: "crypto";
|
|
153
|
+
}>>>;
|
|
154
|
+
description: z.ZodOptional<z.ZodString>;
|
|
155
|
+
}, z.core.$strip>;
|
|
156
|
+
display: z.ZodOptional<z.ZodString>;
|
|
157
|
+
}, z.core.$strip>;
|
|
158
|
+
asset: z.ZodObject<{
|
|
159
|
+
symbol: z.ZodString;
|
|
160
|
+
network: z.ZodOptional<z.ZodString>;
|
|
161
|
+
chainId: z.ZodOptional<z.ZodNumber>;
|
|
162
|
+
address: z.ZodOptional<z.ZodString>;
|
|
163
|
+
decimals: z.ZodOptional<z.ZodNumber>;
|
|
164
|
+
standard: z.ZodOptional<z.ZodDefault<z.ZodEnum<{
|
|
165
|
+
erc20: "erc20";
|
|
166
|
+
spl: "spl";
|
|
167
|
+
custom: "custom";
|
|
168
|
+
}>>>;
|
|
169
|
+
description: z.ZodOptional<z.ZodString>;
|
|
170
|
+
}, z.core.$strip>;
|
|
171
|
+
payTo: z.ZodString;
|
|
172
|
+
resource: z.ZodOptional<z.ZodString>;
|
|
173
|
+
proof: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
174
|
+
mode: z.ZodLiteral<"x402">;
|
|
175
|
+
scheme: z.ZodString;
|
|
176
|
+
network: z.ZodString;
|
|
177
|
+
version: z.ZodOptional<z.ZodNumber>;
|
|
178
|
+
facilitator: z.ZodOptional<z.ZodObject<{
|
|
179
|
+
url: z.ZodString;
|
|
180
|
+
vendor: z.ZodOptional<z.ZodString>;
|
|
181
|
+
verifyPath: z.ZodOptional<z.ZodDefault<z.ZodString>>;
|
|
182
|
+
settlePath: z.ZodOptional<z.ZodDefault<z.ZodString>>;
|
|
183
|
+
apiKey: z.ZodOptional<z.ZodString>;
|
|
184
|
+
apiKeyEnv: z.ZodOptional<z.ZodString>;
|
|
185
|
+
apiKeyHeader: z.ZodOptional<z.ZodDefault<z.ZodString>>;
|
|
186
|
+
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
187
|
+
timeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
188
|
+
}, z.core.$strip>>;
|
|
189
|
+
verifier: z.ZodOptional<z.ZodString>;
|
|
190
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
191
|
+
mode: z.ZodLiteral<"direct">;
|
|
192
|
+
proofTypes: z.ZodArray<z.ZodString>;
|
|
193
|
+
verifier: z.ZodOptional<z.ZodString>;
|
|
194
|
+
instructions: z.ZodOptional<z.ZodString>;
|
|
195
|
+
fields: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
196
|
+
key: z.ZodString;
|
|
197
|
+
label: z.ZodString;
|
|
198
|
+
required: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
199
|
+
description: z.ZodOptional<z.ZodString>;
|
|
200
|
+
example: z.ZodOptional<z.ZodString>;
|
|
201
|
+
}, z.core.$strip>>>;
|
|
202
|
+
allowsManualReview: z.ZodOptional<z.ZodBoolean>;
|
|
203
|
+
}, z.core.$strip>], "mode">;
|
|
204
|
+
settlement: z.ZodOptional<z.ZodObject<{
|
|
205
|
+
windowSeconds: z.ZodOptional<z.ZodNumber>;
|
|
206
|
+
targetConfirmations: z.ZodOptional<z.ZodNumber>;
|
|
207
|
+
finalityDescription: z.ZodOptional<z.ZodString>;
|
|
208
|
+
slaDescription: z.ZodOptional<z.ZodString>;
|
|
209
|
+
}, z.core.$strip>>;
|
|
210
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
211
|
+
}, z.core.$strip>;
|
|
212
|
+
type PaymentOption = z.infer<typeof paymentOptionSchema>;
|
|
213
|
+
declare const paymentRequirementsSchema: z.ZodObject<{
|
|
214
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
215
|
+
message: z.ZodOptional<z.ZodString>;
|
|
216
|
+
title: z.ZodOptional<z.ZodString>;
|
|
217
|
+
resource: z.ZodOptional<z.ZodString>;
|
|
218
|
+
accepts: z.ZodArray<z.ZodObject<{
|
|
219
|
+
id: z.ZodString;
|
|
220
|
+
title: z.ZodString;
|
|
221
|
+
description: z.ZodOptional<z.ZodString>;
|
|
222
|
+
amount: z.ZodObject<{
|
|
223
|
+
value: z.ZodString;
|
|
224
|
+
currency: z.ZodObject<{
|
|
225
|
+
code: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
226
|
+
symbol: z.ZodOptional<z.ZodString>;
|
|
227
|
+
decimals: z.ZodOptional<z.ZodNumber>;
|
|
228
|
+
kind: z.ZodOptional<z.ZodDefault<z.ZodEnum<{
|
|
229
|
+
fiat: "fiat";
|
|
230
|
+
crypto: "crypto";
|
|
231
|
+
}>>>;
|
|
232
|
+
description: z.ZodOptional<z.ZodString>;
|
|
233
|
+
}, z.core.$strip>;
|
|
234
|
+
display: z.ZodOptional<z.ZodString>;
|
|
235
|
+
}, z.core.$strip>;
|
|
236
|
+
asset: z.ZodObject<{
|
|
237
|
+
symbol: z.ZodString;
|
|
238
|
+
network: z.ZodOptional<z.ZodString>;
|
|
239
|
+
chainId: z.ZodOptional<z.ZodNumber>;
|
|
240
|
+
address: z.ZodOptional<z.ZodString>;
|
|
241
|
+
decimals: z.ZodOptional<z.ZodNumber>;
|
|
242
|
+
standard: z.ZodOptional<z.ZodDefault<z.ZodEnum<{
|
|
243
|
+
erc20: "erc20";
|
|
244
|
+
spl: "spl";
|
|
245
|
+
custom: "custom";
|
|
246
|
+
}>>>;
|
|
247
|
+
description: z.ZodOptional<z.ZodString>;
|
|
248
|
+
}, z.core.$strip>;
|
|
249
|
+
payTo: z.ZodString;
|
|
250
|
+
resource: z.ZodOptional<z.ZodString>;
|
|
251
|
+
proof: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
252
|
+
mode: z.ZodLiteral<"x402">;
|
|
253
|
+
scheme: z.ZodString;
|
|
254
|
+
network: z.ZodString;
|
|
255
|
+
version: z.ZodOptional<z.ZodNumber>;
|
|
256
|
+
facilitator: z.ZodOptional<z.ZodObject<{
|
|
257
|
+
url: z.ZodString;
|
|
258
|
+
vendor: z.ZodOptional<z.ZodString>;
|
|
259
|
+
verifyPath: z.ZodOptional<z.ZodDefault<z.ZodString>>;
|
|
260
|
+
settlePath: z.ZodOptional<z.ZodDefault<z.ZodString>>;
|
|
261
|
+
apiKey: z.ZodOptional<z.ZodString>;
|
|
262
|
+
apiKeyEnv: z.ZodOptional<z.ZodString>;
|
|
263
|
+
apiKeyHeader: z.ZodOptional<z.ZodDefault<z.ZodString>>;
|
|
264
|
+
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
265
|
+
timeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
266
|
+
}, z.core.$strip>>;
|
|
267
|
+
verifier: z.ZodOptional<z.ZodString>;
|
|
268
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
269
|
+
mode: z.ZodLiteral<"direct">;
|
|
270
|
+
proofTypes: z.ZodArray<z.ZodString>;
|
|
271
|
+
verifier: z.ZodOptional<z.ZodString>;
|
|
272
|
+
instructions: z.ZodOptional<z.ZodString>;
|
|
273
|
+
fields: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
274
|
+
key: z.ZodString;
|
|
275
|
+
label: z.ZodString;
|
|
276
|
+
required: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
277
|
+
description: z.ZodOptional<z.ZodString>;
|
|
278
|
+
example: z.ZodOptional<z.ZodString>;
|
|
279
|
+
}, z.core.$strip>>>;
|
|
280
|
+
allowsManualReview: z.ZodOptional<z.ZodBoolean>;
|
|
281
|
+
}, z.core.$strip>], "mode">;
|
|
282
|
+
settlement: z.ZodOptional<z.ZodObject<{
|
|
283
|
+
windowSeconds: z.ZodOptional<z.ZodNumber>;
|
|
284
|
+
targetConfirmations: z.ZodOptional<z.ZodNumber>;
|
|
285
|
+
finalityDescription: z.ZodOptional<z.ZodString>;
|
|
286
|
+
slaDescription: z.ZodOptional<z.ZodString>;
|
|
287
|
+
}, z.core.$strip>>;
|
|
288
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
289
|
+
}, z.core.$strip>>;
|
|
290
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
291
|
+
fallbackText: z.ZodOptional<z.ZodString>;
|
|
292
|
+
}, z.core.$strip>;
|
|
293
|
+
type PaymentRequirementsDefinition = z.infer<typeof paymentRequirementsSchema>;
|
|
294
|
+
declare const x402PaymentHeaderSchema: z.ZodObject<{
|
|
295
|
+
x402Version: z.ZodNumber;
|
|
296
|
+
scheme: z.ZodString;
|
|
297
|
+
network: z.ZodString;
|
|
298
|
+
payload: z.ZodUnknown;
|
|
299
|
+
correlationId: z.ZodOptional<z.ZodString>;
|
|
300
|
+
}, z.core.$strip>;
|
|
301
|
+
type X402PaymentHeader = z.infer<typeof x402PaymentHeaderSchema>;
|
|
302
|
+
declare const directPaymentPayloadSchema: z.ZodObject<{
|
|
303
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
304
|
+
optionId: z.ZodString;
|
|
305
|
+
proofType: z.ZodString;
|
|
306
|
+
payload: z.ZodUnknown;
|
|
307
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
308
|
+
}, z.core.$strip>;
|
|
309
|
+
type DirectPaymentPayload = z.infer<typeof directPaymentPayloadSchema>;
|
|
310
|
+
declare const paymentSuccessMetadataSchema: z.ZodObject<{
|
|
311
|
+
optionId: z.ZodString;
|
|
312
|
+
verifier: z.ZodOptional<z.ZodString>;
|
|
313
|
+
txHash: z.ZodOptional<z.ZodString>;
|
|
314
|
+
networkId: z.ZodOptional<z.ZodString>;
|
|
315
|
+
amount: z.ZodOptional<z.ZodObject<{
|
|
316
|
+
value: z.ZodString;
|
|
317
|
+
currency: z.ZodObject<{
|
|
318
|
+
code: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
319
|
+
symbol: z.ZodOptional<z.ZodString>;
|
|
320
|
+
decimals: z.ZodOptional<z.ZodNumber>;
|
|
321
|
+
kind: z.ZodOptional<z.ZodDefault<z.ZodEnum<{
|
|
322
|
+
fiat: "fiat";
|
|
323
|
+
crypto: "crypto";
|
|
324
|
+
}>>>;
|
|
325
|
+
description: z.ZodOptional<z.ZodString>;
|
|
326
|
+
}, z.core.$strip>;
|
|
327
|
+
display: z.ZodOptional<z.ZodString>;
|
|
328
|
+
}, z.core.$strip>>;
|
|
329
|
+
settledAt: z.ZodOptional<z.ZodString>;
|
|
330
|
+
payload: z.ZodOptional<z.ZodUnknown>;
|
|
331
|
+
}, z.core.$strip>;
|
|
332
|
+
type PaymentSuccessMetadata = z.infer<typeof paymentSuccessMetadataSchema>;
|
|
333
|
+
declare const paymentFailureSchema: z.ZodObject<{
|
|
334
|
+
reason: z.ZodString;
|
|
335
|
+
code: z.ZodOptional<z.ZodDefault<z.ZodEnum<{
|
|
336
|
+
unknown: "unknown";
|
|
337
|
+
verifier_not_found: "verifier_not_found";
|
|
338
|
+
verification_failed: "verification_failed";
|
|
339
|
+
invalid_payload: "invalid_payload";
|
|
340
|
+
unsupported_option: "unsupported_option";
|
|
341
|
+
missing_header: "missing_header";
|
|
342
|
+
}>>>;
|
|
343
|
+
retryable: z.ZodOptional<z.ZodBoolean>;
|
|
344
|
+
detail: z.ZodOptional<z.ZodUnknown>;
|
|
345
|
+
}, z.core.$strip>;
|
|
346
|
+
type PaymentFailure = z.infer<typeof paymentFailureSchema>;
|
|
347
|
+
|
|
348
|
+
declare const HEADER_X402 = "X-PAYMENT";
|
|
349
|
+
declare const HEADER_DIRECT = "X-PAYMENT-PROOF";
|
|
350
|
+
declare const HEADER_PAYMENT_RESPONSE = "X-PAYMENT-RESPONSE";
|
|
351
|
+
declare const x402RequirementSchema: z.ZodObject<{
|
|
352
|
+
scheme: z.ZodString;
|
|
353
|
+
network: z.ZodString;
|
|
354
|
+
maxAmountRequired: z.ZodString;
|
|
355
|
+
asset: z.ZodString;
|
|
356
|
+
payTo: z.ZodString;
|
|
357
|
+
resource: z.ZodOptional<z.ZodString>;
|
|
358
|
+
description: z.ZodOptional<z.ZodString>;
|
|
359
|
+
mimeType: z.ZodOptional<z.ZodString>;
|
|
360
|
+
outputSchema: z.ZodOptional<z.ZodUnknown>;
|
|
361
|
+
maxTimeoutSeconds: z.ZodOptional<z.ZodNumber>;
|
|
362
|
+
extra: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
363
|
+
}, z.core.$strip>;
|
|
364
|
+
type X402Requirement = z.infer<typeof x402RequirementSchema>;
|
|
365
|
+
interface X402RequirementsResponse {
|
|
366
|
+
x402Version: number;
|
|
367
|
+
error?: string;
|
|
368
|
+
accepts: X402Requirement[];
|
|
369
|
+
}
|
|
370
|
+
interface PaymentRequiredBody extends PaymentRequirementsDefinition {
|
|
371
|
+
x402?: X402RequirementsResponse;
|
|
372
|
+
}
|
|
373
|
+
type PaymentAttempt = {
|
|
374
|
+
type: "x402";
|
|
375
|
+
headerName: typeof HEADER_X402;
|
|
376
|
+
raw: string;
|
|
377
|
+
payload: X402PaymentHeader;
|
|
378
|
+
} | {
|
|
379
|
+
type: "direct";
|
|
380
|
+
headerName: typeof HEADER_DIRECT;
|
|
381
|
+
raw: string;
|
|
382
|
+
payload: DirectPaymentPayload;
|
|
383
|
+
};
|
|
384
|
+
interface ExtractAttemptsResult {
|
|
385
|
+
attempts: PaymentAttempt[];
|
|
386
|
+
failures: PaymentFailure[];
|
|
387
|
+
}
|
|
388
|
+
interface PaymentVerificationContext {
|
|
389
|
+
attempt: PaymentAttempt;
|
|
390
|
+
option: PaymentOption;
|
|
391
|
+
definition: PaymentRequirementsDefinition;
|
|
392
|
+
settle?: boolean;
|
|
393
|
+
}
|
|
394
|
+
interface PaymentVerificationResult {
|
|
395
|
+
success: boolean;
|
|
396
|
+
optionId: string;
|
|
397
|
+
attemptType: PaymentAttempt["type"];
|
|
398
|
+
metadata?: PaymentSuccessMetadata;
|
|
399
|
+
failure?: PaymentFailure;
|
|
400
|
+
responseHeaders?: Record<string, string>;
|
|
401
|
+
}
|
|
402
|
+
type PaymentVerifier = (context: PaymentVerificationContext) => Promise<PaymentVerificationResult>;
|
|
403
|
+
interface VerifyPaymentOptions {
|
|
404
|
+
definition: PaymentRequirementsDefinition;
|
|
405
|
+
request?: Request;
|
|
406
|
+
attempts?: PaymentAttempt[];
|
|
407
|
+
settle?: boolean;
|
|
408
|
+
verifiers?: Record<string, PaymentVerifier>;
|
|
409
|
+
fetchImpl?: typeof fetch;
|
|
410
|
+
}
|
|
411
|
+
declare function createPaymentRequiredBody(definition: PaymentRequirementsDefinition): PaymentRequiredBody;
|
|
412
|
+
declare function paymentRequiredResponse(definition: PaymentRequirementsDefinition, init?: ResponseInit): Response;
|
|
413
|
+
declare function extractPaymentAttempts(source: Request): ExtractAttemptsResult;
|
|
414
|
+
declare function verifyPayment(options: VerifyPaymentOptions): Promise<PaymentVerificationResult>;
|
|
415
|
+
declare function createPaymentResponseHeader(metadata: PaymentSuccessMetadata): string;
|
|
416
|
+
declare const PAYMENT_HEADERS: {
|
|
417
|
+
readonly x402: "X-PAYMENT";
|
|
418
|
+
readonly direct: "X-PAYMENT-PROOF";
|
|
419
|
+
readonly response: "X-PAYMENT-RESPONSE";
|
|
420
|
+
};
|
|
421
|
+
|
|
422
|
+
interface DefinedPayment {
|
|
423
|
+
definition: PaymentRequirementsDefinition;
|
|
424
|
+
verifiers: Record<string, PaymentVerifier>;
|
|
425
|
+
metadata?: Record<string, unknown>;
|
|
426
|
+
message?: string;
|
|
427
|
+
}
|
|
428
|
+
interface RequirePaymentOptions {
|
|
429
|
+
settle?: boolean;
|
|
430
|
+
verifiers?: Record<string, PaymentVerifier>;
|
|
431
|
+
fetchImpl?: typeof fetch;
|
|
432
|
+
onFailure?: (result: PaymentVerificationResult) => Response;
|
|
433
|
+
}
|
|
434
|
+
interface RequirePaymentSuccess {
|
|
435
|
+
payment: PaymentSuccessMetadata;
|
|
436
|
+
headers: Record<string, string>;
|
|
437
|
+
optionId: string;
|
|
438
|
+
result: PaymentVerificationResult;
|
|
439
|
+
}
|
|
440
|
+
type RequirePaymentOutcome = Response | RequirePaymentSuccess;
|
|
441
|
+
declare class PaymentRequiredError extends Error {
|
|
442
|
+
readonly response: Response;
|
|
443
|
+
readonly verification: PaymentVerificationResult | undefined;
|
|
444
|
+
constructor(response: Response, verification?: PaymentVerificationResult);
|
|
445
|
+
}
|
|
446
|
+
type PaymentContext = RequirePaymentSuccess;
|
|
447
|
+
declare function getPaymentContext(request: Request): PaymentContext | undefined;
|
|
448
|
+
declare function withPaymentRequirement(handler: (request: Request) => Promise<Response> | Response, payment: DefinedPayment | PaymentRequirementsDefinition, options?: RequirePaymentOptions): (request: Request) => Promise<Response>;
|
|
449
|
+
interface DefinePaymentConfig {
|
|
450
|
+
amount: string | number;
|
|
451
|
+
payTo: string;
|
|
452
|
+
currency?: string;
|
|
453
|
+
message?: string;
|
|
454
|
+
resource?: string;
|
|
455
|
+
acceptedMethods?: ("x402" | "402")[];
|
|
456
|
+
acceptedCurrencies?: string[];
|
|
457
|
+
chains?: (string | number)[];
|
|
458
|
+
facilitator?: "opentool" | "coinbase" | string | X402ProofConfig["facilitator"];
|
|
459
|
+
metadata?: Record<string, unknown>;
|
|
460
|
+
verifiers?: Record<string, PaymentVerifier>;
|
|
461
|
+
x402?: X402Config;
|
|
462
|
+
direct?: DirectConfig;
|
|
463
|
+
}
|
|
464
|
+
interface X402Config {
|
|
465
|
+
id?: string;
|
|
466
|
+
facilitator?: string | X402ProofConfig["facilitator"];
|
|
467
|
+
network?: string;
|
|
468
|
+
assetAddress?: string;
|
|
469
|
+
scheme?: string;
|
|
470
|
+
version?: number;
|
|
471
|
+
settlement?: SettlementTerms;
|
|
472
|
+
}
|
|
473
|
+
interface DirectConfig {
|
|
474
|
+
id?: string;
|
|
475
|
+
verifierId?: string;
|
|
476
|
+
proofType?: string;
|
|
477
|
+
token?: string;
|
|
478
|
+
verify?: PaymentVerifier;
|
|
479
|
+
instructions?: string;
|
|
480
|
+
fields?: PaymentField[];
|
|
481
|
+
allowsManualReview?: boolean;
|
|
482
|
+
settlement?: SettlementTerms;
|
|
483
|
+
}
|
|
484
|
+
declare function definePayment(config: DefinePaymentConfig): DefinedPayment;
|
|
485
|
+
declare function requirePayment(request: Request, payment: DefinedPayment | PaymentRequirementsDefinition, options?: RequirePaymentOptions): Promise<RequirePaymentOutcome>;
|
|
486
|
+
|
|
487
|
+
export { type RequirePaymentOutcome as $, paymentFailureSchema as A, type PaymentFailure as B, type Currency as C, type DirectProofConfig as D, type X402Requirement as E, type FacilitatorConfig as F, type X402RequirementsResponse as G, HEADER_PAYMENT_RESPONSE as H, type PaymentRequiredBody as I, type PaymentAttempt as J, type ExtractAttemptsResult as K, type PaymentVerificationContext as L, type PaymentVerificationResult as M, type PaymentVerifier as N, createPaymentRequiredBody as O, PAYMENT_SCHEMA_VERSION as P, paymentRequiredResponse as Q, extractPaymentAttempts as R, type SettlementTerms as S, verifyPayment as T, createPaymentResponseHeader as U, type VerifyPaymentOptions as V, PAYMENT_HEADERS as W, type X402ProofConfig as X, type DefinedPayment as Y, type RequirePaymentOptions as Z, type RequirePaymentSuccess as _, type PaymentSchemaVersion as a, PaymentRequiredError as a0, type PaymentContext as a1, getPaymentContext as a2, withPaymentRequirement as a3, type DefinePaymentConfig as a4, type X402Config as a5, type DirectConfig as a6, definePayment as a7, requirePayment as a8, paymentAmountSchema as b, currencySchema as c, decimalStringSchema as d, type PaymentAmount as e, cryptoAssetSchema as f, type CryptoAsset as g, facilitatorConfigSchema as h, paymentFieldSchema as i, type PaymentField as j, directProofSchema as k, paymentProofSchema as l, type PaymentProofConfig as m, paymentOptionSchema as n, type PaymentOption as o, paymentSchemaVersionSchema as p, paymentRequirementsSchema as q, type PaymentRequirementsDefinition as r, settlementTermsSchema as s, x402PaymentHeaderSchema as t, type X402PaymentHeader as u, directPaymentPayloadSchema as v, type DirectPaymentPayload as w, x402ProofSchema as x, paymentSuccessMetadataSchema as y, type PaymentSuccessMetadata as z };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
2
|
-
import { I as InternalToolDefinition, T as ToolResponse } from './validate-
|
|
3
|
-
export { B as BuildConfig, H as HTTP_METHODS, d as HttpHandlerDefinition, c as HttpMethod, M as McpConfig, h as Metadata, S as ServerConfig, e as Tool, b as ToolContent, f as ToolMetadataOverrides, g as generateMetadata, a as generateMetadataCommand, l as loadAndValidateTools, v as validateCommand } from './validate-
|
|
4
|
-
export { g as CryptoAsset, C as Currency, a4 as DefinePaymentConfig, Y as DefinedPayment, a6 as DirectConfig, w as DirectPaymentPayload, D as DirectProofConfig, K as ExtractAttemptsResult, F as FacilitatorConfig, H as HEADER_PAYMENT_RESPONSE, W as PAYMENT_HEADERS, P as PAYMENT_SCHEMA_VERSION, e as PaymentAmount, J as PaymentAttempt, a1 as PaymentContext, B as PaymentFailure, j as PaymentField, o as PaymentOption, m as PaymentProofConfig, I as PaymentRequiredBody, a0 as PaymentRequiredError, r as PaymentRequirementsDefinition, a as PaymentSchemaVersion, z as PaymentSuccessMetadata, L as PaymentVerificationContext, M as PaymentVerificationResult, N as PaymentVerifier, Z as RequirePaymentOptions, $ as RequirePaymentOutcome, _ as RequirePaymentSuccess, S as SettlementTerms, V as VerifyPaymentOptions, a5 as X402Config, u as X402PaymentHeader, X as X402ProofConfig, E as X402Requirement, G as X402RequirementsResponse, O as createPaymentRequiredBody, U as createPaymentResponseHeader, f as cryptoAssetSchema, c as currencySchema, d as decimalStringSchema, a7 as definePayment, v as directPaymentPayloadSchema, k as directProofSchema, R as extractPaymentAttempts, h as facilitatorConfigSchema, a2 as getPaymentContext, b as paymentAmountSchema, A as paymentFailureSchema, i as paymentFieldSchema, n as paymentOptionSchema, l as paymentProofSchema, Q as paymentRequiredResponse, q as paymentRequirementsSchema, p as paymentSchemaVersionSchema, y as paymentSuccessMetadataSchema, a8 as requirePayment, s as settlementTermsSchema, T as verifyPayment, a3 as withPaymentRequirement, t as x402PaymentHeaderSchema, x as x402ProofSchema } from './index-
|
|
2
|
+
import { I as InternalToolDefinition, T as ToolResponse } from './validate-CqB2Juma.js';
|
|
3
|
+
export { B as BuildConfig, H as HTTP_METHODS, d as HttpHandlerDefinition, c as HttpMethod, M as McpConfig, h as Metadata, S as ServerConfig, e as Tool, b as ToolContent, f as ToolMetadataOverrides, g as generateMetadata, a as generateMetadataCommand, l as loadAndValidateTools, v as validateCommand } from './validate-CqB2Juma.js';
|
|
4
|
+
export { g as CryptoAsset, C as Currency, a4 as DefinePaymentConfig, Y as DefinedPayment, a6 as DirectConfig, w as DirectPaymentPayload, D as DirectProofConfig, K as ExtractAttemptsResult, F as FacilitatorConfig, H as HEADER_PAYMENT_RESPONSE, W as PAYMENT_HEADERS, P as PAYMENT_SCHEMA_VERSION, e as PaymentAmount, J as PaymentAttempt, a1 as PaymentContext, B as PaymentFailure, j as PaymentField, o as PaymentOption, m as PaymentProofConfig, I as PaymentRequiredBody, a0 as PaymentRequiredError, r as PaymentRequirementsDefinition, a as PaymentSchemaVersion, z as PaymentSuccessMetadata, L as PaymentVerificationContext, M as PaymentVerificationResult, N as PaymentVerifier, Z as RequirePaymentOptions, $ as RequirePaymentOutcome, _ as RequirePaymentSuccess, S as SettlementTerms, V as VerifyPaymentOptions, a5 as X402Config, u as X402PaymentHeader, X as X402ProofConfig, E as X402Requirement, G as X402RequirementsResponse, O as createPaymentRequiredBody, U as createPaymentResponseHeader, f as cryptoAssetSchema, c as currencySchema, d as decimalStringSchema, a7 as definePayment, v as directPaymentPayloadSchema, k as directProofSchema, R as extractPaymentAttempts, h as facilitatorConfigSchema, a2 as getPaymentContext, b as paymentAmountSchema, A as paymentFailureSchema, i as paymentFieldSchema, n as paymentOptionSchema, l as paymentProofSchema, Q as paymentRequiredResponse, q as paymentRequirementsSchema, p as paymentSchemaVersionSchema, y as paymentSuccessMetadataSchema, a8 as requirePayment, s as settlementTermsSchema, T as verifyPayment, a3 as withPaymentRequirement, t as x402PaymentHeaderSchema, x as x402ProofSchema } from './index-D_bCF2Bf.js';
|
|
5
5
|
export { ChainMetadata, ChainReference, ChainTokenMap, DEFAULT_CHAIN, DEFAULT_TOKENS, Hex, HexAddress, RpcProviderOptions, RpcUrlResolver, TokenMetadata, TurnkeyOptions, TurnkeySignWith, WalletBaseContext, WalletContext, WalletFullContext, WalletOptions, WalletOptionsBase, WalletPrivateKeyOptions, WalletProviderType, WalletReadonlyContext, WalletReadonlyOptions, WalletRegistry, WalletSendTransactionParams, WalletSignerContext, WalletTransferParams, WalletTurnkeyOptions, chains, getRpcUrl, registry, tokens, wallet, walletToolkit } from './wallets/index.js';
|
|
6
6
|
export { AIAbortError, AIClientConfig, AIError, AIFetchError, AIRequestMetadata, AIResponseError, ChatCompletionChoice, ChatCompletionLogProbs, ChatCompletionResponse, ChatCompletionUsage, ChatMessage, ChatMessageContentPart, ChatMessageContentPartImageUrl, ChatMessageContentPartText, ChatMessageRole, DEFAULT_BASE_URL, DEFAULT_MODEL, DEFAULT_TIMEOUT_MS, FunctionToolDefinition, GenerateTextOptions, GenerateTextResult, GenerationParameters, JsonSchema, ResolvedAIClientConfig, ResponseErrorDetails, StreamTextOptions, StreamTextResult, StreamingEventHandlers, ToolChoice, ToolDefinition, ToolExecutionPolicy, WEBSEARCH_TOOL_DEFINITION, WEBSEARCH_TOOL_NAME, WebSearchOptions, createAIClient, ensureTextContent, flattenMessageContent, generateText, getModelConfig, isStreamingSupported, isToolCallingSupported, listModels, normalizeModelName, resolveConfig, resolveToolset, streamText } from './ai/index.js';
|
|
7
7
|
import { ZodSchema } from 'zod';
|
package/dist/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import { ListToolsRequestSchema, CallToolRequestSchema } from '@modelcontextprot
|
|
|
4
4
|
import * as fs2 from 'fs';
|
|
5
5
|
import * as path5 from 'path';
|
|
6
6
|
import { fileURLToPath, pathToFileURL } from 'url';
|
|
7
|
-
import { zodToJsonSchema } from 'zod-to-json-schema';
|
|
7
|
+
import { zodToJsonSchema } from '@alcyone-labs/zod-to-json-schema';
|
|
8
8
|
import { z } from 'zod';
|
|
9
9
|
import { zeroAddress, createPublicClient, http, createWalletClient } from 'viem';
|
|
10
10
|
import { baseSepolia, mainnet, base } from 'viem/chains';
|
|
@@ -825,8 +825,8 @@ function definePayment(config) {
|
|
|
825
825
|
baseMetadata.plain402 = includePlain402;
|
|
826
826
|
baseMetadata.acceptedMethods = methods;
|
|
827
827
|
baseMetadata.acceptedCurrencies = config.acceptedCurrencies ?? [currencyCode];
|
|
828
|
-
if (config.
|
|
829
|
-
baseMetadata.
|
|
828
|
+
if (config.chains) {
|
|
829
|
+
baseMetadata.chains = config.chains;
|
|
830
830
|
}
|
|
831
831
|
if (facilitatorLabel) {
|
|
832
832
|
baseMetadata.facilitator = facilitatorLabel;
|
|
@@ -2512,7 +2512,7 @@ var PaymentConfigSchema = z.object({
|
|
|
2512
2512
|
plain402: z.boolean().optional(),
|
|
2513
2513
|
acceptedMethods: z.array(z.union([z.literal("x402"), z.literal("402")])).optional(),
|
|
2514
2514
|
acceptedCurrencies: z.array(z.string()).optional(),
|
|
2515
|
-
|
|
2515
|
+
chains: z.array(z.union([z.string(), z.number()])).optional(),
|
|
2516
2516
|
facilitator: z.string().optional()
|
|
2517
2517
|
}).strict();
|
|
2518
2518
|
var DiscoveryMetadataSchema = z.object({
|
|
@@ -2520,9 +2520,9 @@ var DiscoveryMetadataSchema = z.object({
|
|
|
2520
2520
|
category: z.string().optional(),
|
|
2521
2521
|
useCases: z.array(z.string()).optional(),
|
|
2522
2522
|
capabilities: z.array(z.string()).optional(),
|
|
2523
|
-
requirements: z.record(z.any()).optional(),
|
|
2524
|
-
pricing: z.record(z.any()).optional(),
|
|
2525
|
-
compatibility: z.record(z.any()).optional(),
|
|
2523
|
+
requirements: z.record(z.string(), z.any()).optional(),
|
|
2524
|
+
pricing: z.record(z.string(), z.any()).optional(),
|
|
2525
|
+
compatibility: z.record(z.string(), z.any()).optional(),
|
|
2526
2526
|
documentation: z.union([z.string(), z.array(z.string())]).optional()
|
|
2527
2527
|
}).catchall(z.any());
|
|
2528
2528
|
var ToolMetadataOverridesSchema = z.object({
|
|
@@ -2565,9 +2565,9 @@ var AuthoredMetadataSchema = z.object({
|
|
|
2565
2565
|
keywords: z.array(z.string()).optional(),
|
|
2566
2566
|
useCases: z.array(z.string()).optional(),
|
|
2567
2567
|
capabilities: z.array(z.string()).optional(),
|
|
2568
|
-
requirements: z.record(z.any()).optional(),
|
|
2569
|
-
pricing: z.record(z.any()).optional(),
|
|
2570
|
-
compatibility: z.record(z.any()).optional(),
|
|
2568
|
+
requirements: z.record(z.string(), z.any()).optional(),
|
|
2569
|
+
pricing: z.record(z.string(), z.any()).optional(),
|
|
2570
|
+
compatibility: z.record(z.string(), z.any()).optional(),
|
|
2571
2571
|
chains: z.array(z.union([z.string(), z.number()])).optional()
|
|
2572
2572
|
}).catchall(z.any());
|
|
2573
2573
|
var MetadataSchema = z.object({
|
|
@@ -2892,7 +2892,7 @@ function resolvePayment(authored, defaults) {
|
|
|
2892
2892
|
plain402: acceptedMethods.includes("402"),
|
|
2893
2893
|
acceptedMethods,
|
|
2894
2894
|
acceptedCurrencies: Array.isArray(pricing.acceptedCurrencies) ? pricing.acceptedCurrencies : ["USDC"],
|
|
2895
|
-
|
|
2895
|
+
chains: Array.isArray(pricing.chains) ? pricing.chains : [8453]
|
|
2896
2896
|
};
|
|
2897
2897
|
}
|
|
2898
2898
|
function buildDiscovery(authored) {
|