@t2000/mcp 5.5.0 → 5.6.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/dist/index.js CHANGED
@@ -10873,32 +10873,6 @@ var init_suins = __esm({
10873
10873
  }
10874
10874
  });
10875
10875
 
10876
- // ../../node_modules/.pnpm/@mysten+sui@2.17.0_typescript@5.9.3/node_modules/@mysten/sui/dist/utils/move-registry.mjs
10877
- var NAME_PATTERN, VERSION_REGEX, MAX_APP_SIZE, NAME_SEPARATOR, isValidNamedPackage, isValidNamedType;
10878
- var init_move_registry = __esm({
10879
- "../../node_modules/.pnpm/@mysten+sui@2.17.0_typescript@5.9.3/node_modules/@mysten/sui/dist/utils/move-registry.mjs"() {
10880
- init_suins();
10881
- init_sui_types();
10882
- NAME_PATTERN = /^([a-z0-9]+(?:-[a-z0-9]+)*)$/;
10883
- VERSION_REGEX = /^\d+$/;
10884
- MAX_APP_SIZE = 64;
10885
- NAME_SEPARATOR = "/";
10886
- isValidNamedPackage = (name) => {
10887
- const parts = name.split(NAME_SEPARATOR);
10888
- if (parts.length < 2 || parts.length > 3) return false;
10889
- const [org, app, version2] = parts;
10890
- if (version2 !== void 0 && !VERSION_REGEX.test(version2)) return false;
10891
- if (!isValidSuiNSName(org)) return false;
10892
- return NAME_PATTERN.test(app) && app.length < MAX_APP_SIZE;
10893
- };
10894
- isValidNamedType = (type) => {
10895
- const splitType = type.split(/::|<|>|,/);
10896
- for (const t of splitType) if (t.includes(NAME_SEPARATOR) && !isValidNamedPackage(t)) return false;
10897
- return isValidStructTag(type);
10898
- };
10899
- }
10900
- });
10901
-
10902
10876
  // ../../node_modules/.pnpm/@mysten+bcs@2.0.3/node_modules/@mysten/bcs/dist/uleb.mjs
10903
10877
  function ulebEncode(num) {
10904
10878
  let bigNum = BigInt(num);
@@ -12264,1121 +12238,197 @@ var init_sui_types = __esm({
12264
12238
  }
12265
12239
  });
12266
12240
 
