@t2000/cli 0.22.25 → 0.23.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.
Files changed (34) hide show
  1. package/README.md +11 -97
  2. package/dist/{ccip-JEEJV65M.js → ccip-XP27NGI7.js} +3 -3
  3. package/dist/{chunk-A5X4KG7U.js → chunk-3I6VJOM6.js} +210 -970
  4. package/dist/chunk-3I6VJOM6.js.map +1 -0
  5. package/dist/chunk-4N76GQCL.js +35382 -0
  6. package/dist/chunk-4N76GQCL.js.map +1 -0
  7. package/dist/{chunk-XOAZJ42V.js → chunk-DWOZSUBE.js} +588 -584
  8. package/dist/{chunk-XOAZJ42V.js.map → chunk-DWOZSUBE.js.map} +1 -1
  9. package/dist/chunk-EI3GHTKX.js +968 -0
  10. package/dist/chunk-EI3GHTKX.js.map +1 -0
  11. package/dist/{chunk-EEPD7SHV.js → chunk-TYYJRUQI.js} +15755 -15918
  12. package/dist/chunk-TYYJRUQI.js.map +1 -0
  13. package/dist/client-5KJQTN5X.js +84 -0
  14. package/dist/client-5KJQTN5X.js.map +1 -0
  15. package/dist/{client-R3NRAXMD.js → client-IXUBQ3HM.js} +334 -638
  16. package/dist/client-IXUBQ3HM.js.map +1 -0
  17. package/dist/{dist-LKHCKFGY.js → dist-E7HUP73Q.js} +5 -29
  18. package/dist/{dist-ZTFOTMJO.js → dist-W4Q4YXD7.js} +4200 -603
  19. package/dist/dist-W4Q4YXD7.js.map +1 -0
  20. package/dist/index.js +29 -1016
  21. package/dist/index.js.map +1 -1
  22. package/package.json +5 -6
  23. package/dist/chunk-77SWBATH.js +0 -204
  24. package/dist/chunk-77SWBATH.js.map +0 -1
  25. package/dist/chunk-A5X4KG7U.js.map +0 -1
  26. package/dist/chunk-EEPD7SHV.js.map +0 -1
  27. package/dist/chunk-FM4762OE.js +0 -77733
  28. package/dist/chunk-FM4762OE.js.map +0 -1
  29. package/dist/client-CK5OR2TP.js +0 -746
  30. package/dist/client-CK5OR2TP.js.map +0 -1
  31. package/dist/client-R3NRAXMD.js.map +0 -1
  32. package/dist/dist-ZTFOTMJO.js.map +0 -1
  33. /package/dist/{ccip-JEEJV65M.js.map → ccip-XP27NGI7.js.map} +0 -0
  34. /package/dist/{dist-LKHCKFGY.js.map → dist-E7HUP73Q.js.map} +0 -0
