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