12267
- // ../../node_modules/.pnpm/valibot@1.3.1_typescript@5.9.3/node_modules/valibot/dist/index.mjs
12268
- // @__NO_SIDE_EFFECTS__
12269
- function getGlobalConfig(config$1) {
12270
- return {
12271
- lang: config$1?.lang ?? store$4?.lang,
12272
- message: config$1?.message,
12273
- abortEarly: config$1?.abortEarly ?? store$4?.abortEarly,
12274
- abortPipeEarly: config$1?.abortPipeEarly ?? store$4?.abortPipeEarly
12275
- };
12276
- }
12277
- // @__NO_SIDE_EFFECTS__
12278
- function getGlobalMessage(lang) {
12279
- return store$3?.get(lang);
12280
- }
12281
- // @__NO_SIDE_EFFECTS__
12282
- function getSchemaMessage(lang) {
12283
- return store$2?.get(lang);
12284
- }
12285
- // @__NO_SIDE_EFFECTS__
12286
- function getSpecificMessage(reference, lang) {
12287
- return store$1?.get(reference)?.get(lang);
12288
- }
12289
- // @__NO_SIDE_EFFECTS__
12290
- function _stringify(input) {
12291
- const type = typeof input;
12292
- if (type === "string") return `"${input}"`;
12293
- if (type === "number" || type === "bigint" || type === "boolean") return `${input}`;
12294
- if (type === "object" || type === "function") return (input && Object.getPrototypeOf(input)?.constructor?.name) ?? "null";
12295
- return type;
12296
- }
12297
- function _addIssue(context, label, dataset, config$1, other) {
12298
- const input = other && "input" in other ? other.input : dataset.value;
12299
- const expected = other?.expected ?? context.expects ?? null;
12300
- const received = other?.received ?? /* @__PURE__ */ _stringify(input);
12301
- const issue2 = {
12302
- kind: context.kind,
12303
- type: context.type,
12304
- input,
12305
- expected,
12306
- received,
12307
- message: `Invalid ${label}: ${expected ? `Expected ${expected} but r` : "R"}eceived ${received}`,
12308
- requirement: context.requirement,
12309
- path: other?.path,
12310
- issues: other?.issues,
12311
- lang: config$1.lang,
12312
- abortEarly: config$1.abortEarly,
12313
- abortPipeEarly: config$1.abortPipeEarly
12314
- };
12315
- const isSchema = context.kind === "schema";
12316
- const message$1 = other?.message ?? context.message ?? /* @__PURE__ */ getSpecificMessage(context.reference, issue2.lang) ?? (isSchema ? /* @__PURE__ */ getSchemaMessage(issue2.lang) : null) ?? config$1.message ?? /* @__PURE__ */ getGlobalMessage(issue2.lang);
12317
- if (message$1 !== void 0) issue2.message = typeof message$1 === "function" ? message$1(issue2) : message$1;
12318
- if (isSchema) dataset.typed = false;
12319
- if (dataset.issues) dataset.issues.push(issue2);
12320
- else dataset.issues = [issue2];
12321
- }
12322
- // @__NO_SIDE_EFFECTS__
12323
- function _getStandardProps(context) {
12324
- return {
12325
- version: 1,
12326
- vendor: "valibot",
12327
- validate(value$1) {
12328
- return context["~run"]({ value: value$1 }, /* @__PURE__ */ getGlobalConfig());
12329
- }
12330
- };
12331
- }
12332
- // @__NO_SIDE_EFFECTS__
12333
- function _isValidObjectKey(object$1, key) {
12334
- return Object.hasOwn(object$1, key) && key !== "__proto__" && key !== "prototype" && key !== "constructor";
12335
- }
12336
- // @__NO_SIDE_EFFECTS__
12337
- function _joinExpects(values$1, separator) {
12338
- const list = [...new Set(values$1)];
12339
- if (list.length > 1) return `(${list.join(` ${separator} `)})`;
12340
- return list[0] ?? "never";
12341
- }
12342
- // @__NO_SIDE_EFFECTS__
12343
- function check2(requirement, message$1) {
12344
- return {
12345
- kind: "validation",
12346
- type: "check",
12347
- reference: check2,
12348
- async: false,
12349
- expects: null,
12350
- requirement,
12351
- message: message$1,
12352
- "~run"(dataset, config$1) {
12353
- if (dataset.typed && !this.requirement(dataset.value)) _addIssue(this, "input", dataset, config$1);
12354
- return dataset;
12355
- }
12356
- };
12357
- }
12358
- // @__NO_SIDE_EFFECTS__
12359
- function integer2(message$1) {
12360
- return {
12361
- kind: "validation",
12362
- type: "integer",
12363
- reference: integer2,
12364
- async: false,
12365
- expects: null,
12366
- requirement: Number.isInteger,
12367
- message: message$1,
12368
- "~run"(dataset, config$1) {
12369
- if (dataset.typed && !this.requirement(dataset.value)) _addIssue(this, "integer", dataset, config$1);
12370
- return dataset;
12371
- }
12372
- };
12373
- }
12374
- // @__NO_SIDE_EFFECTS__
12375
- function transform2(operation) {
12376
- return {
12377
- kind: "transformation",
12378
- type: "transform",
12379
- reference: transform2,
12380
- async: false,
12381
- operation,
12382
- "~run"(dataset) {
12383
- dataset.value = this.operation(dataset.value);
12384
- return dataset;
12385
- }
12386
- };
12387
- }
12388
- // @__NO_SIDE_EFFECTS__
12389
- function getFallback(schema, dataset, config$1) {
12390
- return typeof schema.fallback === "function" ? schema.fallback(dataset, config$1) : schema.fallback;
12391
- }
12392
- // @__NO_SIDE_EFFECTS__
12393
- function getDefault(schema, dataset, config$1) {
12394
- return typeof schema.default === "function" ? schema.default(dataset, config$1) : schema.default;
12395
- }
12396
- // @__NO_SIDE_EFFECTS__
12397
- function is(schema, input) {
12398
- return !schema["~run"]({ value: input }, { abortEarly: true }).issues;
12399
- }
12400
- // @__NO_SIDE_EFFECTS__
12401
- function array2(item, message$1) {
12402
- return {
12403
- kind: "schema",
12404
- type: "array",
12405
- reference: array2,
12406
- expects: "Array",
12407
- async: false,
12408
- item,
12409
- message: message$1,
12410
- get "~standard"() {
12411
- return /* @__PURE__ */ _getStandardProps(this);
12412
- },
12413
- "~run"(dataset, config$1) {
12414
- const input = dataset.value;
12415
- if (Array.isArray(input)) {
12416
- dataset.typed = true;
12417
- dataset.value = [];
12418
- for (let key = 0; key < input.length; key++) {
12419
- const value$1 = input[key];
12420
- const itemDataset = this.item["~run"]({ value: value$1 }, config$1);
12421
- if (itemDataset.issues) {
12422
- const pathItem = {
12423
- type: "array",
12424
- origin: "value",
12425
- input,
12426
- key,
12427
- value: value$1
12428
- };
12429
- for (const issue2 of itemDataset.issues) {
12430
- if (issue2.path) issue2.path.unshift(pathItem);
12431
- else issue2.path = [pathItem];
12432
- dataset.issues?.push(issue2);
12433
- }
12434
- if (!dataset.issues) dataset.issues = itemDataset.issues;
12435
- if (config$1.abortEarly) {
12436
- dataset.typed = false;
12437
- break;
12438
- }
12439
- }
12440
- if (!itemDataset.typed) dataset.typed = false;
12441
- dataset.value.push(itemDataset.value);
12442
- }
12443
- } else _addIssue(this, "type", dataset, config$1);
12444
- return dataset;
12445
- }
12446
- };
12447
- }
12448
- // @__NO_SIDE_EFFECTS__
12449
- function bigint2(message$1) {
12450
- return {
12451
- kind: "schema",
12452
- type: "bigint",
12453
- reference: bigint2,
12454
- expects: "bigint",
12455
- async: false,
12456
- message: message$1,
12457
- get "~standard"() {
12458
- return /* @__PURE__ */ _getStandardProps(this);
12459
- },
12460
- "~run"(dataset, config$1) {
12461
- if (typeof dataset.value === "bigint") dataset.typed = true;
12462
- else _addIssue(this, "type", dataset, config$1);
12463
- return dataset;
12464
- }
12465
- };
12466
- }
12467
- // @__NO_SIDE_EFFECTS__
12468
- function boolean3(message$1) {
12469
- return {
12470
- kind: "schema",
12471
- type: "boolean",
12472
- reference: boolean3,
12473
- expects: "boolean",
12474
- async: false,
12475
- message: message$1,
12476
- get "~standard"() {
12477
- return /* @__PURE__ */ _getStandardProps(this);
12478
- },
12479
- "~run"(dataset, config$1) {
12480
- if (typeof dataset.value === "boolean") dataset.typed = true;
12481
- else _addIssue(this, "type", dataset, config$1);
12482
- return dataset;
12483
- }
12484
- };
12485
- }
12486
- // @__NO_SIDE_EFFECTS__
12487
- function lazy(getter) {
12488
- return {
12489
- kind: "schema",
12490
- type: "lazy",
12491
- reference: lazy,
12492
- expects: "unknown",
12493
- async: false,
12494
- getter,
12495
- get "~standard"() {
12496
- return /* @__PURE__ */ _getStandardProps(this);
12497
- },
12498
- "~run"(dataset, config$1) {
12499
- return this.getter(dataset.value)["~run"](dataset, config$1);
12500
- }
12501
- };
12502
- }
12503
- // @__NO_SIDE_EFFECTS__
12504
- function literal2(literal_, message$1) {
12505
- return {
12506
- kind: "schema",
12507
- type: "literal",
12508
- reference: literal2,
12509
- expects: /* @__PURE__ */ _stringify(literal_),
12510
- async: false,
12511
- literal: literal_,
12512
- message: message$1,
12513
- get "~standard"() {
12514
- return /* @__PURE__ */ _getStandardProps(this);
12515
- },
12516
- "~run"(dataset, config$1) {
12517
- if (dataset.value === this.literal) dataset.typed = true;
12518
- else _addIssue(this, "type", dataset, config$1);
12519
- return dataset;
12520
- }
12521
- };
12522
- }
12523
- // @__NO_SIDE_EFFECTS__
12524
- function nullable2(wrapped, default_) {
12525
- return {
12526
- kind: "schema",
12527
- type: "nullable",
12528
- reference: nullable2,
12529
- expects: `(${wrapped.expects} | null)`,
12530
- async: false,
12531
- wrapped,
12532
- default: default_,
12533
- get "~standard"() {
12534
- return /* @__PURE__ */ _getStandardProps(this);
12535
- },
12536
- "~run"(dataset, config$1) {
12537
- if (dataset.value === null) {
12538
- if (this.default !== void 0) dataset.value = /* @__PURE__ */ getDefault(this, dataset, config$1);
12539
- if (dataset.value === null) {
12540
- dataset.typed = true;
12541
- return dataset;
12542
- }
12241
+ // ../../node_modules/.pnpm/@mysten+sui@2.17.0_typescript@5.9.3/node_modules/@mysten/sui/dist/utils/move-registry.mjs
12242
+ var NAME_PATTERN, VERSION_REGEX, MAX_APP_SIZE, NAME_SEPARATOR, isValidNamedPackage, isValidNamedType;
12243
+ var init_move_registry = __esm({
12244
+ "../../node_modules/.pnpm/@mysten+sui@2.17.0_typescript@5.9.3/node_modules/@mysten/sui/dist/utils/move-registry.mjs"() {
12245
+ init_suins();
12246
+ init_sui_types();
12247
+ NAME_PATTERN = /^([a-z0-9]+(?:-[a-z0-9]+)*)$/;
12248
+ VERSION_REGEX = /^\d+$/;
12249
+ MAX_APP_SIZE = 64;
12250
+ NAME_SEPARATOR = "/";
12251
+ isValidNamedPackage = (name) => {
12252
+ const parts = name.split(NAME_SEPARATOR);
12253
+ if (parts.length < 2 || parts.length > 3) return false;
12254
+ const [org, app, version2] = parts;
12255
+ if (version2 !== void 0 && !VERSION_REGEX.test(version2)) return false;
12256
+ if (!isValidSuiNSName(org)) return false;
12257
+ return NAME_PATTERN.test(app) && app.length < MAX_APP_SIZE;
12258
+ };
12259
+ isValidNamedType = (type) => {
12260
+ const splitType = type.split(/::|<|>|,/);
12261
+ for (const t of splitType) if (t.includes(NAME_SEPARATOR) && !isValidNamedPackage(t)) return false;
12262
+ return isValidStructTag(type);
12263
+ };
12264
+ }
12265
+ });
12266
+
12267
+ // ../../node_modules/.pnpm/@mysten+sui@2.17.0_typescript@5.9.3/node_modules/@mysten/sui/dist/bcs/type-tag-serializer.mjs
12268
+ var VECTOR_REGEX, STRUCT_REGEX, TypeTagSerializer;
12269
+ var init_type_tag_serializer = __esm({
12270
+ "../../node_modules/.pnpm/@mysten+sui@2.17.0_typescript@5.9.3/node_modules/@mysten/sui/dist/bcs/type-tag-serializer.mjs"() {
12271
+ init_sui_types();
12272
+ init_dist2();
12273
+ VECTOR_REGEX = /^vector<(.+)>$/;
12274
+ STRUCT_REGEX = /^([^:]+)::([^:]+)::([^<]+)(<(.+)>)?/;
12275
+ TypeTagSerializer = class TypeTagSerializer2 {
12276
+ static parseFromStr(str, normalizeAddress = false) {
12277
+ if (str === "address") return { address: null };
12278
+ else if (str === "bool") return { bool: null };
12279
+ else if (str === "u8") return { u8: null };
12280
+ else if (str === "u16") return { u16: null };
12281
+ else if (str === "u32") return { u32: null };
12282
+ else if (str === "u64") return { u64: null };
12283
+ else if (str === "u128") return { u128: null };
12284
+ else if (str === "u256") return { u256: null };
12285
+ else if (str === "signer") return { signer: null };
12286
+ const vectorMatch = str.match(VECTOR_REGEX);
12287
+ if (vectorMatch) return { vector: TypeTagSerializer2.parseFromStr(vectorMatch[1], normalizeAddress) };
12288
+ const structMatch = str.match(STRUCT_REGEX);
12289
+ if (structMatch) return { struct: {
12290
+ address: normalizeAddress ? normalizeSuiAddress(structMatch[1]) : structMatch[1],
12291
+ module: structMatch[2],
12292
+ name: structMatch[3],
12293
+ typeParams: structMatch[5] === void 0 ? [] : TypeTagSerializer2.parseStructTypeArgs(structMatch[5], normalizeAddress)
12294
+ } };
12295
+ throw new Error(`Encountered unexpected token when parsing type args for ${str}`);
12543
12296
  }
12544
- return this.wrapped["~run"](dataset, config$1);
12545
- }
12546
- };
12547
- }
12548
- // @__NO_SIDE_EFFECTS__
12549
- function nullish2(wrapped, default_) {
12550
- return {
12551
- kind: "schema",
12552
- type: "nullish",
12553
- reference: nullish2,
12554
- expects: `(${wrapped.expects} | null | undefined)`,
12555
- async: false,
12556
- wrapped,
12557
- default: default_,
12558
- get "~standard"() {
12559
- return /* @__PURE__ */ _getStandardProps(this);
12560
- },
12561
- "~run"(dataset, config$1) {
12562
- if (dataset.value === null || dataset.value === void 0) {
12563
- if (this.default !== void 0) dataset.value = /* @__PURE__ */ getDefault(this, dataset, config$1);
12564
- if (dataset.value === null || dataset.value === void 0) {
12565
- dataset.typed = true;
12566
- return dataset;
12297
+ static parseStructTypeArgs(str, normalizeAddress = false) {
12298
+ return splitGenericParameters(str).map((tok) => TypeTagSerializer2.parseFromStr(tok, normalizeAddress));
12299
+ }
12300
+ static tagToString(tag2) {
12301
+ if ("bool" in tag2) return "bool";
12302
+ if ("u8" in tag2) return "u8";
12303
+ if ("u16" in tag2) return "u16";
12304
+ if ("u32" in tag2) return "u32";
12305
+ if ("u64" in tag2) return "u64";
12306
+ if ("u128" in tag2) return "u128";
12307
+ if ("u256" in tag2) return "u256";
12308
+ if ("address" in tag2) return "address";
12309
+ if ("signer" in tag2) return "signer";
12310
+ if ("vector" in tag2) return `vector<${TypeTagSerializer2.tagToString(tag2.vector)}>`;
12311
+ if ("struct" in tag2) {
12312
+ const struct = tag2.struct;
12313
+ const typeParams = struct.typeParams.map(TypeTagSerializer2.tagToString).join(", ");
12314
+ return `${struct.address}::${struct.module}::${struct.name}${typeParams ? `<${typeParams}>` : ""}`;
12567
12315
  }
12316
+ throw new Error("Invalid TypeTag");
12568
12317
  }
12569
- return this.wrapped["~run"](dataset, config$1);
12570
- }
12571
- };
12318
+ };
12319
+ }
12320
+ });
12321
+
12322
+ // ../../node_modules/.pnpm/@mysten+sui@2.17.0_typescript@5.9.3/node_modules/@mysten/sui/dist/bcs/bcs.mjs
12323
+ function unsafe_u64(options) {
12324
+ return bcs.u64({
12325
+ name: "unsafe_u64",
12326
+ ...options
12327
+ }).transform({
12328
+ input: (val) => val,
12329
+ output: (val) => Number(val)
12330
+ });
12572
12331
  }
12573
- // @__NO_SIDE_EFFECTS__
12574
- function number3(message$1) {
12575
- return {
12576
- kind: "schema",
12577
- type: "number",
12578
- reference: number3,
12579
- expects: "number",
12580
- async: false,
12581
- message: message$1,
12582
- get "~standard"() {
12583
- return /* @__PURE__ */ _getStandardProps(this);
12584
- },
12585
- "~run"(dataset, config$1) {
12586
- if (typeof dataset.value === "number" && !isNaN(dataset.value)) dataset.typed = true;
12587
- else _addIssue(this, "type", dataset, config$1);
12588
- return dataset;
12589
- }
12590
- };
12332
+ function optionEnum(type) {
12333
+ return bcs.enum("Option", {
12334
+ None: null,
12335
+ Some: type
12336
+ });
12591
12337
  }
12592
- // @__NO_SIDE_EFFECTS__
12593
- function object3(entries$1, message$1) {
12594
- return {
12595
- kind: "schema",
12596
- type: "object",
12597
- reference: object3,
12598
- expects: "Object",
12599
- async: false,
12600
- entries: entries$1,
12601
- message: message$1,
12602
- get "~standard"() {
12603
- return /* @__PURE__ */ _getStandardProps(this);
12604
- },
12605
- "~run"(dataset, config$1) {
12606
- const input = dataset.value;
12607
- if (input && typeof input === "object") {
12608
- dataset.typed = true;
12609
- dataset.value = {};
12610
- for (const key in this.entries) {
12611
- const valueSchema = this.entries[key];
12612
- if (key in input || (valueSchema.type === "exact_optional" || valueSchema.type === "optional" || valueSchema.type === "nullish") && valueSchema.default !== void 0) {
12613
- const value$1 = key in input ? input[key] : /* @__PURE__ */ getDefault(valueSchema);
12614
- const valueDataset = valueSchema["~run"]({ value: value$1 }, config$1);
12615
- if (valueDataset.issues) {
12616
- const pathItem = {
12617
- type: "object",
12618
- origin: "value",
12619
- input,
12620
- key,
12621
- value: value$1
12622
- };
12623
- for (const issue2 of valueDataset.issues) {
12624
- if (issue2.path) issue2.path.unshift(pathItem);
12625
- else issue2.path = [pathItem];
12626
- dataset.issues?.push(issue2);
12627
- }
12628
- if (!dataset.issues) dataset.issues = valueDataset.issues;
12629
- if (config$1.abortEarly) {
12630
- dataset.typed = false;
12631
- break;
12632
- }
12633
- }
12634
- if (!valueDataset.typed) dataset.typed = false;
12635
- dataset.value[key] = valueDataset.value;
12636
- } else if (valueSchema.fallback !== void 0) dataset.value[key] = /* @__PURE__ */ getFallback(valueSchema);
12637
- else if (valueSchema.type !== "exact_optional" && valueSchema.type !== "optional" && valueSchema.type !== "nullish") {
12638
- _addIssue(this, "key", dataset, config$1, {
12639
- input: void 0,
12640
- expected: `"${key}"`,
12641
- path: [{
12642
- type: "object",
12643
- origin: "key",
12644
- input,
12645
- key,
12646
- value: input[key]
12647
- }]
12648
- });
12649
- if (config$1.abortEarly) break;
12650
- }
12651
- }
12652
- } else _addIssue(this, "type", dataset, config$1);
12653
- return dataset;
12654
- }
12655
- };
12338
+ function IntentMessage(T2) {
12339
+ return bcs.struct(`IntentMessage<${T2.name}>`, {
12340
+ intent: Intent,
12341
+ value: T2
12342
+ });
12656
12343
  }
12657
- // @__NO_SIDE_EFFECTS__
12658
- function optional2(wrapped, default_) {
12659
- return {
12660
- kind: "schema",
12661
- type: "optional",
12662
- reference: optional2,
12663
- expects: `(${wrapped.expects} | undefined)`,
12664
- async: false,
12665
- wrapped,
12666
- default: default_,
12667
- get "~standard"() {
12668
- return /* @__PURE__ */ _getStandardProps(this);
12669
- },
12670
- "~run"(dataset, config$1) {
12671
- if (dataset.value === void 0) {
12672
- if (this.default !== void 0) dataset.value = /* @__PURE__ */ getDefault(this, dataset, config$1);
12673
- if (dataset.value === void 0) {
12674
- dataset.typed = true;
12675
- return dataset;
12676
- }
12677
- }
12678
- return this.wrapped["~run"](dataset, config$1);
12679
- }
12680
- };
12681
- }
12682
- // @__NO_SIDE_EFFECTS__
12683
- function picklist(options, message$1) {
12684
- return {
12685
- kind: "schema",
12686
- type: "picklist",
12687
- reference: picklist,
12688
- expects: /* @__PURE__ */ _joinExpects(options.map(_stringify), "|"),
12689
- async: false,
12690
- options,
12691
- message: message$1,
12692
- get "~standard"() {
12693
- return /* @__PURE__ */ _getStandardProps(this);
12694
- },
12695
- "~run"(dataset, config$1) {
12696
- if (this.options.includes(dataset.value)) dataset.typed = true;
12697
- else _addIssue(this, "type", dataset, config$1);
12698
- return dataset;
12699
- }
12700
- };
12701
- }
12702
- // @__NO_SIDE_EFFECTS__
12703
- function record2(key, value$1, message$1) {
12704
- return {
12705
- kind: "schema",
12706
- type: "record",
12707
- reference: record2,
12708
- expects: "Object",
12709
- async: false,
12710
- key,
12711
- value: value$1,
12712
- message: message$1,
12713
- get "~standard"() {
12714
- return /* @__PURE__ */ _getStandardProps(this);
12715
- },
12716
- "~run"(dataset, config$1) {
12717
- const input = dataset.value;
12718
- if (input && typeof input === "object") {
12719
- dataset.typed = true;
12720
- dataset.value = {};
12721
- for (const entryKey in input) if (/* @__PURE__ */ _isValidObjectKey(input, entryKey)) {
12722
- const entryValue = input[entryKey];
12723
- const keyDataset = this.key["~run"]({ value: entryKey }, config$1);
12724
- if (keyDataset.issues) {
12725
- const pathItem = {
12726
- type: "object",
12727
- origin: "key",
12728
- input,
12729
- key: entryKey,
12730
- value: entryValue
12731
- };
12732
- for (const issue2 of keyDataset.issues) {
12733
- issue2.path = [pathItem];
12734
- dataset.issues?.push(issue2);
12735
- }
12736
- if (!dataset.issues) dataset.issues = keyDataset.issues;
12737
- if (config$1.abortEarly) {
12738
- dataset.typed = false;
12739
- break;
12740
- }
12741
- }
12742
- const valueDataset = this.value["~run"]({ value: entryValue }, config$1);
12743
- if (valueDataset.issues) {
12744
- const pathItem = {
12745
- type: "object",
12746
- origin: "value",
12747
- input,
12748
- key: entryKey,
12749
- value: entryValue
12750
- };
12751
- for (const issue2 of valueDataset.issues) {
12752
- if (issue2.path) issue2.path.unshift(pathItem);
12753
- else issue2.path = [pathItem];
12754
- dataset.issues?.push(issue2);
12755
- }
12756
- if (!dataset.issues) dataset.issues = valueDataset.issues;
12757
- if (config$1.abortEarly) {
12758
- dataset.typed = false;
12759
- break;
12760
- }
12761
- }
12762
- if (!keyDataset.typed || !valueDataset.typed) dataset.typed = false;
12763
- if (keyDataset.typed) dataset.value[keyDataset.value] = valueDataset.value;
12764
- }
12765
- } else _addIssue(this, "type", dataset, config$1);
12766
- return dataset;
12767
- }
12768
- };
12769
- }
12770
- // @__NO_SIDE_EFFECTS__
12771
- function string3(message$1) {
12772
- return {
12773
- kind: "schema",
12774
- type: "string",
12775
- reference: string3,
12776
- expects: "string",
12777
- async: false,
12778
- message: message$1,
12779
- get "~standard"() {
12780
- return /* @__PURE__ */ _getStandardProps(this);
12781
- },
12782
- "~run"(dataset, config$1) {
12783
- if (typeof dataset.value === "string") dataset.typed = true;
12784
- else _addIssue(this, "type", dataset, config$1);
12785
- return dataset;
12786
- }
12787
- };
12788
- }
12789
- // @__NO_SIDE_EFFECTS__
12790
- function tuple(items, message$1) {
12791
- return {
12792
- kind: "schema",
12793
- type: "tuple",
12794
- reference: tuple,
12795
- expects: "Array",
12796
- async: false,
12797
- items,
12798
- message: message$1,
12799
- get "~standard"() {
12800
- return /* @__PURE__ */ _getStandardProps(this);
12801
- },
12802
- "~run"(dataset, config$1) {
12803
- const input = dataset.value;
12804
- if (Array.isArray(input)) {
12805
- dataset.typed = true;
12806
- dataset.value = [];
12807
- for (let key = 0; key < this.items.length; key++) {
12808
- const value$1 = input[key];
12809
- const itemDataset = this.items[key]["~run"]({ value: value$1 }, config$1);
12810
- if (itemDataset.issues) {
12811
- const pathItem = {
12812
- type: "array",
12813
- origin: "value",
12814
- input,
12815
- key,
12816
- value: value$1
12817
- };
12818
- for (const issue2 of itemDataset.issues) {
12819
- if (issue2.path) issue2.path.unshift(pathItem);
12820
- else issue2.path = [pathItem];
12821
- dataset.issues?.push(issue2);
12822
- }
12823
- if (!dataset.issues) dataset.issues = itemDataset.issues;
12824
- if (config$1.abortEarly) {
12825
- dataset.typed = false;
12826
- break;
12827
- }
12828
- }
12829
- if (!itemDataset.typed) dataset.typed = false;
12830
- dataset.value.push(itemDataset.value);
12831
- }
12832
- } else _addIssue(this, "type", dataset, config$1);
12833
- return dataset;
12834
- }
12835
- };
12836
- }
12837
- // @__NO_SIDE_EFFECTS__
12838
- function _subIssues(datasets) {
12839
- let issues;
12840
- if (datasets) for (const dataset of datasets) if (issues) issues.push(...dataset.issues);
12841
- else issues = dataset.issues;
12842
- return issues;
12843
- }
12844
- // @__NO_SIDE_EFFECTS__
12845
- function union2(options, message$1) {
12846
- return {
12847
- kind: "schema",
12848
- type: "union",
12849
- reference: union2,
12850
- expects: /* @__PURE__ */ _joinExpects(options.map((option2) => option2.expects), "|"),
12851
- async: false,
12852
- options,
12853
- message: message$1,
12854
- get "~standard"() {
12855
- return /* @__PURE__ */ _getStandardProps(this);
12856
- },
12857
- "~run"(dataset, config$1) {
12858
- let validDataset;
12859
- let typedDatasets;
12860
- let untypedDatasets;
12861
- for (const schema of this.options) {
12862
- const optionDataset = schema["~run"]({ value: dataset.value }, config$1);
12863
- if (optionDataset.typed) if (optionDataset.issues) if (typedDatasets) typedDatasets.push(optionDataset);
12864
- else typedDatasets = [optionDataset];
12865
- else {
12866
- validDataset = optionDataset;
12867
- break;
12868
- }
12869
- else if (untypedDatasets) untypedDatasets.push(optionDataset);
12870
- else untypedDatasets = [optionDataset];
12871
- }
12872
- if (validDataset) return validDataset;
12873
- if (typedDatasets) {
12874
- if (typedDatasets.length === 1) return typedDatasets[0];
12875
- _addIssue(this, "type", dataset, config$1, { issues: /* @__PURE__ */ _subIssues(typedDatasets) });
12876
- dataset.typed = true;
12877
- } else if (untypedDatasets?.length === 1) return untypedDatasets[0];
12878
- else _addIssue(this, "type", dataset, config$1, { issues: /* @__PURE__ */ _subIssues(untypedDatasets) });
12879
- return dataset;
12880
- }
12881
- };
12882
- }
12883
- // @__NO_SIDE_EFFECTS__
12884
- function unknown2() {
12885
- return {
12886
- kind: "schema",
12887
- type: "unknown",
12888
- reference: unknown2,
12889
- expects: "unknown",
12890
- async: false,
12891
- get "~standard"() {
12892
- return /* @__PURE__ */ _getStandardProps(this);
12893
- },
12894
- "~run"(dataset) {
12895
- dataset.typed = true;
12896
- return dataset;
12897
- }
12898
- };
12899
- }
12900
- function parse3(schema, input, config$1) {
12901
- const dataset = schema["~run"]({ value: input }, /* @__PURE__ */ getGlobalConfig(config$1));
12902
- if (dataset.issues) throw new ValiError(dataset.issues);
12903
- return dataset.value;
12904
- }
12905
- // @__NO_SIDE_EFFECTS__
12906
- function pipe2(...pipe$1) {
12907
- return {
12908
- ...pipe$1[0],
12909
- pipe: pipe$1,
12910
- get "~standard"() {
12911
- return /* @__PURE__ */ _getStandardProps(this);
12912
- },
12913
- "~run"(dataset, config$1) {
12914
- for (const item of pipe$1) if (item.kind !== "metadata") {
12915
- if (dataset.issues && (item.kind === "schema" || item.kind === "transformation")) {
12916
- dataset.typed = false;
12917
- break;
12918
- }
12919
- if (!dataset.issues || !config$1.abortEarly && !config$1.abortPipeEarly) dataset = item["~run"](dataset, config$1);
12920
- }
12921
- return dataset;
12922
- }
12923
- };
12924
- }
12925
- var store$4, store$3, store$2, store$1, ValiError;
12926
- var init_dist3 = __esm({
12927
- "../../node_modules/.pnpm/valibot@1.3.1_typescript@5.9.3/node_modules/valibot/dist/index.mjs"() {
12928
- ValiError = class extends Error {
12929
- /**
12930
- * Creates a Valibot error with useful information.
12931
- *
12932
- * @param issues The error issues.
12933
- */
12934
- constructor(issues) {
12935
- super(issues[0].message);
12936
- this.name = "ValiError";
12937
- this.issues = issues;
12938
- }
12939
- };
12940
- }
12941
- });
12942
-
12943
- // ../../node_modules/.pnpm/@mysten+sui@2.17.0_typescript@5.9.3/node_modules/@mysten/sui/dist/transactions/data/internal.mjs
12944
- function safeEnum(options) {
12945
- return union2(Object.keys(options).map((key) => withKind(key, object3({ [key]: options[key] }))));
12946
- }
12947
- function withKind(key, schema) {
12948
- return pipe2(object3({
12949
- ...schema.entries,
12950
- $kind: optional2(literal2(key))
12951
- }), transform2((value) => ({
12952
- ...value,
12953
- $kind: key
12954
- })));
12955
- }
12956
- var SuiAddress, ObjectID, BCSBytes, JsonU64, U32, ObjectRefSchema, ArgumentSchema, GasDataSchema, OpenSignatureBodySchema, OpenSignatureSchema, ProgrammableMoveCallSchema, $Intent, CommandSchema, ObjectArgSchema, ReservationSchema, WithdrawalTypeArgSchema, WithdrawFromSchema, FundsWithdrawalArgSchema, CallArgSchema, NormalizedCallArg, ValidDuringSchema, TransactionExpiration, TransactionDataSchema;
12957
- var init_internal = __esm({
12958
- "../../node_modules/.pnpm/@mysten+sui@2.17.0_typescript@5.9.3/node_modules/@mysten/sui/dist/transactions/data/internal.mjs"() {
12344
+ var Address, ObjectDigest, SuiObjectRef, SharedObjectRef, ObjectArg, Owner, Reservation, WithdrawalType, WithdrawFrom, FundsWithdrawal, CallArg, InnerTypeTag, TypeTag, Argument, ProgrammableMoveCall, Command, ProgrammableTransaction, TransactionKind, ValidDuring, TransactionExpiration, StructTag, GasData, TransactionDataV1, TransactionData, IntentScope, IntentVersion, AppId, Intent, CompressedSignature, PublicKey, MultiSigPkMap, MultiSigPublicKey, MultiSig, base64String, SenderSignedTransaction, SenderSignedData, PasskeyAuthenticator, MoveObjectType, TypeOrigin, UpgradeInfo, MovePackage, MoveObject, Data, ObjectInner;
12345
+ var init_bcs2 = __esm({
12346
+ "../../node_modules/.pnpm/@mysten+sui@2.17.0_typescript@5.9.3/node_modules/@mysten/sui/dist/bcs/bcs.mjs"() {
12959
12347
  init_sui_types();
12960
- init_dist3();
12961
- SuiAddress = pipe2(string3(), transform2((value) => normalizeSuiAddress(value)), check2(isValidSuiAddress));
12962
- ObjectID = SuiAddress;
12963
- BCSBytes = string3();
12964
- JsonU64 = pipe2(union2([string3(), pipe2(number3(), integer2())]), check2((val) => {
12965
- try {
12966
- BigInt(val);
12967
- return BigInt(val) >= 0 && BigInt(val) <= 18446744073709551615n;
12968
- } catch {
12969
- return false;
12348
+ init_type_tag_serializer();
12349
+ init_dist2();
12350
+ Address = bcs.bytes(SUI_ADDRESS_LENGTH).transform({
12351
+ validate: (val) => {
12352
+ const address = typeof val === "string" ? val : toHex(val);
12353
+ if (!address || !isValidSuiAddress(normalizeSuiAddress(address))) throw new Error(`Invalid Sui address ${address}`);
12354
+ },
12355
+ input: (val) => typeof val === "string" ? fromHex(normalizeSuiAddress(val)) : val,
12356
+ output: (val) => normalizeSuiAddress(toHex(val))
12357
+ });
12358
+ ObjectDigest = bcs.byteVector().transform({
12359
+ name: "ObjectDigest",
12360
+ input: (value) => fromBase58(value),
12361
+ output: (value) => toBase58(new Uint8Array(value)),
12362
+ validate: (value) => {
12363
+ if (fromBase58(value).length !== 32) throw new Error("ObjectDigest must be 32 bytes");
12970
12364
  }
12971
- }, "Invalid u64"));
12972
- U32 = pipe2(number3(), integer2(), check2((val) => val >= 0 && val < 2 ** 32, "Invalid u32"));
12973
- ObjectRefSchema = object3({
12974
- objectId: SuiAddress,
12975
- version: JsonU64,
12976
- digest: string3()
12977
12365
  });
12978
- ArgumentSchema = union2([
12979
- withKind("GasCoin", object3({ GasCoin: literal2(true) })),
12980
- withKind("Input", object3({
12981
- Input: pipe2(number3(), integer2()),
12982
- type: optional2(union2([
12983
- literal2("pure"),
12984
- literal2("object"),
12985
- literal2("withdrawal")
12986
- ]))
12987
- })),
12988
- withKind("Result", object3({ Result: pipe2(number3(), integer2()) })),
12989
- withKind("NestedResult", object3({ NestedResult: tuple([pipe2(number3(), integer2()), pipe2(number3(), integer2())]) }))
12990
- ]);
12991
- GasDataSchema = object3({
12992
- budget: nullable2(JsonU64),
12993
- price: nullable2(JsonU64),
12994
- owner: nullable2(SuiAddress),
12995
- payment: nullable2(array2(ObjectRefSchema))
12366
+ SuiObjectRef = bcs.struct("SuiObjectRef", {
12367
+ objectId: Address,
12368
+ version: bcs.u64(),
12369
+ digest: ObjectDigest
12996
12370
  });
12997
- OpenSignatureBodySchema = union2([
12998
- object3({ $kind: literal2("address") }),
12999
- object3({ $kind: literal2("bool") }),
13000
- object3({ $kind: literal2("u8") }),
13001
- object3({ $kind: literal2("u16") }),
13002
- object3({ $kind: literal2("u32") }),
13003
- object3({ $kind: literal2("u64") }),
13004
- object3({ $kind: literal2("u128") }),
13005
- object3({ $kind: literal2("u256") }),
13006
- object3({ $kind: literal2("unknown") }),
13007
- object3({
13008
- $kind: literal2("vector"),
13009
- vector: lazy(() => OpenSignatureBodySchema)
13010
- }),
13011
- object3({
13012
- $kind: literal2("datatype"),
13013
- datatype: object3({
13014
- typeName: string3(),
13015
- typeParameters: array2(lazy(() => OpenSignatureBodySchema))
13016
- })
13017
- }),
13018
- object3({
13019
- $kind: literal2("typeParameter"),
13020
- index: pipe2(number3(), integer2())
13021
- })
13022
- ]);
13023
- OpenSignatureSchema = object3({
13024
- reference: nullable2(union2([
13025
- literal2("mutable"),
13026
- literal2("immutable"),
13027
- literal2("unknown")
13028
- ])),
13029
- body: OpenSignatureBodySchema
12371
+ SharedObjectRef = bcs.struct("SharedObjectRef", {
12372
+ objectId: Address,
12373
+ initialSharedVersion: bcs.u64(),
12374
+ mutable: bcs.bool()
13030
12375
  });
13031
- ProgrammableMoveCallSchema = object3({
13032
- package: ObjectID,
13033
- module: string3(),
13034
- function: string3(),
13035
- typeArguments: array2(string3()),
13036
- arguments: array2(ArgumentSchema),
13037
- _argumentTypes: optional2(nullable2(array2(OpenSignatureSchema)))
12376
+ ObjectArg = bcs.enum("ObjectArg", {
12377
+ ImmOrOwnedObject: SuiObjectRef,
12378
+ SharedObject: SharedObjectRef,
12379
+ Receiving: SuiObjectRef
13038
12380
  });
13039
- $Intent = object3({
13040
- name: string3(),
13041
- inputs: record2(string3(), union2([ArgumentSchema, array2(ArgumentSchema)])),
13042
- data: record2(string3(), unknown2())
12381
+ Owner = bcs.enum("Owner", {
12382
+ AddressOwner: Address,
12383
+ ObjectOwner: Address,
12384
+ Shared: bcs.struct("Shared", { initialSharedVersion: bcs.u64() }),
12385
+ Immutable: null,
12386
+ ConsensusAddressOwner: bcs.struct("ConsensusAddressOwner", {
12387
+ startVersion: bcs.u64(),
12388
+ owner: Address
12389
+ })
13043
12390
  });
13044
- CommandSchema = safeEnum({
13045
- MoveCall: ProgrammableMoveCallSchema,
13046
- TransferObjects: object3({
13047
- objects: array2(ArgumentSchema),
13048
- address: ArgumentSchema
13049
- }),
13050
- SplitCoins: object3({
13051
- coin: ArgumentSchema,
13052
- amounts: array2(ArgumentSchema)
13053
- }),
13054
- MergeCoins: object3({
13055
- destination: ArgumentSchema,
13056
- sources: array2(ArgumentSchema)
13057
- }),
13058
- Publish: object3({
13059
- modules: array2(BCSBytes),
13060
- dependencies: array2(ObjectID)
13061
- }),
13062
- MakeMoveVec: object3({
13063
- type: nullable2(string3()),
13064
- elements: array2(ArgumentSchema)
13065
- }),
13066
- Upgrade: object3({
13067
- modules: array2(BCSBytes),
13068
- dependencies: array2(ObjectID),
13069
- package: ObjectID,
13070
- ticket: ArgumentSchema
13071
- }),
13072
- $Intent
12391
+ Reservation = bcs.enum("Reservation", { MaxAmountU64: bcs.u64() });
12392
+ WithdrawalType = bcs.enum("WithdrawalType", { Balance: bcs.lazy(() => TypeTag) });
12393
+ WithdrawFrom = bcs.enum("WithdrawFrom", {
12394
+ Sender: null,
12395
+ Sponsor: null
13073
12396
  });
13074
- ObjectArgSchema = safeEnum({
13075
- ImmOrOwnedObject: ObjectRefSchema,
13076
- SharedObject: object3({
13077
- objectId: ObjectID,
13078
- initialSharedVersion: JsonU64,
13079
- mutable: boolean3()
13080
- }),
13081
- Receiving: ObjectRefSchema
12397
+ FundsWithdrawal = bcs.struct("FundsWithdrawal", {
12398
+ reservation: Reservation,
12399
+ typeArg: WithdrawalType,
12400
+ withdrawFrom: WithdrawFrom
13082
12401
  });
13083
- ReservationSchema = safeEnum({ MaxAmountU64: JsonU64 });
13084
- WithdrawalTypeArgSchema = safeEnum({ Balance: string3() });
13085
- WithdrawFromSchema = safeEnum({
13086
- Sender: literal2(true),
13087
- Sponsor: literal2(true)
12402
+ CallArg = bcs.enum("CallArg", {
12403
+ Pure: bcs.struct("Pure", { bytes: bcs.byteVector().transform({
12404
+ input: (val) => typeof val === "string" ? fromBase64(val) : val,
12405
+ output: (val) => toBase64(new Uint8Array(val))
12406
+ }) }),
12407
+ Object: ObjectArg,
12408
+ FundsWithdrawal
13088
12409
  });
13089
- FundsWithdrawalArgSchema = object3({
13090
- reservation: ReservationSchema,
13091
- typeArg: WithdrawalTypeArgSchema,
13092
- withdrawFrom: WithdrawFromSchema
12410
+ InnerTypeTag = bcs.enum("TypeTag", {
12411
+ bool: null,
12412
+ u8: null,
12413
+ u64: null,
12414
+ u128: null,
12415
+ address: null,
12416
+ signer: null,
12417
+ vector: bcs.lazy(() => InnerTypeTag),
12418
+ struct: bcs.lazy(() => StructTag),
12419
+ u16: null,
12420
+ u32: null,
12421
+ u256: null
13093
12422
  });
13094
- CallArgSchema = safeEnum({
13095
- Object: ObjectArgSchema,
13096
- Pure: object3({ bytes: BCSBytes }),
13097
- UnresolvedPure: object3({ value: unknown2() }),
13098
- UnresolvedObject: object3({
13099
- objectId: ObjectID,
13100
- version: optional2(nullable2(JsonU64)),
13101
- digest: optional2(nullable2(string3())),
13102
- initialSharedVersion: optional2(nullable2(JsonU64)),
13103
- mutable: optional2(nullable2(boolean3()))
13104
- }),
13105
- FundsWithdrawal: FundsWithdrawalArgSchema
12423
+ TypeTag = InnerTypeTag.transform({
12424
+ input: (typeTag) => typeof typeTag === "string" ? TypeTagSerializer.parseFromStr(typeTag, true) : typeTag,
12425
+ output: (typeTag) => TypeTagSerializer.tagToString(typeTag)
13106
12426
  });
13107
- NormalizedCallArg = safeEnum({
13108
- Object: ObjectArgSchema,
13109
- Pure: object3({ bytes: BCSBytes })
13110
- });
13111
- ValidDuringSchema = object3({
13112
- minEpoch: nullable2(JsonU64),
13113
- maxEpoch: nullable2(JsonU64),
13114
- minTimestamp: nullable2(JsonU64),
13115
- maxTimestamp: nullable2(JsonU64),
13116
- chain: string3(),
13117
- nonce: U32
13118
- });
13119
- TransactionExpiration = safeEnum({
13120
- None: literal2(true),
13121
- Epoch: JsonU64,
13122
- ValidDuring: ValidDuringSchema
13123
- });
13124
- TransactionDataSchema = object3({
13125
- version: literal2(2),
13126
- sender: nullish2(SuiAddress),
13127
- expiration: nullish2(TransactionExpiration),
13128
- gasData: GasDataSchema,
13129
- inputs: array2(CallArgSchema),
13130
- commands: array2(CommandSchema)
13131
- });
13132
- }
13133
- });
13134
-
13135
- // ../../node_modules/.pnpm/@mysten+sui@2.17.0_typescript@5.9.3/node_modules/@mysten/sui/dist/transactions/utils.mjs
13136
- function getIdFromCallArg(arg) {
13137
- if (typeof arg === "string") return normalizeSuiAddress(arg);
13138
- if (arg.Object) {
13139
- if (arg.Object.ImmOrOwnedObject) return normalizeSuiAddress(arg.Object.ImmOrOwnedObject.objectId);
13140
- if (arg.Object.Receiving) return normalizeSuiAddress(arg.Object.Receiving.objectId);
13141
- return normalizeSuiAddress(arg.Object.SharedObject.objectId);
13142
- }
13143
- if (arg.UnresolvedObject) return normalizeSuiAddress(arg.UnresolvedObject.objectId);
13144
- }
13145
- function isArgument(value) {
13146
- return is(ArgumentSchema, value);
13147
- }
13148
- function remapCommandArguments(command, inputMapping, commandMapping) {
13149
- const remapArg = (arg) => {
13150
- switch (arg.$kind) {
13151
- case "Input": {
13152
- const newInputIndex = inputMapping.get(arg.Input);
13153
- if (newInputIndex === void 0) throw new Error(`Input ${arg.Input} not found in input mapping`);
13154
- return {
13155
- ...arg,
13156
- Input: newInputIndex
13157
- };
13158
- }
13159
- case "Result": {
13160
- const newCommandIndex = commandMapping.get(arg.Result);
13161
- if (newCommandIndex !== void 0) return {
13162
- ...arg,
13163
- Result: newCommandIndex
13164
- };
13165
- return arg;
13166
- }
13167
- case "NestedResult": {
13168
- const newCommandIndex = commandMapping.get(arg.NestedResult[0]);
13169
- if (newCommandIndex !== void 0) return {
13170
- ...arg,
13171
- NestedResult: [newCommandIndex, arg.NestedResult[1]]
13172
- };
13173
- return arg;
13174
- }
13175
- default:
13176
- return arg;
13177
- }
13178
- };
13179
- switch (command.$kind) {
13180
- case "MoveCall":
13181
- command.MoveCall.arguments = command.MoveCall.arguments.map(remapArg);
13182
- break;
13183
- case "TransferObjects":
13184
- command.TransferObjects.objects = command.TransferObjects.objects.map(remapArg);
13185
- command.TransferObjects.address = remapArg(command.TransferObjects.address);
13186
- break;
13187
- case "SplitCoins":
13188
- command.SplitCoins.coin = remapArg(command.SplitCoins.coin);
13189
- command.SplitCoins.amounts = command.SplitCoins.amounts.map(remapArg);
13190
- break;
13191
- case "MergeCoins":
13192
- command.MergeCoins.destination = remapArg(command.MergeCoins.destination);
13193
- command.MergeCoins.sources = command.MergeCoins.sources.map(remapArg);
13194
- break;
13195
- case "MakeMoveVec":
13196
- command.MakeMoveVec.elements = command.MakeMoveVec.elements.map(remapArg);
13197
- break;
13198
- case "Upgrade":
13199
- command.Upgrade.ticket = remapArg(command.Upgrade.ticket);
13200
- break;
13201
- case "$Intent": {
13202
- const inputs = command.$Intent.inputs;
13203
- command.$Intent.inputs = {};
13204
- for (const [key, value] of Object.entries(inputs)) command.$Intent.inputs[key] = Array.isArray(value) ? value.map(remapArg) : remapArg(value);
13205
- break;
13206
- }
13207
- }
13208
- }
13209
- var init_utils2 = __esm({
13210
- "../../node_modules/.pnpm/@mysten+sui@2.17.0_typescript@5.9.3/node_modules/@mysten/sui/dist/transactions/utils.mjs"() {
13211
- init_sui_types();
13212
- init_internal();
13213
- init_dist3();
13214
- }
13215
- });
13216
-
13217
- // ../../node_modules/.pnpm/@mysten+sui@2.17.0_typescript@5.9.3/node_modules/@mysten/sui/dist/bcs/type-tag-serializer.mjs
13218
- var VECTOR_REGEX, STRUCT_REGEX, TypeTagSerializer;
13219
- var init_type_tag_serializer = __esm({
13220
- "../../node_modules/.pnpm/@mysten+sui@2.17.0_typescript@5.9.3/node_modules/@mysten/sui/dist/bcs/type-tag-serializer.mjs"() {
13221
- init_sui_types();
13222
- init_dist2();
13223
- VECTOR_REGEX = /^vector<(.+)>$/;
13224
- STRUCT_REGEX = /^([^:]+)::([^:]+)::([^<]+)(<(.+)>)?/;
13225
- TypeTagSerializer = class TypeTagSerializer2 {
13226
- static parseFromStr(str, normalizeAddress = false) {
13227
- if (str === "address") return { address: null };
13228
- else if (str === "bool") return { bool: null };
13229
- else if (str === "u8") return { u8: null };
13230
- else if (str === "u16") return { u16: null };
13231
- else if (str === "u32") return { u32: null };
13232
- else if (str === "u64") return { u64: null };
13233
- else if (str === "u128") return { u128: null };
13234
- else if (str === "u256") return { u256: null };
13235
- else if (str === "signer") return { signer: null };
13236
- const vectorMatch = str.match(VECTOR_REGEX);
13237
- if (vectorMatch) return { vector: TypeTagSerializer2.parseFromStr(vectorMatch[1], normalizeAddress) };
13238
- const structMatch = str.match(STRUCT_REGEX);
13239
- if (structMatch) return { struct: {
13240
- address: normalizeAddress ? normalizeSuiAddress(structMatch[1]) : structMatch[1],
13241
- module: structMatch[2],
13242
- name: structMatch[3],
13243
- typeParams: structMatch[5] === void 0 ? [] : TypeTagSerializer2.parseStructTypeArgs(structMatch[5], normalizeAddress)
13244
- } };
13245
- throw new Error(`Encountered unexpected token when parsing type args for ${str}`);
13246
- }
13247
- static parseStructTypeArgs(str, normalizeAddress = false) {
13248
- return splitGenericParameters(str).map((tok) => TypeTagSerializer2.parseFromStr(tok, normalizeAddress));
13249
- }
13250
- static tagToString(tag2) {
13251
- if ("bool" in tag2) return "bool";
13252
- if ("u8" in tag2) return "u8";
13253
- if ("u16" in tag2) return "u16";
13254
- if ("u32" in tag2) return "u32";
13255
- if ("u64" in tag2) return "u64";
13256
- if ("u128" in tag2) return "u128";
13257
- if ("u256" in tag2) return "u256";
13258
- if ("address" in tag2) return "address";
13259
- if ("signer" in tag2) return "signer";
13260
- if ("vector" in tag2) return `vector<${TypeTagSerializer2.tagToString(tag2.vector)}>`;
13261
- if ("struct" in tag2) {
13262
- const struct = tag2.struct;
13263
- const typeParams = struct.typeParams.map(TypeTagSerializer2.tagToString).join(", ");
13264
- return `${struct.address}::${struct.module}::${struct.name}${typeParams ? `<${typeParams}>` : ""}`;
13265
- }
13266
- throw new Error("Invalid TypeTag");
13267
- }
13268
- };
13269
- }
13270
- });
13271
-
13272
- // ../../node_modules/.pnpm/@mysten+sui@2.17.0_typescript@5.9.3/node_modules/@mysten/sui/dist/bcs/bcs.mjs
13273
- function unsafe_u64(options) {
13274
- return bcs.u64({
13275
- name: "unsafe_u64",
13276
- ...options
13277
- }).transform({
13278
- input: (val) => val,
13279
- output: (val) => Number(val)
13280
- });
13281
- }
13282
- function optionEnum(type) {
13283
- return bcs.enum("Option", {
13284
- None: null,
13285
- Some: type
13286
- });
13287
- }
13288
- function IntentMessage(T2) {
13289
- return bcs.struct(`IntentMessage<${T2.name}>`, {
13290
- intent: Intent,
13291
- value: T2
13292
- });
13293
- }
13294
- var Address, ObjectDigest, SuiObjectRef, SharedObjectRef, ObjectArg, Owner, Reservation, WithdrawalType, WithdrawFrom, FundsWithdrawal, CallArg, InnerTypeTag, TypeTag, Argument, ProgrammableMoveCall, Command, ProgrammableTransaction, TransactionKind, ValidDuring, TransactionExpiration2, StructTag, GasData, TransactionDataV1, TransactionData, IntentScope, IntentVersion, AppId, Intent, CompressedSignature, PublicKey, MultiSigPkMap, MultiSigPublicKey, MultiSig, base64String, SenderSignedTransaction, SenderSignedData, PasskeyAuthenticator, MoveObjectType, TypeOrigin, UpgradeInfo, MovePackage, MoveObject, Data, ObjectInner;
13295
- var init_bcs2 = __esm({
13296
- "../../node_modules/.pnpm/@mysten+sui@2.17.0_typescript@5.9.3/node_modules/@mysten/sui/dist/bcs/bcs.mjs"() {
13297
- init_sui_types();
13298
- init_type_tag_serializer();
13299
- init_dist2();
13300
- Address = bcs.bytes(SUI_ADDRESS_LENGTH).transform({
13301
- validate: (val) => {
13302
- const address = typeof val === "string" ? val : toHex(val);
13303
- if (!address || !isValidSuiAddress(normalizeSuiAddress(address))) throw new Error(`Invalid Sui address ${address}`);
13304
- },
13305
- input: (val) => typeof val === "string" ? fromHex(normalizeSuiAddress(val)) : val,
13306
- output: (val) => normalizeSuiAddress(toHex(val))
13307
- });
13308
- ObjectDigest = bcs.byteVector().transform({
13309
- name: "ObjectDigest",
13310
- input: (value) => fromBase58(value),
13311
- output: (value) => toBase58(new Uint8Array(value)),
13312
- validate: (value) => {
13313
- if (fromBase58(value).length !== 32) throw new Error("ObjectDigest must be 32 bytes");
13314
- }
13315
- });
13316
- SuiObjectRef = bcs.struct("SuiObjectRef", {
13317
- objectId: Address,
13318
- version: bcs.u64(),
13319
- digest: ObjectDigest
13320
- });
13321
- SharedObjectRef = bcs.struct("SharedObjectRef", {
13322
- objectId: Address,
13323
- initialSharedVersion: bcs.u64(),
13324
- mutable: bcs.bool()
13325
- });
13326
- ObjectArg = bcs.enum("ObjectArg", {
13327
- ImmOrOwnedObject: SuiObjectRef,
13328
- SharedObject: SharedObjectRef,
13329
- Receiving: SuiObjectRef
13330
- });
13331
- Owner = bcs.enum("Owner", {
13332
- AddressOwner: Address,
13333
- ObjectOwner: Address,
13334
- Shared: bcs.struct("Shared", { initialSharedVersion: bcs.u64() }),
13335
- Immutable: null,
13336
- ConsensusAddressOwner: bcs.struct("ConsensusAddressOwner", {
13337
- startVersion: bcs.u64(),
13338
- owner: Address
13339
- })
13340
- });
13341
- Reservation = bcs.enum("Reservation", { MaxAmountU64: bcs.u64() });
13342
- WithdrawalType = bcs.enum("WithdrawalType", { Balance: bcs.lazy(() => TypeTag) });
13343
- WithdrawFrom = bcs.enum("WithdrawFrom", {
13344
- Sender: null,
13345
- Sponsor: null
13346
- });
13347
- FundsWithdrawal = bcs.struct("FundsWithdrawal", {
13348
- reservation: Reservation,
13349
- typeArg: WithdrawalType,
13350
- withdrawFrom: WithdrawFrom
13351
- });
13352
- CallArg = bcs.enum("CallArg", {
13353
- Pure: bcs.struct("Pure", { bytes: bcs.byteVector().transform({
13354
- input: (val) => typeof val === "string" ? fromBase64(val) : val,
13355
- output: (val) => toBase64(new Uint8Array(val))
13356
- }) }),
13357
- Object: ObjectArg,
13358
- FundsWithdrawal
13359
- });
13360
- InnerTypeTag = bcs.enum("TypeTag", {
13361
- bool: null,
13362
- u8: null,
13363
- u64: null,
13364
- u128: null,
13365
- address: null,
13366
- signer: null,
13367
- vector: bcs.lazy(() => InnerTypeTag),
13368
- struct: bcs.lazy(() => StructTag),
13369
- u16: null,
13370
- u32: null,
13371
- u256: null
13372
- });
13373
- TypeTag = InnerTypeTag.transform({
13374
- input: (typeTag) => typeof typeTag === "string" ? TypeTagSerializer.parseFromStr(typeTag, true) : typeTag,
13375
- output: (typeTag) => TypeTagSerializer.tagToString(typeTag)
13376
- });
13377
- Argument = bcs.enum("Argument", {
13378
- GasCoin: null,
13379
- Input: bcs.u16(),
13380
- Result: bcs.u16(),
13381
- NestedResult: bcs.tuple([bcs.u16(), bcs.u16()])
12427
+ Argument = bcs.enum("Argument", {
12428
+ GasCoin: null,
12429
+ Input: bcs.u16(),
12430
+ Result: bcs.u16(),
12431
+ NestedResult: bcs.tuple([bcs.u16(), bcs.u16()])
13382
12432
  });
13383
12433
  ProgrammableMoveCall = bcs.struct("ProgrammableMoveCall", {
13384
12434
  package: Address,
@@ -13443,7 +12493,7 @@ var init_bcs2 = __esm({
13443
12493
  chain: ObjectDigest,
13444
12494
  nonce: bcs.u32()
13445
12495
  });
13446
- TransactionExpiration2 = bcs.enum("TransactionExpiration", {
12496
+ TransactionExpiration = bcs.enum("TransactionExpiration", {
13447
12497
  None: null,
13448
12498
  Epoch: unsafe_u64(),
13449
12499
  ValidDuring
@@ -13464,7 +12514,7 @@ var init_bcs2 = __esm({
13464
12514
  kind: TransactionKind,
13465
12515
  sender: Address,
13466
12516
  gasData: GasData,
13467
- expiration: TransactionExpiration2
12517
+ expiration: TransactionExpiration
13468
12518
  });
13469
12519
  TransactionData = bcs.enum("TransactionData", { V1: TransactionDataV1 });
13470
12520
  IntentScope = bcs.enum("IntentScope", {
@@ -13878,7 +12928,7 @@ var init_bcs3 = __esm({
13878
12928
  TransactionData,
13879
12929
  TransactionDataV1,
13880
12930
  TransactionEffects,
13881
- TransactionExpiration: TransactionExpiration2,
12931
+ TransactionExpiration,
13882
12932
  TransactionKind,
13883
12933
  TypeOrigin,
13884
12934
  TypeTag,
@@ -13887,312 +12937,45 @@ var init_bcs3 = __esm({
13887
12937
  }
13888
12938
  });
13889
12939
 
13890
- // ../../node_modules/.pnpm/@mysten+sui@2.17.0_typescript@5.9.3/node_modules/@mysten/sui/dist/transactions/data/v1.mjs
13891
- function serializeV1TransactionData(transactionData) {
13892
- const inputs = transactionData.inputs.map((input, index) => {
13893
- if (input.Object) return {
13894
- kind: "Input",
13895
- index,
13896
- value: { Object: input.Object.ImmOrOwnedObject ? { ImmOrOwned: input.Object.ImmOrOwnedObject } : input.Object.Receiving ? { Receiving: {
13897
- digest: input.Object.Receiving.digest,
13898
- version: input.Object.Receiving.version,
13899
- objectId: input.Object.Receiving.objectId
13900
- } } : { Shared: {
13901
- mutable: input.Object.SharedObject.mutable,
13902
- initialSharedVersion: input.Object.SharedObject.initialSharedVersion,
13903
- objectId: input.Object.SharedObject.objectId
13904
- } } },
13905
- type: "object"
13906
- };
13907
- if (input.Pure) return {
13908
- kind: "Input",
13909
- index,
13910
- value: { Pure: Array.from(fromBase64(input.Pure.bytes)) },
13911
- type: "pure"
13912
- };
13913
- if (input.UnresolvedPure) return {
13914
- kind: "Input",
13915
- type: "pure",
13916
- index,
13917
- value: input.UnresolvedPure.value
13918
- };
13919
- if (input.UnresolvedObject) return {
13920
- kind: "Input",
13921
- type: "object",
13922
- index,
13923
- value: input.UnresolvedObject.objectId
13924
- };
13925
- throw new Error("Invalid input");
13926
- });
13927
- return {
13928
- version: 1,
13929
- sender: transactionData.sender ?? void 0,
13930
- expiration: transactionData.expiration?.$kind === "Epoch" ? { Epoch: Number(transactionData.expiration.Epoch) } : transactionData.expiration ? { None: true } : null,
13931
- gasConfig: {
13932
- owner: transactionData.gasData.owner ?? void 0,
13933
- budget: transactionData.gasData.budget ?? void 0,
13934
- price: transactionData.gasData.price ?? void 0,
13935
- payment: transactionData.gasData.payment ?? void 0
13936
- },
13937
- inputs,
13938
- transactions: transactionData.commands.map((command) => {
13939
- if (command.MakeMoveVec) return {
13940
- kind: "MakeMoveVec",
13941
- type: command.MakeMoveVec.type === null ? { None: true } : { Some: TypeTagSerializer.parseFromStr(command.MakeMoveVec.type) },
13942
- objects: command.MakeMoveVec.elements.map((arg) => convertTransactionArgument(arg, inputs))
13943
- };
13944
- if (command.MergeCoins) return {
13945
- kind: "MergeCoins",
13946
- destination: convertTransactionArgument(command.MergeCoins.destination, inputs),
13947
- sources: command.MergeCoins.sources.map((arg) => convertTransactionArgument(arg, inputs))
13948
- };
13949
- if (command.MoveCall) return {
13950
- kind: "MoveCall",
13951
- target: `${command.MoveCall.package}::${command.MoveCall.module}::${command.MoveCall.function}`,
13952
- typeArguments: command.MoveCall.typeArguments,
13953
- arguments: command.MoveCall.arguments.map((arg) => convertTransactionArgument(arg, inputs))
13954
- };
13955
- if (command.Publish) return {
13956
- kind: "Publish",
13957
- modules: command.Publish.modules.map((mod3) => Array.from(fromBase64(mod3))),
13958
- dependencies: command.Publish.dependencies
13959
- };
13960
- if (command.SplitCoins) return {
13961
- kind: "SplitCoins",
13962
- coin: convertTransactionArgument(command.SplitCoins.coin, inputs),
13963
- amounts: command.SplitCoins.amounts.map((arg) => convertTransactionArgument(arg, inputs))
13964
- };
13965
- if (command.TransferObjects) return {
13966
- kind: "TransferObjects",
13967
- objects: command.TransferObjects.objects.map((arg) => convertTransactionArgument(arg, inputs)),
13968
- address: convertTransactionArgument(command.TransferObjects.address, inputs)
13969
- };
13970
- if (command.Upgrade) return {
13971
- kind: "Upgrade",
13972
- modules: command.Upgrade.modules.map((mod3) => Array.from(fromBase64(mod3))),
13973
- dependencies: command.Upgrade.dependencies,
13974
- packageId: command.Upgrade.package,
13975
- ticket: convertTransactionArgument(command.Upgrade.ticket, inputs)
13976
- };
13977
- throw new Error(`Unknown transaction ${Object.keys(command)}`);
13978
- })
13979
- };
12940
+ // ../../node_modules/.pnpm/@noble+hashes@2.0.1/node_modules/@noble/hashes/utils.js
12941
+ function isBytes2(a) {
12942
+ return a instanceof Uint8Array || ArrayBuffer.isView(a) && a.constructor.name === "Uint8Array";
13980
12943
  }
13981
- function convertTransactionArgument(arg, inputs) {
13982
- if (arg.$kind === "GasCoin") return { kind: "GasCoin" };
13983
- if (arg.$kind === "Result") return {
13984
- kind: "Result",
13985
- index: arg.Result
13986
- };
13987
- if (arg.$kind === "NestedResult") return {
13988
- kind: "NestedResult",
13989
- index: arg.NestedResult[0],
13990
- resultIndex: arg.NestedResult[1]
13991
- };
13992
- if (arg.$kind === "Input") return inputs[arg.Input];
13993
- throw new Error(`Invalid argument ${Object.keys(arg)}`);
12944
+ function anumber2(n, title = "") {
12945
+ if (!Number.isSafeInteger(n) || n < 0) {
12946
+ const prefix = title && `"${title}" `;
12947
+ throw new Error(`${prefix}expected integer >= 0, got ${n}`);
12948
+ }
13994
12949
  }
13995
- function transactionDataFromV1(data) {
13996
- return parse3(TransactionDataSchema, {
13997
- version: 2,
13998
- sender: data.sender ?? null,
13999
- expiration: data.expiration ? "Epoch" in data.expiration ? { Epoch: data.expiration.Epoch } : { None: true } : null,
14000
- gasData: {
14001
- owner: data.gasConfig.owner ?? null,
14002
- budget: data.gasConfig.budget?.toString() ?? null,
14003
- price: data.gasConfig.price?.toString() ?? null,
14004
- payment: data.gasConfig.payment?.map((ref) => ({
14005
- digest: ref.digest,
14006
- objectId: ref.objectId,
14007
- version: ref.version.toString()
14008
- })) ?? null
14009
- },
14010
- inputs: data.inputs.map((input) => {
14011
- if (input.kind === "Input") {
14012
- if (is(NormalizedCallArg2, input.value)) {
14013
- const value = parse3(NormalizedCallArg2, input.value);
14014
- if (value.Object) {
14015
- if (value.Object.ImmOrOwned) return { Object: { ImmOrOwnedObject: {
14016
- objectId: value.Object.ImmOrOwned.objectId,
14017
- version: String(value.Object.ImmOrOwned.version),
14018
- digest: value.Object.ImmOrOwned.digest
14019
- } } };
14020
- if (value.Object.Shared) return { Object: { SharedObject: {
14021
- mutable: value.Object.Shared.mutable ?? null,
14022
- initialSharedVersion: value.Object.Shared.initialSharedVersion,
14023
- objectId: value.Object.Shared.objectId
14024
- } } };
14025
- if (value.Object.Receiving) return { Object: { Receiving: {
14026
- digest: value.Object.Receiving.digest,
14027
- version: String(value.Object.Receiving.version),
14028
- objectId: value.Object.Receiving.objectId
14029
- } } };
14030
- throw new Error("Invalid object input");
14031
- }
14032
- return { Pure: { bytes: toBase64(new Uint8Array(value.Pure)) } };
14033
- }
14034
- if (input.type === "object") return { UnresolvedObject: { objectId: input.value } };
14035
- return { UnresolvedPure: { value: input.value } };
14036
- }
14037
- throw new Error("Invalid input");
14038
- }),
14039
- commands: data.transactions.map((transaction) => {
14040
- switch (transaction.kind) {
14041
- case "MakeMoveVec":
14042
- return { MakeMoveVec: {
14043
- type: "Some" in transaction.type ? TypeTagSerializer.tagToString(transaction.type.Some) : null,
14044
- elements: transaction.objects.map((arg) => parseV1TransactionArgument(arg))
14045
- } };
14046
- case "MergeCoins":
14047
- return { MergeCoins: {
14048
- destination: parseV1TransactionArgument(transaction.destination),
14049
- sources: transaction.sources.map((arg) => parseV1TransactionArgument(arg))
14050
- } };
14051
- case "MoveCall": {
14052
- const [pkg, mod3, fn] = transaction.target.split("::");
14053
- return { MoveCall: {
14054
- package: pkg,
14055
- module: mod3,
14056
- function: fn,
14057
- typeArguments: transaction.typeArguments,
14058
- arguments: transaction.arguments.map((arg) => parseV1TransactionArgument(arg))
14059
- } };
14060
- }
14061
- case "Publish":
14062
- return { Publish: {
14063
- modules: transaction.modules.map((mod3) => toBase64(Uint8Array.from(mod3))),
14064
- dependencies: transaction.dependencies
14065
- } };
14066
- case "SplitCoins":
14067
- return { SplitCoins: {
14068
- coin: parseV1TransactionArgument(transaction.coin),
14069
- amounts: transaction.amounts.map((arg) => parseV1TransactionArgument(arg))
14070
- } };
14071
- case "TransferObjects":
14072
- return { TransferObjects: {
14073
- objects: transaction.objects.map((arg) => parseV1TransactionArgument(arg)),
14074
- address: parseV1TransactionArgument(transaction.address)
14075
- } };
14076
- case "Upgrade":
14077
- return { Upgrade: {
14078
- modules: transaction.modules.map((mod3) => toBase64(Uint8Array.from(mod3))),
14079
- dependencies: transaction.dependencies,
14080
- package: transaction.packageId,
14081
- ticket: parseV1TransactionArgument(transaction.ticket)
14082
- } };
14083
- }
14084
- throw new Error(`Unknown transaction ${Object.keys(transaction)}`);
14085
- })
14086
- });
12950
+ function abytes(value, length, title = "") {
12951
+ const bytes = isBytes2(value);
12952
+ const len = value?.length;
12953
+ const needsLen = length !== void 0;
12954
+ if (!bytes || needsLen && len !== length) {
12955
+ const prefix = title && `"${title}" `;
12956
+ const ofLen = needsLen ? ` of length ${length}` : "";
12957
+ const got = bytes ? `length=${len}` : `type=${typeof value}`;
12958
+ throw new Error(prefix + "expected Uint8Array" + ofLen + ", got " + got);
12959
+ }
12960
+ return value;
14087
12961
  }
14088
- function parseV1TransactionArgument(arg) {
14089
- switch (arg.kind) {
14090
- case "GasCoin":
14091
- return { GasCoin: true };
14092
- case "Result":
14093
- return { Result: arg.index };
14094
- case "NestedResult":
14095
- return { NestedResult: [arg.index, arg.resultIndex] };
14096
- case "Input":
14097
- return { Input: arg.index };
14098
- }
14099
- }
14100
- var ObjectRef, ObjectArg2, NormalizedCallArg2, TransactionInput, TransactionArgumentTypes;
14101
- var init_v1 = __esm({
14102
- "../../node_modules/.pnpm/@mysten+sui@2.17.0_typescript@5.9.3/node_modules/@mysten/sui/dist/transactions/data/v1.mjs"() {
14103
- init_type_tag_serializer();
14104
- init_internal();
14105
- init_dist2();
14106
- init_dist3();
14107
- ObjectRef = object3({
14108
- digest: string3(),
14109
- objectId: string3(),
14110
- version: union2([
14111
- pipe2(number3(), integer2()),
14112
- string3(),
14113
- bigint2()
14114
- ])
14115
- });
14116
- ObjectArg2 = safeEnum({
14117
- ImmOrOwned: ObjectRef,
14118
- Shared: object3({
14119
- objectId: ObjectID,
14120
- initialSharedVersion: JsonU64,
14121
- mutable: boolean3()
14122
- }),
14123
- Receiving: ObjectRef
14124
- });
14125
- NormalizedCallArg2 = safeEnum({
14126
- Object: ObjectArg2,
14127
- Pure: array2(pipe2(number3(), integer2()))
14128
- });
14129
- TransactionInput = union2([object3({
14130
- kind: literal2("Input"),
14131
- index: pipe2(number3(), integer2()),
14132
- value: unknown2(),
14133
- type: optional2(literal2("object"))
14134
- }), object3({
14135
- kind: literal2("Input"),
14136
- index: pipe2(number3(), integer2()),
14137
- value: unknown2(),
14138
- type: literal2("pure")
14139
- })]);
14140
- TransactionArgumentTypes = [
14141
- TransactionInput,
14142
- object3({ kind: literal2("GasCoin") }),
14143
- object3({
14144
- kind: literal2("Result"),
14145
- index: pipe2(number3(), integer2())
14146
- }),
14147
- object3({
14148
- kind: literal2("NestedResult"),
14149
- index: pipe2(number3(), integer2()),
14150
- resultIndex: pipe2(number3(), integer2())
14151
- })
14152
- ];
14153
- union2([...TransactionArgumentTypes]);
14154
- }
14155
- });
14156
-
14157
- // ../../node_modules/.pnpm/@noble+hashes@2.0.1/node_modules/@noble/hashes/utils.js
14158
- function isBytes2(a) {
14159
- return a instanceof Uint8Array || ArrayBuffer.isView(a) && a.constructor.name === "Uint8Array";
14160
- }
14161
- function anumber2(n, title = "") {
14162
- if (!Number.isSafeInteger(n) || n < 0) {
14163
- const prefix = title && `"${title}" `;
14164
- throw new Error(`${prefix}expected integer >= 0, got ${n}`);
14165
- }
14166
- }
14167
- function abytes(value, length, title = "") {
14168
- const bytes = isBytes2(value);
14169
- const len = value?.length;
14170
- const needsLen = length !== void 0;
14171
- if (!bytes || needsLen && len !== length) {
14172
- const prefix = title && `"${title}" `;
14173
- const ofLen = needsLen ? ` of length ${length}` : "";
14174
- const got = bytes ? `length=${len}` : `type=${typeof value}`;
14175
- throw new Error(prefix + "expected Uint8Array" + ofLen + ", got " + got);
14176
- }
14177
- return value;
14178
- }
14179
- function ahash(h) {
14180
- if (typeof h !== "function" || typeof h.create !== "function")
14181
- throw new Error("Hash must wrapped by utils.createHasher");
14182
- anumber2(h.outputLen);
14183
- anumber2(h.blockLen);
14184
- }
14185
- function aexists(instance, checkFinished = true) {
14186
- if (instance.destroyed)
14187
- throw new Error("Hash instance has been destroyed");
14188
- if (checkFinished && instance.finished)
14189
- throw new Error("Hash#digest() has already been called");
14190
- }
14191
- function aoutput(out, instance) {
14192
- abytes(out, void 0, "digestInto() output");
14193
- const min2 = instance.outputLen;
14194
- if (out.length < min2) {
14195
- throw new Error('"digestInto() output" expected to be of length >=' + min2);
12962
+ function ahash(h) {
12963
+ if (typeof h !== "function" || typeof h.create !== "function")
12964
+ throw new Error("Hash must wrapped by utils.createHasher");
12965
+ anumber2(h.outputLen);
12966
+ anumber2(h.blockLen);
12967
+ }
12968
+ function aexists(instance, checkFinished = true) {
12969
+ if (instance.destroyed)
12970
+ throw new Error("Hash instance has been destroyed");
12971
+ if (checkFinished && instance.finished)
12972
+ throw new Error("Hash#digest() has already been called");
12973
+ }
12974
+ function aoutput(out, instance) {
12975
+ abytes(out, void 0, "digestInto() output");
12976
+ const min2 = instance.outputLen;
12977
+ if (out.length < min2) {
12978
+ throw new Error('"digestInto() output" expected to be of length >=' + min2);
14196
12979
  }
14197
12980
  }
14198
12981
  function u32(arr) {
@@ -14302,7 +13085,7 @@ function randomBytes(bytesLength = 32) {
14302
13085
  return cr.getRandomValues(new Uint8Array(bytesLength));
14303
13086
  }
14304
13087
  var isLE, swap8IfBE, swap32IfBE, hasHexBuiltin, hexes, asciis, oidNist;
14305
- var init_utils3 = __esm({
13088
+ var init_utils2 = __esm({
14306
13089
  "../../node_modules/.pnpm/@noble+hashes@2.0.1/node_modules/@noble/hashes/utils.js"() {
14307
13090
  isLE = /* @__PURE__ */ (() => new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68)();
14308
13091
  swap8IfBE = isLE ? (n) => n : (n) => byteSwap(n);
@@ -14589,7 +13372,7 @@ var init_blake = __esm({
14589
13372
  var HashMD, SHA512_IV;
14590
13373
  var init_md = __esm({
14591
13374
  "../../node_modules/.pnpm/@noble+hashes@2.0.1/node_modules/@noble/hashes/_md.js"() {
14592
- init_utils3();
13375
+ init_utils2();
14593
13376
  HashMD = class {
14594
13377
  blockLen;
14595
13378
  outputLen;
@@ -14681,364 +13464,1627 @@ var init_md = __esm({
14681
13464
  to.buffer.set(buffer);
14682
13465
  return to;
14683
13466
  }
14684
- clone() {
14685
- return this._cloneInto();
13467
+ clone() {
13468
+ return this._cloneInto();
13469
+ }
13470
+ };
13471
+ SHA512_IV = /* @__PURE__ */ Uint32Array.from([
13472
+ 1779033703,
13473
+ 4089235720,
13474
+ 3144134277,
13475
+ 2227873595,
13476
+ 1013904242,
13477
+ 4271175723,
13478
+ 2773480762,
13479
+ 1595750129,
13480
+ 1359893119,
13481
+ 2917565137,
13482
+ 2600822924,
13483
+ 725511199,
13484
+ 528734635,
13485
+ 4215389547,
13486
+ 1541459225,
13487
+ 327033209
13488
+ ]);
13489
+ }
13490
+ });
13491
+
13492
+ // ../../node_modules/.pnpm/@noble+hashes@2.0.1/node_modules/@noble/hashes/_u64.js
13493
+ function fromBig(n, le = false) {
13494
+ if (le)
13495
+ return { h: Number(n & U32_MASK64), l: Number(n >> _32n & U32_MASK64) };
13496
+ return { h: Number(n >> _32n & U32_MASK64) | 0, l: Number(n & U32_MASK64) | 0 };
13497
+ }
13498
+ function split(lst, le = false) {
13499
+ const len = lst.length;
13500
+ let Ah = new Uint32Array(len);
13501
+ let Al = new Uint32Array(len);
13502
+ for (let i = 0; i < len; i++) {
13503
+ const { h, l: l2 } = fromBig(lst[i], le);
13504
+ [Ah[i], Al[i]] = [h, l2];
13505
+ }
13506
+ return [Ah, Al];
13507
+ }
13508
+ function add(Ah, Al, Bh, Bl) {
13509
+ const l2 = (Al >>> 0) + (Bl >>> 0);
13510
+ return { h: Ah + Bh + (l2 / 2 ** 32 | 0) | 0, l: l2 | 0 };
13511
+ }
13512
+ var U32_MASK64, _32n, shrSH, shrSL, rotrSH, rotrSL, rotrBH, rotrBL, rotr32H, rotr32L, add3L, add3H, add4L, add4H, add5L, add5H;
13513
+ var init_u64 = __esm({
13514
+ "../../node_modules/.pnpm/@noble+hashes@2.0.1/node_modules/@noble/hashes/_u64.js"() {
13515
+ U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1);
13516
+ _32n = /* @__PURE__ */ BigInt(32);
13517
+ shrSH = (h, _l, s) => h >>> s;
13518
+ shrSL = (h, l2, s) => h << 32 - s | l2 >>> s;
13519
+ rotrSH = (h, l2, s) => h >>> s | l2 << 32 - s;
13520
+ rotrSL = (h, l2, s) => h << 32 - s | l2 >>> s;
13521
+ rotrBH = (h, l2, s) => h << 64 - s | l2 >>> s - 32;
13522
+ rotrBL = (h, l2, s) => h >>> s - 32 | l2 << 64 - s;
13523
+ rotr32H = (_h, l2) => l2;
13524
+ rotr32L = (h, _l) => h;
13525
+ add3L = (Al, Bl, Cl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0);
13526
+ add3H = (low, Ah, Bh, Ch) => Ah + Bh + Ch + (low / 2 ** 32 | 0) | 0;
13527
+ add4L = (Al, Bl, Cl, Dl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0);
13528
+ add4H = (low, Ah, Bh, Ch, Dh) => Ah + Bh + Ch + Dh + (low / 2 ** 32 | 0) | 0;
13529
+ add5L = (Al, Bl, Cl, Dl, El) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0) + (El >>> 0);
13530
+ add5H = (low, Ah, Bh, Ch, Dh, Eh) => Ah + Bh + Ch + Dh + Eh + (low / 2 ** 32 | 0) | 0;
13531
+ }
13532
+ });
13533
+
13534
+ // ../../node_modules/.pnpm/@noble+hashes@2.0.1/node_modules/@noble/hashes/blake2.js
13535
+ function G1b(a, b, c, d, msg, x) {
13536
+ const Xl = msg[x], Xh = msg[x + 1];
13537
+ let Al = BBUF[2 * a], Ah = BBUF[2 * a + 1];
13538
+ let Bl = BBUF[2 * b], Bh = BBUF[2 * b + 1];
13539
+ let Cl = BBUF[2 * c], Ch = BBUF[2 * c + 1];
13540
+ let Dl = BBUF[2 * d], Dh = BBUF[2 * d + 1];
13541
+ let ll = add3L(Al, Bl, Xl);
13542
+ Ah = add3H(ll, Ah, Bh, Xh);
13543
+ Al = ll | 0;
13544
+ ({ Dh, Dl } = { Dh: Dh ^ Ah, Dl: Dl ^ Al });
13545
+ ({ Dh, Dl } = { Dh: rotr32H(Dh, Dl), Dl: rotr32L(Dh, Dl) });
13546
+ ({ h: Ch, l: Cl } = add(Ch, Cl, Dh, Dl));
13547
+ ({ Bh, Bl } = { Bh: Bh ^ Ch, Bl: Bl ^ Cl });
13548
+ ({ Bh, Bl } = { Bh: rotrSH(Bh, Bl, 24), Bl: rotrSL(Bh, Bl, 24) });
13549
+ BBUF[2 * a] = Al, BBUF[2 * a + 1] = Ah;
13550
+ BBUF[2 * b] = Bl, BBUF[2 * b + 1] = Bh;
13551
+ BBUF[2 * c] = Cl, BBUF[2 * c + 1] = Ch;
13552
+ BBUF[2 * d] = Dl, BBUF[2 * d + 1] = Dh;
13553
+ }
13554
+ function G2b(a, b, c, d, msg, x) {
13555
+ const Xl = msg[x], Xh = msg[x + 1];
13556
+ let Al = BBUF[2 * a], Ah = BBUF[2 * a + 1];
13557
+ let Bl = BBUF[2 * b], Bh = BBUF[2 * b + 1];
13558
+ let Cl = BBUF[2 * c], Ch = BBUF[2 * c + 1];
13559
+ let Dl = BBUF[2 * d], Dh = BBUF[2 * d + 1];
13560
+ let ll = add3L(Al, Bl, Xl);
13561
+ Ah = add3H(ll, Ah, Bh, Xh);
13562
+ Al = ll | 0;
13563
+ ({ Dh, Dl } = { Dh: Dh ^ Ah, Dl: Dl ^ Al });
13564
+ ({ Dh, Dl } = { Dh: rotrSH(Dh, Dl, 16), Dl: rotrSL(Dh, Dl, 16) });
13565
+ ({ h: Ch, l: Cl } = add(Ch, Cl, Dh, Dl));
13566
+ ({ Bh, Bl } = { Bh: Bh ^ Ch, Bl: Bl ^ Cl });
13567
+ ({ Bh, Bl } = { Bh: rotrBH(Bh, Bl, 63), Bl: rotrBL(Bh, Bl, 63) });
13568
+ BBUF[2 * a] = Al, BBUF[2 * a + 1] = Ah;
13569
+ BBUF[2 * b] = Bl, BBUF[2 * b + 1] = Bh;
13570
+ BBUF[2 * c] = Cl, BBUF[2 * c + 1] = Ch;
13571
+ BBUF[2 * d] = Dl, BBUF[2 * d + 1] = Dh;
13572
+ }
13573
+ function checkBlake2Opts(outputLen, opts = {}, keyLen, saltLen, persLen) {
13574
+ anumber2(keyLen);
13575
+ if (outputLen < 0 || outputLen > keyLen)
13576
+ throw new Error("outputLen bigger than keyLen");
13577
+ const { key, salt, personalization } = opts;
13578
+ if (key !== void 0 && (key.length < 1 || key.length > keyLen))
13579
+ throw new Error('"key" expected to be undefined or of length=1..' + keyLen);
13580
+ if (salt !== void 0)
13581
+ abytes(salt, saltLen, "salt");
13582
+ if (personalization !== void 0)
13583
+ abytes(personalization, persLen, "personalization");
13584
+ }
13585
+ var B2B_IV, BBUF, _BLAKE2, _BLAKE2b, blake2b;
13586
+ var init_blake2 = __esm({
13587
+ "../../node_modules/.pnpm/@noble+hashes@2.0.1/node_modules/@noble/hashes/blake2.js"() {
13588
+ init_blake();
13589
+ init_u64();
13590
+ init_utils2();
13591
+ B2B_IV = /* @__PURE__ */ Uint32Array.from([
13592
+ 4089235720,
13593
+ 1779033703,
13594
+ 2227873595,
13595
+ 3144134277,
13596
+ 4271175723,
13597
+ 1013904242,
13598
+ 1595750129,
13599
+ 2773480762,
13600
+ 2917565137,
13601
+ 1359893119,
13602
+ 725511199,
13603
+ 2600822924,
13604
+ 4215389547,
13605
+ 528734635,
13606
+ 327033209,
13607
+ 1541459225
13608
+ ]);
13609
+ BBUF = /* @__PURE__ */ new Uint32Array(32);
13610
+ _BLAKE2 = class {
13611
+ buffer;
13612
+ buffer32;
13613
+ finished = false;
13614
+ destroyed = false;
13615
+ length = 0;
13616
+ pos = 0;
13617
+ blockLen;
13618
+ outputLen;
13619
+ constructor(blockLen, outputLen) {
13620
+ anumber2(blockLen);
13621
+ anumber2(outputLen);
13622
+ this.blockLen = blockLen;
13623
+ this.outputLen = outputLen;
13624
+ this.buffer = new Uint8Array(blockLen);
13625
+ this.buffer32 = u32(this.buffer);
13626
+ }
13627
+ update(data) {
13628
+ aexists(this);
13629
+ abytes(data);
13630
+ const { blockLen, buffer, buffer32 } = this;
13631
+ const len = data.length;
13632
+ const offset = data.byteOffset;
13633
+ const buf = data.buffer;
13634
+ for (let pos = 0; pos < len; ) {
13635
+ if (this.pos === blockLen) {
13636
+ swap32IfBE(buffer32);
13637
+ this.compress(buffer32, 0, false);
13638
+ swap32IfBE(buffer32);
13639
+ this.pos = 0;
13640
+ }
13641
+ const take = Math.min(blockLen - this.pos, len - pos);
13642
+ const dataOffset = offset + pos;
13643
+ if (take === blockLen && !(dataOffset % 4) && pos + take < len) {
13644
+ const data32 = new Uint32Array(buf, dataOffset, Math.floor((len - pos) / 4));
13645
+ swap32IfBE(data32);
13646
+ for (let pos32 = 0; pos + blockLen < len; pos32 += buffer32.length, pos += blockLen) {
13647
+ this.length += blockLen;
13648
+ this.compress(data32, pos32, false);
13649
+ }
13650
+ swap32IfBE(data32);
13651
+ continue;
13652
+ }
13653
+ buffer.set(data.subarray(pos, pos + take), this.pos);
13654
+ this.pos += take;
13655
+ this.length += take;
13656
+ pos += take;
13657
+ }
13658
+ return this;
13659
+ }
13660
+ digestInto(out) {
13661
+ aexists(this);
13662
+ aoutput(out, this);
13663
+ const { pos, buffer32 } = this;
13664
+ this.finished = true;
13665
+ clean(this.buffer.subarray(pos));
13666
+ swap32IfBE(buffer32);
13667
+ this.compress(buffer32, 0, true);
13668
+ swap32IfBE(buffer32);
13669
+ const out32 = u32(out);
13670
+ this.get().forEach((v, i) => out32[i] = swap8IfBE(v));
13671
+ }
13672
+ digest() {
13673
+ const { buffer, outputLen } = this;
13674
+ this.digestInto(buffer);
13675
+ const res = buffer.slice(0, outputLen);
13676
+ this.destroy();
13677
+ return res;
13678
+ }
13679
+ _cloneInto(to) {
13680
+ const { buffer, length, finished, destroyed, outputLen, pos } = this;
13681
+ to ||= new this.constructor({ dkLen: outputLen });
13682
+ to.set(...this.get());
13683
+ to.buffer.set(buffer);
13684
+ to.destroyed = destroyed;
13685
+ to.finished = finished;
13686
+ to.length = length;
13687
+ to.pos = pos;
13688
+ to.outputLen = outputLen;
13689
+ return to;
13690
+ }
13691
+ clone() {
13692
+ return this._cloneInto();
13693
+ }
13694
+ };
13695
+ _BLAKE2b = class extends _BLAKE2 {
13696
+ // Same as SHA-512, but LE
13697
+ v0l = B2B_IV[0] | 0;
13698
+ v0h = B2B_IV[1] | 0;
13699
+ v1l = B2B_IV[2] | 0;
13700
+ v1h = B2B_IV[3] | 0;
13701
+ v2l = B2B_IV[4] | 0;
13702
+ v2h = B2B_IV[5] | 0;
13703
+ v3l = B2B_IV[6] | 0;
13704
+ v3h = B2B_IV[7] | 0;
13705
+ v4l = B2B_IV[8] | 0;
13706
+ v4h = B2B_IV[9] | 0;
13707
+ v5l = B2B_IV[10] | 0;
13708
+ v5h = B2B_IV[11] | 0;
13709
+ v6l = B2B_IV[12] | 0;
13710
+ v6h = B2B_IV[13] | 0;
13711
+ v7l = B2B_IV[14] | 0;
13712
+ v7h = B2B_IV[15] | 0;
13713
+ constructor(opts = {}) {
13714
+ const olen = opts.dkLen === void 0 ? 64 : opts.dkLen;
13715
+ super(128, olen);
13716
+ checkBlake2Opts(olen, opts, 64, 16, 16);
13717
+ let { key, personalization, salt } = opts;
13718
+ let keyLength = 0;
13719
+ if (key !== void 0) {
13720
+ abytes(key, void 0, "key");
13721
+ keyLength = key.length;
13722
+ }
13723
+ this.v0l ^= this.outputLen | keyLength << 8 | 1 << 16 | 1 << 24;
13724
+ if (salt !== void 0) {
13725
+ abytes(salt, void 0, "salt");
13726
+ const slt = u32(salt);
13727
+ this.v4l ^= swap8IfBE(slt[0]);
13728
+ this.v4h ^= swap8IfBE(slt[1]);
13729
+ this.v5l ^= swap8IfBE(slt[2]);
13730
+ this.v5h ^= swap8IfBE(slt[3]);
13731
+ }
13732
+ if (personalization !== void 0) {
13733
+ abytes(personalization, void 0, "personalization");
13734
+ const pers = u32(personalization);
13735
+ this.v6l ^= swap8IfBE(pers[0]);
13736
+ this.v6h ^= swap8IfBE(pers[1]);
13737
+ this.v7l ^= swap8IfBE(pers[2]);
13738
+ this.v7h ^= swap8IfBE(pers[3]);
13739
+ }
13740
+ if (key !== void 0) {
13741
+ const tmp = new Uint8Array(this.blockLen);
13742
+ tmp.set(key);
13743
+ this.update(tmp);
13744
+ }
13745
+ }
13746
+ // prettier-ignore
13747
+ get() {
13748
+ let { v0l, v0h, v1l, v1h, v2l, v2h, v3l, v3h, v4l, v4h, v5l, v5h, v6l, v6h, v7l, v7h } = this;
13749
+ return [v0l, v0h, v1l, v1h, v2l, v2h, v3l, v3h, v4l, v4h, v5l, v5h, v6l, v6h, v7l, v7h];
13750
+ }
13751
+ // prettier-ignore
13752
+ set(v0l, v0h, v1l, v1h, v2l, v2h, v3l, v3h, v4l, v4h, v5l, v5h, v6l, v6h, v7l, v7h) {
13753
+ this.v0l = v0l | 0;
13754
+ this.v0h = v0h | 0;
13755
+ this.v1l = v1l | 0;
13756
+ this.v1h = v1h | 0;
13757
+ this.v2l = v2l | 0;
13758
+ this.v2h = v2h | 0;
13759
+ this.v3l = v3l | 0;
13760
+ this.v3h = v3h | 0;
13761
+ this.v4l = v4l | 0;
13762
+ this.v4h = v4h | 0;
13763
+ this.v5l = v5l | 0;
13764
+ this.v5h = v5h | 0;
13765
+ this.v6l = v6l | 0;
13766
+ this.v6h = v6h | 0;
13767
+ this.v7l = v7l | 0;
13768
+ this.v7h = v7h | 0;
13769
+ }
13770
+ compress(msg, offset, isLast) {
13771
+ this.get().forEach((v, i) => BBUF[i] = v);
13772
+ BBUF.set(B2B_IV, 16);
13773
+ let { h, l: l2 } = fromBig(BigInt(this.length));
13774
+ BBUF[24] = B2B_IV[8] ^ l2;
13775
+ BBUF[25] = B2B_IV[9] ^ h;
13776
+ if (isLast) {
13777
+ BBUF[28] = ~BBUF[28];
13778
+ BBUF[29] = ~BBUF[29];
13779
+ }
13780
+ let j = 0;
13781
+ const s = BSIGMA;
13782
+ for (let i = 0; i < 12; i++) {
13783
+ G1b(0, 4, 8, 12, msg, offset + 2 * s[j++]);
13784
+ G2b(0, 4, 8, 12, msg, offset + 2 * s[j++]);
13785
+ G1b(1, 5, 9, 13, msg, offset + 2 * s[j++]);
13786
+ G2b(1, 5, 9, 13, msg, offset + 2 * s[j++]);
13787
+ G1b(2, 6, 10, 14, msg, offset + 2 * s[j++]);
13788
+ G2b(2, 6, 10, 14, msg, offset + 2 * s[j++]);
13789
+ G1b(3, 7, 11, 15, msg, offset + 2 * s[j++]);
13790
+ G2b(3, 7, 11, 15, msg, offset + 2 * s[j++]);
13791
+ G1b(0, 5, 10, 15, msg, offset + 2 * s[j++]);
13792
+ G2b(0, 5, 10, 15, msg, offset + 2 * s[j++]);
13793
+ G1b(1, 6, 11, 12, msg, offset + 2 * s[j++]);
13794
+ G2b(1, 6, 11, 12, msg, offset + 2 * s[j++]);
13795
+ G1b(2, 7, 8, 13, msg, offset + 2 * s[j++]);
13796
+ G2b(2, 7, 8, 13, msg, offset + 2 * s[j++]);
13797
+ G1b(3, 4, 9, 14, msg, offset + 2 * s[j++]);
13798
+ G2b(3, 4, 9, 14, msg, offset + 2 * s[j++]);
13799
+ }
13800
+ this.v0l ^= BBUF[0] ^ BBUF[16];
13801
+ this.v0h ^= BBUF[1] ^ BBUF[17];
13802
+ this.v1l ^= BBUF[2] ^ BBUF[18];
13803
+ this.v1h ^= BBUF[3] ^ BBUF[19];
13804
+ this.v2l ^= BBUF[4] ^ BBUF[20];
13805
+ this.v2h ^= BBUF[5] ^ BBUF[21];
13806
+ this.v3l ^= BBUF[6] ^ BBUF[22];
13807
+ this.v3h ^= BBUF[7] ^ BBUF[23];
13808
+ this.v4l ^= BBUF[8] ^ BBUF[24];
13809
+ this.v4h ^= BBUF[9] ^ BBUF[25];
13810
+ this.v5l ^= BBUF[10] ^ BBUF[26];
13811
+ this.v5h ^= BBUF[11] ^ BBUF[27];
13812
+ this.v6l ^= BBUF[12] ^ BBUF[28];
13813
+ this.v6h ^= BBUF[13] ^ BBUF[29];
13814
+ this.v7l ^= BBUF[14] ^ BBUF[30];
13815
+ this.v7h ^= BBUF[15] ^ BBUF[31];
13816
+ clean(BBUF);
13817
+ }
13818
+ destroy() {
13819
+ this.destroyed = true;
13820
+ clean(this.buffer32);
13821
+ this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
13822
+ }
13823
+ };
13824
+ blake2b = /* @__PURE__ */ createHasher((opts) => new _BLAKE2b(opts));
13825
+ }
13826
+ });
13827
+
13828
+ // ../../node_modules/.pnpm/@mysten+sui@2.17.0_typescript@5.9.3/node_modules/@mysten/sui/dist/utils/dynamic-fields.mjs
13829
+ function deriveDynamicFieldID(parentId, typeTag, key) {
13830
+ const address = suiBcs.Address.serialize(parentId).toBytes();
13831
+ const tag2 = suiBcs.TypeTag.serialize(typeTag).toBytes();
13832
+ const keyLength = suiBcs.u64().serialize(key.length).toBytes();
13833
+ const hash = blake2b.create({ dkLen: 32 });
13834
+ hash.update(new Uint8Array([240]));
13835
+ hash.update(address);
13836
+ hash.update(keyLength);
13837
+ hash.update(key);
13838
+ hash.update(tag2);
13839
+ return `0x${toHex(hash.digest().slice(0, 32))}`;
13840
+ }
13841
+ var init_dynamic_fields = __esm({
13842
+ "../../node_modules/.pnpm/@mysten+sui@2.17.0_typescript@5.9.3/node_modules/@mysten/sui/dist/utils/dynamic-fields.mjs"() {
13843
+ init_bcs3();
13844
+ init_dist2();
13845
+ init_blake2();
13846
+ }
13847
+ });
13848
+
13849
+ // ../../node_modules/.pnpm/@mysten+sui@2.17.0_typescript@5.9.3/node_modules/@mysten/sui/dist/utils/constants.mjs
13850
+ var MOVE_STDLIB_ADDRESS, SUI_FRAMEWORK_ADDRESS, SUI_CLOCK_OBJECT_ID, SUI_TYPE_ARG, SUI_SYSTEM_STATE_OBJECT_ID, SUI_RANDOM_OBJECT_ID, SUI_DENY_LIST_OBJECT_ID;
13851
+ var init_constants = __esm({
13852
+ "../../node_modules/.pnpm/@mysten+sui@2.17.0_typescript@5.9.3/node_modules/@mysten/sui/dist/utils/constants.mjs"() {
13853
+ BigInt(1e9);
13854
+ MOVE_STDLIB_ADDRESS = "0x0000000000000000000000000000000000000000000000000000000000000001";
13855
+ SUI_FRAMEWORK_ADDRESS = "0x0000000000000000000000000000000000000000000000000000000000000002";
13856
+ SUI_CLOCK_OBJECT_ID = "0x0000000000000000000000000000000000000000000000000000000000000006";
13857
+ SUI_TYPE_ARG = `${SUI_FRAMEWORK_ADDRESS}::sui::SUI`;
13858
+ SUI_SYSTEM_STATE_OBJECT_ID = "0x0000000000000000000000000000000000000000000000000000000000000005";
13859
+ SUI_RANDOM_OBJECT_ID = "0x0000000000000000000000000000000000000000000000000000000000000008";
13860
+ SUI_DENY_LIST_OBJECT_ID = "0x0000000000000000000000000000000000000000000000000000000000000403";
13861
+ }
13862
+ });
13863
+
13864
+ // ../../node_modules/.pnpm/@mysten+sui@2.17.0_typescript@5.9.3/node_modules/@mysten/sui/dist/utils/index.mjs
13865
+ var init_utils3 = __esm({
13866
+ "../../node_modules/.pnpm/@mysten+sui@2.17.0_typescript@5.9.3/node_modules/@mysten/sui/dist/utils/index.mjs"() {
13867
+ init_move_registry();
13868
+ init_sui_types();
13869
+ init_constants();
13870
+ init_dist2();
13871
+ }
13872
+ });
13873
+
13874
+ // ../../node_modules/.pnpm/valibot@1.3.1_typescript@5.9.3/node_modules/valibot/dist/index.mjs
13875
+ // @__NO_SIDE_EFFECTS__
13876
+ function getGlobalConfig(config$1) {
13877
+ return {
13878
+ lang: config$1?.lang ?? store$4?.lang,
13879
+ message: config$1?.message,
13880
+ abortEarly: config$1?.abortEarly ?? store$4?.abortEarly,
13881
+ abortPipeEarly: config$1?.abortPipeEarly ?? store$4?.abortPipeEarly
13882
+ };
13883
+ }
13884
+ // @__NO_SIDE_EFFECTS__
13885
+ function getGlobalMessage(lang) {
13886
+ return store$3?.get(lang);
13887
+ }
13888
+ // @__NO_SIDE_EFFECTS__
13889
+ function getSchemaMessage(lang) {
13890
+ return store$2?.get(lang);
13891
+ }
13892
+ // @__NO_SIDE_EFFECTS__
13893
+ function getSpecificMessage(reference, lang) {
13894
+ return store$1?.get(reference)?.get(lang);
13895
+ }
13896
+ // @__NO_SIDE_EFFECTS__
13897
+ function _stringify(input) {
13898
+ const type = typeof input;
13899
+ if (type === "string") return `"${input}"`;
13900
+ if (type === "number" || type === "bigint" || type === "boolean") return `${input}`;
13901
+ if (type === "object" || type === "function") return (input && Object.getPrototypeOf(input)?.constructor?.name) ?? "null";
13902
+ return type;
13903
+ }
13904
+ function _addIssue(context, label, dataset, config$1, other) {
13905
+ const input = other && "input" in other ? other.input : dataset.value;
13906
+ const expected = other?.expected ?? context.expects ?? null;
13907
+ const received = other?.received ?? /* @__PURE__ */ _stringify(input);
13908
+ const issue2 = {
13909
+ kind: context.kind,
13910
+ type: context.type,
13911
+ input,
13912
+ expected,
13913
+ received,
13914
+ message: `Invalid ${label}: ${expected ? `Expected ${expected} but r` : "R"}eceived ${received}`,
13915
+ requirement: context.requirement,
13916
+ path: other?.path,
13917
+ issues: other?.issues,
13918
+ lang: config$1.lang,
13919
+ abortEarly: config$1.abortEarly,
13920
+ abortPipeEarly: config$1.abortPipeEarly
13921
+ };
13922
+ const isSchema = context.kind === "schema";
13923
+ const message$1 = other?.message ?? context.message ?? /* @__PURE__ */ getSpecificMessage(context.reference, issue2.lang) ?? (isSchema ? /* @__PURE__ */ getSchemaMessage(issue2.lang) : null) ?? config$1.message ?? /* @__PURE__ */ getGlobalMessage(issue2.lang);
13924
+ if (message$1 !== void 0) issue2.message = typeof message$1 === "function" ? message$1(issue2) : message$1;
13925
+ if (isSchema) dataset.typed = false;
13926
+ if (dataset.issues) dataset.issues.push(issue2);
13927
+ else dataset.issues = [issue2];
13928
+ }
13929
+ // @__NO_SIDE_EFFECTS__
13930
+ function _getStandardProps(context) {
13931
+ return {
13932
+ version: 1,
13933
+ vendor: "valibot",
13934
+ validate(value$1) {
13935
+ return context["~run"]({ value: value$1 }, /* @__PURE__ */ getGlobalConfig());
13936
+ }
13937
+ };
13938
+ }
13939
+ // @__NO_SIDE_EFFECTS__
13940
+ function _isValidObjectKey(object$1, key) {
13941
+ return Object.hasOwn(object$1, key) && key !== "__proto__" && key !== "prototype" && key !== "constructor";
13942
+ }
13943
+ // @__NO_SIDE_EFFECTS__
13944
+ function _joinExpects(values$1, separator) {
13945
+ const list = [...new Set(values$1)];
13946
+ if (list.length > 1) return `(${list.join(` ${separator} `)})`;
13947
+ return list[0] ?? "never";
13948
+ }
13949
+ // @__NO_SIDE_EFFECTS__
13950
+ function check2(requirement, message$1) {
13951
+ return {
13952
+ kind: "validation",
13953
+ type: "check",
13954
+ reference: check2,
13955
+ async: false,
13956
+ expects: null,
13957
+ requirement,
13958
+ message: message$1,
13959
+ "~run"(dataset, config$1) {
13960
+ if (dataset.typed && !this.requirement(dataset.value)) _addIssue(this, "input", dataset, config$1);
13961
+ return dataset;
13962
+ }
13963
+ };
13964
+ }
13965
+ // @__NO_SIDE_EFFECTS__
13966
+ function integer2(message$1) {
13967
+ return {
13968
+ kind: "validation",
13969
+ type: "integer",
13970
+ reference: integer2,
13971
+ async: false,
13972
+ expects: null,
13973
+ requirement: Number.isInteger,
13974
+ message: message$1,
13975
+ "~run"(dataset, config$1) {
13976
+ if (dataset.typed && !this.requirement(dataset.value)) _addIssue(this, "integer", dataset, config$1);
13977
+ return dataset;
13978
+ }
13979
+ };
13980
+ }
13981
+ // @__NO_SIDE_EFFECTS__
13982
+ function transform2(operation) {
13983
+ return {
13984
+ kind: "transformation",
13985
+ type: "transform",
13986
+ reference: transform2,
13987
+ async: false,
13988
+ operation,
13989
+ "~run"(dataset) {
13990
+ dataset.value = this.operation(dataset.value);
13991
+ return dataset;
13992
+ }
13993
+ };
13994
+ }
13995
+ // @__NO_SIDE_EFFECTS__
13996
+ function getFallback(schema, dataset, config$1) {
13997
+ return typeof schema.fallback === "function" ? schema.fallback(dataset, config$1) : schema.fallback;
13998
+ }
13999
+ // @__NO_SIDE_EFFECTS__
14000
+ function getDefault(schema, dataset, config$1) {
14001
+ return typeof schema.default === "function" ? schema.default(dataset, config$1) : schema.default;
14002
+ }
14003
+ // @__NO_SIDE_EFFECTS__
14004
+ function is(schema, input) {
14005
+ return !schema["~run"]({ value: input }, { abortEarly: true }).issues;
14006
+ }
14007
+ // @__NO_SIDE_EFFECTS__
14008
+ function array2(item, message$1) {
14009
+ return {
14010
+ kind: "schema",
14011
+ type: "array",
14012
+ reference: array2,
14013
+ expects: "Array",
14014
+ async: false,
14015
+ item,
14016
+ message: message$1,
14017
+ get "~standard"() {
14018
+ return /* @__PURE__ */ _getStandardProps(this);
14019
+ },
14020
+ "~run"(dataset, config$1) {
14021
+ const input = dataset.value;
14022
+ if (Array.isArray(input)) {
14023
+ dataset.typed = true;
14024
+ dataset.value = [];
14025
+ for (let key = 0; key < input.length; key++) {
14026
+ const value$1 = input[key];
14027
+ const itemDataset = this.item["~run"]({ value: value$1 }, config$1);
14028
+ if (itemDataset.issues) {
14029
+ const pathItem = {
14030
+ type: "array",
14031
+ origin: "value",
14032
+ input,
14033
+ key,
14034
+ value: value$1
14035
+ };
14036
+ for (const issue2 of itemDataset.issues) {
14037
+ if (issue2.path) issue2.path.unshift(pathItem);
14038
+ else issue2.path = [pathItem];
14039
+ dataset.issues?.push(issue2);
14040
+ }
14041
+ if (!dataset.issues) dataset.issues = itemDataset.issues;
14042
+ if (config$1.abortEarly) {
14043
+ dataset.typed = false;
14044
+ break;
14045
+ }
14046
+ }
14047
+ if (!itemDataset.typed) dataset.typed = false;
14048
+ dataset.value.push(itemDataset.value);
14049
+ }
14050
+ } else _addIssue(this, "type", dataset, config$1);
14051
+ return dataset;
14052
+ }
14053
+ };
14054
+ }
14055
+ // @__NO_SIDE_EFFECTS__
14056
+ function bigint2(message$1) {
14057
+ return {
14058
+ kind: "schema",
14059
+ type: "bigint",
14060
+ reference: bigint2,
14061
+ expects: "bigint",
14062
+ async: false,
14063
+ message: message$1,
14064
+ get "~standard"() {
14065
+ return /* @__PURE__ */ _getStandardProps(this);
14066
+ },
14067
+ "~run"(dataset, config$1) {
14068
+ if (typeof dataset.value === "bigint") dataset.typed = true;
14069
+ else _addIssue(this, "type", dataset, config$1);
14070
+ return dataset;
14071
+ }
14072
+ };
14073
+ }
14074
+ // @__NO_SIDE_EFFECTS__
14075
+ function boolean3(message$1) {
14076
+ return {
14077
+ kind: "schema",
14078
+ type: "boolean",
14079
+ reference: boolean3,
14080
+ expects: "boolean",
14081
+ async: false,
14082
+ message: message$1,
14083
+ get "~standard"() {
14084
+ return /* @__PURE__ */ _getStandardProps(this);
14085
+ },
14086
+ "~run"(dataset, config$1) {
14087
+ if (typeof dataset.value === "boolean") dataset.typed = true;
14088
+ else _addIssue(this, "type", dataset, config$1);
14089
+ return dataset;
14090
+ }
14091
+ };
14092
+ }
14093
+ // @__NO_SIDE_EFFECTS__
14094
+ function lazy(getter) {
14095
+ return {
14096
+ kind: "schema",
14097
+ type: "lazy",
14098
+ reference: lazy,
14099
+ expects: "unknown",
14100
+ async: false,
14101
+ getter,
14102
+ get "~standard"() {
14103
+ return /* @__PURE__ */ _getStandardProps(this);
14104
+ },
14105
+ "~run"(dataset, config$1) {
14106
+ return this.getter(dataset.value)["~run"](dataset, config$1);
14107
+ }
14108
+ };
14109
+ }
14110
+ // @__NO_SIDE_EFFECTS__
14111
+ function literal2(literal_, message$1) {
14112
+ return {
14113
+ kind: "schema",
14114
+ type: "literal",
14115
+ reference: literal2,
14116
+ expects: /* @__PURE__ */ _stringify(literal_),
14117
+ async: false,
14118
+ literal: literal_,
14119
+ message: message$1,
14120
+ get "~standard"() {
14121
+ return /* @__PURE__ */ _getStandardProps(this);
14122
+ },
14123
+ "~run"(dataset, config$1) {
14124
+ if (dataset.value === this.literal) dataset.typed = true;
14125
+ else _addIssue(this, "type", dataset, config$1);
14126
+ return dataset;
14127
+ }
14128
+ };
14129
+ }
14130
+ // @__NO_SIDE_EFFECTS__
14131
+ function nullable2(wrapped, default_) {
14132
+ return {
14133
+ kind: "schema",
14134
+ type: "nullable",
14135
+ reference: nullable2,
14136
+ expects: `(${wrapped.expects} | null)`,
14137
+ async: false,
14138
+ wrapped,
14139
+ default: default_,
14140
+ get "~standard"() {
14141
+ return /* @__PURE__ */ _getStandardProps(this);
14142
+ },
14143
+ "~run"(dataset, config$1) {
14144
+ if (dataset.value === null) {
14145
+ if (this.default !== void 0) dataset.value = /* @__PURE__ */ getDefault(this, dataset, config$1);
14146
+ if (dataset.value === null) {
14147
+ dataset.typed = true;
14148
+ return dataset;
14149
+ }
14150
+ }
14151
+ return this.wrapped["~run"](dataset, config$1);
14152
+ }
14153
+ };
14154
+ }
14155
+ // @__NO_SIDE_EFFECTS__
14156
+ function nullish2(wrapped, default_) {
14157
+ return {
14158
+ kind: "schema",
14159
+ type: "nullish",
14160
+ reference: nullish2,
14161
+ expects: `(${wrapped.expects} | null | undefined)`,
14162
+ async: false,
14163
+ wrapped,
14164
+ default: default_,
14165
+ get "~standard"() {
14166
+ return /* @__PURE__ */ _getStandardProps(this);
14167
+ },
14168
+ "~run"(dataset, config$1) {
14169
+ if (dataset.value === null || dataset.value === void 0) {
14170
+ if (this.default !== void 0) dataset.value = /* @__PURE__ */ getDefault(this, dataset, config$1);
14171
+ if (dataset.value === null || dataset.value === void 0) {
14172
+ dataset.typed = true;
14173
+ return dataset;
14174
+ }
14175
+ }
14176
+ return this.wrapped["~run"](dataset, config$1);
14177
+ }
14178
+ };
14179
+ }
14180
+ // @__NO_SIDE_EFFECTS__
14181
+ function number3(message$1) {
14182
+ return {
14183
+ kind: "schema",
14184
+ type: "number",
14185
+ reference: number3,
14186
+ expects: "number",
14187
+ async: false,
14188
+ message: message$1,
14189
+ get "~standard"() {
14190
+ return /* @__PURE__ */ _getStandardProps(this);
14191
+ },
14192
+ "~run"(dataset, config$1) {
14193
+ if (typeof dataset.value === "number" && !isNaN(dataset.value)) dataset.typed = true;
14194
+ else _addIssue(this, "type", dataset, config$1);
14195
+ return dataset;
14196
+ }
14197
+ };
14198
+ }
14199
+ // @__NO_SIDE_EFFECTS__
14200
+ function object3(entries$1, message$1) {
14201
+ return {
14202
+ kind: "schema",
14203
+ type: "object",
14204
+ reference: object3,
14205
+ expects: "Object",
14206
+ async: false,
14207
+ entries: entries$1,
14208
+ message: message$1,
14209
+ get "~standard"() {
14210
+ return /* @__PURE__ */ _getStandardProps(this);
14211
+ },
14212
+ "~run"(dataset, config$1) {
14213
+ const input = dataset.value;
14214
+ if (input && typeof input === "object") {
14215
+ dataset.typed = true;
14216
+ dataset.value = {};
14217
+ for (const key in this.entries) {
14218
+ const valueSchema = this.entries[key];
14219
+ if (key in input || (valueSchema.type === "exact_optional" || valueSchema.type === "optional" || valueSchema.type === "nullish") && valueSchema.default !== void 0) {
14220
+ const value$1 = key in input ? input[key] : /* @__PURE__ */ getDefault(valueSchema);
14221
+ const valueDataset = valueSchema["~run"]({ value: value$1 }, config$1);
14222
+ if (valueDataset.issues) {
14223
+ const pathItem = {
14224
+ type: "object",
14225
+ origin: "value",
14226
+ input,
14227
+ key,
14228
+ value: value$1
14229
+ };
14230
+ for (const issue2 of valueDataset.issues) {
14231
+ if (issue2.path) issue2.path.unshift(pathItem);
14232
+ else issue2.path = [pathItem];
14233
+ dataset.issues?.push(issue2);
14234
+ }
14235
+ if (!dataset.issues) dataset.issues = valueDataset.issues;
14236
+ if (config$1.abortEarly) {
14237
+ dataset.typed = false;
14238
+ break;
14239
+ }
14240
+ }
14241
+ if (!valueDataset.typed) dataset.typed = false;
14242
+ dataset.value[key] = valueDataset.value;
14243
+ } else if (valueSchema.fallback !== void 0) dataset.value[key] = /* @__PURE__ */ getFallback(valueSchema);
14244
+ else if (valueSchema.type !== "exact_optional" && valueSchema.type !== "optional" && valueSchema.type !== "nullish") {
14245
+ _addIssue(this, "key", dataset, config$1, {
14246
+ input: void 0,
14247
+ expected: `"${key}"`,
14248
+ path: [{
14249
+ type: "object",
14250
+ origin: "key",
14251
+ input,
14252
+ key,
14253
+ value: input[key]
14254
+ }]
14255
+ });
14256
+ if (config$1.abortEarly) break;
14257
+ }
14258
+ }
14259
+ } else _addIssue(this, "type", dataset, config$1);
14260
+ return dataset;
14261
+ }
14262
+ };
14263
+ }
14264
+ // @__NO_SIDE_EFFECTS__
14265
+ function optional2(wrapped, default_) {
14266
+ return {
14267
+ kind: "schema",
14268
+ type: "optional",
14269
+ reference: optional2,
14270
+ expects: `(${wrapped.expects} | undefined)`,
14271
+ async: false,
14272
+ wrapped,
14273
+ default: default_,
14274
+ get "~standard"() {
14275
+ return /* @__PURE__ */ _getStandardProps(this);
14276
+ },
14277
+ "~run"(dataset, config$1) {
14278
+ if (dataset.value === void 0) {
14279
+ if (this.default !== void 0) dataset.value = /* @__PURE__ */ getDefault(this, dataset, config$1);
14280
+ if (dataset.value === void 0) {
14281
+ dataset.typed = true;
14282
+ return dataset;
14283
+ }
14284
+ }
14285
+ return this.wrapped["~run"](dataset, config$1);
14286
+ }
14287
+ };
14288
+ }
14289
+ // @__NO_SIDE_EFFECTS__
14290
+ function picklist(options, message$1) {
14291
+ return {
14292
+ kind: "schema",
14293
+ type: "picklist",
14294
+ reference: picklist,
14295
+ expects: /* @__PURE__ */ _joinExpects(options.map(_stringify), "|"),
14296
+ async: false,
14297
+ options,
14298
+ message: message$1,
14299
+ get "~standard"() {
14300
+ return /* @__PURE__ */ _getStandardProps(this);
14301
+ },
14302
+ "~run"(dataset, config$1) {
14303
+ if (this.options.includes(dataset.value)) dataset.typed = true;
14304
+ else _addIssue(this, "type", dataset, config$1);
14305
+ return dataset;
14306
+ }
14307
+ };
14308
+ }
14309
+ // @__NO_SIDE_EFFECTS__
14310
+ function record2(key, value$1, message$1) {
14311
+ return {
14312
+ kind: "schema",
14313
+ type: "record",
14314
+ reference: record2,
14315
+ expects: "Object",
14316
+ async: false,
14317
+ key,
14318
+ value: value$1,
14319
+ message: message$1,
14320
+ get "~standard"() {
14321
+ return /* @__PURE__ */ _getStandardProps(this);
14322
+ },
14323
+ "~run"(dataset, config$1) {
14324
+ const input = dataset.value;
14325
+ if (input && typeof input === "object") {
14326
+ dataset.typed = true;
14327
+ dataset.value = {};
14328
+ for (const entryKey in input) if (/* @__PURE__ */ _isValidObjectKey(input, entryKey)) {
14329
+ const entryValue = input[entryKey];
14330
+ const keyDataset = this.key["~run"]({ value: entryKey }, config$1);
14331
+ if (keyDataset.issues) {
14332
+ const pathItem = {
14333
+ type: "object",
14334
+ origin: "key",
14335
+ input,
14336
+ key: entryKey,
14337
+ value: entryValue
14338
+ };
14339
+ for (const issue2 of keyDataset.issues) {
14340
+ issue2.path = [pathItem];
14341
+ dataset.issues?.push(issue2);
14342
+ }
14343
+ if (!dataset.issues) dataset.issues = keyDataset.issues;
14344
+ if (config$1.abortEarly) {
14345
+ dataset.typed = false;
14346
+ break;
14347
+ }
14348
+ }
14349
+ const valueDataset = this.value["~run"]({ value: entryValue }, config$1);
14350
+ if (valueDataset.issues) {
14351
+ const pathItem = {
14352
+ type: "object",
14353
+ origin: "value",
14354
+ input,
14355
+ key: entryKey,
14356
+ value: entryValue
14357
+ };
14358
+ for (const issue2 of valueDataset.issues) {
14359
+ if (issue2.path) issue2.path.unshift(pathItem);
14360
+ else issue2.path = [pathItem];
14361
+ dataset.issues?.push(issue2);
14362
+ }
14363
+ if (!dataset.issues) dataset.issues = valueDataset.issues;
14364
+ if (config$1.abortEarly) {
14365
+ dataset.typed = false;
14366
+ break;
14367
+ }
14368
+ }
14369
+ if (!keyDataset.typed || !valueDataset.typed) dataset.typed = false;
14370
+ if (keyDataset.typed) dataset.value[keyDataset.value] = valueDataset.value;
14371
+ }
14372
+ } else _addIssue(this, "type", dataset, config$1);
14373
+ return dataset;
14374
+ }
14375
+ };
14376
+ }
14377
+ // @__NO_SIDE_EFFECTS__
14378
+ function string3(message$1) {
14379
+ return {
14380
+ kind: "schema",
14381
+ type: "string",
14382
+ reference: string3,
14383
+ expects: "string",
14384
+ async: false,
14385
+ message: message$1,
14386
+ get "~standard"() {
14387
+ return /* @__PURE__ */ _getStandardProps(this);
14388
+ },
14389
+ "~run"(dataset, config$1) {
14390
+ if (typeof dataset.value === "string") dataset.typed = true;
14391
+ else _addIssue(this, "type", dataset, config$1);
14392
+ return dataset;
14393
+ }
14394
+ };
14395
+ }
14396
+ // @__NO_SIDE_EFFECTS__
14397
+ function tuple(items, message$1) {
14398
+ return {
14399
+ kind: "schema",
14400
+ type: "tuple",
14401
+ reference: tuple,
14402
+ expects: "Array",
14403
+ async: false,
14404
+ items,
14405
+ message: message$1,
14406
+ get "~standard"() {
14407
+ return /* @__PURE__ */ _getStandardProps(this);
14408
+ },
14409
+ "~run"(dataset, config$1) {
14410
+ const input = dataset.value;
14411
+ if (Array.isArray(input)) {
14412
+ dataset.typed = true;
14413
+ dataset.value = [];
14414
+ for (let key = 0; key < this.items.length; key++) {
14415
+ const value$1 = input[key];
14416
+ const itemDataset = this.items[key]["~run"]({ value: value$1 }, config$1);
14417
+ if (itemDataset.issues) {
14418
+ const pathItem = {
14419
+ type: "array",
14420
+ origin: "value",
14421
+ input,
14422
+ key,
14423
+ value: value$1
14424
+ };
14425
+ for (const issue2 of itemDataset.issues) {
14426
+ if (issue2.path) issue2.path.unshift(pathItem);
14427
+ else issue2.path = [pathItem];
14428
+ dataset.issues?.push(issue2);
14429
+ }
14430
+ if (!dataset.issues) dataset.issues = itemDataset.issues;
14431
+ if (config$1.abortEarly) {
14432
+ dataset.typed = false;
14433
+ break;
14434
+ }
14435
+ }
14436
+ if (!itemDataset.typed) dataset.typed = false;
14437
+ dataset.value.push(itemDataset.value);
14438
+ }
14439
+ } else _addIssue(this, "type", dataset, config$1);
14440
+ return dataset;
14441
+ }
14442
+ };
14443
+ }
14444
+ // @__NO_SIDE_EFFECTS__
14445
+ function _subIssues(datasets) {
14446
+ let issues;
14447
+ if (datasets) for (const dataset of datasets) if (issues) issues.push(...dataset.issues);
14448
+ else issues = dataset.issues;
14449
+ return issues;
14450
+ }
14451
+ // @__NO_SIDE_EFFECTS__
14452
+ function union2(options, message$1) {
14453
+ return {
14454
+ kind: "schema",
14455
+ type: "union",
14456
+ reference: union2,
14457
+ expects: /* @__PURE__ */ _joinExpects(options.map((option2) => option2.expects), "|"),
14458
+ async: false,
14459
+ options,
14460
+ message: message$1,
14461
+ get "~standard"() {
14462
+ return /* @__PURE__ */ _getStandardProps(this);
14463
+ },
14464
+ "~run"(dataset, config$1) {
14465
+ let validDataset;
14466
+ let typedDatasets;
14467
+ let untypedDatasets;
14468
+ for (const schema of this.options) {
14469
+ const optionDataset = schema["~run"]({ value: dataset.value }, config$1);
14470
+ if (optionDataset.typed) if (optionDataset.issues) if (typedDatasets) typedDatasets.push(optionDataset);
14471
+ else typedDatasets = [optionDataset];
14472
+ else {
14473
+ validDataset = optionDataset;
14474
+ break;
14475
+ }
14476
+ else if (untypedDatasets) untypedDatasets.push(optionDataset);
14477
+ else untypedDatasets = [optionDataset];
14478
+ }
14479
+ if (validDataset) return validDataset;
14480
+ if (typedDatasets) {
14481
+ if (typedDatasets.length === 1) return typedDatasets[0];
14482
+ _addIssue(this, "type", dataset, config$1, { issues: /* @__PURE__ */ _subIssues(typedDatasets) });
14483
+ dataset.typed = true;
14484
+ } else if (untypedDatasets?.length === 1) return untypedDatasets[0];
14485
+ else _addIssue(this, "type", dataset, config$1, { issues: /* @__PURE__ */ _subIssues(untypedDatasets) });
14486
+ return dataset;
14487
+ }
14488
+ };
14489
+ }
14490
+ // @__NO_SIDE_EFFECTS__
14491
+ function unknown2() {
14492
+ return {
14493
+ kind: "schema",
14494
+ type: "unknown",
14495
+ reference: unknown2,
14496
+ expects: "unknown",
14497
+ async: false,
14498
+ get "~standard"() {
14499
+ return /* @__PURE__ */ _getStandardProps(this);
14500
+ },
14501
+ "~run"(dataset) {
14502
+ dataset.typed = true;
14503
+ return dataset;
14504
+ }
14505
+ };
14506
+ }
14507
+ function parse3(schema, input, config$1) {
14508
+ const dataset = schema["~run"]({ value: input }, /* @__PURE__ */ getGlobalConfig(config$1));
14509
+ if (dataset.issues) throw new ValiError(dataset.issues);
14510
+ return dataset.value;
14511
+ }
14512
+ // @__NO_SIDE_EFFECTS__
14513
+ function pipe2(...pipe$1) {
14514
+ return {
14515
+ ...pipe$1[0],
14516
+ pipe: pipe$1,
14517
+ get "~standard"() {
14518
+ return /* @__PURE__ */ _getStandardProps(this);
14519
+ },
14520
+ "~run"(dataset, config$1) {
14521
+ for (const item of pipe$1) if (item.kind !== "metadata") {
14522
+ if (dataset.issues && (item.kind === "schema" || item.kind === "transformation")) {
14523
+ dataset.typed = false;
14524
+ break;
14525
+ }
14526
+ if (!dataset.issues || !config$1.abortEarly && !config$1.abortPipeEarly) dataset = item["~run"](dataset, config$1);
14527
+ }
14528
+ return dataset;
14529
+ }
14530
+ };
14531
+ }
14532
+ var store$4, store$3, store$2, store$1, ValiError;
14533
+ var init_dist3 = __esm({
14534
+ "../../node_modules/.pnpm/valibot@1.3.1_typescript@5.9.3/node_modules/valibot/dist/index.mjs"() {
14535
+ ValiError = class extends Error {
14536
+ /**
14537
+ * Creates a Valibot error with useful information.
14538
+ *
14539
+ * @param issues The error issues.
14540
+ */
14541
+ constructor(issues) {
14542
+ super(issues[0].message);
14543
+ this.name = "ValiError";
14544
+ this.issues = issues;
14686
14545
  }
14687
14546
  };
14688
- SHA512_IV = /* @__PURE__ */ Uint32Array.from([
14689
- 1779033703,
14690
- 4089235720,
14691
- 3144134277,
14692
- 2227873595,
14693
- 1013904242,
14694
- 4271175723,
14695
- 2773480762,
14696
- 1595750129,
14697
- 1359893119,
14698
- 2917565137,
14699
- 2600822924,
14700
- 725511199,
14701
- 528734635,
14702
- 4215389547,
14703
- 1541459225,
14704
- 327033209
14705
- ]);
14706
14547
  }
14707
14548
  });
14708
14549
 
14709
- // ../../node_modules/.pnpm/@noble+hashes@2.0.1/node_modules/@noble/hashes/_u64.js
14710
- function fromBig(n, le = false) {
14711
- if (le)
14712
- return { h: Number(n & U32_MASK64), l: Number(n >> _32n & U32_MASK64) };
14713
- return { h: Number(n >> _32n & U32_MASK64) | 0, l: Number(n & U32_MASK64) | 0 };
14714
- }
14715
- function split(lst, le = false) {
14716
- const len = lst.length;
14717
- let Ah = new Uint32Array(len);
14718
- let Al = new Uint32Array(len);
14719
- for (let i = 0; i < len; i++) {
14720
- const { h, l: l2 } = fromBig(lst[i], le);
14721
- [Ah[i], Al[i]] = [h, l2];
14722
- }
14723
- return [Ah, Al];
14550
+ // ../../node_modules/.pnpm/@mysten+sui@2.17.0_typescript@5.9.3/node_modules/@mysten/sui/dist/transactions/data/internal.mjs
14551
+ function safeEnum(options) {
14552
+ return union2(Object.keys(options).map((key) => withKind(key, object3({ [key]: options[key] }))));
14724
14553
  }
14725
- function add(Ah, Al, Bh, Bl) {
14726
- const l2 = (Al >>> 0) + (Bl >>> 0);
14727
- return { h: Ah + Bh + (l2 / 2 ** 32 | 0) | 0, l: l2 | 0 };
14554
+ function withKind(key, schema) {
14555
+ return pipe2(object3({
14556
+ ...schema.entries,
14557
+ $kind: optional2(literal2(key))
14558
+ }), transform2((value) => ({
14559
+ ...value,
14560
+ $kind: key
14561
+ })));
14728
14562
  }
14729
- var U32_MASK64, _32n, shrSH, shrSL, rotrSH, rotrSL, rotrBH, rotrBL, rotr32H, rotr32L, add3L, add3H, add4L, add4H, add5L, add5H;
14730
- var init_u64 = __esm({
14731
- "../../node_modules/.pnpm/@noble+hashes@2.0.1/node_modules/@noble/hashes/_u64.js"() {
14732
- U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1);
14733
- _32n = /* @__PURE__ */ BigInt(32);
14734
- shrSH = (h, _l, s) => h >>> s;
14735
- shrSL = (h, l2, s) => h << 32 - s | l2 >>> s;
14736
- rotrSH = (h, l2, s) => h >>> s | l2 << 32 - s;
14737
- rotrSL = (h, l2, s) => h << 32 - s | l2 >>> s;
14738
- rotrBH = (h, l2, s) => h << 64 - s | l2 >>> s - 32;
14739
- rotrBL = (h, l2, s) => h >>> s - 32 | l2 << 64 - s;
14740
- rotr32H = (_h, l2) => l2;
14741
- rotr32L = (h, _l) => h;
14742
- add3L = (Al, Bl, Cl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0);
14743
- add3H = (low, Ah, Bh, Ch) => Ah + Bh + Ch + (low / 2 ** 32 | 0) | 0;
14744
- add4L = (Al, Bl, Cl, Dl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0);
14745
- add4H = (low, Ah, Bh, Ch, Dh) => Ah + Bh + Ch + Dh + (low / 2 ** 32 | 0) | 0;
14746
- add5L = (Al, Bl, Cl, Dl, El) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0) + (El >>> 0);
14747
- add5H = (low, Ah, Bh, Ch, Dh, Eh) => Ah + Bh + Ch + Dh + Eh + (low / 2 ** 32 | 0) | 0;
14563
+ var SuiAddress, ObjectID, BCSBytes, JsonU64, U32, ObjectRefSchema, ArgumentSchema, GasDataSchema, OpenSignatureBodySchema, OpenSignatureSchema, ProgrammableMoveCallSchema, $Intent, CommandSchema, ObjectArgSchema, ReservationSchema, WithdrawalTypeArgSchema, WithdrawFromSchema, FundsWithdrawalArgSchema, CallArgSchema, NormalizedCallArg, ValidDuringSchema, TransactionExpiration2, TransactionDataSchema;
14564
+ var init_internal = __esm({
14565
+ "../../node_modules/.pnpm/@mysten+sui@2.17.0_typescript@5.9.3/node_modules/@mysten/sui/dist/transactions/data/internal.mjs"() {
14566
+ init_sui_types();
14567
+ init_dist3();
14568
+ SuiAddress = pipe2(string3(), transform2((value) => normalizeSuiAddress(value)), check2(isValidSuiAddress));
14569
+ ObjectID = SuiAddress;
14570
+ BCSBytes = string3();
14571
+ JsonU64 = pipe2(union2([string3(), pipe2(number3(), integer2())]), check2((val) => {
14572
+ try {
14573
+ BigInt(val);
14574
+ return BigInt(val) >= 0 && BigInt(val) <= 18446744073709551615n;
14575
+ } catch {
14576
+ return false;
14577
+ }
14578
+ }, "Invalid u64"));
14579
+ U32 = pipe2(number3(), integer2(), check2((val) => val >= 0 && val < 2 ** 32, "Invalid u32"));
14580
+ ObjectRefSchema = object3({
14581
+ objectId: SuiAddress,
14582
+ version: JsonU64,
14583
+ digest: string3()
14584
+ });
14585
+ ArgumentSchema = union2([
14586
+ withKind("GasCoin", object3({ GasCoin: literal2(true) })),
14587
+ withKind("Input", object3({
14588
+ Input: pipe2(number3(), integer2()),
14589
+ type: optional2(union2([
14590
+ literal2("pure"),
14591
+ literal2("object"),
14592
+ literal2("withdrawal")
14593
+ ]))
14594
+ })),
14595
+ withKind("Result", object3({ Result: pipe2(number3(), integer2()) })),
14596
+ withKind("NestedResult", object3({ NestedResult: tuple([pipe2(number3(), integer2()), pipe2(number3(), integer2())]) }))
14597
+ ]);
14598
+ GasDataSchema = object3({
14599
+ budget: nullable2(JsonU64),
14600
+ price: nullable2(JsonU64),
14601
+ owner: nullable2(SuiAddress),
14602
+ payment: nullable2(array2(ObjectRefSchema))
14603
+ });
14604
+ OpenSignatureBodySchema = union2([
14605
+ object3({ $kind: literal2("address") }),
14606
+ object3({ $kind: literal2("bool") }),
14607
+ object3({ $kind: literal2("u8") }),
14608
+ object3({ $kind: literal2("u16") }),
14609
+ object3({ $kind: literal2("u32") }),
14610
+ object3({ $kind: literal2("u64") }),
14611
+ object3({ $kind: literal2("u128") }),
14612
+ object3({ $kind: literal2("u256") }),
14613
+ object3({ $kind: literal2("unknown") }),
14614
+ object3({
14615
+ $kind: literal2("vector"),
14616
+ vector: lazy(() => OpenSignatureBodySchema)
14617
+ }),
14618
+ object3({
14619
+ $kind: literal2("datatype"),
14620
+ datatype: object3({
14621
+ typeName: string3(),
14622
+ typeParameters: array2(lazy(() => OpenSignatureBodySchema))
14623
+ })
14624
+ }),
14625
+ object3({
14626
+ $kind: literal2("typeParameter"),
14627
+ index: pipe2(number3(), integer2())
14628
+ })
14629
+ ]);
14630
+ OpenSignatureSchema = object3({
14631
+ reference: nullable2(union2([
14632
+ literal2("mutable"),
14633
+ literal2("immutable"),
14634
+ literal2("unknown")
14635
+ ])),
14636
+ body: OpenSignatureBodySchema
14637
+ });
14638
+ ProgrammableMoveCallSchema = object3({
14639
+ package: ObjectID,
14640
+ module: string3(),
14641
+ function: string3(),
14642
+ typeArguments: array2(string3()),
14643
+ arguments: array2(ArgumentSchema),
14644
+ _argumentTypes: optional2(nullable2(array2(OpenSignatureSchema)))
14645
+ });
14646
+ $Intent = object3({
14647
+ name: string3(),
14648
+ inputs: record2(string3(), union2([ArgumentSchema, array2(ArgumentSchema)])),
14649
+ data: record2(string3(), unknown2())
14650
+ });
14651
+ CommandSchema = safeEnum({
14652
+ MoveCall: ProgrammableMoveCallSchema,
14653
+ TransferObjects: object3({
14654
+ objects: array2(ArgumentSchema),
14655
+ address: ArgumentSchema
14656
+ }),
14657
+ SplitCoins: object3({
14658
+ coin: ArgumentSchema,
14659
+ amounts: array2(ArgumentSchema)
14660
+ }),
14661
+ MergeCoins: object3({
14662
+ destination: ArgumentSchema,
14663
+ sources: array2(ArgumentSchema)
14664
+ }),
14665
+ Publish: object3({
14666
+ modules: array2(BCSBytes),
14667
+ dependencies: array2(ObjectID)
14668
+ }),
14669
+ MakeMoveVec: object3({
14670
+ type: nullable2(string3()),
14671
+ elements: array2(ArgumentSchema)
14672
+ }),
14673
+ Upgrade: object3({
14674
+ modules: array2(BCSBytes),
14675
+ dependencies: array2(ObjectID),
14676
+ package: ObjectID,
14677
+ ticket: ArgumentSchema
14678
+ }),
14679
+ $Intent
14680
+ });
14681
+ ObjectArgSchema = safeEnum({
14682
+ ImmOrOwnedObject: ObjectRefSchema,
14683
+ SharedObject: object3({
14684
+ objectId: ObjectID,
14685
+ initialSharedVersion: JsonU64,
14686
+ mutable: boolean3()
14687
+ }),
14688
+ Receiving: ObjectRefSchema
14689
+ });
14690
+ ReservationSchema = safeEnum({ MaxAmountU64: JsonU64 });
14691
+ WithdrawalTypeArgSchema = safeEnum({ Balance: string3() });
14692
+ WithdrawFromSchema = safeEnum({
14693
+ Sender: literal2(true),
14694
+ Sponsor: literal2(true)
14695
+ });
14696
+ FundsWithdrawalArgSchema = object3({
14697
+ reservation: ReservationSchema,
14698
+ typeArg: WithdrawalTypeArgSchema,
14699
+ withdrawFrom: WithdrawFromSchema
14700
+ });
14701
+ CallArgSchema = safeEnum({
14702
+ Object: ObjectArgSchema,
14703
+ Pure: object3({ bytes: BCSBytes }),
14704
+ UnresolvedPure: object3({ value: unknown2() }),
14705
+ UnresolvedObject: object3({
14706
+ objectId: ObjectID,
14707
+ version: optional2(nullable2(JsonU64)),
14708
+ digest: optional2(nullable2(string3())),
14709
+ initialSharedVersion: optional2(nullable2(JsonU64)),
14710
+ mutable: optional2(nullable2(boolean3()))
14711
+ }),
14712
+ FundsWithdrawal: FundsWithdrawalArgSchema
14713
+ });
14714
+ NormalizedCallArg = safeEnum({
14715
+ Object: ObjectArgSchema,
14716
+ Pure: object3({ bytes: BCSBytes })
14717
+ });
14718
+ ValidDuringSchema = object3({
14719
+ minEpoch: nullable2(JsonU64),
14720
+ maxEpoch: nullable2(JsonU64),
14721
+ minTimestamp: nullable2(JsonU64),
14722
+ maxTimestamp: nullable2(JsonU64),
14723
+ chain: string3(),
14724
+ nonce: U32
14725
+ });
14726
+ TransactionExpiration2 = safeEnum({
14727
+ None: literal2(true),
14728
+ Epoch: JsonU64,
14729
+ ValidDuring: ValidDuringSchema
14730
+ });
14731
+ TransactionDataSchema = object3({
14732
+ version: literal2(2),
14733
+ sender: nullish2(SuiAddress),
14734
+ expiration: nullish2(TransactionExpiration2),
14735
+ gasData: GasDataSchema,
14736
+ inputs: array2(CallArgSchema),
14737
+ commands: array2(CommandSchema)
14738
+ });
14748
14739
  }
14749
14740
  });
14750
14741
 
14751
- // ../../node_modules/.pnpm/@noble+hashes@2.0.1/node_modules/@noble/hashes/blake2.js
14752
- function G1b(a, b, c, d, msg, x) {
14753
- const Xl = msg[x], Xh = msg[x + 1];
14754
- let Al = BBUF[2 * a], Ah = BBUF[2 * a + 1];
14755
- let Bl = BBUF[2 * b], Bh = BBUF[2 * b + 1];
14756
- let Cl = BBUF[2 * c], Ch = BBUF[2 * c + 1];
14757
- let Dl = BBUF[2 * d], Dh = BBUF[2 * d + 1];
14758
- let ll = add3L(Al, Bl, Xl);
14759
- Ah = add3H(ll, Ah, Bh, Xh);
14760
- Al = ll | 0;
14761
- ({ Dh, Dl } = { Dh: Dh ^ Ah, Dl: Dl ^ Al });
14762
- ({ Dh, Dl } = { Dh: rotr32H(Dh, Dl), Dl: rotr32L(Dh, Dl) });
14763
- ({ h: Ch, l: Cl } = add(Ch, Cl, Dh, Dl));
14764
- ({ Bh, Bl } = { Bh: Bh ^ Ch, Bl: Bl ^ Cl });
14765
- ({ Bh, Bl } = { Bh: rotrSH(Bh, Bl, 24), Bl: rotrSL(Bh, Bl, 24) });
14766
- BBUF[2 * a] = Al, BBUF[2 * a + 1] = Ah;
14767
- BBUF[2 * b] = Bl, BBUF[2 * b + 1] = Bh;
14768
- BBUF[2 * c] = Cl, BBUF[2 * c + 1] = Ch;
14769
- BBUF[2 * d] = Dl, BBUF[2 * d + 1] = Dh;
14770
- }
14771
- function G2b(a, b, c, d, msg, x) {
14772
- const Xl = msg[x], Xh = msg[x + 1];
14773
- let Al = BBUF[2 * a], Ah = BBUF[2 * a + 1];
14774
- let Bl = BBUF[2 * b], Bh = BBUF[2 * b + 1];
14775
- let Cl = BBUF[2 * c], Ch = BBUF[2 * c + 1];
14776
- let Dl = BBUF[2 * d], Dh = BBUF[2 * d + 1];
14777
- let ll = add3L(Al, Bl, Xl);
14778
- Ah = add3H(ll, Ah, Bh, Xh);
14779
- Al = ll | 0;
14780
- ({ Dh, Dl } = { Dh: Dh ^ Ah, Dl: Dl ^ Al });
14781
- ({ Dh, Dl } = { Dh: rotrSH(Dh, Dl, 16), Dl: rotrSL(Dh, Dl, 16) });
14782
- ({ h: Ch, l: Cl } = add(Ch, Cl, Dh, Dl));
14783
- ({ Bh, Bl } = { Bh: Bh ^ Ch, Bl: Bl ^ Cl });
14784
- ({ Bh, Bl } = { Bh: rotrBH(Bh, Bl, 63), Bl: rotrBL(Bh, Bl, 63) });
14785
- BBUF[2 * a] = Al, BBUF[2 * a + 1] = Ah;
14786
- BBUF[2 * b] = Bl, BBUF[2 * b + 1] = Bh;
14787
- BBUF[2 * c] = Cl, BBUF[2 * c + 1] = Ch;
14788
- BBUF[2 * d] = Dl, BBUF[2 * d + 1] = Dh;
14742
+ // ../../node_modules/.pnpm/@mysten+sui@2.17.0_typescript@5.9.3/node_modules/@mysten/sui/dist/transactions/utils.mjs
14743
+ function getIdFromCallArg(arg) {
14744
+ if (typeof arg === "string") return normalizeSuiAddress(arg);
14745
+ if (arg.Object) {
14746
+ if (arg.Object.ImmOrOwnedObject) return normalizeSuiAddress(arg.Object.ImmOrOwnedObject.objectId);
14747
+ if (arg.Object.Receiving) return normalizeSuiAddress(arg.Object.Receiving.objectId);
14748
+ return normalizeSuiAddress(arg.Object.SharedObject.objectId);
14749
+ }
14750
+ if (arg.UnresolvedObject) return normalizeSuiAddress(arg.UnresolvedObject.objectId);
14789
14751
  }
14790
- function checkBlake2Opts(outputLen, opts = {}, keyLen, saltLen, persLen) {
14791
- anumber2(keyLen);
14792
- if (outputLen < 0 || outputLen > keyLen)
14793
- throw new Error("outputLen bigger than keyLen");
14794
- const { key, salt, personalization } = opts;
14795
- if (key !== void 0 && (key.length < 1 || key.length > keyLen))
14796
- throw new Error('"key" expected to be undefined or of length=1..' + keyLen);
14797
- if (salt !== void 0)
14798
- abytes(salt, saltLen, "salt");
14799
- if (personalization !== void 0)
14800
- abytes(personalization, persLen, "personalization");
14752
+ function isArgument(value) {
14753
+ return is(ArgumentSchema, value);
14801
14754
  }
14802
- var B2B_IV, BBUF, _BLAKE2, _BLAKE2b, blake2b;
14803
- var init_blake2 = __esm({
14804
- "../../node_modules/.pnpm/@noble+hashes@2.0.1/node_modules/@noble/hashes/blake2.js"() {
14805
- init_blake();
14806
- init_u64();
14807
- init_utils3();
14808
- B2B_IV = /* @__PURE__ */ Uint32Array.from([
14809
- 4089235720,
14810
- 1779033703,
14811
- 2227873595,
14812
- 3144134277,
14813
- 4271175723,
14814
- 1013904242,
14815
- 1595750129,
14816
- 2773480762,
14817
- 2917565137,
14818
- 1359893119,
14819
- 725511199,
14820
- 2600822924,
14821
- 4215389547,
14822
- 528734635,
14823
- 327033209,
14824
- 1541459225
14825
- ]);
14826
- BBUF = /* @__PURE__ */ new Uint32Array(32);
14827
- _BLAKE2 = class {
14828
- buffer;
14829
- buffer32;
14830
- finished = false;
14831
- destroyed = false;
14832
- length = 0;
14833
- pos = 0;
14834
- blockLen;
14835
- outputLen;
14836
- constructor(blockLen, outputLen) {
14837
- anumber2(blockLen);
14838
- anumber2(outputLen);
14839
- this.blockLen = blockLen;
14840
- this.outputLen = outputLen;
14841
- this.buffer = new Uint8Array(blockLen);
14842
- this.buffer32 = u32(this.buffer);
14843
- }
14844
- update(data) {
14845
- aexists(this);
14846
- abytes(data);
14847
- const { blockLen, buffer, buffer32 } = this;
14848
- const len = data.length;
14849
- const offset = data.byteOffset;
14850
- const buf = data.buffer;
14851
- for (let pos = 0; pos < len; ) {
14852
- if (this.pos === blockLen) {
14853
- swap32IfBE(buffer32);
14854
- this.compress(buffer32, 0, false);
14855
- swap32IfBE(buffer32);
14856
- this.pos = 0;
14857
- }
14858
- const take = Math.min(blockLen - this.pos, len - pos);
14859
- const dataOffset = offset + pos;
14860
- if (take === blockLen && !(dataOffset % 4) && pos + take < len) {
14861
- const data32 = new Uint32Array(buf, dataOffset, Math.floor((len - pos) / 4));
14862
- swap32IfBE(data32);
14863
- for (let pos32 = 0; pos + blockLen < len; pos32 += buffer32.length, pos += blockLen) {
14864
- this.length += blockLen;
14865
- this.compress(data32, pos32, false);
14866
- }
14867
- swap32IfBE(data32);
14868
- continue;
14869
- }
14870
- buffer.set(data.subarray(pos, pos + take), this.pos);
14871
- this.pos += take;
14872
- this.length += take;
14873
- pos += take;
14874
- }
14875
- return this;
14876
- }
14877
- digestInto(out) {
14878
- aexists(this);
14879
- aoutput(out, this);
14880
- const { pos, buffer32 } = this;
14881
- this.finished = true;
14882
- clean(this.buffer.subarray(pos));
14883
- swap32IfBE(buffer32);
14884
- this.compress(buffer32, 0, true);
14885
- swap32IfBE(buffer32);
14886
- const out32 = u32(out);
14887
- this.get().forEach((v, i) => out32[i] = swap8IfBE(v));
14888
- }
14889
- digest() {
14890
- const { buffer, outputLen } = this;
14891
- this.digestInto(buffer);
14892
- const res = buffer.slice(0, outputLen);
14893
- this.destroy();
14894
- return res;
14895
- }
14896
- _cloneInto(to) {
14897
- const { buffer, length, finished, destroyed, outputLen, pos } = this;
14898
- to ||= new this.constructor({ dkLen: outputLen });
14899
- to.set(...this.get());
14900
- to.buffer.set(buffer);
14901
- to.destroyed = destroyed;
14902
- to.finished = finished;
14903
- to.length = length;
14904
- to.pos = pos;
14905
- to.outputLen = outputLen;
14906
- return to;
14907
- }
14908
- clone() {
14909
- return this._cloneInto();
14910
- }
14911
- };
14912
- _BLAKE2b = class extends _BLAKE2 {
14913
- // Same as SHA-512, but LE
14914
- v0l = B2B_IV[0] | 0;
14915
- v0h = B2B_IV[1] | 0;
14916
- v1l = B2B_IV[2] | 0;
14917
- v1h = B2B_IV[3] | 0;
14918
- v2l = B2B_IV[4] | 0;
14919
- v2h = B2B_IV[5] | 0;
14920
- v3l = B2B_IV[6] | 0;
14921
- v3h = B2B_IV[7] | 0;
14922
- v4l = B2B_IV[8] | 0;
14923
- v4h = B2B_IV[9] | 0;
14924
- v5l = B2B_IV[10] | 0;
14925
- v5h = B2B_IV[11] | 0;
14926
- v6l = B2B_IV[12] | 0;
14927
- v6h = B2B_IV[13] | 0;
14928
- v7l = B2B_IV[14] | 0;
14929
- v7h = B2B_IV[15] | 0;
14930
- constructor(opts = {}) {
14931
- const olen = opts.dkLen === void 0 ? 64 : opts.dkLen;
14932
- super(128, olen);
14933
- checkBlake2Opts(olen, opts, 64, 16, 16);
14934
- let { key, personalization, salt } = opts;
14935
- let keyLength = 0;
14936
- if (key !== void 0) {
14937
- abytes(key, void 0, "key");
14938
- keyLength = key.length;
14939
- }
14940
- this.v0l ^= this.outputLen | keyLength << 8 | 1 << 16 | 1 << 24;
14941
- if (salt !== void 0) {
14942
- abytes(salt, void 0, "salt");
14943
- const slt = u32(salt);
14944
- this.v4l ^= swap8IfBE(slt[0]);
14945
- this.v4h ^= swap8IfBE(slt[1]);
14946
- this.v5l ^= swap8IfBE(slt[2]);
14947
- this.v5h ^= swap8IfBE(slt[3]);
14948
- }
14949
- if (personalization !== void 0) {
14950
- abytes(personalization, void 0, "personalization");
14951
- const pers = u32(personalization);
14952
- this.v6l ^= swap8IfBE(pers[0]);
14953
- this.v6h ^= swap8IfBE(pers[1]);
14954
- this.v7l ^= swap8IfBE(pers[2]);
14955
- this.v7h ^= swap8IfBE(pers[3]);
14956
- }
14957
- if (key !== void 0) {
14958
- const tmp = new Uint8Array(this.blockLen);
14959
- tmp.set(key);
14960
- this.update(tmp);
14961
- }
14962
- }
14963
- // prettier-ignore
14964
- get() {
14965
- let { v0l, v0h, v1l, v1h, v2l, v2h, v3l, v3h, v4l, v4h, v5l, v5h, v6l, v6h, v7l, v7h } = this;
14966
- return [v0l, v0h, v1l, v1h, v2l, v2h, v3l, v3h, v4l, v4h, v5l, v5h, v6l, v6h, v7l, v7h];
14755
+ function remapCommandArguments(command, inputMapping, commandMapping) {
14756
+ const remapArg = (arg) => {
14757
+ switch (arg.$kind) {
14758
+ case "Input": {
14759
+ const newInputIndex = inputMapping.get(arg.Input);
14760
+ if (newInputIndex === void 0) throw new Error(`Input ${arg.Input} not found in input mapping`);
14761
+ return {
14762
+ ...arg,
14763
+ Input: newInputIndex
14764
+ };
14967
14765
  }
14968
- // prettier-ignore
14969
- set(v0l, v0h, v1l, v1h, v2l, v2h, v3l, v3h, v4l, v4h, v5l, v5h, v6l, v6h, v7l, v7h) {
14970
- this.v0l = v0l | 0;
14971
- this.v0h = v0h | 0;
14972
- this.v1l = v1l | 0;
14973
- this.v1h = v1h | 0;
14974
- this.v2l = v2l | 0;
14975
- this.v2h = v2h | 0;
14976
- this.v3l = v3l | 0;
14977
- this.v3h = v3h | 0;
14978
- this.v4l = v4l | 0;
14979
- this.v4h = v4h | 0;
14980
- this.v5l = v5l | 0;
14981
- this.v5h = v5h | 0;
14982
- this.v6l = v6l | 0;
14983
- this.v6h = v6h | 0;
14984
- this.v7l = v7l | 0;
14985
- this.v7h = v7h | 0;
14766
+ case "Result": {
14767
+ const newCommandIndex = commandMapping.get(arg.Result);
14768
+ if (newCommandIndex !== void 0) return {
14769
+ ...arg,
14770
+ Result: newCommandIndex
14771
+ };
14772
+ return arg;
14986
14773
  }
14987
- compress(msg, offset, isLast) {
14988
- this.get().forEach((v, i) => BBUF[i] = v);
14989
- BBUF.set(B2B_IV, 16);
14990
- let { h, l: l2 } = fromBig(BigInt(this.length));
14991
- BBUF[24] = B2B_IV[8] ^ l2;
14992
- BBUF[25] = B2B_IV[9] ^ h;
14993
- if (isLast) {
14994
- BBUF[28] = ~BBUF[28];
14995
- BBUF[29] = ~BBUF[29];
14996
- }
14997
- let j = 0;
14998
- const s = BSIGMA;
14999
- for (let i = 0; i < 12; i++) {
15000
- G1b(0, 4, 8, 12, msg, offset + 2 * s[j++]);
15001
- G2b(0, 4, 8, 12, msg, offset + 2 * s[j++]);
15002
- G1b(1, 5, 9, 13, msg, offset + 2 * s[j++]);
15003
- G2b(1, 5, 9, 13, msg, offset + 2 * s[j++]);
15004
- G1b(2, 6, 10, 14, msg, offset + 2 * s[j++]);
15005
- G2b(2, 6, 10, 14, msg, offset + 2 * s[j++]);
15006
- G1b(3, 7, 11, 15, msg, offset + 2 * s[j++]);
15007
- G2b(3, 7, 11, 15, msg, offset + 2 * s[j++]);
15008
- G1b(0, 5, 10, 15, msg, offset + 2 * s[j++]);
15009
- G2b(0, 5, 10, 15, msg, offset + 2 * s[j++]);
15010
- G1b(1, 6, 11, 12, msg, offset + 2 * s[j++]);
15011
- G2b(1, 6, 11, 12, msg, offset + 2 * s[j++]);
15012
- G1b(2, 7, 8, 13, msg, offset + 2 * s[j++]);
15013
- G2b(2, 7, 8, 13, msg, offset + 2 * s[j++]);
15014
- G1b(3, 4, 9, 14, msg, offset + 2 * s[j++]);
15015
- G2b(3, 4, 9, 14, msg, offset + 2 * s[j++]);
14774
+ case "NestedResult": {
14775
+ const newCommandIndex = commandMapping.get(arg.NestedResult[0]);
14776
+ if (newCommandIndex !== void 0) return {
14777
+ ...arg,
14778
+ NestedResult: [newCommandIndex, arg.NestedResult[1]]
14779
+ };
14780
+ return arg;
14781
+ }
14782
+ default:
14783
+ return arg;
14784
+ }
14785
+ };
14786
+ switch (command.$kind) {
14787
+ case "MoveCall":
14788
+ command.MoveCall.arguments = command.MoveCall.arguments.map(remapArg);
14789
+ break;
14790
+ case "TransferObjects":
14791
+ command.TransferObjects.objects = command.TransferObjects.objects.map(remapArg);
14792
+ command.TransferObjects.address = remapArg(command.TransferObjects.address);
14793
+ break;
14794
+ case "SplitCoins":
14795
+ command.SplitCoins.coin = remapArg(command.SplitCoins.coin);
14796
+ command.SplitCoins.amounts = command.SplitCoins.amounts.map(remapArg);
14797
+ break;
14798
+ case "MergeCoins":
14799
+ command.MergeCoins.destination = remapArg(command.MergeCoins.destination);
14800
+ command.MergeCoins.sources = command.MergeCoins.sources.map(remapArg);
14801
+ break;
14802
+ case "MakeMoveVec":
14803
+ command.MakeMoveVec.elements = command.MakeMoveVec.elements.map(remapArg);
14804
+ break;
14805
+ case "Upgrade":
14806
+ command.Upgrade.ticket = remapArg(command.Upgrade.ticket);
14807
+ break;
14808
+ case "$Intent": {
14809
+ const inputs = command.$Intent.inputs;
14810
+ command.$Intent.inputs = {};
14811
+ for (const [key, value] of Object.entries(inputs)) command.$Intent.inputs[key] = Array.isArray(value) ? value.map(remapArg) : remapArg(value);
14812
+ break;
14813
+ }
14814
+ }
14815
+ }
14816
+ var init_utils4 = __esm({
14817
+ "../../node_modules/.pnpm/@mysten+sui@2.17.0_typescript@5.9.3/node_modules/@mysten/sui/dist/transactions/utils.mjs"() {
14818
+ init_sui_types();
14819
+ init_internal();
14820
+ init_dist3();
14821
+ }
14822
+ });
14823
+
14824
+ // ../../node_modules/.pnpm/@mysten+sui@2.17.0_typescript@5.9.3/node_modules/@mysten/sui/dist/transactions/data/v1.mjs
14825
+ function serializeV1TransactionData(transactionData) {
14826
+ const inputs = transactionData.inputs.map((input, index) => {
14827
+ if (input.Object) return {
14828
+ kind: "Input",
14829
+ index,
14830
+ value: { Object: input.Object.ImmOrOwnedObject ? { ImmOrOwned: input.Object.ImmOrOwnedObject } : input.Object.Receiving ? { Receiving: {
14831
+ digest: input.Object.Receiving.digest,
14832
+ version: input.Object.Receiving.version,
14833
+ objectId: input.Object.Receiving.objectId
14834
+ } } : { Shared: {
14835
+ mutable: input.Object.SharedObject.mutable,
14836
+ initialSharedVersion: input.Object.SharedObject.initialSharedVersion,
14837
+ objectId: input.Object.SharedObject.objectId
14838
+ } } },
14839
+ type: "object"
14840
+ };
14841
+ if (input.Pure) return {
14842
+ kind: "Input",
14843
+ index,
14844
+ value: { Pure: Array.from(fromBase64(input.Pure.bytes)) },
14845
+ type: "pure"
14846
+ };
14847
+ if (input.UnresolvedPure) return {
14848
+ kind: "Input",
14849
+ type: "pure",
14850
+ index,
14851
+ value: input.UnresolvedPure.value
14852
+ };
14853
+ if (input.UnresolvedObject) return {
14854
+ kind: "Input",
14855
+ type: "object",
14856
+ index,
14857
+ value: input.UnresolvedObject.objectId
14858
+ };
14859
+ throw new Error("Invalid input");
14860
+ });
14861
+ return {
14862
+ version: 1,
14863
+ sender: transactionData.sender ?? void 0,
14864
+ expiration: transactionData.expiration?.$kind === "Epoch" ? { Epoch: Number(transactionData.expiration.Epoch) } : transactionData.expiration ? { None: true } : null,
14865
+ gasConfig: {
14866
+ owner: transactionData.gasData.owner ?? void 0,
14867
+ budget: transactionData.gasData.budget ?? void 0,
14868
+ price: transactionData.gasData.price ?? void 0,
14869
+ payment: transactionData.gasData.payment ?? void 0
14870
+ },
14871
+ inputs,
14872
+ transactions: transactionData.commands.map((command) => {
14873
+ if (command.MakeMoveVec) return {
14874
+ kind: "MakeMoveVec",
14875
+ type: command.MakeMoveVec.type === null ? { None: true } : { Some: TypeTagSerializer.parseFromStr(command.MakeMoveVec.type) },
14876
+ objects: command.MakeMoveVec.elements.map((arg) => convertTransactionArgument(arg, inputs))
14877
+ };
14878
+ if (command.MergeCoins) return {
14879
+ kind: "MergeCoins",
14880
+ destination: convertTransactionArgument(command.MergeCoins.destination, inputs),
14881
+ sources: command.MergeCoins.sources.map((arg) => convertTransactionArgument(arg, inputs))
14882
+ };
14883
+ if (command.MoveCall) return {
14884
+ kind: "MoveCall",
14885
+ target: `${command.MoveCall.package}::${command.MoveCall.module}::${command.MoveCall.function}`,
14886
+ typeArguments: command.MoveCall.typeArguments,
14887
+ arguments: command.MoveCall.arguments.map((arg) => convertTransactionArgument(arg, inputs))
14888
+ };
14889
+ if (command.Publish) return {
14890
+ kind: "Publish",
14891
+ modules: command.Publish.modules.map((mod3) => Array.from(fromBase64(mod3))),
14892
+ dependencies: command.Publish.dependencies
14893
+ };
14894
+ if (command.SplitCoins) return {
14895
+ kind: "SplitCoins",
14896
+ coin: convertTransactionArgument(command.SplitCoins.coin, inputs),
14897
+ amounts: command.SplitCoins.amounts.map((arg) => convertTransactionArgument(arg, inputs))
14898
+ };
14899
+ if (command.TransferObjects) return {
14900
+ kind: "TransferObjects",
14901
+ objects: command.TransferObjects.objects.map((arg) => convertTransactionArgument(arg, inputs)),
14902
+ address: convertTransactionArgument(command.TransferObjects.address, inputs)
14903
+ };
14904
+ if (command.Upgrade) return {
14905
+ kind: "Upgrade",
14906
+ modules: command.Upgrade.modules.map((mod3) => Array.from(fromBase64(mod3))),
14907
+ dependencies: command.Upgrade.dependencies,
14908
+ packageId: command.Upgrade.package,
14909
+ ticket: convertTransactionArgument(command.Upgrade.ticket, inputs)
14910
+ };
14911
+ throw new Error(`Unknown transaction ${Object.keys(command)}`);
14912
+ })
14913
+ };
14914
+ }
14915
+ function convertTransactionArgument(arg, inputs) {
14916
+ if (arg.$kind === "GasCoin") return { kind: "GasCoin" };
14917
+ if (arg.$kind === "Result") return {
14918
+ kind: "Result",
14919
+ index: arg.Result
14920
+ };
14921
+ if (arg.$kind === "NestedResult") return {
14922
+ kind: "NestedResult",
14923
+ index: arg.NestedResult[0],
14924
+ resultIndex: arg.NestedResult[1]
14925
+ };
14926
+ if (arg.$kind === "Input") return inputs[arg.Input];
14927
+ throw new Error(`Invalid argument ${Object.keys(arg)}`);
14928
+ }
14929
+ function transactionDataFromV1(data) {
14930
+ return parse3(TransactionDataSchema, {
14931
+ version: 2,
14932
+ sender: data.sender ?? null,
14933
+ expiration: data.expiration ? "Epoch" in data.expiration ? { Epoch: data.expiration.Epoch } : { None: true } : null,
14934
+ gasData: {
14935
+ owner: data.gasConfig.owner ?? null,
14936
+ budget: data.gasConfig.budget?.toString() ?? null,
14937
+ price: data.gasConfig.price?.toString() ?? null,
14938
+ payment: data.gasConfig.payment?.map((ref) => ({
14939
+ digest: ref.digest,
14940
+ objectId: ref.objectId,
14941
+ version: ref.version.toString()
14942
+ })) ?? null
14943
+ },
14944
+ inputs: data.inputs.map((input) => {
14945
+ if (input.kind === "Input") {
14946
+ if (is(NormalizedCallArg2, input.value)) {
14947
+ const value = parse3(NormalizedCallArg2, input.value);
14948
+ if (value.Object) {
14949
+ if (value.Object.ImmOrOwned) return { Object: { ImmOrOwnedObject: {
14950
+ objectId: value.Object.ImmOrOwned.objectId,
14951
+ version: String(value.Object.ImmOrOwned.version),
14952
+ digest: value.Object.ImmOrOwned.digest
14953
+ } } };
14954
+ if (value.Object.Shared) return { Object: { SharedObject: {
14955
+ mutable: value.Object.Shared.mutable ?? null,
14956
+ initialSharedVersion: value.Object.Shared.initialSharedVersion,
14957
+ objectId: value.Object.Shared.objectId
14958
+ } } };
14959
+ if (value.Object.Receiving) return { Object: { Receiving: {
14960
+ digest: value.Object.Receiving.digest,
14961
+ version: String(value.Object.Receiving.version),
14962
+ objectId: value.Object.Receiving.objectId
14963
+ } } };
14964
+ throw new Error("Invalid object input");
14965
+ }
14966
+ return { Pure: { bytes: toBase64(new Uint8Array(value.Pure)) } };
15016
14967
  }
15017
- this.v0l ^= BBUF[0] ^ BBUF[16];
15018
- this.v0h ^= BBUF[1] ^ BBUF[17];
15019
- this.v1l ^= BBUF[2] ^ BBUF[18];
15020
- this.v1h ^= BBUF[3] ^ BBUF[19];
15021
- this.v2l ^= BBUF[4] ^ BBUF[20];
15022
- this.v2h ^= BBUF[5] ^ BBUF[21];
15023
- this.v3l ^= BBUF[6] ^ BBUF[22];
15024
- this.v3h ^= BBUF[7] ^ BBUF[23];
15025
- this.v4l ^= BBUF[8] ^ BBUF[24];
15026
- this.v4h ^= BBUF[9] ^ BBUF[25];
15027
- this.v5l ^= BBUF[10] ^ BBUF[26];
15028
- this.v5h ^= BBUF[11] ^ BBUF[27];
15029
- this.v6l ^= BBUF[12] ^ BBUF[28];
15030
- this.v6h ^= BBUF[13] ^ BBUF[29];
15031
- this.v7l ^= BBUF[14] ^ BBUF[30];
15032
- this.v7h ^= BBUF[15] ^ BBUF[31];
15033
- clean(BBUF);
14968
+ if (input.type === "object") return { UnresolvedObject: { objectId: input.value } };
14969
+ return { UnresolvedPure: { value: input.value } };
15034
14970
  }
15035
- destroy() {
15036
- this.destroyed = true;
15037
- clean(this.buffer32);
15038
- this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
14971
+ throw new Error("Invalid input");
14972
+ }),
14973
+ commands: data.transactions.map((transaction) => {
14974
+ switch (transaction.kind) {
14975
+ case "MakeMoveVec":
14976
+ return { MakeMoveVec: {
14977
+ type: "Some" in transaction.type ? TypeTagSerializer.tagToString(transaction.type.Some) : null,
14978
+ elements: transaction.objects.map((arg) => parseV1TransactionArgument(arg))
14979
+ } };
14980
+ case "MergeCoins":
14981
+ return { MergeCoins: {
14982
+ destination: parseV1TransactionArgument(transaction.destination),
14983
+ sources: transaction.sources.map((arg) => parseV1TransactionArgument(arg))
14984
+ } };
14985
+ case "MoveCall": {
14986
+ const [pkg, mod3, fn] = transaction.target.split("::");
14987
+ return { MoveCall: {
14988
+ package: pkg,
14989
+ module: mod3,
14990
+ function: fn,
14991
+ typeArguments: transaction.typeArguments,
14992
+ arguments: transaction.arguments.map((arg) => parseV1TransactionArgument(arg))
14993
+ } };
14994
+ }
14995
+ case "Publish":
14996
+ return { Publish: {
14997
+ modules: transaction.modules.map((mod3) => toBase64(Uint8Array.from(mod3))),
14998
+ dependencies: transaction.dependencies
14999
+ } };
15000
+ case "SplitCoins":
15001
+ return { SplitCoins: {
15002
+ coin: parseV1TransactionArgument(transaction.coin),
15003
+ amounts: transaction.amounts.map((arg) => parseV1TransactionArgument(arg))
15004
+ } };
15005
+ case "TransferObjects":
15006
+ return { TransferObjects: {
15007
+ objects: transaction.objects.map((arg) => parseV1TransactionArgument(arg)),
15008
+ address: parseV1TransactionArgument(transaction.address)
15009
+ } };
15010
+ case "Upgrade":
15011
+ return { Upgrade: {
15012
+ modules: transaction.modules.map((mod3) => toBase64(Uint8Array.from(mod3))),
15013
+ dependencies: transaction.dependencies,
15014
+ package: transaction.packageId,
15015
+ ticket: parseV1TransactionArgument(transaction.ticket)
15016
+ } };
15039
15017
  }
15040
- };
15041
- blake2b = /* @__PURE__ */ createHasher((opts) => new _BLAKE2b(opts));
15018
+ throw new Error(`Unknown transaction ${Object.keys(transaction)}`);
15019
+ })
15020
+ });
15021
+ }
15022
+ function parseV1TransactionArgument(arg) {
15023
+ switch (arg.kind) {
15024
+ case "GasCoin":
15025
+ return { GasCoin: true };
15026
+ case "Result":
15027
+ return { Result: arg.index };
15028
+ case "NestedResult":
15029
+ return { NestedResult: [arg.index, arg.resultIndex] };
15030
+ case "Input":
15031
+ return { Input: arg.index };
15032
+ }
15033
+ }
15034
+ var ObjectRef, ObjectArg2, NormalizedCallArg2, TransactionInput, TransactionArgumentTypes;
15035
+ var init_v1 = __esm({
15036
+ "../../node_modules/.pnpm/@mysten+sui@2.17.0_typescript@5.9.3/node_modules/@mysten/sui/dist/transactions/data/v1.mjs"() {
15037
+ init_type_tag_serializer();
15038
+ init_internal();
15039
+ init_dist2();
15040
+ init_dist3();
15041
+ ObjectRef = object3({
15042
+ digest: string3(),
15043
+ objectId: string3(),
15044
+ version: union2([
15045
+ pipe2(number3(), integer2()),
15046
+ string3(),
15047
+ bigint2()
15048
+ ])
15049
+ });
15050
+ ObjectArg2 = safeEnum({
15051
+ ImmOrOwned: ObjectRef,
15052
+ Shared: object3({
15053
+ objectId: ObjectID,
15054
+ initialSharedVersion: JsonU64,
15055
+ mutable: boolean3()
15056
+ }),
15057
+ Receiving: ObjectRef
15058
+ });
15059
+ NormalizedCallArg2 = safeEnum({
15060
+ Object: ObjectArg2,
15061
+ Pure: array2(pipe2(number3(), integer2()))
15062
+ });
15063
+ TransactionInput = union2([object3({
15064
+ kind: literal2("Input"),
15065
+ index: pipe2(number3(), integer2()),
15066
+ value: unknown2(),
15067
+ type: optional2(literal2("object"))
15068
+ }), object3({
15069
+ kind: literal2("Input"),
15070
+ index: pipe2(number3(), integer2()),
15071
+ value: unknown2(),
15072
+ type: literal2("pure")
15073
+ })]);
15074
+ TransactionArgumentTypes = [
15075
+ TransactionInput,
15076
+ object3({ kind: literal2("GasCoin") }),
15077
+ object3({
15078
+ kind: literal2("Result"),
15079
+ index: pipe2(number3(), integer2())
15080
+ }),
15081
+ object3({
15082
+ kind: literal2("NestedResult"),
15083
+ index: pipe2(number3(), integer2()),
15084
+ resultIndex: pipe2(number3(), integer2())
15085
+ })
15086
+ ];
15087
+ union2([...TransactionArgumentTypes]);
15042
15088
  }
15043
15089
  });
15044
15090
 
@@ -15068,7 +15114,7 @@ var init_TransactionData = __esm({
15068
15114
  init_internal();
15069
15115
  init_v1();
15070
15116
  init_hash();
15071
- init_utils2();
15117
+ init_utils4();
15072
15118
  init_dist2();
15073
15119
  init_dist3();
15074
15120
  TransactionDataBuilder = class TransactionDataBuilder2 {
@@ -15510,21 +15556,6 @@ var init_Inputs = __esm({
15510
15556
  }
15511
15557
  });
15512
15558
 
15513
- // ../../node_modules/.pnpm/@mysten+sui@2.17.0_typescript@5.9.3/node_modules/@mysten/sui/dist/utils/constants.mjs
15514
- var MOVE_STDLIB_ADDRESS, SUI_FRAMEWORK_ADDRESS, SUI_CLOCK_OBJECT_ID, SUI_TYPE_ARG, SUI_SYSTEM_STATE_OBJECT_ID, SUI_RANDOM_OBJECT_ID, SUI_DENY_LIST_OBJECT_ID;
15515
- var init_constants = __esm({
15516
- "../../node_modules/.pnpm/@mysten+sui@2.17.0_typescript@5.9.3/node_modules/@mysten/sui/dist/utils/constants.mjs"() {
15517
- BigInt(1e9);
15518
- MOVE_STDLIB_ADDRESS = "0x0000000000000000000000000000000000000000000000000000000000000001";
15519
- SUI_FRAMEWORK_ADDRESS = "0x0000000000000000000000000000000000000000000000000000000000000002";
15520
- SUI_CLOCK_OBJECT_ID = "0x0000000000000000000000000000000000000000000000000000000000000006";
15521
- SUI_TYPE_ARG = `${SUI_FRAMEWORK_ADDRESS}::sui::SUI`;
15522
- SUI_SYSTEM_STATE_OBJECT_ID = "0x0000000000000000000000000000000000000000000000000000000000000005";
15523
- SUI_RANDOM_OBJECT_ID = "0x0000000000000000000000000000000000000000000000000000000000000008";
15524
- SUI_DENY_LIST_OBJECT_ID = "0x0000000000000000000000000000000000000000000000000000000000000403";
15525
- }
15526
- });
15527
-
15528
15559
  // ../../node_modules/.pnpm/@mysten+sui@2.17.0_typescript@5.9.3/node_modules/@mysten/sui/dist/transactions/serializer.mjs
15529
15560
  function parseTypeName(typeName) {
15530
15561
  const parts = typeName.split("::");
@@ -16085,27 +16116,6 @@ var init_errors2 = __esm({
16085
16116
  }
16086
16117
  });
16087
16118
 
16088
- // ../../node_modules/.pnpm/@mysten+sui@2.17.0_typescript@5.9.3/node_modules/@mysten/sui/dist/utils/dynamic-fields.mjs
16089
- function deriveDynamicFieldID(parentId, typeTag, key) {
16090
- const address = suiBcs.Address.serialize(parentId).toBytes();
16091
- const tag2 = suiBcs.TypeTag.serialize(typeTag).toBytes();
16092
- const keyLength = suiBcs.u64().serialize(key.length).toBytes();
16093
- const hash = blake2b.create({ dkLen: 32 });
16094
- hash.update(new Uint8Array([240]));
16095
- hash.update(address);
16096
- hash.update(keyLength);
16097
- hash.update(key);
16098
- hash.update(tag2);
16099
- return `0x${toHex(hash.digest().slice(0, 32))}`;
16100
- }
16101
- var init_dynamic_fields = __esm({
16102
- "../../node_modules/.pnpm/@mysten+sui@2.17.0_typescript@5.9.3/node_modules/@mysten/sui/dist/utils/dynamic-fields.mjs"() {
16103
- init_bcs3();
16104
- init_dist2();
16105
- init_blake2();
16106
- }
16107
- });
16108
-
16109
16119
  // ../../node_modules/.pnpm/@mysten+sui@2.17.0_typescript@5.9.3/node_modules/@mysten/sui/dist/utils/coin-reservation.mjs
16110
16120
  function deriveReservationObjectId(owner, chainIdentifier) {
16111
16121
  const accBytes = fromHex(deriveDynamicFieldID(SUI_ACCUMULATOR_ROOT_OBJECT_ID, ACCUMULATOR_KEY_TYPE_TAG, suiBcs.Address.serialize(owner).toBytes()).slice(2));
@@ -17179,7 +17189,7 @@ var init_Transaction = __esm({
17179
17189
  init_sui_types();
17180
17190
  init_internal();
17181
17191
  init_v1();
17182
- init_utils2();
17192
+ init_utils4();
17183
17193
  init_TransactionData();
17184
17194
  init_Commands();
17185
17195
  init_v2();
@@ -17252,7 +17262,7 @@ var init_Transaction = __esm({
17252
17262
  if (!this.#data.sender) this.#data.sender = sender;
17253
17263
  }
17254
17264
  setExpiration(expiration) {
17255
- this.#data.expiration = expiration ? parse3(TransactionExpiration, expiration) : null;
17265
+ this.#data.expiration = expiration ? parse3(TransactionExpiration2, expiration) : null;
17256
17266
  }
17257
17267
  setGasPrice(price) {
17258
17268
  this.#data.gasData.price = String(price);
@@ -18444,7 +18454,7 @@ __export(transactions_exports, {
18444
18454
  });
18445
18455
  var init_transactions = __esm({
18446
18456
  "../../node_modules/.pnpm/@mysten+sui@2.17.0_typescript@5.9.3/node_modules/@mysten/sui/dist/transactions/index.mjs"() {
18447
- init_utils2();
18457
+ init_utils4();
18448
18458
  init_TransactionData();
18449
18459
  init_Commands();
18450
18460
  init_Inputs();
@@ -20212,16 +20222,6 @@ var require_json_bigint = __commonJS({
20212
20222
  }
20213
20223
  });
20214
20224
 
20215
- // ../../node_modules/.pnpm/@mysten+sui@2.17.0_typescript@5.9.3/node_modules/@mysten/sui/dist/utils/index.mjs
20216
- var init_utils4 = __esm({
20217
- "../../node_modules/.pnpm/@mysten+sui@2.17.0_typescript@5.9.3/node_modules/@mysten/sui/dist/utils/index.mjs"() {
20218
- init_move_registry();
20219
- init_sui_types();
20220
- init_constants();
20221
- init_dist2();
20222
- }
20223
- });
20224
-
20225
20225
  // ../../node_modules/.pnpm/@mysten+sui@2.17.0_typescript@5.9.3/node_modules/@mysten/sui/dist/client/cache.mjs
20226
20226
  var ClientCache;
20227
20227
  var init_cache = __esm({
@@ -52361,7 +52361,7 @@ var init_dist7 = __esm({
52361
52361
  "../../node_modules/.pnpm/@cetusprotocol+aggregator-sdk@1.4.8_axios@1.15.2_typescript@5.9.3/node_modules/@cetusprotocol/aggregator-sdk/dist/index.js"() {
52362
52362
  init_transactions();
52363
52363
  import_json_bigint = __toESM(require_json_bigint());
52364
- init_utils4();
52364
+ init_utils3();
52365
52365
  init_grpc();
52366
52366
  init_esm();
52367
52367
  init_bcs3();
@@ -62576,7 +62576,7 @@ var init_publickey = __esm({
62576
62576
  init_signature_scheme2();
62577
62577
  init_dist2();
62578
62578
  init_blake2();
62579
- init_utils3();
62579
+ init_utils2();
62580
62580
  PublicKey2 = class {
62581
62581
  /**
62582
62582
  * Checks if two public keys are equal
@@ -63488,7 +63488,7 @@ var MAX_KEY_CLAIM_NAME_LENGTH, MAX_KEY_CLAIM_VALUE_LENGTH, MAX_AUD_VALUE_LENGTH,
63488
63488
  var init_utils9 = __esm({
63489
63489
  "../../node_modules/.pnpm/@mysten+sui@2.17.0_typescript@5.9.3/node_modules/@mysten/sui/dist/zklogin/utils.mjs"() {
63490
63490
  init_poseidon();
63491
- init_utils3();
63491
+ init_utils2();
63492
63492
  MAX_KEY_CLAIM_NAME_LENGTH = 32;
63493
63493
  MAX_KEY_CLAIM_VALUE_LENGTH = 115;
63494
63494
  MAX_AUD_VALUE_LENGTH = 145;
@@ -63887,7 +63887,7 @@ var X402_SCHEME, X402_VERSION, X402_PAYMENT_HEADER, X402_PAYMENT_RESPONSE_HEADER
63887
63887
  var init_x402 = __esm({
63888
63888
  "../../node_modules/.pnpm/@suimpp+mpp@0.8.1_@modelcontextprotocol+sdk@1.28.0_zod@3.25.76__express@5.2.1_hono@4.12_f78e9d565196b7d48429724cce956455/node_modules/@suimpp/mpp/dist/x402.js"() {
63889
63889
  init_transactions();
63890
- init_utils4();
63890
+ init_utils3();
63891
63891
  X402_SCHEME = "exact";
63892
63892
  X402_VERSION = 1;
63893
63893
  X402_PAYMENT_HEADER = "X-PAYMENT";
@@ -63948,7 +63948,7 @@ var init_address = __esm({
63948
63948
  init_utils9();
63949
63949
  init_jwt_utils();
63950
63950
  init_blake2();
63951
- init_utils3();
63951
+ init_utils2();
63952
63952
  MAX_HEADER_LEN_B64 = 248;
63953
63953
  MAX_PADDED_UNSIGNED_JWT_LEN = 1600;
63954
63954
  }
@@ -63981,7 +63981,7 @@ var init_nonce = __esm({
63981
63981
  init_poseidon();
63982
63982
  init_utils9();
63983
63983
  init_dist2();
63984
- init_utils3();
63984
+ init_utils2();
63985
63985
  init_base();
63986
63986
  NONCE_LENGTH = 27;
63987
63987
  }
@@ -74144,6 +74144,7 @@ var StdioServerTransport = class {
74144
74144
  };
74145
74145
 
74146
74146
  // ../sdk/dist/index.js
74147
+ init_utils3();
74147
74148
  init_transactions();
74148
74149
  init_dist7();
74149
74150
  var import_bn7 = __toESM(require_bn2());
@@ -74158,12 +74159,12 @@ var PaymentKitUriError = class extends PaymentKitClientError {
74158
74159
  };
74159
74160
 
74160
74161
  // ../../node_modules/.pnpm/@mysten+payment-kit@0.1.6_@mysten+sui@2.17.0_typescript@5.9.3_/node_modules/@mysten/payment-kit/dist/constants.mjs
74161
- init_utils4();
74162
+ init_utils3();
74162
74163
  normalizeStructTag(SUI_TYPE_ARG);
74163
74164
  var SUI_PAYMENT_KIT_PROTOCOL = "sui:pay";
74164
74165
 
74165
74166
  // ../../node_modules/.pnpm/@mysten+payment-kit@0.1.6_@mysten+sui@2.17.0_typescript@5.9.3_/node_modules/@mysten/payment-kit/dist/uri.mjs
74166
- init_utils4();
74167
+ init_utils3();
74167
74168
  var isValidNonce = (nonce) => {
74168
74169
  return nonce.length <= 36;
74169
74170
  };
@@ -76688,9 +76689,6 @@ var SuiGraphQLClient = class extends BaseClient {
76688
76689
  }
76689
76690
  };
76690
76691
 
76691
- // ../sdk/dist/index.js
76692
- init_utils4();
76693
-
76694
76692
  // ../../node_modules/.pnpm/@mysten+sui@2.17.0_typescript@5.9.3/node_modules/@mysten/sui/dist/keypairs/ed25519/publickey.mjs
76695
76693
  init_signature_scheme2();
76696
76694
  init_publickey();
@@ -76699,7 +76697,7 @@ init_dist2();
76699
76697
  // ../../node_modules/.pnpm/@noble+hashes@2.0.1/node_modules/@noble/hashes/sha2.js
76700
76698
  init_md();
76701
76699
  init_u64();
76702
- init_utils3();
76700
+ init_utils2();
76703
76701
  var K512 = /* @__PURE__ */ (() => split([
76704
76702
  "0x428a2f98d728ae22",
76705
76703
  "0x7137449123ef65cd",
@@ -76908,8 +76906,8 @@ var sha512 = /* @__PURE__ */ createHasher(
76908
76906
  );
76909
76907
 
76910
76908
  // ../../node_modules/.pnpm/@noble+curves@2.0.1/node_modules/@noble/curves/utils.js
76911
- init_utils3();
76912
- init_utils3();
76909
+ init_utils2();
76910
+ init_utils2();
76913
76911
  var _0n = /* @__PURE__ */ BigInt(0);
76914
76912
  var _1n = /* @__PURE__ */ BigInt(1);
76915
76913
  function abool(value, title = "") {
@@ -78110,7 +78108,7 @@ var Ed25519PublicKey = class extends PublicKey2 {
78110
78108
  init_dist2();
78111
78109
 
78112
78110
  // ../../node_modules/.pnpm/@noble+hashes@2.0.1/node_modules/@noble/hashes/hmac.js
78113
- init_utils3();
78111
+ init_utils2();
78114
78112
  var _HMAC = class {
78115
78113
  oHash;
78116
78114
  iHash;
@@ -78182,7 +78180,7 @@ var hmac = (hash, key, message) => new _HMAC(hash, key).update(message).digest()
78182
78180
  hmac.create = (hash, key) => new _HMAC(hash, key);
78183
78181
 
78184
78182
  // ../../node_modules/.pnpm/@noble+hashes@2.0.1/node_modules/@noble/hashes/pbkdf2.js
78185
- init_utils3();
78183
+ init_utils2();
78186
78184
  function pbkdf2Init(hash, _password, _salt, _opts) {
78187
78185
  ahash(hash);
78188
78186
  const opts = checkOpts({ dkLen: 32, asyncTick: 10 }, _opts);
@@ -78601,6 +78599,38 @@ var init_errors3 = __esm2({
78601
78599
  };
78602
78600
  }
78603
78601
  });
78602
+ function preflightFail(code, error2) {
78603
+ return { valid: false, code, error: error2 };
78604
+ }
78605
+ function checkPositiveAmount(amount, label = "Amount", max2 = PREFLIGHT_MAX_AMOUNT) {
78606
+ if (typeof amount !== "number" || !Number.isFinite(amount)) {
78607
+ return preflightFail("INVALID_AMOUNT", `${label} must be a finite number`);
78608
+ }
78609
+ if (amount <= 0) {
78610
+ return preflightFail("INVALID_AMOUNT", `${label} must be greater than zero`);
78611
+ }
78612
+ if (amount > max2) {
78613
+ return preflightFail("INVALID_AMOUNT", `${label} ${amount} exceeds the sane maximum (${max2})`);
78614
+ }
78615
+ return PREFLIGHT_OK;
78616
+ }
78617
+ function checkSuiAddress(address, label = "recipient") {
78618
+ try {
78619
+ if (typeof address === "string" && address.trim() !== "" && isValidSuiAddress(normalizeSuiAddress(address))) {
78620
+ return PREFLIGHT_OK;
78621
+ }
78622
+ } catch {
78623
+ }
78624
+ return preflightFail("INVALID_ADDRESS", `Invalid ${label} address: ${address}`);
78625
+ }
78626
+ var PREFLIGHT_MAX_AMOUNT;
78627
+ var PREFLIGHT_OK;
78628
+ var init_preflight = __esm2({
78629
+ "src/preflight.ts"() {
78630
+ PREFLIGHT_MAX_AMOUNT = 1e6;
78631
+ PREFLIGHT_OK = { valid: true };
78632
+ }
78633
+ });
78604
78634
  var token_registry_exports = {};
78605
78635
  __export2(token_registry_exports, {
78606
78636
  COIN_REGISTRY: () => COIN_REGISTRY,
@@ -78874,10 +78904,28 @@ __export2(cetus_swap_exports, {
78874
78904
  findSwapRoute: () => findSwapRoute,
78875
78905
  isCetusRouteFresh: () => isCetusRouteFresh,
78876
78906
  isPrecomputedRouteCompatibleWithProviders: () => isPrecomputedRouteCompatibleWithProviders,
78907
+ preflightSwap: () => preflightSwap,
78877
78908
  resolveTokenType: () => resolveTokenType,
78878
78909
  serializeCetusRoute: () => serializeCetusRoute,
78879
78910
  verifyCetusRouteCoinMatch: () => verifyCetusRouteCoinMatch
78880
78911
  });
78912
+ function preflightSwap(input) {
78913
+ if (typeof input.from !== "string" || input.from.trim() === "") {
78914
+ return preflightFail("INVALID_ASSET", "A `from` token is required to swap");
78915
+ }
78916
+ if (typeof input.to !== "string" || input.to.trim() === "") {
78917
+ return preflightFail("INVALID_ASSET", "A `to` token is required to swap");
78918
+ }
78919
+ const amountCheck = checkPositiveAmount(input.amount, "Amount", Number.POSITIVE_INFINITY);
78920
+ if (!amountCheck.valid) return amountCheck;
78921
+ const resolvedFrom = resolveTokenType(input.from);
78922
+ const resolvedTo = resolveTokenType(input.to);
78923
+ const sameToken = input.from.trim() === input.to.trim() || resolvedFrom !== null && resolvedFrom === resolvedTo;
78924
+ if (sameToken) {
78925
+ return preflightFail("INVALID_ASSET", `Cannot swap ${input.from} to itself`);
78926
+ }
78927
+ return PREFLIGHT_OK;
78928
+ }
78881
78929
  function serializeCetusRoute(route, context) {
78882
78930
  return {
78883
78931
  routerData: serializeRouterDataV3(route.routerData),
@@ -79130,6 +79178,7 @@ var clientCache;
79130
79178
  var init_cetus_swap = __esm2({
79131
79179
  "src/protocols/cetus-swap.ts"() {
79132
79180
  init_token_registry();
79181
+ init_preflight();
79133
79182
  init_token_registry();
79134
79183
  OVERLAY_FEE_RATE = 1e-3;
79135
79184
  clientCache = /* @__PURE__ */ new Map();
@@ -79455,8 +79504,33 @@ async function executeTx(client, signer, buildTx, options = {}) {
79455
79504
  return { digest: txn.digest, gasCostSui, effects };
79456
79505
  }
79457
79506
  init_errors3();
79507
+ init_preflight();
79508
+ function preflightPay(input) {
79509
+ if (typeof input.url !== "string" || input.url.trim() === "") {
79510
+ return preflightFail("FACILITATOR_REJECTION", "A target URL is required to pay");
79511
+ }
79512
+ let parsed;
79513
+ try {
79514
+ parsed = new URL(input.url);
79515
+ } catch {
79516
+ return preflightFail("FACILITATOR_REJECTION", `Invalid URL: ${input.url}`);
79517
+ }
79518
+ if (parsed.protocol !== "http:" && parsed.protocol !== "https:") {
79519
+ return preflightFail(
79520
+ "FACILITATOR_REJECTION",
79521
+ `URL must be http(s): got ${parsed.protocol}//`
79522
+ );
79523
+ }
79524
+ if (input.maxPrice !== void 0) {
79525
+ const priceCheck = checkPositiveAmount(input.maxPrice, "maxPrice");
79526
+ if (!priceCheck.valid) return priceCheck;
79527
+ }
79528
+ return PREFLIGHT_OK;
79529
+ }
79458
79530
  async function payWithMpp(args) {
79459
79531
  const { signer, client, options } = args;
79532
+ const pf = preflightPay({ url: options.url, maxPrice: options.maxPrice });
79533
+ if (!pf.valid) throw new T2000Error(pf.code, pf.error);
79460
79534
  const method = (options.method ?? "GET").toUpperCase();
79461
79535
  const canHaveBody = method !== "GET" && method !== "HEAD";
79462
79536
  const reqInit = {
@@ -79648,6 +79722,25 @@ for (const [key, info] of Object.entries(SUPPORTED_ASSETS)) {
79648
79722
  ASSET_LOOKUP.set(info.displayName.toUpperCase(), key);
79649
79723
  }
79650
79724
  }
79725
+ init_preflight();
79726
+ function preflightSend(input) {
79727
+ try {
79728
+ assertAllowedAsset("send", input.asset);
79729
+ } catch (e) {
79730
+ return preflightFail("INVALID_ASSET", e.message);
79731
+ }
79732
+ const amountCheck = checkPositiveAmount(input.amount);
79733
+ if (!amountCheck.valid) return amountCheck;
79734
+ if ((input.asset === "USDC" || input.asset === "USDsui") && input.amount < GASLESS_MIN_STABLE_AMOUNT) {
79735
+ return preflightFail(
79736
+ "INVALID_AMOUNT",
79737
+ `Minimum gasless transfer is ${GASLESS_MIN_STABLE_AMOUNT} ${input.asset}. Got ${input.amount}.`
79738
+ );
79739
+ }
79740
+ const addressCheck = checkSuiAddress(input.to);
79741
+ if (!addressCheck.valid) return addressCheck;
79742
+ return PREFLIGHT_OK;
79743
+ }
79651
79744
  async function buildSendTx({
79652
79745
  client,
79653
79746
  address,
@@ -79655,17 +79748,11 @@ async function buildSendTx({
79655
79748
  amount,
79656
79749
  asset
79657
79750
  }) {
79658
- assertAllowedAsset("send", asset);
79751
+ const pf = preflightSend({ to, amount, asset });
79752
+ if (!pf.valid) throw new T2000Error(pf.code, pf.error);
79659
79753
  const recipient = validateAddress(to);
79660
79754
  const assetInfo = SUPPORTED_ASSETS[asset];
79661
79755
  if (!assetInfo) throw new T2000Error("ASSET_NOT_SUPPORTED", `Asset ${asset} is not supported`);
79662
- if (amount <= 0) throw new T2000Error("INVALID_AMOUNT", "Amount must be greater than zero");
79663
- if ((asset === "USDC" || asset === "USDsui") && amount < GASLESS_MIN_STABLE_AMOUNT) {
79664
- throw new T2000Error(
79665
- "INVALID_AMOUNT",
79666
- `Minimum gasless transfer is ${GASLESS_MIN_STABLE_AMOUNT} ${asset}. Got ${amount}.`
79667
- );
79668
- }
79669
79756
  const rawAmount = displayToRaw(amount, assetInfo.decimals);
79670
79757
  const tx = new Transaction();
79671
79758
  tx.setSender(address);
@@ -79952,7 +80039,7 @@ var TX_NODE_FRAGMENT = `
79952
80039
  }
79953
80040
  `;
79954
80041
  var HISTORY_QUERY = `query History($address: SuiAddress!, $last: Int!) {
79955
- transactions(last: $last, filter: { sentAddress: $address }) {
80042
+ transactions(last: $last, filter: { affectedAddress: $address }) {
79956
80043
  nodes {${TX_NODE_FRAGMENT}}
79957
80044
  }
79958
80045
  }`;
@@ -80022,7 +80109,9 @@ function buildRecord(args) {
80022
80109
  return { digest, action, label, legs, amount, asset, recipient, direction, timestamp: timestampMs, gasCost };
80023
80110
  }
80024
80111
  init_token_registry();
80025
- var SUI_MAINNET_URL = "https://fullnode.mainnet.sui.io:443";
80112
+ var RESOLVE_NAME_QUERY = `query ResolveSuins($name: String!) {
80113
+ address(name: $name) { address }
80114
+ }`;
80026
80115
  var SUI_ADDRESS_REGEX = /^0x[a-fA-F0-9]{1,64}$/i;
80027
80116
  var SUINS_NAME_REGEX = /^[a-z0-9-]+(\.[a-z0-9-]+)*\.sui$/;
80028
80117
  var InvalidAddressError = class extends Error {
@@ -80059,38 +80148,22 @@ async function resolveSuinsViaRpc(rawName, ctx = {}) {
80059
80148
  if (!SUINS_NAME_REGEX.test(name)) {
80060
80149
  throw new InvalidAddressError(rawName);
80061
80150
  }
80062
- const url2 = ctx.suiRpcUrl || SUI_MAINNET_URL;
80151
+ const gql = getSuiGraphQLClient();
80063
80152
  let res;
80064
80153
  try {
80065
- res = await fetch(url2, {
80066
- method: "POST",
80067
- headers: { "Content-Type": "application/json" },
80068
- body: JSON.stringify({
80069
- jsonrpc: "2.0",
80070
- id: 1,
80071
- method: "suix_resolveNameServiceAddress",
80072
- params: [name]
80073
- }),
80074
- signal: ctx.signal ?? AbortSignal.timeout(8e3)
80154
+ res = await gql.query({
80155
+ query: RESOLVE_NAME_QUERY,
80156
+ variables: { name },
80157
+ signal: ctx.signal
80075
80158
  });
80076
80159
  } catch (err) {
80077
80160
  const msg = err instanceof Error ? err.message : String(err);
80078
80161
  throw new SuinsRpcError(name, msg);
80079
80162
  }
80080
- if (!res.ok) {
80081
- throw new SuinsRpcError(name, `HTTP ${res.status}`);
80082
- }
80083
- let body;
80084
- try {
80085
- body = await res.json();
80086
- } catch (err) {
80087
- const msg = err instanceof Error ? err.message : String(err);
80088
- throw new SuinsRpcError(name, `JSON parse failed: ${msg}`);
80089
- }
80090
- if (body.error) {
80091
- throw new SuinsRpcError(name, body.error.message);
80163
+ if (res.errors?.length) {
80164
+ throw new SuinsRpcError(name, res.errors.map((e) => e.message ?? "unknown error").join("; "));
80092
80165
  }
80093
- return body.result ?? null;
80166
+ return res.data?.address?.address ?? null;
80094
80167
  }
80095
80168
  init_errors3();
80096
80169
  var DEFAULT_CONFIG_DIR = join$1(homedir(), ".t2000");
@@ -80362,7 +80435,9 @@ var T2000 = class _T2000 extends import_index2.default {
80362
80435
  amountUsd: approxUsdValue(params.from, params.amount) ?? 0,
80363
80436
  force: params.force
80364
80437
  });
80365
- const { findSwapRoute: findSwapRoute2, buildSwapTx: buildSwapTx2, resolveTokenType: resolveTokenType2 } = await Promise.resolve().then(() => (init_cetus_swap(), cetus_swap_exports));
80438
+ const { findSwapRoute: findSwapRoute2, buildSwapTx: buildSwapTx2, resolveTokenType: resolveTokenType2, preflightSwap: preflightSwap2 } = await Promise.resolve().then(() => (init_cetus_swap(), cetus_swap_exports));
80439
+ const pf = preflightSwap2({ from: params.from, to: params.to, amount: params.amount });
80440
+ if (!pf.valid) throw new T2000Error(pf.code, pf.error);
80366
80441
  const fromType = resolveTokenType2(params.from);
80367
80442
  const toType = resolveTokenType2(params.to);
80368
80443
  if (!fromType) throw new T2000Error("ASSET_NOT_SUPPORTED", `Unknown token: ${params.from}. Provide the full coin type.`);
@@ -80696,6 +80771,7 @@ init_errors3();
80696
80771
  init_swap_quote();
80697
80772
  init_cetus_swap();
80698
80773
  init_token_registry();
80774
+ init_preflight();
80699
80775
 
80700
80776
  // src/agent.ts
80701
80777
  async function createAgent(keyPath) {
@@ -81103,7 +81179,7 @@ CRITICAL: When the user asks to use any external or paid API, names a provider (
81103
81179
  Spending is the user's own USDC and every t2000_pay call is bounded by maxPrice. For larger or multi-step spends, state the estimated cost first and proceed once the user is happy. Use t2000_balance to check funds. The v4 wallet is payments-only; savings / lending live on audric.ai.`;
81104
81180
 
81105
81181
  // src/index.ts
81106
- var PKG_VERSION = "5.5.0" ;
81182
+ var PKG_VERSION = "5.6.0" ;
81107
81183
  console.log = (...args) => console.error("[log]", ...args);
81108
81184
  console.warn = (...args) => console.error("[warn]", ...args);
81109
81185
  async function startMcpServer(opts) {