@@ -1,746 +0,0 @@
1
- import { createRequire as __createRequire } from 'module'; import { fileURLToPath as __fileURLToPath } from 'url'; import { dirname as __pathDirname } from 'path'; const require = __createRequire(import.meta.url); const __filename = __fileURLToPath(import.meta.url); const __dirname = __pathDirname(__filename);
2
- import {
3
- $brand,
4
- $input,
5
- $output,
6
- Base64_exports,
7
- Json_exports,
8
- NEVER,
9
- TimePrecision,
10
- ZodMiniAny,
11
- ZodMiniArray,
12
- ZodMiniBase64,
13
- ZodMiniBase64URL,
14
- ZodMiniBigInt,
15
- ZodMiniBigIntFormat,
16
- ZodMiniBoolean,
17
- ZodMiniCIDRv4,
18
- ZodMiniCIDRv6,
19
- ZodMiniCUID,
20
- ZodMiniCUID2,
21
- ZodMiniCatch,
22
- ZodMiniCodec,
23
- ZodMiniCustom,
24
- ZodMiniCustomStringFormat,
25
- ZodMiniDate,
26
- ZodMiniDefault,
27
- ZodMiniDiscriminatedUnion,
28
- ZodMiniE164,
29
- ZodMiniEmail,
30
- ZodMiniEmoji,
31
- ZodMiniEnum,
32
- ZodMiniExactOptional,
33
- ZodMiniFile,
34
- ZodMiniFunction,
35
- ZodMiniGUID,
36
- ZodMiniIPv4,
37
- ZodMiniIPv6,
38
- ZodMiniISODate,
39
- ZodMiniISODateTime,
40
- ZodMiniISODuration,
41
- ZodMiniISOTime,
42
- ZodMiniIntersection,
43
- ZodMiniJWT,
44
- ZodMiniKSUID,
45
- ZodMiniLazy,
46
- ZodMiniLiteral,
47
- ZodMiniMAC,
48
- ZodMiniMap,
49
- ZodMiniNaN,
50
- ZodMiniNanoID,
51
- ZodMiniNever,
52
- ZodMiniNonOptional,
53
- ZodMiniNull,
54
- ZodMiniNullable,
55
- ZodMiniNumber,
56
- ZodMiniNumberFormat,
57
- ZodMiniObject,
58
- ZodMiniOptional,
59
- ZodMiniPipe,
60
- ZodMiniPrefault,
61
- ZodMiniPromise,
62
- ZodMiniReadonly,
63
- ZodMiniRecord,
64
- ZodMiniSet,
65
- ZodMiniString,
66
- ZodMiniStringFormat,
67
- ZodMiniSuccess,
68
- ZodMiniSymbol,
69
- ZodMiniTemplateLiteral,
70
- ZodMiniTransform,
71
- ZodMiniTuple,
72
- ZodMiniType,
73
- ZodMiniULID,
74
- ZodMiniURL,
75
- ZodMiniUUID,
76
- ZodMiniUndefined,
77
- ZodMiniUnion,
78
- ZodMiniUnknown,
79
- ZodMiniVoid,
80
- ZodMiniXID,
81
- ZodMiniXor,
82
- _catch,
83
- _default,
84
- _endsWith,
85
- _enum,
86
- _function,
87
- _gt,
88
- _gte,
89
- _includes,
90
- _instanceof,
91
- _lazy,
92
- _length,
93
- _lowercase,
94
- _lt,
95
- _lte,
96
- _maxLength,
97
- _maxSize,
98
- _mime,
99
- _minLength,
100
- _minSize,
101
- _multipleOf,
102
- _negative,
103
- _nonnegative,
104
- _nonpositive,
105
- _normalize,
106
- _null,
107
- _overwrite,
108
- _positive,
109
- _property,
110
- _regex,
111
- _size,
112
- _startsWith,
113
- _toLowerCase,
114
- _toUpperCase,
115
- _trim,
116
- _undefined,
117
- _uppercase,
118
- _void,
119
- any,
120
- array,
121
- base64,
122
- base64url,
123
- bigint,
124
- boolean,
125
- catchall,
126
- check,
127
- cidrv4,
128
- cidrv6,
129
- clone,
130
- codec,
131
- coerce_exports,
132
- config,
133
- core_exports,
134
- cuid,
135
- cuid2,
136
- custom,
137
- date,
138
- decode,
139
- decodeAsync,
140
- describe,
141
- discriminatedUnion,
142
- e164,
143
- email,
144
- emoji,
145
- encode,
146
- encodeAsync,
147
- exactOptional,
148
- extend,
149
- external_exports,
150
- file,
151
- flattenError,
152
- float32,
153
- float64,
154
- formatError,
155
- globalRegistry,
156
- guid,
157
- hex,
158
- hostname,
159
- httpUrl,
160
- int,
161
- int32,
162
- int64,
163
- intersection,
164
- ipv4,
165
- ipv6,
166
- iso_exports,
167
- json,
168
- jwt,
169
- keyof,
170
- ksuid,
171
- literal,
172
- locales_exports,
173
- looseObject,
174
- looseRecord,
175
- mac,
176
- map,
177
- merge,
178
- meta,
179
- nan,
180
- nanoid,
181
- nativeEnum,
182
- never,
183
- nonoptional,
184
- nullable,
185
- nullish,
186
- number,
187
- object,
188
- omit,
189
- optional,
190
- parse,
191
- parseAsync,
192
- partial,
193
- partialRecord,
194
- pick,
195
- pipe,
196
- prefault,
197
- prettifyError,
198
- promise,
199
- readonly,
200
- record,
201
- refine,
202
- regexes_exports,
203
- registry,
204
- required,
205
- safeDecode,
206
- safeDecodeAsync,
207
- safeEncode,
208
- safeEncodeAsync,
209
- safeExtend,
210
- safeParse,
211
- safeParseAsync,
212
- set,
213
- strictObject,
214
- string,
215
- stringFormat,
216
- stringbool,
217
- success,
218
- superRefine,
219
- symbol,
220
- templateLiteral,
221
- toJSONSchema,
222
- transform,
223
- treeifyError,
224
- tuple,
225
- uint32,
226
- uint64,
227
- ulid,
228
- union,
229
- unknown,
230
- url,
231
- util_exports,
232
- uuid,
233
- uuidv4,
234
- uuidv6,
235
- uuidv7,
236
- xid,
237
- xor
238
- } from "./chunk-EEPD7SHV.js";
239
- import "./chunk-NGS6K3I3.js";
240
- import "./chunk-77SWBATH.js";
241
- import "./chunk-7LGHVVIJ.js";
242
- import {
243
- Transaction
244
- } from "./chunk-XOAZJ42V.js";
245
- import "./chunk-3XUF7GM3.js";
246
- import {
247
- __export
248
- } from "./chunk-YPWSCLE3.js";
249
-
250
- // ../../node_modules/.pnpm/mppx@0.4.9_@modelcontextprotocol+sdk@1.28.0_zod@4.3.6__express@5.2.1_hono@4.12.9_openap_c4e524ef2c460fde6664b2d190f6f806/node_modules/mppx/dist/PaymentRequest.js
251
- function deserialize(encoded) {
252
- const json2 = Base64_exports.toString(encoded);
253
- return JSON.parse(json2);
254
- }
255
- function serialize(request) {
256
- const json2 = Json_exports.canonicalize(request);
257
- return Base64_exports.fromString(json2, { pad: false, url: true });
258
- }
259
-
260
- // ../../node_modules/.pnpm/mppx@0.4.9_@modelcontextprotocol+sdk@1.28.0_zod@4.3.6__express@5.2.1_hono@4.12.9_openap_c4e524ef2c460fde6664b2d190f6f806/node_modules/mppx/dist/zod.js
261
- var zod_exports = {};
262
- __export(zod_exports, {
263
- $brand: () => $brand,
264
- $input: () => $input,
265
- $output: () => $output,
266
- NEVER: () => NEVER,
267
- TimePrecision: () => TimePrecision,
268
- ZodMiniAny: () => ZodMiniAny,
269
- ZodMiniArray: () => ZodMiniArray,
270
- ZodMiniBase64: () => ZodMiniBase64,
271
- ZodMiniBase64URL: () => ZodMiniBase64URL,
272
- ZodMiniBigInt: () => ZodMiniBigInt,
273
- ZodMiniBigIntFormat: () => ZodMiniBigIntFormat,
274
- ZodMiniBoolean: () => ZodMiniBoolean,
275
- ZodMiniCIDRv4: () => ZodMiniCIDRv4,
276
- ZodMiniCIDRv6: () => ZodMiniCIDRv6,
277
- ZodMiniCUID: () => ZodMiniCUID,
278
- ZodMiniCUID2: () => ZodMiniCUID2,
279
- ZodMiniCatch: () => ZodMiniCatch,
280
- ZodMiniCodec: () => ZodMiniCodec,
281
- ZodMiniCustom: () => ZodMiniCustom,
282
- ZodMiniCustomStringFormat: () => ZodMiniCustomStringFormat,
283
- ZodMiniDate: () => ZodMiniDate,
284
- ZodMiniDefault: () => ZodMiniDefault,
285
- ZodMiniDiscriminatedUnion: () => ZodMiniDiscriminatedUnion,
286
- ZodMiniE164: () => ZodMiniE164,
287
- ZodMiniEmail: () => ZodMiniEmail,
288
- ZodMiniEmoji: () => ZodMiniEmoji,
289
- ZodMiniEnum: () => ZodMiniEnum,
290
- ZodMiniExactOptional: () => ZodMiniExactOptional,
291
- ZodMiniFile: () => ZodMiniFile,
292
- ZodMiniFunction: () => ZodMiniFunction,
293
- ZodMiniGUID: () => ZodMiniGUID,
294
- ZodMiniIPv4: () => ZodMiniIPv4,
295
- ZodMiniIPv6: () => ZodMiniIPv6,
296
- ZodMiniISODate: () => ZodMiniISODate,
297
- ZodMiniISODateTime: () => ZodMiniISODateTime,
298
- ZodMiniISODuration: () => ZodMiniISODuration,
299
- ZodMiniISOTime: () => ZodMiniISOTime,
300
- ZodMiniIntersection: () => ZodMiniIntersection,
301
- ZodMiniJWT: () => ZodMiniJWT,
302
- ZodMiniKSUID: () => ZodMiniKSUID,
303
- ZodMiniLazy: () => ZodMiniLazy,
304
- ZodMiniLiteral: () => ZodMiniLiteral,
305
- ZodMiniMAC: () => ZodMiniMAC,
306
- ZodMiniMap: () => ZodMiniMap,
307
- ZodMiniNaN: () => ZodMiniNaN,
308
- ZodMiniNanoID: () => ZodMiniNanoID,
309
- ZodMiniNever: () => ZodMiniNever,
310
- ZodMiniNonOptional: () => ZodMiniNonOptional,
311
- ZodMiniNull: () => ZodMiniNull,
312
- ZodMiniNullable: () => ZodMiniNullable,
313
- ZodMiniNumber: () => ZodMiniNumber,
314
- ZodMiniNumberFormat: () => ZodMiniNumberFormat,
315
- ZodMiniObject: () => ZodMiniObject,
316
- ZodMiniOptional: () => ZodMiniOptional,
317
- ZodMiniPipe: () => ZodMiniPipe,
318
- ZodMiniPrefault: () => ZodMiniPrefault,
319
- ZodMiniPromise: () => ZodMiniPromise,
320
- ZodMiniReadonly: () => ZodMiniReadonly,
321
- ZodMiniRecord: () => ZodMiniRecord,
322
- ZodMiniSet: () => ZodMiniSet,
323
- ZodMiniString: () => ZodMiniString,
324
- ZodMiniStringFormat: () => ZodMiniStringFormat,
325
- ZodMiniSuccess: () => ZodMiniSuccess,
326
- ZodMiniSymbol: () => ZodMiniSymbol,
327
- ZodMiniTemplateLiteral: () => ZodMiniTemplateLiteral,
328
- ZodMiniTransform: () => ZodMiniTransform,
329
- ZodMiniTuple: () => ZodMiniTuple,
330
- ZodMiniType: () => ZodMiniType,
331
- ZodMiniULID: () => ZodMiniULID,
332
- ZodMiniURL: () => ZodMiniURL,
333
- ZodMiniUUID: () => ZodMiniUUID,
334
- ZodMiniUndefined: () => ZodMiniUndefined,
335
- ZodMiniUnion: () => ZodMiniUnion,
336
- ZodMiniUnknown: () => ZodMiniUnknown,
337
- ZodMiniVoid: () => ZodMiniVoid,
338
- ZodMiniXID: () => ZodMiniXID,
339
- ZodMiniXor: () => ZodMiniXor,
340
- _default: () => _default,
341
- _function: () => _function,
342
- address: () => address,
343
- amount: () => amount,
344
- any: () => any,
345
- array: () => array,
346
- base64: () => base64,
347
- base64url: () => base64url,
348
- bigint: () => bigint,
349
- boolean: () => boolean,
350
- catch: () => _catch,
351
- catchall: () => catchall,
352
- check: () => check,
353
- cidrv4: () => cidrv4,
354
- cidrv6: () => cidrv6,
355
- clone: () => clone,
356
- codec: () => codec,
357
- coerce: () => coerce_exports,
358
- config: () => config,
359
- core: () => core_exports,
360
- cuid: () => cuid,
361
- cuid2: () => cuid2,
362
- custom: () => custom,
363
- date: () => date,
364
- datetime: () => datetime,
365
- decode: () => decode,
366
- decodeAsync: () => decodeAsync,
367
- describe: () => describe,
368
- discriminatedUnion: () => discriminatedUnion,
369
- e164: () => e164,
370
- email: () => email,
371
- emoji: () => emoji,
372
- encode: () => encode,
373
- encodeAsync: () => encodeAsync,
374
- endsWith: () => _endsWith,
375
- enum: () => _enum,
376
- exactOptional: () => exactOptional,
377
- extend: () => extend,
378
- file: () => file,
379
- flattenError: () => flattenError,
380
- float32: () => float32,
381
- float64: () => float64,
382
- formatError: () => formatError,
383
- function: () => _function,
384
- globalRegistry: () => globalRegistry,
385
- gt: () => _gt,
386
- gte: () => _gte,
387
- guid: () => guid,
388
- hash: () => hash,
389
- hex: () => hex,
390
- hostname: () => hostname,
391
- httpUrl: () => httpUrl,
392
- includes: () => _includes,
393
- instanceof: () => _instanceof,
394
- int: () => int,
395
- int32: () => int32,
396
- int64: () => int64,
397
- intersection: () => intersection,
398
- ipv4: () => ipv4,
399
- ipv6: () => ipv6,
400
- iso: () => iso_exports,
401
- json: () => json,
402
- jwt: () => jwt,
403
- keyof: () => keyof,
404
- ksuid: () => ksuid,
405
- lazy: () => _lazy,
406
- length: () => _length,
407
- literal: () => literal,
408
- locales: () => locales_exports,
409
- looseObject: () => looseObject,
410
- looseRecord: () => looseRecord,
411
- lowercase: () => _lowercase,
412
- lt: () => _lt,
413
- lte: () => _lte,
414
- mac: () => mac,
415
- map: () => map,
416
- maxLength: () => _maxLength,
417
- maxSize: () => _maxSize,
418
- maximum: () => _lte,
419
- merge: () => merge,
420
- meta: () => meta,
421
- mime: () => _mime,
422
- minLength: () => _minLength,
423
- minSize: () => _minSize,
424
- minimum: () => _gte,
425
- multipleOf: () => _multipleOf,
426
- nan: () => nan,
427
- nanoid: () => nanoid,
428
- nativeEnum: () => nativeEnum,
429
- negative: () => _negative,
430
- never: () => never,
431
- nonnegative: () => _nonnegative,
432
- nonoptional: () => nonoptional,
433
- nonpositive: () => _nonpositive,
434
- normalize: () => _normalize,
435
- null: () => _null,
436
- nullable: () => nullable,
437
- nullish: () => nullish,
438
- number: () => number,
439
- object: () => object,
440
- omit: () => omit,
441
- optional: () => optional,
442
- overwrite: () => _overwrite,
443
- parse: () => parse,
444
- parseAsync: () => parseAsync,
445
- partial: () => partial,
446
- partialRecord: () => partialRecord,
447
- period: () => period,
448
- pick: () => pick,
449
- pipe: () => pipe,
450
- positive: () => _positive,
451
- prefault: () => prefault,
452
- prettifyError: () => prettifyError,
453
- promise: () => promise,
454
- property: () => _property,
455
- readonly: () => readonly,
456
- record: () => record,
457
- refine: () => refine,
458
- regex: () => _regex,
459
- regexes: () => regexes_exports,
460
- registry: () => registry,
461
- required: () => required,
462
- safeDecode: () => safeDecode,
463
- safeDecodeAsync: () => safeDecodeAsync,
464
- safeEncode: () => safeEncode,
465
- safeEncodeAsync: () => safeEncodeAsync,
466
- safeExtend: () => safeExtend,
467
- safeParse: () => safeParse,
468
- safeParseAsync: () => safeParseAsync,
469
- set: () => set,
470
- signature: () => signature,
471
- size: () => _size,
472
- startsWith: () => _startsWith,
473
- strictObject: () => strictObject,
474
- string: () => string,
475
- stringFormat: () => stringFormat,
476
- stringbool: () => stringbool,
477
- success: () => success,
478
- superRefine: () => superRefine,
479
- symbol: () => symbol,
480
- templateLiteral: () => templateLiteral,
481
- toJSONSchema: () => toJSONSchema,
482
- toLowerCase: () => _toLowerCase,
483
- toUpperCase: () => _toUpperCase,
484
- transform: () => transform,
485
- treeifyError: () => treeifyError,
486
- trim: () => _trim,
487
- tuple: () => tuple,
488
- uint32: () => uint32,
489
- uint64: () => uint64,
490
- ulid: () => ulid,
491
- undefined: () => _undefined,
492
- union: () => union,
493
- unknown: () => unknown,
494
- unwrapOptional: () => unwrapOptional,
495
- uppercase: () => _uppercase,
496
- url: () => url,
497
- util: () => util_exports,
498
- uuid: () => uuid,
499
- uuidv4: () => uuidv4,
500
- uuidv6: () => uuidv6,
501
- uuidv7: () => uuidv7,
502
- void: () => _void,
503
- xid: () => xid,
504
- xor: () => xor,
505
- z: () => external_exports
506
- });
507
- function amount() {
508
- return external_exports.string().check(external_exports.regex(/^\d+(\.\d+)?$/, "Invalid amount"));
509
- }
510
- function datetime() {
511
- return external_exports.string().check(external_exports.regex(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})$/, "Invalid ISO 8601 datetime"));
512
- }
513
- function address() {
514
- return external_exports.string().check(external_exports.regex(/^0x[0-9a-fA-F]{40}$/, "Invalid address"));
515
- }
516
- function hash() {
517
- return external_exports.string().check(external_exports.regex(/^0x[0-9a-fA-F]{64}$/, "Invalid hash"));
518
- }
519
- function period() {
520
- return external_exports.string().check(external_exports.regex(/^(day|week|month|year|\d+)$/, "Invalid period"));
521
- }
522
- function signature() {
523
- return external_exports.string().check(external_exports.regex(/^0x[0-9a-fA-F]+$/, "Invalid signature"));
524
- }
525
- function unwrapOptional(schema) {
526
- if (schema._zod.def.type === "optional")
527
- return schema._zod.def.innerType;
528
- return schema;
529
- }
530
-
531
- // ../../node_modules/.pnpm/mppx@0.4.9_@modelcontextprotocol+sdk@1.28.0_zod@4.3.6__express@5.2.1_hono@4.12.9_openap_c4e524ef2c460fde6664b2d190f6f806/node_modules/mppx/dist/Challenge.js
532
- var Schema = object({
533
- /** Optional human-readable description of the payment. */
534
- description: optional(string()),
535
- /** Optional digest of the request body (format: "sha-256=base64hash"). */
536
- digest: optional(string().check(_regex(/^sha-256=/, "Invalid digest format"))),
537
- /** Optional expiration timestamp (ISO 8601). */
538
- expires: optional(datetime()),
539
- /** Unique challenge identifier (HMAC-bound). */
540
- id: string(),
541
- /** Intent type (e.g., "charge", "session"). */
542
- intent: string(),
543
- /** Payment method (e.g., "tempo", "stripe"). */
544
- method: string(),
545
- /** Optional server-defined correlation data. Flat string-to-string map; clients MUST NOT modify. */
546
- opaque: optional(record(string(), string())),
547
- /** Server realm (e.g., hostname). */
548
- realm: string(),
549
- /** Method-specific request data. */
550
- request: record(string(), unknown())
551
- });
552
-
553
- // ../../node_modules/.pnpm/mppx@0.4.9_@modelcontextprotocol+sdk@1.28.0_zod@4.3.6__express@5.2.1_hono@4.12.9_openap_c4e524ef2c460fde6664b2d190f6f806/node_modules/mppx/dist/Credential.js
554
- var Credential_exports = {};
555
- __export(Credential_exports, {
556
- deserialize: () => deserialize2,
557
- extractPaymentScheme: () => extractPaymentScheme,
558
- from: () => from,
559
- fromRequest: () => fromRequest,
560
- serialize: () => serialize2
561
- });
562
- function deserialize2(value) {
563
- const prefixMatch = value.match(/^Payment\s+(.+)$/i);
564
- if (!prefixMatch?.[1])
565
- throw new Error("Missing Payment scheme.");
566
- try {
567
- const json2 = Base64_exports.toString(prefixMatch[1]);
568
- const parsed = JSON.parse(json2);
569
- const challenge = Schema.parse({
570
- ...parsed.challenge,
571
- request: deserialize(parsed.challenge.request)
572
- });
573
- return {
574
- challenge,
575
- payload: parsed.payload,
576
- ...parsed.source && { source: parsed.source }
577
- };
578
- } catch {
579
- throw new Error("Invalid base64url or JSON.");
580
- }
581
- }
582
- function from(parameters) {
583
- const { challenge, payload, source } = parameters;
584
- return {
585
- challenge,
586
- payload,
587
- ...source && { source }
588
- };
589
- }
590
- function fromRequest(request) {
591
- const header = request.headers.get("Authorization");
592
- if (!header)
593
- throw new Error("Missing Authorization header.");
594
- const payment = extractPaymentScheme(header);
595
- if (!payment)
596
- throw new Error("Missing Payment scheme.");
597
- return deserialize2(payment);
598
- }
599
- function serialize2(credential) {
600
- const wire = {
601
- challenge: {
602
- ...credential.challenge,
603
- request: serialize(credential.challenge.request)
604
- },
605
- payload: credential.payload,
606
- ...credential.source && { source: credential.source }
607
- };
608
- const json2 = JSON.stringify(wire);
609
- const encoded = Base64_exports.fromString(json2, { pad: false, url: true });
610
- return `Payment ${encoded}`;
611
- }
612
- function extractPaymentScheme(header) {
613
- const schemes = header.split(",").map((s) => s.trim());
614
- return schemes.find((s) => /^Payment\s+/i.test(s)) ?? null;
615
- }
616
-
617
- // ../../node_modules/.pnpm/mppx@0.4.9_@modelcontextprotocol+sdk@1.28.0_zod@4.3.6__express@5.2.1_hono@4.12.9_openap_c4e524ef2c460fde6664b2d190f6f806/node_modules/mppx/dist/Method.js
618
- var Method_exports = {};
619
- __export(Method_exports, {
620
- from: () => from2,
621
- toClient: () => toClient,
622
- toServer: () => toServer
623
- });
624
- function from2(method) {
625
- return method;
626
- }
627
- function toClient(method, options) {
628
- const { context, createCredential } = options;
629
- return {
630
- ...method,
631
- context,
632
- createCredential
633
- };
634
- }
635
- function toServer(method, options) {
636
- const { defaults, request, respond, transport, verify } = options;
637
- return {
638
- ...method,
639
- defaults,
640
- request,
641
- respond,
642
- transport,
643
- verify
644
- };
645
- }
646
-
647
- // ../mpp-sui/dist/client.js
648
- var suiCharge = Method_exports.from({
649
- intent: "charge",
650
- name: "sui",
651
- schema: {
652
- credential: {
653
- payload: zod_exports.object({
654
- digest: zod_exports.string()
655
- })
656
- },
657
- request: zod_exports.object({
658
- amount: zod_exports.string(),
659
- currency: zod_exports.string(),
660
- recipient: zod_exports.string()
661
- })
662
- }
663
- });
664
- var SUI_USDC_TYPE = "0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC";
665
- async function fetchCoins(client, owner, coinType) {
666
- const coins = [];
667
- let cursor;
668
- let hasNext = true;
669
- while (hasNext) {
670
- const page = await client.getCoins({ owner, coinType, cursor: cursor ?? void 0 });
671
- coins.push(...page.data.map((c) => ({ coinObjectId: c.coinObjectId, balance: c.balance })));
672
- cursor = page.nextCursor;
673
- hasNext = page.hasNextPage;
674
- }
675
- return coins;
676
- }
677
- function parseAmountToRaw(amount2, decimals) {
678
- const [whole = "0", frac = ""] = amount2.split(".");
679
- const paddedFrac = frac.padEnd(decimals, "0").slice(0, decimals);
680
- return BigInt(whole + paddedFrac);
681
- }
682
- function sui(options) {
683
- const address2 = options.signer.getAddress();
684
- return Method_exports.toClient(suiCharge, {
685
- async createCredential({ challenge }) {
686
- const { amount: amount2, currency, recipient } = challenge.request;
687
- const amountRaw = parseAmountToRaw(amount2, 6);
688
- const coins = await fetchCoins(options.client, address2, currency);
689
- if (coins.length === 0) {
690
- throw new Error(
691
- `No ${currency.split("::").pop()} balance to pay with`
692
- );
693
- }
694
- const totalBalance = coins.reduce(
695
- (sum, c) => sum + BigInt(c.balance),
696
- 0n
697
- );
698
- if (totalBalance < amountRaw) {
699
- const available = Number(totalBalance) / 1e6;
700
- const requested = Number(amountRaw) / 1e6;
701
- throw new Error(
702
- `Not enough USDC to pay $${requested.toFixed(2)} (available: $${available.toFixed(2)})`
703
- );
704
- }
705
- const tx = new Transaction();
706
- tx.setSender(address2);
707
- const primaryCoin = tx.object(coins[0].coinObjectId);
708
- if (coins.length > 1) {
709
- tx.mergeCoins(
710
- primaryCoin,
711
- coins.slice(1).map((c) => tx.object(c.coinObjectId))
712
- );
713
- }
714
- const [payment] = tx.splitCoins(primaryCoin, [amountRaw]);
715
- tx.transferObjects([payment], recipient);
716
- let result;
717
- try {
718
- if (options.execute) {
719
- result = await options.execute(tx);
720
- } else {
721
- tx.setSender(address2);
722
- const built = await tx.build({ client: options.client });
723
- const { signature: signature2 } = await options.signer.signTransaction(built);
724
- result = await options.client.executeTransactionBlock({
725
- transactionBlock: built,
726
- signature: signature2,
727
- options: { showEffects: true }
728
- });
729
- }
730
- } catch (err) {
731
- const msg = err instanceof Error ? err.message : String(err);
732
- throw new Error(`Payment transaction failed: ${msg}`);
733
- }
734
- return Credential_exports.serialize({
735
- challenge,
736
- payload: { digest: result.digest }
737
- });
738
- }
739
- });
740
- }
741
- export {
742
- SUI_USDC_TYPE,
743
- sui,
744
- suiCharge
745
- };
746
- //# sourceMappingURL=client-CK5OR2TP.js.map