@t2000/cli 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.
Files changed (27) hide show
  1. package/dist/{chunk-YKME3ZZ5.js → chunk-64M2IV26.js} +5 -5
  2. package/dist/{chunk-V6MPPVOY.js → chunk-D6WAQS6U.js} +3 -3
  3. package/dist/{chunk-HRGEZK3M.js → chunk-I2DCISQP.js} +3 -3
  4. package/dist/{chunk-ZIKS3DOX.js → chunk-ITIKLNK5.js} +3 -3
  5. package/dist/{chunk-FORXEDQJ.js → chunk-MPXYF2CX.js} +1449 -1449
  6. package/dist/chunk-MPXYF2CX.js.map +1 -0
  7. package/dist/{dist-4JZ33TE5.js → dist-ULTRYNV7.js} +1977 -1899
  8. package/dist/dist-ULTRYNV7.js.map +1 -0
  9. package/dist/{dist-OPR66FUQ.js → dist-VXJH2WYL.js} +6 -6
  10. package/dist/{esm-EIRCX523.js → esm-RF62MWQV.js} +2 -2
  11. package/dist/{grpc-IINTSDGR.js → grpc-UMZJXRGY.js} +4 -4
  12. package/dist/index.js +127 -48
  13. package/dist/index.js.map +1 -1
  14. package/dist/{transactions-JPL6KL3D.js → transactions-FSCAFG5Z.js} +4 -4
  15. package/dist/{x402-TTLPDM7N.js → x402-EMQGKUTK.js} +4 -4
  16. package/package.json +3 -3
  17. package/dist/chunk-FORXEDQJ.js.map +0 -1
  18. package/dist/dist-4JZ33TE5.js.map +0 -1
  19. /package/dist/{chunk-YKME3ZZ5.js.map → chunk-64M2IV26.js.map} +0 -0
  20. /package/dist/{chunk-V6MPPVOY.js.map → chunk-D6WAQS6U.js.map} +0 -0
  21. /package/dist/{chunk-HRGEZK3M.js.map → chunk-I2DCISQP.js.map} +0 -0
  22. /package/dist/{chunk-ZIKS3DOX.js.map → chunk-ITIKLNK5.js.map} +0 -0
  23. /package/dist/{dist-OPR66FUQ.js.map → dist-VXJH2WYL.js.map} +0 -0
  24. /package/dist/{esm-EIRCX523.js.map → esm-RF62MWQV.js.map} +0 -0
  25. /package/dist/{grpc-IINTSDGR.js.map → grpc-UMZJXRGY.js.map} +0 -0
  26. /package/dist/{transactions-JPL6KL3D.js.map → transactions-FSCAFG5Z.js.map} +0 -0
  27. /package/dist/{x402-TTLPDM7N.js.map → x402-EMQGKUTK.js.map} +0 -0
@@ -10831,35 +10831,6 @@ var init_suins = __esm({
10831
10831
  MAX_SUI_NS_NAME_LENGTH = 235;
10832
10832
  }
10833
10833
  });
10834
- var NAME_PATTERN;
10835
- var VERSION_REGEX;
10836
- var MAX_APP_SIZE;
10837
- var NAME_SEPARATOR;
10838
- var isValidNamedPackage;
10839
- var isValidNamedType;
10840
- var init_move_registry = __esm({
10841
- "../../node_modules/.pnpm/@mysten+sui@2.17.0_typescript@5.9.3/node_modules/@mysten/sui/dist/utils/move-registry.mjs"() {
10842
- init_suins();
10843
- init_sui_types();
10844
- NAME_PATTERN = /^([a-z0-9]+(?:-[a-z0-9]+)*)$/;
10845
- VERSION_REGEX = /^\d+$/;
10846
- MAX_APP_SIZE = 64;
10847
- NAME_SEPARATOR = "/";
10848
- isValidNamedPackage = (name) => {
10849
- const parts = name.split(NAME_SEPARATOR);
10850
- if (parts.length < 2 || parts.length > 3) return false;
10851
- const [org, app, version2] = parts;
10852
- if (version2 !== void 0 && !VERSION_REGEX.test(version2)) return false;
10853
- if (!isValidSuiNSName(org)) return false;
10854
- return NAME_PATTERN.test(app) && app.length < MAX_APP_SIZE;
10855
- };
10856
- isValidNamedType = (type) => {
10857
- const splitType = type.split(/::|<|>|,/);
10858
- for (const t of splitType) if (t.includes(NAME_SEPARATOR) && !isValidNamedPackage(t)) return false;
10859
- return isValidStructTag(type);
10860
- };
10861
- }
10862
- });
10863
10834
  function ulebEncode(num) {
10864
10835
  let bigNum = BigInt(num);
10865
10836
  const arr = [];
@@ -12216,1152 +12187,211 @@ var init_sui_types = __esm({
12216
12187
  VECTOR_TYPE_REGEX = /^vector<(.+)>$/;
12217
12188
  }
12218
12189
  });
12219
- // @__NO_SIDE_EFFECTS__
12220
- function getGlobalConfig(config$1) {
12221
- return {
12222
- lang: config$1?.lang ?? store$4?.lang,
12223
- message: config$1?.message,
12224
- abortEarly: config$1?.abortEarly ?? store$4?.abortEarly,
12225
- abortPipeEarly: config$1?.abortPipeEarly ?? store$4?.abortPipeEarly
12226
- };
12227
- }
12228
- // @__NO_SIDE_EFFECTS__
12229
- function getGlobalMessage(lang) {
12230
- return store$3?.get(lang);
12231
- }
12232
- // @__NO_SIDE_EFFECTS__
12233
- function getSchemaMessage(lang) {
12234
- return store$2?.get(lang);
12235
- }
12236
- // @__NO_SIDE_EFFECTS__
12237
- function getSpecificMessage(reference, lang) {
12238
- return store$1?.get(reference)?.get(lang);
12239
- }
12240
- // @__NO_SIDE_EFFECTS__
12241
- function _stringify(input) {
12242
- const type = typeof input;
12243
- if (type === "string") return `"${input}"`;
12244
- if (type === "number" || type === "bigint" || type === "boolean") return `${input}`;
12245
- if (type === "object" || type === "function") return (input && Object.getPrototypeOf(input)?.constructor?.name) ?? "null";
12246
- return type;
12247
- }
12248
- function _addIssue(context, label, dataset, config$1, other) {
12249
- const input = other && "input" in other ? other.input : dataset.value;
12250
- const expected = other?.expected ?? context.expects ?? null;
12251
- const received = other?.received ?? /* @__PURE__ */ _stringify(input);
12252
- const issue2 = {
12253
- kind: context.kind,
12254
- type: context.type,
12255
- input,
12256
- expected,
12257
- received,
12258
- message: `Invalid ${label}: ${expected ? `Expected ${expected} but r` : "R"}eceived ${received}`,
12259
- requirement: context.requirement,
12260
- path: other?.path,
12261
- issues: other?.issues,
12262
- lang: config$1.lang,
12263
- abortEarly: config$1.abortEarly,
12264
- abortPipeEarly: config$1.abortPipeEarly
12265
- };
12266
- const isSchema = context.kind === "schema";
12267
- 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);
12268
- if (message$1 !== void 0) issue2.message = typeof message$1 === "function" ? message$1(issue2) : message$1;
12269
- if (isSchema) dataset.typed = false;
12270
- if (dataset.issues) dataset.issues.push(issue2);
12271
- else dataset.issues = [issue2];
12272
- }
12273
- // @__NO_SIDE_EFFECTS__
12274
- function _getStandardProps(context) {
12275
- return {
12276
- version: 1,
12277
- vendor: "valibot",
12278
- validate(value$1) {
12279
- return context["~run"]({ value: value$1 }, /* @__PURE__ */ getGlobalConfig());
12280
- }
12281
- };
12282
- }
12283
- // @__NO_SIDE_EFFECTS__
12284
- function _isValidObjectKey(object$1, key) {
12285
- return Object.hasOwn(object$1, key) && key !== "__proto__" && key !== "prototype" && key !== "constructor";
12286
- }
12287
- // @__NO_SIDE_EFFECTS__
12288
- function _joinExpects(values$1, separator) {
12289
- const list = [...new Set(values$1)];
12290
- if (list.length > 1) return `(${list.join(` ${separator} `)})`;
12291
- return list[0] ?? "never";
12292
- }
12293
- // @__NO_SIDE_EFFECTS__
12294
- function check2(requirement, message$1) {
12295
- return {
12296
- kind: "validation",
12297
- type: "check",
12298
- reference: check2,
12299
- async: false,
12300
- expects: null,
12301
- requirement,
12302
- message: message$1,
12303
- "~run"(dataset, config$1) {
12304
- if (dataset.typed && !this.requirement(dataset.value)) _addIssue(this, "input", dataset, config$1);
12305
- return dataset;
12306
- }
12307
- };
12308
- }
12309
- // @__NO_SIDE_EFFECTS__
12310
- function integer2(message$1) {
12311
- return {
12312
- kind: "validation",
12313
- type: "integer",
12314
- reference: integer2,
12315
- async: false,
12316
- expects: null,
12317
- requirement: Number.isInteger,
12318
- message: message$1,
12319
- "~run"(dataset, config$1) {
12320
- if (dataset.typed && !this.requirement(dataset.value)) _addIssue(this, "integer", dataset, config$1);
12321
- return dataset;
12322
- }
12323
- };
12324
- }
12325
- // @__NO_SIDE_EFFECTS__
12326
- function transform2(operation) {
12327
- return {
12328
- kind: "transformation",
12329
- type: "transform",
12330
- reference: transform2,
12331
- async: false,
12332
- operation,
12333
- "~run"(dataset) {
12334
- dataset.value = this.operation(dataset.value);
12335
- return dataset;
12336
- }
12337
- };
12338
- }
12339
- // @__NO_SIDE_EFFECTS__
12340
- function getFallback(schema, dataset, config$1) {
12341
- return typeof schema.fallback === "function" ? schema.fallback(dataset, config$1) : schema.fallback;
12342
- }
12343
- // @__NO_SIDE_EFFECTS__
12344
- function getDefault(schema, dataset, config$1) {
12345
- return typeof schema.default === "function" ? schema.default(dataset, config$1) : schema.default;
12346
- }
12347
- // @__NO_SIDE_EFFECTS__
12348
- function is(schema, input) {
12349
- return !schema["~run"]({ value: input }, { abortEarly: true }).issues;
12350
- }
12351
- // @__NO_SIDE_EFFECTS__
12352
- function array2(item, message$1) {
12353
- return {
12354
- kind: "schema",
12355
- type: "array",
12356
- reference: array2,
12357
- expects: "Array",
12358
- async: false,
12359
- item,
12360
- message: message$1,
12361
- get "~standard"() {
12362
- return /* @__PURE__ */ _getStandardProps(this);
12363
- },
12364
- "~run"(dataset, config$1) {
12365
- const input = dataset.value;
12366
- if (Array.isArray(input)) {
12367
- dataset.typed = true;
12368
- dataset.value = [];
12369
- for (let key = 0; key < input.length; key++) {
12370
- const value$1 = input[key];
12371
- const itemDataset = this.item["~run"]({ value: value$1 }, config$1);
12372
- if (itemDataset.issues) {
12373
- const pathItem = {
12374
- type: "array",
12375
- origin: "value",
12376
- input,
12377
- key,
12378
- value: value$1
12379
- };
12380
- for (const issue2 of itemDataset.issues) {
12381
- if (issue2.path) issue2.path.unshift(pathItem);
12382
- else issue2.path = [pathItem];
12383
- dataset.issues?.push(issue2);
12384
- }
12385
- if (!dataset.issues) dataset.issues = itemDataset.issues;
12386
- if (config$1.abortEarly) {
12387
- dataset.typed = false;
12388
- break;
12389
- }
12390
- }
12391
- if (!itemDataset.typed) dataset.typed = false;
12392
- dataset.value.push(itemDataset.value);
12393
- }
12394
- } else _addIssue(this, "type", dataset, config$1);
12395
- return dataset;
12396
- }
12397
- };
12398
- }
12399
- // @__NO_SIDE_EFFECTS__
12400
- function bigint2(message$1) {
12401
- return {
12402
- kind: "schema",
12403
- type: "bigint",
12404
- reference: bigint2,
12405
- expects: "bigint",
12406
- async: false,
12407
- message: message$1,
12408
- get "~standard"() {
12409
- return /* @__PURE__ */ _getStandardProps(this);
12410
- },
12411
- "~run"(dataset, config$1) {
12412
- if (typeof dataset.value === "bigint") dataset.typed = true;
12413
- else _addIssue(this, "type", dataset, config$1);
12414
- return dataset;
12415
- }
12416
- };
12417
- }
12418
- // @__NO_SIDE_EFFECTS__
12419
- function boolean3(message$1) {
12420
- return {
12421
- kind: "schema",
12422
- type: "boolean",
12423
- reference: boolean3,
12424
- expects: "boolean",
12425
- async: false,
12426
- message: message$1,
12427
- get "~standard"() {
12428
- return /* @__PURE__ */ _getStandardProps(this);
12429
- },
12430
- "~run"(dataset, config$1) {
12431
- if (typeof dataset.value === "boolean") dataset.typed = true;
12432
- else _addIssue(this, "type", dataset, config$1);
12433
- return dataset;
12434
- }
12435
- };
12436
- }
12437
- // @__NO_SIDE_EFFECTS__
12438
- function lazy(getter) {
12439
- return {
12440
- kind: "schema",
12441
- type: "lazy",
12442
- reference: lazy,
12443
- expects: "unknown",
12444
- async: false,
12445
- getter,
12446
- get "~standard"() {
12447
- return /* @__PURE__ */ _getStandardProps(this);
12448
- },
12449
- "~run"(dataset, config$1) {
12450
- return this.getter(dataset.value)["~run"](dataset, config$1);
12451
- }
12452
- };
12453
- }
12454
- // @__NO_SIDE_EFFECTS__
12455
- function literal2(literal_, message$1) {
12456
- return {
12457
- kind: "schema",
12458
- type: "literal",
12459
- reference: literal2,
12460
- expects: /* @__PURE__ */ _stringify(literal_),
12461
- async: false,
12462
- literal: literal_,
12463
- message: message$1,
12464
- get "~standard"() {
12465
- return /* @__PURE__ */ _getStandardProps(this);
12466
- },
12467
- "~run"(dataset, config$1) {
12468
- if (dataset.value === this.literal) dataset.typed = true;
12469
- else _addIssue(this, "type", dataset, config$1);
12470
- return dataset;
12471
- }
12472
- };
12473
- }
12474
- // @__NO_SIDE_EFFECTS__
12475
- function nullable2(wrapped, default_) {
12476
- return {
12477
- kind: "schema",
12478
- type: "nullable",
12479
- reference: nullable2,
12480
- expects: `(${wrapped.expects} | null)`,
12481
- async: false,
12482
- wrapped,
12483
- default: default_,
12484
- get "~standard"() {
12485
- return /* @__PURE__ */ _getStandardProps(this);
12486
- },
12487
- "~run"(dataset, config$1) {
12488
- if (dataset.value === null) {
12489
- if (this.default !== void 0) dataset.value = /* @__PURE__ */ getDefault(this, dataset, config$1);
12490
- if (dataset.value === null) {
12491
- dataset.typed = true;
12492
- return dataset;
12493
- }
12190
+ var NAME_PATTERN;
12191
+ var VERSION_REGEX;
12192
+ var MAX_APP_SIZE;
12193
+ var NAME_SEPARATOR;
12194
+ var isValidNamedPackage;
12195
+ var isValidNamedType;
12196
+ var init_move_registry = __esm({
12197
+ "../../node_modules/.pnpm/@mysten+sui@2.17.0_typescript@5.9.3/node_modules/@mysten/sui/dist/utils/move-registry.mjs"() {
12198
+ init_suins();
12199
+ init_sui_types();
12200
+ NAME_PATTERN = /^([a-z0-9]+(?:-[a-z0-9]+)*)$/;
12201
+ VERSION_REGEX = /^\d+$/;
12202
+ MAX_APP_SIZE = 64;
12203
+ NAME_SEPARATOR = "/";
12204
+ isValidNamedPackage = (name) => {
12205
+ const parts = name.split(NAME_SEPARATOR);
12206
+ if (parts.length < 2 || parts.length > 3) return false;
12207
+ const [org, app, version2] = parts;
12208
+ if (version2 !== void 0 && !VERSION_REGEX.test(version2)) return false;
12209
+ if (!isValidSuiNSName(org)) return false;
12210
+ return NAME_PATTERN.test(app) && app.length < MAX_APP_SIZE;
12211
+ };
12212
+ isValidNamedType = (type) => {
12213
+ const splitType = type.split(/::|<|>|,/);
12214
+ for (const t of splitType) if (t.includes(NAME_SEPARATOR) && !isValidNamedPackage(t)) return false;
12215
+ return isValidStructTag(type);
12216
+ };
12217
+ }
12218
+ });
12219
+ var VECTOR_REGEX;
12220
+ var STRUCT_REGEX;
12221
+ var TypeTagSerializer;
12222
+ var init_type_tag_serializer = __esm({
12223
+ "../../node_modules/.pnpm/@mysten+sui@2.17.0_typescript@5.9.3/node_modules/@mysten/sui/dist/bcs/type-tag-serializer.mjs"() {
12224
+ init_sui_types();
12225
+ init_dist2();
12226
+ VECTOR_REGEX = /^vector<(.+)>$/;
12227
+ STRUCT_REGEX = /^([^:]+)::([^:]+)::([^<]+)(<(.+)>)?/;
12228
+ TypeTagSerializer = class TypeTagSerializer2 {
12229
+ static parseFromStr(str, normalizeAddress = false) {
12230
+ if (str === "address") return { address: null };
12231
+ else if (str === "bool") return { bool: null };
12232
+ else if (str === "u8") return { u8: null };
12233
+ else if (str === "u16") return { u16: null };
12234
+ else if (str === "u32") return { u32: null };
12235
+ else if (str === "u64") return { u64: null };
12236
+ else if (str === "u128") return { u128: null };
12237
+ else if (str === "u256") return { u256: null };
12238
+ else if (str === "signer") return { signer: null };
12239
+ const vectorMatch = str.match(VECTOR_REGEX);
12240
+ if (vectorMatch) return { vector: TypeTagSerializer2.parseFromStr(vectorMatch[1], normalizeAddress) };
12241
+ const structMatch = str.match(STRUCT_REGEX);
12242
+ if (structMatch) return { struct: {
12243
+ address: normalizeAddress ? normalizeSuiAddress(structMatch[1]) : structMatch[1],
12244
+ module: structMatch[2],
12245
+ name: structMatch[3],
12246
+ typeParams: structMatch[5] === void 0 ? [] : TypeTagSerializer2.parseStructTypeArgs(structMatch[5], normalizeAddress)
12247
+ } };
12248
+ throw new Error(`Encountered unexpected token when parsing type args for ${str}`);
12494
12249
  }
12495
- return this.wrapped["~run"](dataset, config$1);
12496
- }
12497
- };
12498
- }
12499
- // @__NO_SIDE_EFFECTS__
12500
- function nullish2(wrapped, default_) {
12501
- return {
12502
- kind: "schema",
12503
- type: "nullish",
12504
- reference: nullish2,
12505
- expects: `(${wrapped.expects} | null | undefined)`,
12506
- async: false,
12507
- wrapped,
12508
- default: default_,
12509
- get "~standard"() {
12510
- return /* @__PURE__ */ _getStandardProps(this);
12511
- },
12512
- "~run"(dataset, config$1) {
12513
- if (dataset.value === null || dataset.value === void 0) {
12514
- if (this.default !== void 0) dataset.value = /* @__PURE__ */ getDefault(this, dataset, config$1);
12515
- if (dataset.value === null || dataset.value === void 0) {
12516
- dataset.typed = true;
12517
- return dataset;
12250
+ static parseStructTypeArgs(str, normalizeAddress = false) {
12251
+ return splitGenericParameters(str).map((tok) => TypeTagSerializer2.parseFromStr(tok, normalizeAddress));
12252
+ }
12253
+ static tagToString(tag2) {
12254
+ if ("bool" in tag2) return "bool";
12255
+ if ("u8" in tag2) return "u8";
12256
+ if ("u16" in tag2) return "u16";
12257
+ if ("u32" in tag2) return "u32";
12258
+ if ("u64" in tag2) return "u64";
12259
+ if ("u128" in tag2) return "u128";
12260
+ if ("u256" in tag2) return "u256";
12261
+ if ("address" in tag2) return "address";
12262
+ if ("signer" in tag2) return "signer";
12263
+ if ("vector" in tag2) return `vector<${TypeTagSerializer2.tagToString(tag2.vector)}>`;
12264
+ if ("struct" in tag2) {
12265
+ const struct = tag2.struct;
12266
+ const typeParams = struct.typeParams.map(TypeTagSerializer2.tagToString).join(", ");
12267
+ return `${struct.address}::${struct.module}::${struct.name}${typeParams ? `<${typeParams}>` : ""}`;
12518
12268
  }
12269
+ throw new Error("Invalid TypeTag");
12519
12270
  }
12520
- return this.wrapped["~run"](dataset, config$1);
12521
- }
12522
- };
12271
+ };
12272
+ }
12273
+ });
12274
+ function unsafe_u64(options) {
12275
+ return bcs.u64({
12276
+ name: "unsafe_u64",
12277
+ ...options
12278
+ }).transform({
12279
+ input: (val) => val,
12280
+ output: (val) => Number(val)
12281
+ });
12523
12282
  }
12524
- // @__NO_SIDE_EFFECTS__
12525
- function number3(message$1) {
12526
- return {
12527
- kind: "schema",
12528
- type: "number",
12529
- reference: number3,
12530
- expects: "number",
12531
- async: false,
12532
- message: message$1,
12533
- get "~standard"() {
12534
- return /* @__PURE__ */ _getStandardProps(this);
12535
- },
12536
- "~run"(dataset, config$1) {
12537
- if (typeof dataset.value === "number" && !isNaN(dataset.value)) dataset.typed = true;
12538
- else _addIssue(this, "type", dataset, config$1);
12539
- return dataset;
12540
- }
12541
- };
12283
+ function optionEnum(type) {
12284
+ return bcs.enum("Option", {
12285
+ None: null,
12286
+ Some: type
12287
+ });
12542
12288
  }
12543
- // @__NO_SIDE_EFFECTS__
12544
- function object3(entries$1, message$1) {
12545
- return {
12546
- kind: "schema",
12547
- type: "object",
12548
- reference: object3,
12549
- expects: "Object",
12550
- async: false,
12551
- entries: entries$1,
12552
- message: message$1,
12553
- get "~standard"() {
12554
- return /* @__PURE__ */ _getStandardProps(this);
12555
- },
12556
- "~run"(dataset, config$1) {
12557
- const input = dataset.value;
12558
- if (input && typeof input === "object") {
12559
- dataset.typed = true;
12560
- dataset.value = {};
12561
- for (const key in this.entries) {
12562
- const valueSchema = this.entries[key];
12563
- if (key in input || (valueSchema.type === "exact_optional" || valueSchema.type === "optional" || valueSchema.type === "nullish") && valueSchema.default !== void 0) {
12564
- const value$1 = key in input ? input[key] : /* @__PURE__ */ getDefault(valueSchema);
12565
- const valueDataset = valueSchema["~run"]({ value: value$1 }, config$1);
12566
- if (valueDataset.issues) {
12567
- const pathItem = {
12568
- type: "object",
12569
- origin: "value",
12570
- input,
12571
- key,
12572
- value: value$1
12573
- };
12574
- for (const issue2 of valueDataset.issues) {
12575
- if (issue2.path) issue2.path.unshift(pathItem);
12576
- else issue2.path = [pathItem];
12577
- dataset.issues?.push(issue2);
12578
- }
12579
- if (!dataset.issues) dataset.issues = valueDataset.issues;
12580
- if (config$1.abortEarly) {
12581
- dataset.typed = false;
12582
- break;
12583
- }
12584
- }
12585
- if (!valueDataset.typed) dataset.typed = false;
12586
- dataset.value[key] = valueDataset.value;
12587
- } else if (valueSchema.fallback !== void 0) dataset.value[key] = /* @__PURE__ */ getFallback(valueSchema);
12588
- else if (valueSchema.type !== "exact_optional" && valueSchema.type !== "optional" && valueSchema.type !== "nullish") {
12589
- _addIssue(this, "key", dataset, config$1, {
12590
- input: void 0,
12591
- expected: `"${key}"`,
12592
- path: [{
12593
- type: "object",
12594
- origin: "key",
12595
- input,
12596
- key,
12597
- value: input[key]
12598
- }]
12599
- });
12600
- if (config$1.abortEarly) break;
12601
- }
12602
- }
12603
- } else _addIssue(this, "type", dataset, config$1);
12604
- return dataset;
12605
- }
12606
- };
12289
+ function IntentMessage(T2) {
12290
+ return bcs.struct(`IntentMessage<${T2.name}>`, {
12291
+ intent: Intent,
12292
+ value: T2
12293
+ });
12607
12294
  }
12608
- // @__NO_SIDE_EFFECTS__
12609
- function optional2(wrapped, default_) {
12610
- return {
12611
- kind: "schema",
12612
- type: "optional",
12613
- reference: optional2,
12614
- expects: `(${wrapped.expects} | undefined)`,
12615
- async: false,
12616
- wrapped,
12617
- default: default_,
12618
- get "~standard"() {
12619
- return /* @__PURE__ */ _getStandardProps(this);
12620
- },
12621
- "~run"(dataset, config$1) {
12622
- if (dataset.value === void 0) {
12623
- if (this.default !== void 0) dataset.value = /* @__PURE__ */ getDefault(this, dataset, config$1);
12624
- if (dataset.value === void 0) {
12625
- dataset.typed = true;
12626
- return dataset;
12627
- }
12628
- }
12629
- return this.wrapped["~run"](dataset, config$1);
12630
- }
12631
- };
12632
- }
12633
- // @__NO_SIDE_EFFECTS__
12634
- function picklist(options, message$1) {
12635
- return {
12636
- kind: "schema",
12637
- type: "picklist",
12638
- reference: picklist,
12639
- expects: /* @__PURE__ */ _joinExpects(options.map(_stringify), "|"),
12640
- async: false,
12641
- options,
12642
- message: message$1,
12643
- get "~standard"() {
12644
- return /* @__PURE__ */ _getStandardProps(this);
12645
- },
12646
- "~run"(dataset, config$1) {
12647
- if (this.options.includes(dataset.value)) dataset.typed = true;
12648
- else _addIssue(this, "type", dataset, config$1);
12649
- return dataset;
12650
- }
12651
- };
12652
- }
12653
- // @__NO_SIDE_EFFECTS__
12654
- function record2(key, value$1, message$1) {
12655
- return {
12656
- kind: "schema",
12657
- type: "record",
12658
- reference: record2,
12659
- expects: "Object",
12660
- async: false,
12661
- key,
12662
- value: value$1,
12663
- message: message$1,
12664
- get "~standard"() {
12665
- return /* @__PURE__ */ _getStandardProps(this);
12666
- },
12667
- "~run"(dataset, config$1) {
12668
- const input = dataset.value;
12669
- if (input && typeof input === "object") {
12670
- dataset.typed = true;
12671
- dataset.value = {};
12672
- for (const entryKey in input) if (/* @__PURE__ */ _isValidObjectKey(input, entryKey)) {
12673
- const entryValue = input[entryKey];
12674
- const keyDataset = this.key["~run"]({ value: entryKey }, config$1);
12675
- if (keyDataset.issues) {
12676
- const pathItem = {
12677
- type: "object",
12678
- origin: "key",
12679
- input,
12680
- key: entryKey,
12681
- value: entryValue
12682
- };
12683
- for (const issue2 of keyDataset.issues) {
12684
- issue2.path = [pathItem];
12685
- dataset.issues?.push(issue2);
12686
- }
12687
- if (!dataset.issues) dataset.issues = keyDataset.issues;
12688
- if (config$1.abortEarly) {
12689
- dataset.typed = false;
12690
- break;
12691
- }
12692
- }
12693
- const valueDataset = this.value["~run"]({ value: entryValue }, config$1);
12694
- if (valueDataset.issues) {
12695
- const pathItem = {
12696
- type: "object",
12697
- origin: "value",
12698
- input,
12699
- key: entryKey,
12700
- value: entryValue
12701
- };
12702
- for (const issue2 of valueDataset.issues) {
12703
- if (issue2.path) issue2.path.unshift(pathItem);
12704
- else issue2.path = [pathItem];
12705
- dataset.issues?.push(issue2);
12706
- }
12707
- if (!dataset.issues) dataset.issues = valueDataset.issues;
12708
- if (config$1.abortEarly) {
12709
- dataset.typed = false;
12710
- break;
12711
- }
12712
- }
12713
- if (!keyDataset.typed || !valueDataset.typed) dataset.typed = false;
12714
- if (keyDataset.typed) dataset.value[keyDataset.value] = valueDataset.value;
12715
- }
12716
- } else _addIssue(this, "type", dataset, config$1);
12717
- return dataset;
12718
- }
12719
- };
12720
- }
12721
- // @__NO_SIDE_EFFECTS__
12722
- function string3(message$1) {
12723
- return {
12724
- kind: "schema",
12725
- type: "string",
12726
- reference: string3,
12727
- expects: "string",
12728
- async: false,
12729
- message: message$1,
12730
- get "~standard"() {
12731
- return /* @__PURE__ */ _getStandardProps(this);
12732
- },
12733
- "~run"(dataset, config$1) {
12734
- if (typeof dataset.value === "string") dataset.typed = true;
12735
- else _addIssue(this, "type", dataset, config$1);
12736
- return dataset;
12737
- }
12738
- };
12739
- }
12740
- // @__NO_SIDE_EFFECTS__
12741
- function tuple(items, message$1) {
12742
- return {
12743
- kind: "schema",
12744
- type: "tuple",
12745
- reference: tuple,
12746
- expects: "Array",
12747
- async: false,
12748
- items,
12749
- message: message$1,
12750
- get "~standard"() {
12751
- return /* @__PURE__ */ _getStandardProps(this);
12752
- },
12753
- "~run"(dataset, config$1) {
12754
- const input = dataset.value;
12755
- if (Array.isArray(input)) {
12756
- dataset.typed = true;
12757
- dataset.value = [];
12758
- for (let key = 0; key < this.items.length; key++) {
12759
- const value$1 = input[key];
12760
- const itemDataset = this.items[key]["~run"]({ value: value$1 }, config$1);
12761
- if (itemDataset.issues) {
12762
- const pathItem = {
12763
- type: "array",
12764
- origin: "value",
12765
- input,
12766
- key,
12767
- value: value$1
12768
- };
12769
- for (const issue2 of itemDataset.issues) {
12770
- if (issue2.path) issue2.path.unshift(pathItem);
12771
- else issue2.path = [pathItem];
12772
- dataset.issues?.push(issue2);
12773
- }
12774
- if (!dataset.issues) dataset.issues = itemDataset.issues;
12775
- if (config$1.abortEarly) {
12776
- dataset.typed = false;
12777
- break;
12778
- }
12779
- }
12780
- if (!itemDataset.typed) dataset.typed = false;
12781
- dataset.value.push(itemDataset.value);
12782
- }
12783
- } else _addIssue(this, "type", dataset, config$1);
12784
- return dataset;
12785
- }
12786
- };
12787
- }
12788
- // @__NO_SIDE_EFFECTS__
12789
- function _subIssues(datasets) {
12790
- let issues;
12791
- if (datasets) for (const dataset of datasets) if (issues) issues.push(...dataset.issues);
12792
- else issues = dataset.issues;
12793
- return issues;
12794
- }
12795
- // @__NO_SIDE_EFFECTS__
12796
- function union2(options, message$1) {
12797
- return {
12798
- kind: "schema",
12799
- type: "union",
12800
- reference: union2,
12801
- expects: /* @__PURE__ */ _joinExpects(options.map((option2) => option2.expects), "|"),
12802
- async: false,
12803
- options,
12804
- message: message$1,
12805
- get "~standard"() {
12806
- return /* @__PURE__ */ _getStandardProps(this);
12807
- },
12808
- "~run"(dataset, config$1) {
12809
- let validDataset;
12810
- let typedDatasets;
12811
- let untypedDatasets;
12812
- for (const schema of this.options) {
12813
- const optionDataset = schema["~run"]({ value: dataset.value }, config$1);
12814
- if (optionDataset.typed) if (optionDataset.issues) if (typedDatasets) typedDatasets.push(optionDataset);
12815
- else typedDatasets = [optionDataset];
12816
- else {
12817
- validDataset = optionDataset;
12818
- break;
12819
- }
12820
- else if (untypedDatasets) untypedDatasets.push(optionDataset);
12821
- else untypedDatasets = [optionDataset];
12822
- }
12823
- if (validDataset) return validDataset;
12824
- if (typedDatasets) {
12825
- if (typedDatasets.length === 1) return typedDatasets[0];
12826
- _addIssue(this, "type", dataset, config$1, { issues: /* @__PURE__ */ _subIssues(typedDatasets) });
12827
- dataset.typed = true;
12828
- } else if (untypedDatasets?.length === 1) return untypedDatasets[0];
12829
- else _addIssue(this, "type", dataset, config$1, { issues: /* @__PURE__ */ _subIssues(untypedDatasets) });
12830
- return dataset;
12831
- }
12832
- };
12833
- }
12834
- // @__NO_SIDE_EFFECTS__
12835
- function unknown2() {
12836
- return {
12837
- kind: "schema",
12838
- type: "unknown",
12839
- reference: unknown2,
12840
- expects: "unknown",
12841
- async: false,
12842
- get "~standard"() {
12843
- return /* @__PURE__ */ _getStandardProps(this);
12844
- },
12845
- "~run"(dataset) {
12846
- dataset.typed = true;
12847
- return dataset;
12848
- }
12849
- };
12850
- }
12851
- function parse3(schema, input, config$1) {
12852
- const dataset = schema["~run"]({ value: input }, /* @__PURE__ */ getGlobalConfig(config$1));
12853
- if (dataset.issues) throw new ValiError(dataset.issues);
12854
- return dataset.value;
12855
- }
12856
- // @__NO_SIDE_EFFECTS__
12857
- function pipe2(...pipe$1) {
12858
- return {
12859
- ...pipe$1[0],
12860
- pipe: pipe$1,
12861
- get "~standard"() {
12862
- return /* @__PURE__ */ _getStandardProps(this);
12863
- },
12864
- "~run"(dataset, config$1) {
12865
- for (const item of pipe$1) if (item.kind !== "metadata") {
12866
- if (dataset.issues && (item.kind === "schema" || item.kind === "transformation")) {
12867
- dataset.typed = false;
12868
- break;
12869
- }
12870
- if (!dataset.issues || !config$1.abortEarly && !config$1.abortPipeEarly) dataset = item["~run"](dataset, config$1);
12871
- }
12872
- return dataset;
12873
- }
12874
- };
12875
- }
12876
- var store$4;
12877
- var store$3;
12878
- var store$2;
12879
- var store$1;
12880
- var ValiError;
12881
- var init_dist3 = __esm({
12882
- "../../node_modules/.pnpm/valibot@1.3.1_typescript@5.9.3/node_modules/valibot/dist/index.mjs"() {
12883
- ValiError = class extends Error {
12884
- /**
12885
- * Creates a Valibot error with useful information.
12886
- *
12887
- * @param issues The error issues.
12888
- */
12889
- constructor(issues) {
12890
- super(issues[0].message);
12891
- this.name = "ValiError";
12892
- this.issues = issues;
12893
- }
12894
- };
12895
- }
12896
- });
12897
- function safeEnum(options) {
12898
- return /* @__PURE__ */ union2(Object.keys(options).map((key) => withKind(key, /* @__PURE__ */ object3({ [key]: options[key] }))));
12899
- }
12900
- function withKind(key, schema) {
12901
- return /* @__PURE__ */ pipe2(/* @__PURE__ */ object3({
12902
- ...schema.entries,
12903
- $kind: /* @__PURE__ */ optional2(/* @__PURE__ */ literal2(key))
12904
- }), /* @__PURE__ */ transform2((value) => ({
12905
- ...value,
12906
- $kind: key
12907
- })));
12908
- }
12909
- var SuiAddress;
12910
- var ObjectID;
12911
- var BCSBytes;
12912
- var JsonU64;
12913
- var U32;
12914
- var ObjectRefSchema;
12915
- var ArgumentSchema;
12916
- var GasDataSchema;
12917
- var OpenSignatureBodySchema;
12918
- var OpenSignatureSchema;
12919
- var ProgrammableMoveCallSchema;
12920
- var $Intent;
12921
- var CommandSchema;
12922
- var ObjectArgSchema;
12923
- var ReservationSchema;
12924
- var WithdrawalTypeArgSchema;
12925
- var WithdrawFromSchema;
12926
- var FundsWithdrawalArgSchema;
12927
- var CallArgSchema;
12928
- var NormalizedCallArg;
12929
- var ValidDuringSchema;
12295
+ var Address;
12296
+ var ObjectDigest;
12297
+ var SuiObjectRef;
12298
+ var SharedObjectRef;
12299
+ var ObjectArg;
12300
+ var Owner;
12301
+ var Reservation;
12302
+ var WithdrawalType;
12303
+ var WithdrawFrom;
12304
+ var FundsWithdrawal;
12305
+ var CallArg;
12306
+ var InnerTypeTag;
12307
+ var TypeTag;
12308
+ var Argument;
12309
+ var ProgrammableMoveCall;
12310
+ var Command;
12311
+ var ProgrammableTransaction;
12312
+ var TransactionKind;
12313
+ var ValidDuring;
12930
12314
  var TransactionExpiration;
12931
- var TransactionDataSchema;
12932
- var init_internal = __esm({
12933
- "../../node_modules/.pnpm/@mysten+sui@2.17.0_typescript@5.9.3/node_modules/@mysten/sui/dist/transactions/data/internal.mjs"() {
12315
+ var StructTag;
12316
+ var GasData;
12317
+ var TransactionDataV1;
12318
+ var TransactionData;
12319
+ var IntentScope;
12320
+ var IntentVersion;
12321
+ var AppId;
12322
+ var Intent;
12323
+ var CompressedSignature;
12324
+ var PublicKey;
12325
+ var MultiSigPkMap;
12326
+ var MultiSigPublicKey;
12327
+ var MultiSig;
12328
+ var base64String;
12329
+ var SenderSignedTransaction;
12330
+ var SenderSignedData;
12331
+ var PasskeyAuthenticator;
12332
+ var MoveObjectType;
12333
+ var TypeOrigin;
12334
+ var UpgradeInfo;
12335
+ var MovePackage;
12336
+ var MoveObject;
12337
+ var Data;
12338
+ var ObjectInner;
12339
+ var init_bcs2 = __esm({
12340
+ "../../node_modules/.pnpm/@mysten+sui@2.17.0_typescript@5.9.3/node_modules/@mysten/sui/dist/bcs/bcs.mjs"() {
12934
12341
  init_sui_types();
12935
- init_dist3();
12936
- SuiAddress = /* @__PURE__ */ pipe2(/* @__PURE__ */ string3(), /* @__PURE__ */ transform2((value) => normalizeSuiAddress(value)), /* @__PURE__ */ check2(isValidSuiAddress));
12937
- ObjectID = SuiAddress;
12938
- BCSBytes = /* @__PURE__ */ string3();
12939
- JsonU64 = /* @__PURE__ */ pipe2(/* @__PURE__ */ union2([/* @__PURE__ */ string3(), /* @__PURE__ */ pipe2(/* @__PURE__ */ number3(), /* @__PURE__ */ integer2())]), /* @__PURE__ */ check2((val) => {
12940
- try {
12941
- BigInt(val);
12942
- return BigInt(val) >= 0 && BigInt(val) <= 18446744073709551615n;
12943
- } catch {
12944
- return false;
12342
+ init_type_tag_serializer();
12343
+ init_dist2();
12344
+ Address = bcs.bytes(SUI_ADDRESS_LENGTH).transform({
12345
+ validate: (val) => {
12346
+ const address = typeof val === "string" ? val : toHex(val);
12347
+ if (!address || !isValidSuiAddress(normalizeSuiAddress(address))) throw new Error(`Invalid Sui address ${address}`);
12348
+ },
12349
+ input: (val) => typeof val === "string" ? fromHex(normalizeSuiAddress(val)) : val,
12350
+ output: (val) => normalizeSuiAddress(toHex(val))
12351
+ });
12352
+ ObjectDigest = bcs.byteVector().transform({
12353
+ name: "ObjectDigest",
12354
+ input: (value) => fromBase58(value),
12355
+ output: (value) => toBase58(new Uint8Array(value)),
12356
+ validate: (value) => {
12357
+ if (fromBase58(value).length !== 32) throw new Error("ObjectDigest must be 32 bytes");
12945
12358
  }
12946
- }, "Invalid u64"));
12947
- U32 = /* @__PURE__ */ pipe2(/* @__PURE__ */ number3(), /* @__PURE__ */ integer2(), /* @__PURE__ */ check2((val) => val >= 0 && val < 2 ** 32, "Invalid u32"));
12948
- ObjectRefSchema = /* @__PURE__ */ object3({
12949
- objectId: SuiAddress,
12950
- version: JsonU64,
12951
- digest: /* @__PURE__ */ string3()
12952
12359
  });
12953
- ArgumentSchema = /* @__PURE__ */ union2([
12954
- withKind("GasCoin", /* @__PURE__ */ object3({ GasCoin: /* @__PURE__ */ literal2(true) })),
12955
- withKind("Input", /* @__PURE__ */ object3({
12956
- Input: /* @__PURE__ */ pipe2(/* @__PURE__ */ number3(), /* @__PURE__ */ integer2()),
12957
- type: /* @__PURE__ */ optional2(/* @__PURE__ */ union2([
12958
- /* @__PURE__ */ literal2("pure"),
12959
- /* @__PURE__ */ literal2("object"),
12960
- /* @__PURE__ */ literal2("withdrawal")
12961
- ]))
12962
- })),
12963
- withKind("Result", /* @__PURE__ */ object3({ Result: /* @__PURE__ */ pipe2(/* @__PURE__ */ number3(), /* @__PURE__ */ integer2()) })),
12964
- withKind("NestedResult", /* @__PURE__ */ object3({ NestedResult: /* @__PURE__ */ tuple([/* @__PURE__ */ pipe2(/* @__PURE__ */ number3(), /* @__PURE__ */ integer2()), /* @__PURE__ */ pipe2(/* @__PURE__ */ number3(), /* @__PURE__ */ integer2())]) }))
12965
- ]);
12966
- GasDataSchema = /* @__PURE__ */ object3({
12967
- budget: /* @__PURE__ */ nullable2(JsonU64),
12968
- price: /* @__PURE__ */ nullable2(JsonU64),
12969
- owner: /* @__PURE__ */ nullable2(SuiAddress),
12970
- payment: /* @__PURE__ */ nullable2(/* @__PURE__ */ array2(ObjectRefSchema))
12360
+ SuiObjectRef = bcs.struct("SuiObjectRef", {
12361
+ objectId: Address,
12362
+ version: bcs.u64(),
12363
+ digest: ObjectDigest
12971
12364
  });
12972
- OpenSignatureBodySchema = /* @__PURE__ */ union2([
12973
- /* @__PURE__ */ object3({ $kind: /* @__PURE__ */ literal2("address") }),
12974
- /* @__PURE__ */ object3({ $kind: /* @__PURE__ */ literal2("bool") }),
12975
- /* @__PURE__ */ object3({ $kind: /* @__PURE__ */ literal2("u8") }),
12976
- /* @__PURE__ */ object3({ $kind: /* @__PURE__ */ literal2("u16") }),
12977
- /* @__PURE__ */ object3({ $kind: /* @__PURE__ */ literal2("u32") }),
12978
- /* @__PURE__ */ object3({ $kind: /* @__PURE__ */ literal2("u64") }),
12979
- /* @__PURE__ */ object3({ $kind: /* @__PURE__ */ literal2("u128") }),
12980
- /* @__PURE__ */ object3({ $kind: /* @__PURE__ */ literal2("u256") }),
12981
- /* @__PURE__ */ object3({ $kind: /* @__PURE__ */ literal2("unknown") }),
12982
- /* @__PURE__ */ object3({
12983
- $kind: /* @__PURE__ */ literal2("vector"),
12984
- vector: /* @__PURE__ */ lazy(() => OpenSignatureBodySchema)
12985
- }),
12986
- /* @__PURE__ */ object3({
12987
- $kind: /* @__PURE__ */ literal2("datatype"),
12988
- datatype: /* @__PURE__ */ object3({
12989
- typeName: /* @__PURE__ */ string3(),
12990
- typeParameters: /* @__PURE__ */ array2(/* @__PURE__ */ lazy(() => OpenSignatureBodySchema))
12991
- })
12992
- }),
12993
- /* @__PURE__ */ object3({
12994
- $kind: /* @__PURE__ */ literal2("typeParameter"),
12995
- index: /* @__PURE__ */ pipe2(/* @__PURE__ */ number3(), /* @__PURE__ */ integer2())
12365
+ SharedObjectRef = bcs.struct("SharedObjectRef", {
12366
+ objectId: Address,
12367
+ initialSharedVersion: bcs.u64(),
12368
+ mutable: bcs.bool()
12369
+ });
12370
+ ObjectArg = bcs.enum("ObjectArg", {
12371
+ ImmOrOwnedObject: SuiObjectRef,
12372
+ SharedObject: SharedObjectRef,
12373
+ Receiving: SuiObjectRef
12374
+ });
12375
+ Owner = bcs.enum("Owner", {
12376
+ AddressOwner: Address,
12377
+ ObjectOwner: Address,
12378
+ Shared: bcs.struct("Shared", { initialSharedVersion: bcs.u64() }),
12379
+ Immutable: null,
12380
+ ConsensusAddressOwner: bcs.struct("ConsensusAddressOwner", {
12381
+ startVersion: bcs.u64(),
12382
+ owner: Address
12996
12383
  })
12997
- ]);
12998
- OpenSignatureSchema = /* @__PURE__ */ object3({
12999
- reference: /* @__PURE__ */ nullable2(/* @__PURE__ */ union2([
13000
- /* @__PURE__ */ literal2("mutable"),
13001
- /* @__PURE__ */ literal2("immutable"),
13002
- /* @__PURE__ */ literal2("unknown")
13003
- ])),
13004
- body: OpenSignatureBodySchema
13005
12384
  });
13006
- ProgrammableMoveCallSchema = /* @__PURE__ */ object3({
13007
- package: ObjectID,
13008
- module: /* @__PURE__ */ string3(),
13009
- function: /* @__PURE__ */ string3(),
13010
- typeArguments: /* @__PURE__ */ array2(/* @__PURE__ */ string3()),
13011
- arguments: /* @__PURE__ */ array2(ArgumentSchema),
13012
- _argumentTypes: /* @__PURE__ */ optional2(/* @__PURE__ */ nullable2(/* @__PURE__ */ array2(OpenSignatureSchema)))
12385
+ Reservation = bcs.enum("Reservation", { MaxAmountU64: bcs.u64() });
12386
+ WithdrawalType = bcs.enum("WithdrawalType", { Balance: bcs.lazy(() => TypeTag) });
12387
+ WithdrawFrom = bcs.enum("WithdrawFrom", {
12388
+ Sender: null,
12389
+ Sponsor: null
13013
12390
  });
13014
- $Intent = /* @__PURE__ */ object3({
13015
- name: /* @__PURE__ */ string3(),
13016
- inputs: /* @__PURE__ */ record2(/* @__PURE__ */ string3(), /* @__PURE__ */ union2([ArgumentSchema, /* @__PURE__ */ array2(ArgumentSchema)])),
13017
- data: /* @__PURE__ */ record2(/* @__PURE__ */ string3(), /* @__PURE__ */ unknown2())
13018
- });
13019
- CommandSchema = safeEnum({
13020
- MoveCall: ProgrammableMoveCallSchema,
13021
- TransferObjects: /* @__PURE__ */ object3({
13022
- objects: /* @__PURE__ */ array2(ArgumentSchema),
13023
- address: ArgumentSchema
13024
- }),
13025
- SplitCoins: /* @__PURE__ */ object3({
13026
- coin: ArgumentSchema,
13027
- amounts: /* @__PURE__ */ array2(ArgumentSchema)
13028
- }),
13029
- MergeCoins: /* @__PURE__ */ object3({
13030
- destination: ArgumentSchema,
13031
- sources: /* @__PURE__ */ array2(ArgumentSchema)
13032
- }),
13033
- Publish: /* @__PURE__ */ object3({
13034
- modules: /* @__PURE__ */ array2(BCSBytes),
13035
- dependencies: /* @__PURE__ */ array2(ObjectID)
13036
- }),
13037
- MakeMoveVec: /* @__PURE__ */ object3({
13038
- type: /* @__PURE__ */ nullable2(/* @__PURE__ */ string3()),
13039
- elements: /* @__PURE__ */ array2(ArgumentSchema)
13040
- }),
13041
- Upgrade: /* @__PURE__ */ object3({
13042
- modules: /* @__PURE__ */ array2(BCSBytes),
13043
- dependencies: /* @__PURE__ */ array2(ObjectID),
13044
- package: ObjectID,
13045
- ticket: ArgumentSchema
13046
- }),
13047
- $Intent
13048
- });
13049
- ObjectArgSchema = safeEnum({
13050
- ImmOrOwnedObject: ObjectRefSchema,
13051
- SharedObject: /* @__PURE__ */ object3({
13052
- objectId: ObjectID,
13053
- initialSharedVersion: JsonU64,
13054
- mutable: /* @__PURE__ */ boolean3()
13055
- }),
13056
- Receiving: ObjectRefSchema
13057
- });
13058
- ReservationSchema = safeEnum({ MaxAmountU64: JsonU64 });
13059
- WithdrawalTypeArgSchema = safeEnum({ Balance: /* @__PURE__ */ string3() });
13060
- WithdrawFromSchema = safeEnum({
13061
- Sender: /* @__PURE__ */ literal2(true),
13062
- Sponsor: /* @__PURE__ */ literal2(true)
13063
- });
13064
- FundsWithdrawalArgSchema = /* @__PURE__ */ object3({
13065
- reservation: ReservationSchema,
13066
- typeArg: WithdrawalTypeArgSchema,
13067
- withdrawFrom: WithdrawFromSchema
13068
- });
13069
- CallArgSchema = safeEnum({
13070
- Object: ObjectArgSchema,
13071
- Pure: /* @__PURE__ */ object3({ bytes: BCSBytes }),
13072
- UnresolvedPure: /* @__PURE__ */ object3({ value: /* @__PURE__ */ unknown2() }),
13073
- UnresolvedObject: /* @__PURE__ */ object3({
13074
- objectId: ObjectID,
13075
- version: /* @__PURE__ */ optional2(/* @__PURE__ */ nullable2(JsonU64)),
13076
- digest: /* @__PURE__ */ optional2(/* @__PURE__ */ nullable2(/* @__PURE__ */ string3())),
13077
- initialSharedVersion: /* @__PURE__ */ optional2(/* @__PURE__ */ nullable2(JsonU64)),
13078
- mutable: /* @__PURE__ */ optional2(/* @__PURE__ */ nullable2(/* @__PURE__ */ boolean3()))
13079
- }),
13080
- FundsWithdrawal: FundsWithdrawalArgSchema
13081
- });
13082
- NormalizedCallArg = safeEnum({
13083
- Object: ObjectArgSchema,
13084
- Pure: /* @__PURE__ */ object3({ bytes: BCSBytes })
13085
- });
13086
- ValidDuringSchema = /* @__PURE__ */ object3({
13087
- minEpoch: /* @__PURE__ */ nullable2(JsonU64),
13088
- maxEpoch: /* @__PURE__ */ nullable2(JsonU64),
13089
- minTimestamp: /* @__PURE__ */ nullable2(JsonU64),
13090
- maxTimestamp: /* @__PURE__ */ nullable2(JsonU64),
13091
- chain: /* @__PURE__ */ string3(),
13092
- nonce: U32
13093
- });
13094
- TransactionExpiration = safeEnum({
13095
- None: /* @__PURE__ */ literal2(true),
13096
- Epoch: JsonU64,
13097
- ValidDuring: ValidDuringSchema
13098
- });
13099
- TransactionDataSchema = /* @__PURE__ */ object3({
13100
- version: /* @__PURE__ */ literal2(2),
13101
- sender: /* @__PURE__ */ nullish2(SuiAddress),
13102
- expiration: /* @__PURE__ */ nullish2(TransactionExpiration),
13103
- gasData: GasDataSchema,
13104
- inputs: /* @__PURE__ */ array2(CallArgSchema),
13105
- commands: /* @__PURE__ */ array2(CommandSchema)
13106
- });
13107
- }
13108
- });
13109
- function getIdFromCallArg(arg) {
13110
- if (typeof arg === "string") return normalizeSuiAddress(arg);
13111
- if (arg.Object) {
13112
- if (arg.Object.ImmOrOwnedObject) return normalizeSuiAddress(arg.Object.ImmOrOwnedObject.objectId);
13113
- if (arg.Object.Receiving) return normalizeSuiAddress(arg.Object.Receiving.objectId);
13114
- return normalizeSuiAddress(arg.Object.SharedObject.objectId);
13115
- }
13116
- if (arg.UnresolvedObject) return normalizeSuiAddress(arg.UnresolvedObject.objectId);
13117
- }
13118
- function isArgument(value) {
13119
- return /* @__PURE__ */ is(ArgumentSchema, value);
13120
- }
13121
- function remapCommandArguments(command, inputMapping, commandMapping) {
13122
- const remapArg = (arg) => {
13123
- switch (arg.$kind) {
13124
- case "Input": {
13125
- const newInputIndex = inputMapping.get(arg.Input);
13126
- if (newInputIndex === void 0) throw new Error(`Input ${arg.Input} not found in input mapping`);
13127
- return {
13128
- ...arg,
13129
- Input: newInputIndex
13130
- };
13131
- }
13132
- case "Result": {
13133
- const newCommandIndex = commandMapping.get(arg.Result);
13134
- if (newCommandIndex !== void 0) return {
13135
- ...arg,
13136
- Result: newCommandIndex
13137
- };
13138
- return arg;
13139
- }
13140
- case "NestedResult": {
13141
- const newCommandIndex = commandMapping.get(arg.NestedResult[0]);
13142
- if (newCommandIndex !== void 0) return {
13143
- ...arg,
13144
- NestedResult: [newCommandIndex, arg.NestedResult[1]]
13145
- };
13146
- return arg;
13147
- }
13148
- default:
13149
- return arg;
13150
- }
13151
- };
13152
- switch (command.$kind) {
13153
- case "MoveCall":
13154
- command.MoveCall.arguments = command.MoveCall.arguments.map(remapArg);
13155
- break;
13156
- case "TransferObjects":
13157
- command.TransferObjects.objects = command.TransferObjects.objects.map(remapArg);
13158
- command.TransferObjects.address = remapArg(command.TransferObjects.address);
13159
- break;
13160
- case "SplitCoins":
13161
- command.SplitCoins.coin = remapArg(command.SplitCoins.coin);
13162
- command.SplitCoins.amounts = command.SplitCoins.amounts.map(remapArg);
13163
- break;
13164
- case "MergeCoins":
13165
- command.MergeCoins.destination = remapArg(command.MergeCoins.destination);
13166
- command.MergeCoins.sources = command.MergeCoins.sources.map(remapArg);
13167
- break;
13168
- case "MakeMoveVec":
13169
- command.MakeMoveVec.elements = command.MakeMoveVec.elements.map(remapArg);
13170
- break;
13171
- case "Upgrade":
13172
- command.Upgrade.ticket = remapArg(command.Upgrade.ticket);
13173
- break;
13174
- case "$Intent": {
13175
- const inputs = command.$Intent.inputs;
13176
- command.$Intent.inputs = {};
13177
- for (const [key, value] of Object.entries(inputs)) command.$Intent.inputs[key] = Array.isArray(value) ? value.map(remapArg) : remapArg(value);
13178
- break;
13179
- }
13180
- }
13181
- }
13182
- var init_utils2 = __esm({
13183
- "../../node_modules/.pnpm/@mysten+sui@2.17.0_typescript@5.9.3/node_modules/@mysten/sui/dist/transactions/utils.mjs"() {
13184
- init_sui_types();
13185
- init_internal();
13186
- init_dist3();
13187
- }
13188
- });
13189
- var VECTOR_REGEX;
13190
- var STRUCT_REGEX;
13191
- var TypeTagSerializer;
13192
- var init_type_tag_serializer = __esm({
13193
- "../../node_modules/.pnpm/@mysten+sui@2.17.0_typescript@5.9.3/node_modules/@mysten/sui/dist/bcs/type-tag-serializer.mjs"() {
13194
- init_sui_types();
13195
- init_dist2();
13196
- VECTOR_REGEX = /^vector<(.+)>$/;
13197
- STRUCT_REGEX = /^([^:]+)::([^:]+)::([^<]+)(<(.+)>)?/;
13198
- TypeTagSerializer = class TypeTagSerializer2 {
13199
- static parseFromStr(str, normalizeAddress = false) {
13200
- if (str === "address") return { address: null };
13201
- else if (str === "bool") return { bool: null };
13202
- else if (str === "u8") return { u8: null };
13203
- else if (str === "u16") return { u16: null };
13204
- else if (str === "u32") return { u32: null };
13205
- else if (str === "u64") return { u64: null };
13206
- else if (str === "u128") return { u128: null };
13207
- else if (str === "u256") return { u256: null };
13208
- else if (str === "signer") return { signer: null };
13209
- const vectorMatch = str.match(VECTOR_REGEX);
13210
- if (vectorMatch) return { vector: TypeTagSerializer2.parseFromStr(vectorMatch[1], normalizeAddress) };
13211
- const structMatch = str.match(STRUCT_REGEX);
13212
- if (structMatch) return { struct: {
13213
- address: normalizeAddress ? normalizeSuiAddress(structMatch[1]) : structMatch[1],
13214
- module: structMatch[2],
13215
- name: structMatch[3],
13216
- typeParams: structMatch[5] === void 0 ? [] : TypeTagSerializer2.parseStructTypeArgs(structMatch[5], normalizeAddress)
13217
- } };
13218
- throw new Error(`Encountered unexpected token when parsing type args for ${str}`);
13219
- }
13220
- static parseStructTypeArgs(str, normalizeAddress = false) {
13221
- return splitGenericParameters(str).map((tok) => TypeTagSerializer2.parseFromStr(tok, normalizeAddress));
13222
- }
13223
- static tagToString(tag2) {
13224
- if ("bool" in tag2) return "bool";
13225
- if ("u8" in tag2) return "u8";
13226
- if ("u16" in tag2) return "u16";
13227
- if ("u32" in tag2) return "u32";
13228
- if ("u64" in tag2) return "u64";
13229
- if ("u128" in tag2) return "u128";
13230
- if ("u256" in tag2) return "u256";
13231
- if ("address" in tag2) return "address";
13232
- if ("signer" in tag2) return "signer";
13233
- if ("vector" in tag2) return `vector<${TypeTagSerializer2.tagToString(tag2.vector)}>`;
13234
- if ("struct" in tag2) {
13235
- const struct = tag2.struct;
13236
- const typeParams = struct.typeParams.map(TypeTagSerializer2.tagToString).join(", ");
13237
- return `${struct.address}::${struct.module}::${struct.name}${typeParams ? `<${typeParams}>` : ""}`;
13238
- }
13239
- throw new Error("Invalid TypeTag");
13240
- }
13241
- };
13242
- }
13243
- });
13244
- function unsafe_u64(options) {
13245
- return bcs.u64({
13246
- name: "unsafe_u64",
13247
- ...options
13248
- }).transform({
13249
- input: (val) => val,
13250
- output: (val) => Number(val)
13251
- });
13252
- }
13253
- function optionEnum(type) {
13254
- return bcs.enum("Option", {
13255
- None: null,
13256
- Some: type
13257
- });
13258
- }
13259
- function IntentMessage(T2) {
13260
- return bcs.struct(`IntentMessage<${T2.name}>`, {
13261
- intent: Intent,
13262
- value: T2
13263
- });
13264
- }
13265
- var Address;
13266
- var ObjectDigest;
13267
- var SuiObjectRef;
13268
- var SharedObjectRef;
13269
- var ObjectArg;
13270
- var Owner;
13271
- var Reservation;
13272
- var WithdrawalType;
13273
- var WithdrawFrom;
13274
- var FundsWithdrawal;
13275
- var CallArg;
13276
- var InnerTypeTag;
13277
- var TypeTag;
13278
- var Argument;
13279
- var ProgrammableMoveCall;
13280
- var Command;
13281
- var ProgrammableTransaction;
13282
- var TransactionKind;
13283
- var ValidDuring;
13284
- var TransactionExpiration2;
13285
- var StructTag;
13286
- var GasData;
13287
- var TransactionDataV1;
13288
- var TransactionData;
13289
- var IntentScope;
13290
- var IntentVersion;
13291
- var AppId;
13292
- var Intent;
13293
- var CompressedSignature;
13294
- var PublicKey;
13295
- var MultiSigPkMap;
13296
- var MultiSigPublicKey;
13297
- var MultiSig;
13298
- var base64String;
13299
- var SenderSignedTransaction;
13300
- var SenderSignedData;
13301
- var PasskeyAuthenticator;
13302
- var MoveObjectType;
13303
- var TypeOrigin;
13304
- var UpgradeInfo;
13305
- var MovePackage;
13306
- var MoveObject;
13307
- var Data;
13308
- var ObjectInner;
13309
- var init_bcs2 = __esm({
13310
- "../../node_modules/.pnpm/@mysten+sui@2.17.0_typescript@5.9.3/node_modules/@mysten/sui/dist/bcs/bcs.mjs"() {
13311
- init_sui_types();
13312
- init_type_tag_serializer();
13313
- init_dist2();
13314
- Address = bcs.bytes(SUI_ADDRESS_LENGTH).transform({
13315
- validate: (val) => {
13316
- const address = typeof val === "string" ? val : toHex(val);
13317
- if (!address || !isValidSuiAddress(normalizeSuiAddress(address))) throw new Error(`Invalid Sui address ${address}`);
13318
- },
13319
- input: (val) => typeof val === "string" ? fromHex(normalizeSuiAddress(val)) : val,
13320
- output: (val) => normalizeSuiAddress(toHex(val))
13321
- });
13322
- ObjectDigest = bcs.byteVector().transform({
13323
- name: "ObjectDigest",
13324
- input: (value) => fromBase58(value),
13325
- output: (value) => toBase58(new Uint8Array(value)),
13326
- validate: (value) => {
13327
- if (fromBase58(value).length !== 32) throw new Error("ObjectDigest must be 32 bytes");
13328
- }
13329
- });
13330
- SuiObjectRef = bcs.struct("SuiObjectRef", {
13331
- objectId: Address,
13332
- version: bcs.u64(),
13333
- digest: ObjectDigest
13334
- });
13335
- SharedObjectRef = bcs.struct("SharedObjectRef", {
13336
- objectId: Address,
13337
- initialSharedVersion: bcs.u64(),
13338
- mutable: bcs.bool()
13339
- });
13340
- ObjectArg = bcs.enum("ObjectArg", {
13341
- ImmOrOwnedObject: SuiObjectRef,
13342
- SharedObject: SharedObjectRef,
13343
- Receiving: SuiObjectRef
13344
- });
13345
- Owner = bcs.enum("Owner", {
13346
- AddressOwner: Address,
13347
- ObjectOwner: Address,
13348
- Shared: bcs.struct("Shared", { initialSharedVersion: bcs.u64() }),
13349
- Immutable: null,
13350
- ConsensusAddressOwner: bcs.struct("ConsensusAddressOwner", {
13351
- startVersion: bcs.u64(),
13352
- owner: Address
13353
- })
13354
- });
13355
- Reservation = bcs.enum("Reservation", { MaxAmountU64: bcs.u64() });
13356
- WithdrawalType = bcs.enum("WithdrawalType", { Balance: bcs.lazy(() => TypeTag) });
13357
- WithdrawFrom = bcs.enum("WithdrawFrom", {
13358
- Sender: null,
13359
- Sponsor: null
13360
- });
13361
- FundsWithdrawal = bcs.struct("FundsWithdrawal", {
13362
- reservation: Reservation,
13363
- typeArg: WithdrawalType,
13364
- withdrawFrom: WithdrawFrom
12391
+ FundsWithdrawal = bcs.struct("FundsWithdrawal", {
12392
+ reservation: Reservation,
12393
+ typeArg: WithdrawalType,
12394
+ withdrawFrom: WithdrawFrom
13365
12395
  });
13366
12396
  CallArg = bcs.enum("CallArg", {
13367
12397
  Pure: bcs.struct("Pure", { bytes: bcs.byteVector().transform({
@@ -13457,7 +12487,7 @@ var init_bcs2 = __esm({
13457
12487
  chain: ObjectDigest,
13458
12488
  nonce: bcs.u32()
13459
12489
  });
13460
- TransactionExpiration2 = bcs.enum("TransactionExpiration", {
12490
+ TransactionExpiration = bcs.enum("TransactionExpiration", {
13461
12491
  None: null,
13462
12492
  Epoch: unsafe_u64(),
13463
12493
  ValidDuring
@@ -13478,7 +12508,7 @@ var init_bcs2 = __esm({
13478
12508
  kind: TransactionKind,
13479
12509
  sender: Address,
13480
12510
  gasData: GasData,
13481
- expiration: TransactionExpiration2
12511
+ expiration: TransactionExpiration
13482
12512
  });
13483
12513
  TransactionData = bcs.enum("TransactionData", { V1: TransactionDataV1 });
13484
12514
  IntentScope = bcs.enum("IntentScope", {
@@ -13906,7 +12936,7 @@ var init_bcs3 = __esm({
13906
12936
  TransactionData,
13907
12937
  TransactionDataV1,
13908
12938
  TransactionEffects,
13909
- TransactionExpiration: TransactionExpiration2,
12939
+ TransactionExpiration,
13910
12940
  TransactionKind,
13911
12941
  TypeOrigin,
13912
12942
  TypeTag,
@@ -13914,283 +12944,14 @@ var init_bcs3 = __esm({
13914
12944
  };
13915
12945
  }
13916
12946
  });
13917
- function serializeV1TransactionData(transactionData) {
13918
- const inputs = transactionData.inputs.map((input, index) => {
13919
- if (input.Object) return {
13920
- kind: "Input",
13921
- index,
13922
- value: { Object: input.Object.ImmOrOwnedObject ? { ImmOrOwned: input.Object.ImmOrOwnedObject } : input.Object.Receiving ? { Receiving: {
13923
- digest: input.Object.Receiving.digest,
13924
- version: input.Object.Receiving.version,
13925
- objectId: input.Object.Receiving.objectId
13926
- } } : { Shared: {
13927
- mutable: input.Object.SharedObject.mutable,
13928
- initialSharedVersion: input.Object.SharedObject.initialSharedVersion,
13929
- objectId: input.Object.SharedObject.objectId
13930
- } } },
13931
- type: "object"
13932
- };
13933
- if (input.Pure) return {
13934
- kind: "Input",
13935
- index,
13936
- value: { Pure: Array.from(fromBase64(input.Pure.bytes)) },
13937
- type: "pure"
13938
- };
13939
- if (input.UnresolvedPure) return {
13940
- kind: "Input",
13941
- type: "pure",
13942
- index,
13943
- value: input.UnresolvedPure.value
13944
- };
13945
- if (input.UnresolvedObject) return {
13946
- kind: "Input",
13947
- type: "object",
13948
- index,
13949
- value: input.UnresolvedObject.objectId
13950
- };
13951
- throw new Error("Invalid input");
13952
- });
13953
- return {
13954
- version: 1,
13955
- sender: transactionData.sender ?? void 0,
13956
- expiration: transactionData.expiration?.$kind === "Epoch" ? { Epoch: Number(transactionData.expiration.Epoch) } : transactionData.expiration ? { None: true } : null,
13957
- gasConfig: {
13958
- owner: transactionData.gasData.owner ?? void 0,
13959
- budget: transactionData.gasData.budget ?? void 0,
13960
- price: transactionData.gasData.price ?? void 0,
13961
- payment: transactionData.gasData.payment ?? void 0
13962
- },
13963
- inputs,
13964
- transactions: transactionData.commands.map((command) => {
13965
- if (command.MakeMoveVec) return {
13966
- kind: "MakeMoveVec",
13967
- type: command.MakeMoveVec.type === null ? { None: true } : { Some: TypeTagSerializer.parseFromStr(command.MakeMoveVec.type) },
13968
- objects: command.MakeMoveVec.elements.map((arg) => convertTransactionArgument(arg, inputs))
13969
- };
13970
- if (command.MergeCoins) return {
13971
- kind: "MergeCoins",
13972
- destination: convertTransactionArgument(command.MergeCoins.destination, inputs),
13973
- sources: command.MergeCoins.sources.map((arg) => convertTransactionArgument(arg, inputs))
13974
- };
13975
- if (command.MoveCall) return {
13976
- kind: "MoveCall",
13977
- target: `${command.MoveCall.package}::${command.MoveCall.module}::${command.MoveCall.function}`,
13978
- typeArguments: command.MoveCall.typeArguments,
13979
- arguments: command.MoveCall.arguments.map((arg) => convertTransactionArgument(arg, inputs))
13980
- };
13981
- if (command.Publish) return {
13982
- kind: "Publish",
13983
- modules: command.Publish.modules.map((mod3) => Array.from(fromBase64(mod3))),
13984
- dependencies: command.Publish.dependencies
13985
- };
13986
- if (command.SplitCoins) return {
13987
- kind: "SplitCoins",
13988
- coin: convertTransactionArgument(command.SplitCoins.coin, inputs),
13989
- amounts: command.SplitCoins.amounts.map((arg) => convertTransactionArgument(arg, inputs))
13990
- };
13991
- if (command.TransferObjects) return {
13992
- kind: "TransferObjects",
13993
- objects: command.TransferObjects.objects.map((arg) => convertTransactionArgument(arg, inputs)),
13994
- address: convertTransactionArgument(command.TransferObjects.address, inputs)
13995
- };
13996
- if (command.Upgrade) return {
13997
- kind: "Upgrade",
13998
- modules: command.Upgrade.modules.map((mod3) => Array.from(fromBase64(mod3))),
13999
- dependencies: command.Upgrade.dependencies,
14000
- packageId: command.Upgrade.package,
14001
- ticket: convertTransactionArgument(command.Upgrade.ticket, inputs)
14002
- };
14003
- throw new Error(`Unknown transaction ${Object.keys(command)}`);
14004
- })
14005
- };
12947
+ function isBytes2(a) {
12948
+ return a instanceof Uint8Array || ArrayBuffer.isView(a) && a.constructor.name === "Uint8Array";
14006
12949
  }
14007
- function convertTransactionArgument(arg, inputs) {
14008
- if (arg.$kind === "GasCoin") return { kind: "GasCoin" };
14009
- if (arg.$kind === "Result") return {
14010
- kind: "Result",
14011
- index: arg.Result
14012
- };
14013
- if (arg.$kind === "NestedResult") return {
14014
- kind: "NestedResult",
14015
- index: arg.NestedResult[0],
14016
- resultIndex: arg.NestedResult[1]
14017
- };
14018
- if (arg.$kind === "Input") return inputs[arg.Input];
14019
- throw new Error(`Invalid argument ${Object.keys(arg)}`);
14020
- }
14021
- function transactionDataFromV1(data) {
14022
- return parse3(TransactionDataSchema, {
14023
- version: 2,
14024
- sender: data.sender ?? null,
14025
- expiration: data.expiration ? "Epoch" in data.expiration ? { Epoch: data.expiration.Epoch } : { None: true } : null,
14026
- gasData: {
14027
- owner: data.gasConfig.owner ?? null,
14028
- budget: data.gasConfig.budget?.toString() ?? null,
14029
- price: data.gasConfig.price?.toString() ?? null,
14030
- payment: data.gasConfig.payment?.map((ref) => ({
14031
- digest: ref.digest,
14032
- objectId: ref.objectId,
14033
- version: ref.version.toString()
14034
- })) ?? null
14035
- },
14036
- inputs: data.inputs.map((input) => {
14037
- if (input.kind === "Input") {
14038
- if (/* @__PURE__ */ is(NormalizedCallArg2, input.value)) {
14039
- const value = parse3(NormalizedCallArg2, input.value);
14040
- if (value.Object) {
14041
- if (value.Object.ImmOrOwned) return { Object: { ImmOrOwnedObject: {
14042
- objectId: value.Object.ImmOrOwned.objectId,
14043
- version: String(value.Object.ImmOrOwned.version),
14044
- digest: value.Object.ImmOrOwned.digest
14045
- } } };
14046
- if (value.Object.Shared) return { Object: { SharedObject: {
14047
- mutable: value.Object.Shared.mutable ?? null,
14048
- initialSharedVersion: value.Object.Shared.initialSharedVersion,
14049
- objectId: value.Object.Shared.objectId
14050
- } } };
14051
- if (value.Object.Receiving) return { Object: { Receiving: {
14052
- digest: value.Object.Receiving.digest,
14053
- version: String(value.Object.Receiving.version),
14054
- objectId: value.Object.Receiving.objectId
14055
- } } };
14056
- throw new Error("Invalid object input");
14057
- }
14058
- return { Pure: { bytes: toBase64(new Uint8Array(value.Pure)) } };
14059
- }
14060
- if (input.type === "object") return { UnresolvedObject: { objectId: input.value } };
14061
- return { UnresolvedPure: { value: input.value } };
14062
- }
14063
- throw new Error("Invalid input");
14064
- }),
14065
- commands: data.transactions.map((transaction) => {
14066
- switch (transaction.kind) {
14067
- case "MakeMoveVec":
14068
- return { MakeMoveVec: {
14069
- type: "Some" in transaction.type ? TypeTagSerializer.tagToString(transaction.type.Some) : null,
14070
- elements: transaction.objects.map((arg) => parseV1TransactionArgument(arg))
14071
- } };
14072
- case "MergeCoins":
14073
- return { MergeCoins: {
14074
- destination: parseV1TransactionArgument(transaction.destination),
14075
- sources: transaction.sources.map((arg) => parseV1TransactionArgument(arg))
14076
- } };
14077
- case "MoveCall": {
14078
- const [pkg, mod3, fn] = transaction.target.split("::");
14079
- return { MoveCall: {
14080
- package: pkg,
14081
- module: mod3,
14082
- function: fn,
14083
- typeArguments: transaction.typeArguments,
14084
- arguments: transaction.arguments.map((arg) => parseV1TransactionArgument(arg))
14085
- } };
14086
- }
14087
- case "Publish":
14088
- return { Publish: {
14089
- modules: transaction.modules.map((mod3) => toBase64(Uint8Array.from(mod3))),
14090
- dependencies: transaction.dependencies
14091
- } };
14092
- case "SplitCoins":
14093
- return { SplitCoins: {
14094
- coin: parseV1TransactionArgument(transaction.coin),
14095
- amounts: transaction.amounts.map((arg) => parseV1TransactionArgument(arg))
14096
- } };
14097
- case "TransferObjects":
14098
- return { TransferObjects: {
14099
- objects: transaction.objects.map((arg) => parseV1TransactionArgument(arg)),
14100
- address: parseV1TransactionArgument(transaction.address)
14101
- } };
14102
- case "Upgrade":
14103
- return { Upgrade: {
14104
- modules: transaction.modules.map((mod3) => toBase64(Uint8Array.from(mod3))),
14105
- dependencies: transaction.dependencies,
14106
- package: transaction.packageId,
14107
- ticket: parseV1TransactionArgument(transaction.ticket)
14108
- } };
14109
- }
14110
- throw new Error(`Unknown transaction ${Object.keys(transaction)}`);
14111
- })
14112
- });
14113
- }
14114
- function parseV1TransactionArgument(arg) {
14115
- switch (arg.kind) {
14116
- case "GasCoin":
14117
- return { GasCoin: true };
14118
- case "Result":
14119
- return { Result: arg.index };
14120
- case "NestedResult":
14121
- return { NestedResult: [arg.index, arg.resultIndex] };
14122
- case "Input":
14123
- return { Input: arg.index };
14124
- }
14125
- }
14126
- var ObjectRef;
14127
- var ObjectArg2;
14128
- var NormalizedCallArg2;
14129
- var TransactionInput;
14130
- var TransactionArgumentTypes;
14131
- var init_v1 = __esm({
14132
- "../../node_modules/.pnpm/@mysten+sui@2.17.0_typescript@5.9.3/node_modules/@mysten/sui/dist/transactions/data/v1.mjs"() {
14133
- init_type_tag_serializer();
14134
- init_internal();
14135
- init_dist2();
14136
- init_dist3();
14137
- ObjectRef = /* @__PURE__ */ object3({
14138
- digest: /* @__PURE__ */ string3(),
14139
- objectId: /* @__PURE__ */ string3(),
14140
- version: /* @__PURE__ */ union2([
14141
- /* @__PURE__ */ pipe2(/* @__PURE__ */ number3(), /* @__PURE__ */ integer2()),
14142
- /* @__PURE__ */ string3(),
14143
- /* @__PURE__ */ bigint2()
14144
- ])
14145
- });
14146
- ObjectArg2 = safeEnum({
14147
- ImmOrOwned: ObjectRef,
14148
- Shared: /* @__PURE__ */ object3({
14149
- objectId: ObjectID,
14150
- initialSharedVersion: JsonU64,
14151
- mutable: /* @__PURE__ */ boolean3()
14152
- }),
14153
- Receiving: ObjectRef
14154
- });
14155
- NormalizedCallArg2 = safeEnum({
14156
- Object: ObjectArg2,
14157
- Pure: /* @__PURE__ */ array2(/* @__PURE__ */ pipe2(/* @__PURE__ */ number3(), /* @__PURE__ */ integer2()))
14158
- });
14159
- TransactionInput = /* @__PURE__ */ union2([/* @__PURE__ */ object3({
14160
- kind: /* @__PURE__ */ literal2("Input"),
14161
- index: /* @__PURE__ */ pipe2(/* @__PURE__ */ number3(), /* @__PURE__ */ integer2()),
14162
- value: /* @__PURE__ */ unknown2(),
14163
- type: /* @__PURE__ */ optional2(/* @__PURE__ */ literal2("object"))
14164
- }), /* @__PURE__ */ object3({
14165
- kind: /* @__PURE__ */ literal2("Input"),
14166
- index: /* @__PURE__ */ pipe2(/* @__PURE__ */ number3(), /* @__PURE__ */ integer2()),
14167
- value: /* @__PURE__ */ unknown2(),
14168
- type: /* @__PURE__ */ literal2("pure")
14169
- })]);
14170
- TransactionArgumentTypes = [
14171
- TransactionInput,
14172
- /* @__PURE__ */ object3({ kind: /* @__PURE__ */ literal2("GasCoin") }),
14173
- /* @__PURE__ */ object3({
14174
- kind: /* @__PURE__ */ literal2("Result"),
14175
- index: /* @__PURE__ */ pipe2(/* @__PURE__ */ number3(), /* @__PURE__ */ integer2())
14176
- }),
14177
- /* @__PURE__ */ object3({
14178
- kind: /* @__PURE__ */ literal2("NestedResult"),
14179
- index: /* @__PURE__ */ pipe2(/* @__PURE__ */ number3(), /* @__PURE__ */ integer2()),
14180
- resultIndex: /* @__PURE__ */ pipe2(/* @__PURE__ */ number3(), /* @__PURE__ */ integer2())
14181
- })
14182
- ];
14183
- /* @__PURE__ */ union2([...TransactionArgumentTypes]);
14184
- }
14185
- });
14186
- function isBytes2(a) {
14187
- return a instanceof Uint8Array || ArrayBuffer.isView(a) && a.constructor.name === "Uint8Array";
14188
- }
14189
- function anumber2(n, title = "") {
14190
- if (!Number.isSafeInteger(n) || n < 0) {
14191
- const prefix = title && `"${title}" `;
14192
- throw new Error(`${prefix}expected integer >= 0, got ${n}`);
14193
- }
12950
+ function anumber2(n, title = "") {
12951
+ if (!Number.isSafeInteger(n) || n < 0) {
12952
+ const prefix = title && `"${title}" `;
12953
+ throw new Error(`${prefix}expected integer >= 0, got ${n}`);
12954
+ }
14194
12955
  }
14195
12956
  function abytes(value, length, title = "") {
14196
12957
  const bytes = isBytes2(value);
@@ -14336,7 +13097,7 @@ var hasHexBuiltin;
14336
13097
  var hexes;
14337
13098
  var asciis;
14338
13099
  var oidNist;
14339
- var init_utils3 = __esm({
13100
+ var init_utils2 = __esm({
14340
13101
  "../../node_modules/.pnpm/@noble+hashes@2.0.1/node_modules/@noble/hashes/utils.js"() {
14341
13102
  isLE = /* @__PURE__ */ (() => new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68)();
14342
13103
  swap8IfBE = isLE ? (n) => n : (n) => byteSwap(n);
@@ -14620,7 +13381,7 @@ var HashMD;
14620
13381
  var SHA512_IV;
14621
13382
  var init_md = __esm({
14622
13383
  "../../node_modules/.pnpm/@noble+hashes@2.0.1/node_modules/@noble/hashes/_md.js"() {
14623
- init_utils3();
13384
+ init_utils2();
14624
13385
  HashMD = class {
14625
13386
  blockLen;
14626
13387
  outputLen;
@@ -14716,375 +13477,1660 @@ var init_md = __esm({
14716
13477
  return this._cloneInto();
14717
13478
  }
14718
13479
  };
14719
- SHA512_IV = /* @__PURE__ */ Uint32Array.from([
14720
- 1779033703,
14721
- 4089235720,
14722
- 3144134277,
14723
- 2227873595,
14724
- 1013904242,
14725
- 4271175723,
14726
- 2773480762,
14727
- 1595750129,
14728
- 1359893119,
14729
- 2917565137,
14730
- 2600822924,
14731
- 725511199,
14732
- 528734635,
14733
- 4215389547,
14734
- 1541459225,
14735
- 327033209
14736
- ]);
13480
+ SHA512_IV = /* @__PURE__ */ Uint32Array.from([
13481
+ 1779033703,
13482
+ 4089235720,
13483
+ 3144134277,
13484
+ 2227873595,
13485
+ 1013904242,
13486
+ 4271175723,
13487
+ 2773480762,
13488
+ 1595750129,
13489
+ 1359893119,
13490
+ 2917565137,
13491
+ 2600822924,
13492
+ 725511199,
13493
+ 528734635,
13494
+ 4215389547,
13495
+ 1541459225,
13496
+ 327033209
13497
+ ]);
13498
+ }
13499
+ });
13500
+ function fromBig(n, le = false) {
13501
+ if (le)
13502
+ return { h: Number(n & U32_MASK64), l: Number(n >> _32n & U32_MASK64) };
13503
+ return { h: Number(n >> _32n & U32_MASK64) | 0, l: Number(n & U32_MASK64) | 0 };
13504
+ }
13505
+ function split(lst, le = false) {
13506
+ const len = lst.length;
13507
+ let Ah = new Uint32Array(len);
13508
+ let Al = new Uint32Array(len);
13509
+ for (let i = 0; i < len; i++) {
13510
+ const { h, l: l2 } = fromBig(lst[i], le);
13511
+ [Ah[i], Al[i]] = [h, l2];
13512
+ }
13513
+ return [Ah, Al];
13514
+ }
13515
+ function add(Ah, Al, Bh, Bl) {
13516
+ const l2 = (Al >>> 0) + (Bl >>> 0);
13517
+ return { h: Ah + Bh + (l2 / 2 ** 32 | 0) | 0, l: l2 | 0 };
13518
+ }
13519
+ var U32_MASK64;
13520
+ var _32n;
13521
+ var shrSH;
13522
+ var shrSL;
13523
+ var rotrSH;
13524
+ var rotrSL;
13525
+ var rotrBH;
13526
+ var rotrBL;
13527
+ var rotr32H;
13528
+ var rotr32L;
13529
+ var add3L;
13530
+ var add3H;
13531
+ var add4L;
13532
+ var add4H;
13533
+ var add5L;
13534
+ var add5H;
13535
+ var init_u64 = __esm({
13536
+ "../../node_modules/.pnpm/@noble+hashes@2.0.1/node_modules/@noble/hashes/_u64.js"() {
13537
+ U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1);
13538
+ _32n = /* @__PURE__ */ BigInt(32);
13539
+ shrSH = (h, _l, s) => h >>> s;
13540
+ shrSL = (h, l2, s) => h << 32 - s | l2 >>> s;
13541
+ rotrSH = (h, l2, s) => h >>> s | l2 << 32 - s;
13542
+ rotrSL = (h, l2, s) => h << 32 - s | l2 >>> s;
13543
+ rotrBH = (h, l2, s) => h << 64 - s | l2 >>> s - 32;
13544
+ rotrBL = (h, l2, s) => h >>> s - 32 | l2 << 64 - s;
13545
+ rotr32H = (_h, l2) => l2;
13546
+ rotr32L = (h, _l) => h;
13547
+ add3L = (Al, Bl, Cl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0);
13548
+ add3H = (low, Ah, Bh, Ch) => Ah + Bh + Ch + (low / 2 ** 32 | 0) | 0;
13549
+ add4L = (Al, Bl, Cl, Dl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0);
13550
+ add4H = (low, Ah, Bh, Ch, Dh) => Ah + Bh + Ch + Dh + (low / 2 ** 32 | 0) | 0;
13551
+ add5L = (Al, Bl, Cl, Dl, El) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0) + (El >>> 0);
13552
+ add5H = (low, Ah, Bh, Ch, Dh, Eh) => Ah + Bh + Ch + Dh + Eh + (low / 2 ** 32 | 0) | 0;
13553
+ }
13554
+ });
13555
+ function G1b(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: rotr32H(Dh, Dl), Dl: rotr32L(Dh, Dl) });
13566
+ ({ h: Ch, l: Cl } = add(Ch, Cl, Dh, Dl));
13567
+ ({ Bh, Bl } = { Bh: Bh ^ Ch, Bl: Bl ^ Cl });
13568
+ ({ Bh, Bl } = { Bh: rotrSH(Bh, Bl, 24), Bl: rotrSL(Bh, Bl, 24) });
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 G2b(a, b, c, d, msg, x) {
13575
+ const Xl = msg[x], Xh = msg[x + 1];
13576
+ let Al = BBUF[2 * a], Ah = BBUF[2 * a + 1];
13577
+ let Bl = BBUF[2 * b], Bh = BBUF[2 * b + 1];
13578
+ let Cl = BBUF[2 * c], Ch = BBUF[2 * c + 1];
13579
+ let Dl = BBUF[2 * d], Dh = BBUF[2 * d + 1];
13580
+ let ll = add3L(Al, Bl, Xl);
13581
+ Ah = add3H(ll, Ah, Bh, Xh);
13582
+ Al = ll | 0;
13583
+ ({ Dh, Dl } = { Dh: Dh ^ Ah, Dl: Dl ^ Al });
13584
+ ({ Dh, Dl } = { Dh: rotrSH(Dh, Dl, 16), Dl: rotrSL(Dh, Dl, 16) });
13585
+ ({ h: Ch, l: Cl } = add(Ch, Cl, Dh, Dl));
13586
+ ({ Bh, Bl } = { Bh: Bh ^ Ch, Bl: Bl ^ Cl });
13587
+ ({ Bh, Bl } = { Bh: rotrBH(Bh, Bl, 63), Bl: rotrBL(Bh, Bl, 63) });
13588
+ BBUF[2 * a] = Al, BBUF[2 * a + 1] = Ah;
13589
+ BBUF[2 * b] = Bl, BBUF[2 * b + 1] = Bh;
13590
+ BBUF[2 * c] = Cl, BBUF[2 * c + 1] = Ch;
13591
+ BBUF[2 * d] = Dl, BBUF[2 * d + 1] = Dh;
13592
+ }
13593
+ function checkBlake2Opts(outputLen, opts = {}, keyLen, saltLen, persLen) {
13594
+ anumber2(keyLen);
13595
+ if (outputLen < 0 || outputLen > keyLen)
13596
+ throw new Error("outputLen bigger than keyLen");
13597
+ const { key, salt, personalization } = opts;
13598
+ if (key !== void 0 && (key.length < 1 || key.length > keyLen))
13599
+ throw new Error('"key" expected to be undefined or of length=1..' + keyLen);
13600
+ if (salt !== void 0)
13601
+ abytes(salt, saltLen, "salt");
13602
+ if (personalization !== void 0)
13603
+ abytes(personalization, persLen, "personalization");
13604
+ }
13605
+ var B2B_IV;
13606
+ var BBUF;
13607
+ var _BLAKE2;
13608
+ var _BLAKE2b;
13609
+ var blake2b;
13610
+ var init_blake2 = __esm({
13611
+ "../../node_modules/.pnpm/@noble+hashes@2.0.1/node_modules/@noble/hashes/blake2.js"() {
13612
+ init_blake();
13613
+ init_u64();
13614
+ init_utils2();
13615
+ B2B_IV = /* @__PURE__ */ Uint32Array.from([
13616
+ 4089235720,
13617
+ 1779033703,
13618
+ 2227873595,
13619
+ 3144134277,
13620
+ 4271175723,
13621
+ 1013904242,
13622
+ 1595750129,
13623
+ 2773480762,
13624
+ 2917565137,
13625
+ 1359893119,
13626
+ 725511199,
13627
+ 2600822924,
13628
+ 4215389547,
13629
+ 528734635,
13630
+ 327033209,
13631
+ 1541459225
13632
+ ]);
13633
+ BBUF = /* @__PURE__ */ new Uint32Array(32);
13634
+ _BLAKE2 = class {
13635
+ buffer;
13636
+ buffer32;
13637
+ finished = false;
13638
+ destroyed = false;
13639
+ length = 0;
13640
+ pos = 0;
13641
+ blockLen;
13642
+ outputLen;
13643
+ constructor(blockLen, outputLen) {
13644
+ anumber2(blockLen);
13645
+ anumber2(outputLen);
13646
+ this.blockLen = blockLen;
13647
+ this.outputLen = outputLen;
13648
+ this.buffer = new Uint8Array(blockLen);
13649
+ this.buffer32 = u32(this.buffer);
13650
+ }
13651
+ update(data) {
13652
+ aexists(this);
13653
+ abytes(data);
13654
+ const { blockLen, buffer, buffer32 } = this;
13655
+ const len = data.length;
13656
+ const offset = data.byteOffset;
13657
+ const buf = data.buffer;
13658
+ for (let pos = 0; pos < len; ) {
13659
+ if (this.pos === blockLen) {
13660
+ swap32IfBE(buffer32);
13661
+ this.compress(buffer32, 0, false);
13662
+ swap32IfBE(buffer32);
13663
+ this.pos = 0;
13664
+ }
13665
+ const take = Math.min(blockLen - this.pos, len - pos);
13666
+ const dataOffset = offset + pos;
13667
+ if (take === blockLen && !(dataOffset % 4) && pos + take < len) {
13668
+ const data32 = new Uint32Array(buf, dataOffset, Math.floor((len - pos) / 4));
13669
+ swap32IfBE(data32);
13670
+ for (let pos32 = 0; pos + blockLen < len; pos32 += buffer32.length, pos += blockLen) {
13671
+ this.length += blockLen;
13672
+ this.compress(data32, pos32, false);
13673
+ }
13674
+ swap32IfBE(data32);
13675
+ continue;
13676
+ }
13677
+ buffer.set(data.subarray(pos, pos + take), this.pos);
13678
+ this.pos += take;
13679
+ this.length += take;
13680
+ pos += take;
13681
+ }
13682
+ return this;
13683
+ }
13684
+ digestInto(out) {
13685
+ aexists(this);
13686
+ aoutput(out, this);
13687
+ const { pos, buffer32 } = this;
13688
+ this.finished = true;
13689
+ clean(this.buffer.subarray(pos));
13690
+ swap32IfBE(buffer32);
13691
+ this.compress(buffer32, 0, true);
13692
+ swap32IfBE(buffer32);
13693
+ const out32 = u32(out);
13694
+ this.get().forEach((v, i) => out32[i] = swap8IfBE(v));
13695
+ }
13696
+ digest() {
13697
+ const { buffer, outputLen } = this;
13698
+ this.digestInto(buffer);
13699
+ const res = buffer.slice(0, outputLen);
13700
+ this.destroy();
13701
+ return res;
13702
+ }
13703
+ _cloneInto(to) {
13704
+ const { buffer, length, finished, destroyed, outputLen, pos } = this;
13705
+ to ||= new this.constructor({ dkLen: outputLen });
13706
+ to.set(...this.get());
13707
+ to.buffer.set(buffer);
13708
+ to.destroyed = destroyed;
13709
+ to.finished = finished;
13710
+ to.length = length;
13711
+ to.pos = pos;
13712
+ to.outputLen = outputLen;
13713
+ return to;
13714
+ }
13715
+ clone() {
13716
+ return this._cloneInto();
13717
+ }
13718
+ };
13719
+ _BLAKE2b = class extends _BLAKE2 {
13720
+ // Same as SHA-512, but LE
13721
+ v0l = B2B_IV[0] | 0;
13722
+ v0h = B2B_IV[1] | 0;
13723
+ v1l = B2B_IV[2] | 0;
13724
+ v1h = B2B_IV[3] | 0;
13725
+ v2l = B2B_IV[4] | 0;
13726
+ v2h = B2B_IV[5] | 0;
13727
+ v3l = B2B_IV[6] | 0;
13728
+ v3h = B2B_IV[7] | 0;
13729
+ v4l = B2B_IV[8] | 0;
13730
+ v4h = B2B_IV[9] | 0;
13731
+ v5l = B2B_IV[10] | 0;
13732
+ v5h = B2B_IV[11] | 0;
13733
+ v6l = B2B_IV[12] | 0;
13734
+ v6h = B2B_IV[13] | 0;
13735
+ v7l = B2B_IV[14] | 0;
13736
+ v7h = B2B_IV[15] | 0;
13737
+ constructor(opts = {}) {
13738
+ const olen = opts.dkLen === void 0 ? 64 : opts.dkLen;
13739
+ super(128, olen);
13740
+ checkBlake2Opts(olen, opts, 64, 16, 16);
13741
+ let { key, personalization, salt } = opts;
13742
+ let keyLength = 0;
13743
+ if (key !== void 0) {
13744
+ abytes(key, void 0, "key");
13745
+ keyLength = key.length;
13746
+ }
13747
+ this.v0l ^= this.outputLen | keyLength << 8 | 1 << 16 | 1 << 24;
13748
+ if (salt !== void 0) {
13749
+ abytes(salt, void 0, "salt");
13750
+ const slt = u32(salt);
13751
+ this.v4l ^= swap8IfBE(slt[0]);
13752
+ this.v4h ^= swap8IfBE(slt[1]);
13753
+ this.v5l ^= swap8IfBE(slt[2]);
13754
+ this.v5h ^= swap8IfBE(slt[3]);
13755
+ }
13756
+ if (personalization !== void 0) {
13757
+ abytes(personalization, void 0, "personalization");
13758
+ const pers = u32(personalization);
13759
+ this.v6l ^= swap8IfBE(pers[0]);
13760
+ this.v6h ^= swap8IfBE(pers[1]);
13761
+ this.v7l ^= swap8IfBE(pers[2]);
13762
+ this.v7h ^= swap8IfBE(pers[3]);
13763
+ }
13764
+ if (key !== void 0) {
13765
+ const tmp = new Uint8Array(this.blockLen);
13766
+ tmp.set(key);
13767
+ this.update(tmp);
13768
+ }
13769
+ }
13770
+ // prettier-ignore
13771
+ get() {
13772
+ let { v0l, v0h, v1l, v1h, v2l, v2h, v3l, v3h, v4l, v4h, v5l, v5h, v6l, v6h, v7l, v7h } = this;
13773
+ return [v0l, v0h, v1l, v1h, v2l, v2h, v3l, v3h, v4l, v4h, v5l, v5h, v6l, v6h, v7l, v7h];
13774
+ }
13775
+ // prettier-ignore
13776
+ set(v0l, v0h, v1l, v1h, v2l, v2h, v3l, v3h, v4l, v4h, v5l, v5h, v6l, v6h, v7l, v7h) {
13777
+ this.v0l = v0l | 0;
13778
+ this.v0h = v0h | 0;
13779
+ this.v1l = v1l | 0;
13780
+ this.v1h = v1h | 0;
13781
+ this.v2l = v2l | 0;
13782
+ this.v2h = v2h | 0;
13783
+ this.v3l = v3l | 0;
13784
+ this.v3h = v3h | 0;
13785
+ this.v4l = v4l | 0;
13786
+ this.v4h = v4h | 0;
13787
+ this.v5l = v5l | 0;
13788
+ this.v5h = v5h | 0;
13789
+ this.v6l = v6l | 0;
13790
+ this.v6h = v6h | 0;
13791
+ this.v7l = v7l | 0;
13792
+ this.v7h = v7h | 0;
13793
+ }
13794
+ compress(msg, offset, isLast) {
13795
+ this.get().forEach((v, i) => BBUF[i] = v);
13796
+ BBUF.set(B2B_IV, 16);
13797
+ let { h, l: l2 } = fromBig(BigInt(this.length));
13798
+ BBUF[24] = B2B_IV[8] ^ l2;
13799
+ BBUF[25] = B2B_IV[9] ^ h;
13800
+ if (isLast) {
13801
+ BBUF[28] = ~BBUF[28];
13802
+ BBUF[29] = ~BBUF[29];
13803
+ }
13804
+ let j = 0;
13805
+ const s = BSIGMA;
13806
+ for (let i = 0; i < 12; i++) {
13807
+ G1b(0, 4, 8, 12, msg, offset + 2 * s[j++]);
13808
+ G2b(0, 4, 8, 12, msg, offset + 2 * s[j++]);
13809
+ G1b(1, 5, 9, 13, msg, offset + 2 * s[j++]);
13810
+ G2b(1, 5, 9, 13, msg, offset + 2 * s[j++]);
13811
+ G1b(2, 6, 10, 14, msg, offset + 2 * s[j++]);
13812
+ G2b(2, 6, 10, 14, msg, offset + 2 * s[j++]);
13813
+ G1b(3, 7, 11, 15, msg, offset + 2 * s[j++]);
13814
+ G2b(3, 7, 11, 15, msg, offset + 2 * s[j++]);
13815
+ G1b(0, 5, 10, 15, msg, offset + 2 * s[j++]);
13816
+ G2b(0, 5, 10, 15, msg, offset + 2 * s[j++]);
13817
+ G1b(1, 6, 11, 12, msg, offset + 2 * s[j++]);
13818
+ G2b(1, 6, 11, 12, msg, offset + 2 * s[j++]);
13819
+ G1b(2, 7, 8, 13, msg, offset + 2 * s[j++]);
13820
+ G2b(2, 7, 8, 13, msg, offset + 2 * s[j++]);
13821
+ G1b(3, 4, 9, 14, msg, offset + 2 * s[j++]);
13822
+ G2b(3, 4, 9, 14, msg, offset + 2 * s[j++]);
13823
+ }
13824
+ this.v0l ^= BBUF[0] ^ BBUF[16];
13825
+ this.v0h ^= BBUF[1] ^ BBUF[17];
13826
+ this.v1l ^= BBUF[2] ^ BBUF[18];
13827
+ this.v1h ^= BBUF[3] ^ BBUF[19];
13828
+ this.v2l ^= BBUF[4] ^ BBUF[20];
13829
+ this.v2h ^= BBUF[5] ^ BBUF[21];
13830
+ this.v3l ^= BBUF[6] ^ BBUF[22];
13831
+ this.v3h ^= BBUF[7] ^ BBUF[23];
13832
+ this.v4l ^= BBUF[8] ^ BBUF[24];
13833
+ this.v4h ^= BBUF[9] ^ BBUF[25];
13834
+ this.v5l ^= BBUF[10] ^ BBUF[26];
13835
+ this.v5h ^= BBUF[11] ^ BBUF[27];
13836
+ this.v6l ^= BBUF[12] ^ BBUF[28];
13837
+ this.v6h ^= BBUF[13] ^ BBUF[29];
13838
+ this.v7l ^= BBUF[14] ^ BBUF[30];
13839
+ this.v7h ^= BBUF[15] ^ BBUF[31];
13840
+ clean(BBUF);
13841
+ }
13842
+ destroy() {
13843
+ this.destroyed = true;
13844
+ clean(this.buffer32);
13845
+ this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
13846
+ }
13847
+ };
13848
+ blake2b = /* @__PURE__ */ createHasher((opts) => new _BLAKE2b(opts));
13849
+ }
13850
+ });
13851
+ function deriveDynamicFieldID(parentId, typeTag, key) {
13852
+ const address = suiBcs.Address.serialize(parentId).toBytes();
13853
+ const tag2 = suiBcs.TypeTag.serialize(typeTag).toBytes();
13854
+ const keyLength = suiBcs.u64().serialize(key.length).toBytes();
13855
+ const hash = blake2b.create({ dkLen: 32 });
13856
+ hash.update(new Uint8Array([240]));
13857
+ hash.update(address);
13858
+ hash.update(keyLength);
13859
+ hash.update(key);
13860
+ hash.update(tag2);
13861
+ return `0x${toHex(hash.digest().slice(0, 32))}`;
13862
+ }
13863
+ var init_dynamic_fields = __esm({
13864
+ "../../node_modules/.pnpm/@mysten+sui@2.17.0_typescript@5.9.3/node_modules/@mysten/sui/dist/utils/dynamic-fields.mjs"() {
13865
+ init_bcs3();
13866
+ init_dist2();
13867
+ init_blake2();
13868
+ }
13869
+ });
13870
+ var MOVE_STDLIB_ADDRESS;
13871
+ var SUI_FRAMEWORK_ADDRESS;
13872
+ var SUI_CLOCK_OBJECT_ID;
13873
+ var SUI_TYPE_ARG;
13874
+ var SUI_SYSTEM_STATE_OBJECT_ID;
13875
+ var SUI_RANDOM_OBJECT_ID;
13876
+ var SUI_DENY_LIST_OBJECT_ID;
13877
+ var init_constants = __esm({
13878
+ "../../node_modules/.pnpm/@mysten+sui@2.17.0_typescript@5.9.3/node_modules/@mysten/sui/dist/utils/constants.mjs"() {
13879
+ BigInt(1e9);
13880
+ MOVE_STDLIB_ADDRESS = "0x0000000000000000000000000000000000000000000000000000000000000001";
13881
+ SUI_FRAMEWORK_ADDRESS = "0x0000000000000000000000000000000000000000000000000000000000000002";
13882
+ SUI_CLOCK_OBJECT_ID = "0x0000000000000000000000000000000000000000000000000000000000000006";
13883
+ SUI_TYPE_ARG = `${SUI_FRAMEWORK_ADDRESS}::sui::SUI`;
13884
+ SUI_SYSTEM_STATE_OBJECT_ID = "0x0000000000000000000000000000000000000000000000000000000000000005";
13885
+ SUI_RANDOM_OBJECT_ID = "0x0000000000000000000000000000000000000000000000000000000000000008";
13886
+ SUI_DENY_LIST_OBJECT_ID = "0x0000000000000000000000000000000000000000000000000000000000000403";
13887
+ }
13888
+ });
13889
+ var init_utils3 = __esm({
13890
+ "../../node_modules/.pnpm/@mysten+sui@2.17.0_typescript@5.9.3/node_modules/@mysten/sui/dist/utils/index.mjs"() {
13891
+ init_move_registry();
13892
+ init_sui_types();
13893
+ init_constants();
13894
+ init_dist2();
13895
+ }
13896
+ });
13897
+ // @__NO_SIDE_EFFECTS__
13898
+ function getGlobalConfig(config$1) {
13899
+ return {
13900
+ lang: config$1?.lang ?? store$4?.lang,
13901
+ message: config$1?.message,
13902
+ abortEarly: config$1?.abortEarly ?? store$4?.abortEarly,
13903
+ abortPipeEarly: config$1?.abortPipeEarly ?? store$4?.abortPipeEarly
13904
+ };
13905
+ }
13906
+ // @__NO_SIDE_EFFECTS__
13907
+ function getGlobalMessage(lang) {
13908
+ return store$3?.get(lang);
13909
+ }
13910
+ // @__NO_SIDE_EFFECTS__
13911
+ function getSchemaMessage(lang) {
13912
+ return store$2?.get(lang);
13913
+ }
13914
+ // @__NO_SIDE_EFFECTS__
13915
+ function getSpecificMessage(reference, lang) {
13916
+ return store$1?.get(reference)?.get(lang);
13917
+ }
13918
+ // @__NO_SIDE_EFFECTS__
13919
+ function _stringify(input) {
13920
+ const type = typeof input;
13921
+ if (type === "string") return `"${input}"`;
13922
+ if (type === "number" || type === "bigint" || type === "boolean") return `${input}`;
13923
+ if (type === "object" || type === "function") return (input && Object.getPrototypeOf(input)?.constructor?.name) ?? "null";
13924
+ return type;
13925
+ }
13926
+ function _addIssue(context, label, dataset, config$1, other) {
13927
+ const input = other && "input" in other ? other.input : dataset.value;
13928
+ const expected = other?.expected ?? context.expects ?? null;
13929
+ const received = other?.received ?? /* @__PURE__ */ _stringify(input);
13930
+ const issue2 = {
13931
+ kind: context.kind,
13932
+ type: context.type,
13933
+ input,
13934
+ expected,
13935
+ received,
13936
+ message: `Invalid ${label}: ${expected ? `Expected ${expected} but r` : "R"}eceived ${received}`,
13937
+ requirement: context.requirement,
13938
+ path: other?.path,
13939
+ issues: other?.issues,
13940
+ lang: config$1.lang,
13941
+ abortEarly: config$1.abortEarly,
13942
+ abortPipeEarly: config$1.abortPipeEarly
13943
+ };
13944
+ const isSchema = context.kind === "schema";
13945
+ 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);
13946
+ if (message$1 !== void 0) issue2.message = typeof message$1 === "function" ? message$1(issue2) : message$1;
13947
+ if (isSchema) dataset.typed = false;
13948
+ if (dataset.issues) dataset.issues.push(issue2);
13949
+ else dataset.issues = [issue2];
13950
+ }
13951
+ // @__NO_SIDE_EFFECTS__
13952
+ function _getStandardProps(context) {
13953
+ return {
13954
+ version: 1,
13955
+ vendor: "valibot",
13956
+ validate(value$1) {
13957
+ return context["~run"]({ value: value$1 }, /* @__PURE__ */ getGlobalConfig());
13958
+ }
13959
+ };
13960
+ }
13961
+ // @__NO_SIDE_EFFECTS__
13962
+ function _isValidObjectKey(object$1, key) {
13963
+ return Object.hasOwn(object$1, key) && key !== "__proto__" && key !== "prototype" && key !== "constructor";
13964
+ }
13965
+ // @__NO_SIDE_EFFECTS__
13966
+ function _joinExpects(values$1, separator) {
13967
+ const list = [...new Set(values$1)];
13968
+ if (list.length > 1) return `(${list.join(` ${separator} `)})`;
13969
+ return list[0] ?? "never";
13970
+ }
13971
+ // @__NO_SIDE_EFFECTS__
13972
+ function check2(requirement, message$1) {
13973
+ return {
13974
+ kind: "validation",
13975
+ type: "check",
13976
+ reference: check2,
13977
+ async: false,
13978
+ expects: null,
13979
+ requirement,
13980
+ message: message$1,
13981
+ "~run"(dataset, config$1) {
13982
+ if (dataset.typed && !this.requirement(dataset.value)) _addIssue(this, "input", dataset, config$1);
13983
+ return dataset;
13984
+ }
13985
+ };
13986
+ }
13987
+ // @__NO_SIDE_EFFECTS__
13988
+ function integer2(message$1) {
13989
+ return {
13990
+ kind: "validation",
13991
+ type: "integer",
13992
+ reference: integer2,
13993
+ async: false,
13994
+ expects: null,
13995
+ requirement: Number.isInteger,
13996
+ message: message$1,
13997
+ "~run"(dataset, config$1) {
13998
+ if (dataset.typed && !this.requirement(dataset.value)) _addIssue(this, "integer", dataset, config$1);
13999
+ return dataset;
14000
+ }
14001
+ };
14002
+ }
14003
+ // @__NO_SIDE_EFFECTS__
14004
+ function transform2(operation) {
14005
+ return {
14006
+ kind: "transformation",
14007
+ type: "transform",
14008
+ reference: transform2,
14009
+ async: false,
14010
+ operation,
14011
+ "~run"(dataset) {
14012
+ dataset.value = this.operation(dataset.value);
14013
+ return dataset;
14014
+ }
14015
+ };
14016
+ }
14017
+ // @__NO_SIDE_EFFECTS__
14018
+ function getFallback(schema, dataset, config$1) {
14019
+ return typeof schema.fallback === "function" ? schema.fallback(dataset, config$1) : schema.fallback;
14020
+ }
14021
+ // @__NO_SIDE_EFFECTS__
14022
+ function getDefault(schema, dataset, config$1) {
14023
+ return typeof schema.default === "function" ? schema.default(dataset, config$1) : schema.default;
14024
+ }
14025
+ // @__NO_SIDE_EFFECTS__
14026
+ function is(schema, input) {
14027
+ return !schema["~run"]({ value: input }, { abortEarly: true }).issues;
14028
+ }
14029
+ // @__NO_SIDE_EFFECTS__
14030
+ function array2(item, message$1) {
14031
+ return {
14032
+ kind: "schema",
14033
+ type: "array",
14034
+ reference: array2,
14035
+ expects: "Array",
14036
+ async: false,
14037
+ item,
14038
+ message: message$1,
14039
+ get "~standard"() {
14040
+ return /* @__PURE__ */ _getStandardProps(this);
14041
+ },
14042
+ "~run"(dataset, config$1) {
14043
+ const input = dataset.value;
14044
+ if (Array.isArray(input)) {
14045
+ dataset.typed = true;
14046
+ dataset.value = [];
14047
+ for (let key = 0; key < input.length; key++) {
14048
+ const value$1 = input[key];
14049
+ const itemDataset = this.item["~run"]({ value: value$1 }, config$1);
14050
+ if (itemDataset.issues) {
14051
+ const pathItem = {
14052
+ type: "array",
14053
+ origin: "value",
14054
+ input,
14055
+ key,
14056
+ value: value$1
14057
+ };
14058
+ for (const issue2 of itemDataset.issues) {
14059
+ if (issue2.path) issue2.path.unshift(pathItem);
14060
+ else issue2.path = [pathItem];
14061
+ dataset.issues?.push(issue2);
14062
+ }
14063
+ if (!dataset.issues) dataset.issues = itemDataset.issues;
14064
+ if (config$1.abortEarly) {
14065
+ dataset.typed = false;
14066
+ break;
14067
+ }
14068
+ }
14069
+ if (!itemDataset.typed) dataset.typed = false;
14070
+ dataset.value.push(itemDataset.value);
14071
+ }
14072
+ } else _addIssue(this, "type", dataset, config$1);
14073
+ return dataset;
14074
+ }
14075
+ };
14076
+ }
14077
+ // @__NO_SIDE_EFFECTS__
14078
+ function bigint2(message$1) {
14079
+ return {
14080
+ kind: "schema",
14081
+ type: "bigint",
14082
+ reference: bigint2,
14083
+ expects: "bigint",
14084
+ async: false,
14085
+ message: message$1,
14086
+ get "~standard"() {
14087
+ return /* @__PURE__ */ _getStandardProps(this);
14088
+ },
14089
+ "~run"(dataset, config$1) {
14090
+ if (typeof dataset.value === "bigint") dataset.typed = true;
14091
+ else _addIssue(this, "type", dataset, config$1);
14092
+ return dataset;
14093
+ }
14094
+ };
14095
+ }
14096
+ // @__NO_SIDE_EFFECTS__
14097
+ function boolean3(message$1) {
14098
+ return {
14099
+ kind: "schema",
14100
+ type: "boolean",
14101
+ reference: boolean3,
14102
+ expects: "boolean",
14103
+ async: false,
14104
+ message: message$1,
14105
+ get "~standard"() {
14106
+ return /* @__PURE__ */ _getStandardProps(this);
14107
+ },
14108
+ "~run"(dataset, config$1) {
14109
+ if (typeof dataset.value === "boolean") dataset.typed = true;
14110
+ else _addIssue(this, "type", dataset, config$1);
14111
+ return dataset;
14112
+ }
14113
+ };
14114
+ }
14115
+ // @__NO_SIDE_EFFECTS__
14116
+ function lazy(getter) {
14117
+ return {
14118
+ kind: "schema",
14119
+ type: "lazy",
14120
+ reference: lazy,
14121
+ expects: "unknown",
14122
+ async: false,
14123
+ getter,
14124
+ get "~standard"() {
14125
+ return /* @__PURE__ */ _getStandardProps(this);
14126
+ },
14127
+ "~run"(dataset, config$1) {
14128
+ return this.getter(dataset.value)["~run"](dataset, config$1);
14129
+ }
14130
+ };
14131
+ }
14132
+ // @__NO_SIDE_EFFECTS__
14133
+ function literal2(literal_, message$1) {
14134
+ return {
14135
+ kind: "schema",
14136
+ type: "literal",
14137
+ reference: literal2,
14138
+ expects: /* @__PURE__ */ _stringify(literal_),
14139
+ async: false,
14140
+ literal: literal_,
14141
+ message: message$1,
14142
+ get "~standard"() {
14143
+ return /* @__PURE__ */ _getStandardProps(this);
14144
+ },
14145
+ "~run"(dataset, config$1) {
14146
+ if (dataset.value === this.literal) dataset.typed = true;
14147
+ else _addIssue(this, "type", dataset, config$1);
14148
+ return dataset;
14149
+ }
14150
+ };
14151
+ }
14152
+ // @__NO_SIDE_EFFECTS__
14153
+ function nullable2(wrapped, default_) {
14154
+ return {
14155
+ kind: "schema",
14156
+ type: "nullable",
14157
+ reference: nullable2,
14158
+ expects: `(${wrapped.expects} | null)`,
14159
+ async: false,
14160
+ wrapped,
14161
+ default: default_,
14162
+ get "~standard"() {
14163
+ return /* @__PURE__ */ _getStandardProps(this);
14164
+ },
14165
+ "~run"(dataset, config$1) {
14166
+ if (dataset.value === null) {
14167
+ if (this.default !== void 0) dataset.value = /* @__PURE__ */ getDefault(this, dataset, config$1);
14168
+ if (dataset.value === null) {
14169
+ dataset.typed = true;
14170
+ return dataset;
14171
+ }
14172
+ }
14173
+ return this.wrapped["~run"](dataset, config$1);
14174
+ }
14175
+ };
14176
+ }
14177
+ // @__NO_SIDE_EFFECTS__
14178
+ function nullish2(wrapped, default_) {
14179
+ return {
14180
+ kind: "schema",
14181
+ type: "nullish",
14182
+ reference: nullish2,
14183
+ expects: `(${wrapped.expects} | null | undefined)`,
14184
+ async: false,
14185
+ wrapped,
14186
+ default: default_,
14187
+ get "~standard"() {
14188
+ return /* @__PURE__ */ _getStandardProps(this);
14189
+ },
14190
+ "~run"(dataset, config$1) {
14191
+ if (dataset.value === null || dataset.value === void 0) {
14192
+ if (this.default !== void 0) dataset.value = /* @__PURE__ */ getDefault(this, dataset, config$1);
14193
+ if (dataset.value === null || dataset.value === void 0) {
14194
+ dataset.typed = true;
14195
+ return dataset;
14196
+ }
14197
+ }
14198
+ return this.wrapped["~run"](dataset, config$1);
14199
+ }
14200
+ };
14201
+ }
14202
+ // @__NO_SIDE_EFFECTS__
14203
+ function number3(message$1) {
14204
+ return {
14205
+ kind: "schema",
14206
+ type: "number",
14207
+ reference: number3,
14208
+ expects: "number",
14209
+ async: false,
14210
+ message: message$1,
14211
+ get "~standard"() {
14212
+ return /* @__PURE__ */ _getStandardProps(this);
14213
+ },
14214
+ "~run"(dataset, config$1) {
14215
+ if (typeof dataset.value === "number" && !isNaN(dataset.value)) dataset.typed = true;
14216
+ else _addIssue(this, "type", dataset, config$1);
14217
+ return dataset;
14218
+ }
14219
+ };
14220
+ }
14221
+ // @__NO_SIDE_EFFECTS__
14222
+ function object3(entries$1, message$1) {
14223
+ return {
14224
+ kind: "schema",
14225
+ type: "object",
14226
+ reference: object3,
14227
+ expects: "Object",
14228
+ async: false,
14229
+ entries: entries$1,
14230
+ message: message$1,
14231
+ get "~standard"() {
14232
+ return /* @__PURE__ */ _getStandardProps(this);
14233
+ },
14234
+ "~run"(dataset, config$1) {
14235
+ const input = dataset.value;
14236
+ if (input && typeof input === "object") {
14237
+ dataset.typed = true;
14238
+ dataset.value = {};
14239
+ for (const key in this.entries) {
14240
+ const valueSchema = this.entries[key];
14241
+ if (key in input || (valueSchema.type === "exact_optional" || valueSchema.type === "optional" || valueSchema.type === "nullish") && valueSchema.default !== void 0) {
14242
+ const value$1 = key in input ? input[key] : /* @__PURE__ */ getDefault(valueSchema);
14243
+ const valueDataset = valueSchema["~run"]({ value: value$1 }, config$1);
14244
+ if (valueDataset.issues) {
14245
+ const pathItem = {
14246
+ type: "object",
14247
+ origin: "value",
14248
+ input,
14249
+ key,
14250
+ value: value$1
14251
+ };
14252
+ for (const issue2 of valueDataset.issues) {
14253
+ if (issue2.path) issue2.path.unshift(pathItem);
14254
+ else issue2.path = [pathItem];
14255
+ dataset.issues?.push(issue2);
14256
+ }
14257
+ if (!dataset.issues) dataset.issues = valueDataset.issues;
14258
+ if (config$1.abortEarly) {
14259
+ dataset.typed = false;
14260
+ break;
14261
+ }
14262
+ }
14263
+ if (!valueDataset.typed) dataset.typed = false;
14264
+ dataset.value[key] = valueDataset.value;
14265
+ } else if (valueSchema.fallback !== void 0) dataset.value[key] = /* @__PURE__ */ getFallback(valueSchema);
14266
+ else if (valueSchema.type !== "exact_optional" && valueSchema.type !== "optional" && valueSchema.type !== "nullish") {
14267
+ _addIssue(this, "key", dataset, config$1, {
14268
+ input: void 0,
14269
+ expected: `"${key}"`,
14270
+ path: [{
14271
+ type: "object",
14272
+ origin: "key",
14273
+ input,
14274
+ key,
14275
+ value: input[key]
14276
+ }]
14277
+ });
14278
+ if (config$1.abortEarly) break;
14279
+ }
14280
+ }
14281
+ } else _addIssue(this, "type", dataset, config$1);
14282
+ return dataset;
14283
+ }
14284
+ };
14285
+ }
14286
+ // @__NO_SIDE_EFFECTS__
14287
+ function optional2(wrapped, default_) {
14288
+ return {
14289
+ kind: "schema",
14290
+ type: "optional",
14291
+ reference: optional2,
14292
+ expects: `(${wrapped.expects} | undefined)`,
14293
+ async: false,
14294
+ wrapped,
14295
+ default: default_,
14296
+ get "~standard"() {
14297
+ return /* @__PURE__ */ _getStandardProps(this);
14298
+ },
14299
+ "~run"(dataset, config$1) {
14300
+ if (dataset.value === void 0) {
14301
+ if (this.default !== void 0) dataset.value = /* @__PURE__ */ getDefault(this, dataset, config$1);
14302
+ if (dataset.value === void 0) {
14303
+ dataset.typed = true;
14304
+ return dataset;
14305
+ }
14306
+ }
14307
+ return this.wrapped["~run"](dataset, config$1);
14308
+ }
14309
+ };
14310
+ }
14311
+ // @__NO_SIDE_EFFECTS__
14312
+ function picklist(options, message$1) {
14313
+ return {
14314
+ kind: "schema",
14315
+ type: "picklist",
14316
+ reference: picklist,
14317
+ expects: /* @__PURE__ */ _joinExpects(options.map(_stringify), "|"),
14318
+ async: false,
14319
+ options,
14320
+ message: message$1,
14321
+ get "~standard"() {
14322
+ return /* @__PURE__ */ _getStandardProps(this);
14323
+ },
14324
+ "~run"(dataset, config$1) {
14325
+ if (this.options.includes(dataset.value)) dataset.typed = true;
14326
+ else _addIssue(this, "type", dataset, config$1);
14327
+ return dataset;
14328
+ }
14329
+ };
14330
+ }
14331
+ // @__NO_SIDE_EFFECTS__
14332
+ function record2(key, value$1, message$1) {
14333
+ return {
14334
+ kind: "schema",
14335
+ type: "record",
14336
+ reference: record2,
14337
+ expects: "Object",
14338
+ async: false,
14339
+ key,
14340
+ value: value$1,
14341
+ message: message$1,
14342
+ get "~standard"() {
14343
+ return /* @__PURE__ */ _getStandardProps(this);
14344
+ },
14345
+ "~run"(dataset, config$1) {
14346
+ const input = dataset.value;
14347
+ if (input && typeof input === "object") {
14348
+ dataset.typed = true;
14349
+ dataset.value = {};
14350
+ for (const entryKey in input) if (/* @__PURE__ */ _isValidObjectKey(input, entryKey)) {
14351
+ const entryValue = input[entryKey];
14352
+ const keyDataset = this.key["~run"]({ value: entryKey }, config$1);
14353
+ if (keyDataset.issues) {
14354
+ const pathItem = {
14355
+ type: "object",
14356
+ origin: "key",
14357
+ input,
14358
+ key: entryKey,
14359
+ value: entryValue
14360
+ };
14361
+ for (const issue2 of keyDataset.issues) {
14362
+ issue2.path = [pathItem];
14363
+ dataset.issues?.push(issue2);
14364
+ }
14365
+ if (!dataset.issues) dataset.issues = keyDataset.issues;
14366
+ if (config$1.abortEarly) {
14367
+ dataset.typed = false;
14368
+ break;
14369
+ }
14370
+ }
14371
+ const valueDataset = this.value["~run"]({ value: entryValue }, config$1);
14372
+ if (valueDataset.issues) {
14373
+ const pathItem = {
14374
+ type: "object",
14375
+ origin: "value",
14376
+ input,
14377
+ key: entryKey,
14378
+ value: entryValue
14379
+ };
14380
+ for (const issue2 of valueDataset.issues) {
14381
+ if (issue2.path) issue2.path.unshift(pathItem);
14382
+ else issue2.path = [pathItem];
14383
+ dataset.issues?.push(issue2);
14384
+ }
14385
+ if (!dataset.issues) dataset.issues = valueDataset.issues;
14386
+ if (config$1.abortEarly) {
14387
+ dataset.typed = false;
14388
+ break;
14389
+ }
14390
+ }
14391
+ if (!keyDataset.typed || !valueDataset.typed) dataset.typed = false;
14392
+ if (keyDataset.typed) dataset.value[keyDataset.value] = valueDataset.value;
14393
+ }
14394
+ } else _addIssue(this, "type", dataset, config$1);
14395
+ return dataset;
14396
+ }
14397
+ };
14398
+ }
14399
+ // @__NO_SIDE_EFFECTS__
14400
+ function string3(message$1) {
14401
+ return {
14402
+ kind: "schema",
14403
+ type: "string",
14404
+ reference: string3,
14405
+ expects: "string",
14406
+ async: false,
14407
+ message: message$1,
14408
+ get "~standard"() {
14409
+ return /* @__PURE__ */ _getStandardProps(this);
14410
+ },
14411
+ "~run"(dataset, config$1) {
14412
+ if (typeof dataset.value === "string") dataset.typed = true;
14413
+ else _addIssue(this, "type", dataset, config$1);
14414
+ return dataset;
14415
+ }
14416
+ };
14417
+ }
14418
+ // @__NO_SIDE_EFFECTS__
14419
+ function tuple(items, message$1) {
14420
+ return {
14421
+ kind: "schema",
14422
+ type: "tuple",
14423
+ reference: tuple,
14424
+ expects: "Array",
14425
+ async: false,
14426
+ items,
14427
+ message: message$1,
14428
+ get "~standard"() {
14429
+ return /* @__PURE__ */ _getStandardProps(this);
14430
+ },
14431
+ "~run"(dataset, config$1) {
14432
+ const input = dataset.value;
14433
+ if (Array.isArray(input)) {
14434
+ dataset.typed = true;
14435
+ dataset.value = [];
14436
+ for (let key = 0; key < this.items.length; key++) {
14437
+ const value$1 = input[key];
14438
+ const itemDataset = this.items[key]["~run"]({ value: value$1 }, config$1);
14439
+ if (itemDataset.issues) {
14440
+ const pathItem = {
14441
+ type: "array",
14442
+ origin: "value",
14443
+ input,
14444
+ key,
14445
+ value: value$1
14446
+ };
14447
+ for (const issue2 of itemDataset.issues) {
14448
+ if (issue2.path) issue2.path.unshift(pathItem);
14449
+ else issue2.path = [pathItem];
14450
+ dataset.issues?.push(issue2);
14451
+ }
14452
+ if (!dataset.issues) dataset.issues = itemDataset.issues;
14453
+ if (config$1.abortEarly) {
14454
+ dataset.typed = false;
14455
+ break;
14456
+ }
14457
+ }
14458
+ if (!itemDataset.typed) dataset.typed = false;
14459
+ dataset.value.push(itemDataset.value);
14460
+ }
14461
+ } else _addIssue(this, "type", dataset, config$1);
14462
+ return dataset;
14463
+ }
14464
+ };
14465
+ }
14466
+ // @__NO_SIDE_EFFECTS__
14467
+ function _subIssues(datasets) {
14468
+ let issues;
14469
+ if (datasets) for (const dataset of datasets) if (issues) issues.push(...dataset.issues);
14470
+ else issues = dataset.issues;
14471
+ return issues;
14472
+ }
14473
+ // @__NO_SIDE_EFFECTS__
14474
+ function union2(options, message$1) {
14475
+ return {
14476
+ kind: "schema",
14477
+ type: "union",
14478
+ reference: union2,
14479
+ expects: /* @__PURE__ */ _joinExpects(options.map((option2) => option2.expects), "|"),
14480
+ async: false,
14481
+ options,
14482
+ message: message$1,
14483
+ get "~standard"() {
14484
+ return /* @__PURE__ */ _getStandardProps(this);
14485
+ },
14486
+ "~run"(dataset, config$1) {
14487
+ let validDataset;
14488
+ let typedDatasets;
14489
+ let untypedDatasets;
14490
+ for (const schema of this.options) {
14491
+ const optionDataset = schema["~run"]({ value: dataset.value }, config$1);
14492
+ if (optionDataset.typed) if (optionDataset.issues) if (typedDatasets) typedDatasets.push(optionDataset);
14493
+ else typedDatasets = [optionDataset];
14494
+ else {
14495
+ validDataset = optionDataset;
14496
+ break;
14497
+ }
14498
+ else if (untypedDatasets) untypedDatasets.push(optionDataset);
14499
+ else untypedDatasets = [optionDataset];
14500
+ }
14501
+ if (validDataset) return validDataset;
14502
+ if (typedDatasets) {
14503
+ if (typedDatasets.length === 1) return typedDatasets[0];
14504
+ _addIssue(this, "type", dataset, config$1, { issues: /* @__PURE__ */ _subIssues(typedDatasets) });
14505
+ dataset.typed = true;
14506
+ } else if (untypedDatasets?.length === 1) return untypedDatasets[0];
14507
+ else _addIssue(this, "type", dataset, config$1, { issues: /* @__PURE__ */ _subIssues(untypedDatasets) });
14508
+ return dataset;
14509
+ }
14510
+ };
14511
+ }
14512
+ // @__NO_SIDE_EFFECTS__
14513
+ function unknown2() {
14514
+ return {
14515
+ kind: "schema",
14516
+ type: "unknown",
14517
+ reference: unknown2,
14518
+ expects: "unknown",
14519
+ async: false,
14520
+ get "~standard"() {
14521
+ return /* @__PURE__ */ _getStandardProps(this);
14522
+ },
14523
+ "~run"(dataset) {
14524
+ dataset.typed = true;
14525
+ return dataset;
14526
+ }
14527
+ };
14528
+ }
14529
+ function parse3(schema, input, config$1) {
14530
+ const dataset = schema["~run"]({ value: input }, /* @__PURE__ */ getGlobalConfig(config$1));
14531
+ if (dataset.issues) throw new ValiError(dataset.issues);
14532
+ return dataset.value;
14533
+ }
14534
+ // @__NO_SIDE_EFFECTS__
14535
+ function pipe2(...pipe$1) {
14536
+ return {
14537
+ ...pipe$1[0],
14538
+ pipe: pipe$1,
14539
+ get "~standard"() {
14540
+ return /* @__PURE__ */ _getStandardProps(this);
14541
+ },
14542
+ "~run"(dataset, config$1) {
14543
+ for (const item of pipe$1) if (item.kind !== "metadata") {
14544
+ if (dataset.issues && (item.kind === "schema" || item.kind === "transformation")) {
14545
+ dataset.typed = false;
14546
+ break;
14547
+ }
14548
+ if (!dataset.issues || !config$1.abortEarly && !config$1.abortPipeEarly) dataset = item["~run"](dataset, config$1);
14549
+ }
14550
+ return dataset;
14551
+ }
14552
+ };
14553
+ }
14554
+ var store$4;
14555
+ var store$3;
14556
+ var store$2;
14557
+ var store$1;
14558
+ var ValiError;
14559
+ var init_dist3 = __esm({
14560
+ "../../node_modules/.pnpm/valibot@1.3.1_typescript@5.9.3/node_modules/valibot/dist/index.mjs"() {
14561
+ ValiError = class extends Error {
14562
+ /**
14563
+ * Creates a Valibot error with useful information.
14564
+ *
14565
+ * @param issues The error issues.
14566
+ */
14567
+ constructor(issues) {
14568
+ super(issues[0].message);
14569
+ this.name = "ValiError";
14570
+ this.issues = issues;
14571
+ }
14572
+ };
14737
14573
  }
14738
14574
  });
14739
- function fromBig(n, le = false) {
14740
- if (le)
14741
- return { h: Number(n & U32_MASK64), l: Number(n >> _32n & U32_MASK64) };
14742
- return { h: Number(n >> _32n & U32_MASK64) | 0, l: Number(n & U32_MASK64) | 0 };
14743
- }
14744
- function split(lst, le = false) {
14745
- const len = lst.length;
14746
- let Ah = new Uint32Array(len);
14747
- let Al = new Uint32Array(len);
14748
- for (let i = 0; i < len; i++) {
14749
- const { h, l: l2 } = fromBig(lst[i], le);
14750
- [Ah[i], Al[i]] = [h, l2];
14751
- }
14752
- return [Ah, Al];
14575
+ function safeEnum(options) {
14576
+ return /* @__PURE__ */ union2(Object.keys(options).map((key) => withKind(key, /* @__PURE__ */ object3({ [key]: options[key] }))));
14753
14577
  }
14754
- function add(Ah, Al, Bh, Bl) {
14755
- const l2 = (Al >>> 0) + (Bl >>> 0);
14756
- return { h: Ah + Bh + (l2 / 2 ** 32 | 0) | 0, l: l2 | 0 };
14578
+ function withKind(key, schema) {
14579
+ return /* @__PURE__ */ pipe2(/* @__PURE__ */ object3({
14580
+ ...schema.entries,
14581
+ $kind: /* @__PURE__ */ optional2(/* @__PURE__ */ literal2(key))
14582
+ }), /* @__PURE__ */ transform2((value) => ({
14583
+ ...value,
14584
+ $kind: key
14585
+ })));
14757
14586
  }
14758
- var U32_MASK64;
14759
- var _32n;
14760
- var shrSH;
14761
- var shrSL;
14762
- var rotrSH;
14763
- var rotrSL;
14764
- var rotrBH;
14765
- var rotrBL;
14766
- var rotr32H;
14767
- var rotr32L;
14768
- var add3L;
14769
- var add3H;
14770
- var add4L;
14771
- var add4H;
14772
- var add5L;
14773
- var add5H;
14774
- var init_u64 = __esm({
14775
- "../../node_modules/.pnpm/@noble+hashes@2.0.1/node_modules/@noble/hashes/_u64.js"() {
14776
- U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1);
14777
- _32n = /* @__PURE__ */ BigInt(32);
14778
- shrSH = (h, _l, s) => h >>> s;
14779
- shrSL = (h, l2, s) => h << 32 - s | l2 >>> s;
14780
- rotrSH = (h, l2, s) => h >>> s | l2 << 32 - s;
14781
- rotrSL = (h, l2, s) => h << 32 - s | l2 >>> s;
14782
- rotrBH = (h, l2, s) => h << 64 - s | l2 >>> s - 32;
14783
- rotrBL = (h, l2, s) => h >>> s - 32 | l2 << 64 - s;
14784
- rotr32H = (_h, l2) => l2;
14785
- rotr32L = (h, _l) => h;
14786
- add3L = (Al, Bl, Cl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0);
14787
- add3H = (low, Ah, Bh, Ch) => Ah + Bh + Ch + (low / 2 ** 32 | 0) | 0;
14788
- add4L = (Al, Bl, Cl, Dl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0);
14789
- add4H = (low, Ah, Bh, Ch, Dh) => Ah + Bh + Ch + Dh + (low / 2 ** 32 | 0) | 0;
14790
- add5L = (Al, Bl, Cl, Dl, El) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0) + (El >>> 0);
14791
- add5H = (low, Ah, Bh, Ch, Dh, Eh) => Ah + Bh + Ch + Dh + Eh + (low / 2 ** 32 | 0) | 0;
14587
+ var SuiAddress;
14588
+ var ObjectID;
14589
+ var BCSBytes;
14590
+ var JsonU64;
14591
+ var U32;
14592
+ var ObjectRefSchema;
14593
+ var ArgumentSchema;
14594
+ var GasDataSchema;
14595
+ var OpenSignatureBodySchema;
14596
+ var OpenSignatureSchema;
14597
+ var ProgrammableMoveCallSchema;
14598
+ var $Intent;
14599
+ var CommandSchema;
14600
+ var ObjectArgSchema;
14601
+ var ReservationSchema;
14602
+ var WithdrawalTypeArgSchema;
14603
+ var WithdrawFromSchema;
14604
+ var FundsWithdrawalArgSchema;
14605
+ var CallArgSchema;
14606
+ var NormalizedCallArg;
14607
+ var ValidDuringSchema;
14608
+ var TransactionExpiration2;
14609
+ var TransactionDataSchema;
14610
+ var init_internal = __esm({
14611
+ "../../node_modules/.pnpm/@mysten+sui@2.17.0_typescript@5.9.3/node_modules/@mysten/sui/dist/transactions/data/internal.mjs"() {
14612
+ init_sui_types();
14613
+ init_dist3();
14614
+ SuiAddress = /* @__PURE__ */ pipe2(/* @__PURE__ */ string3(), /* @__PURE__ */ transform2((value) => normalizeSuiAddress(value)), /* @__PURE__ */ check2(isValidSuiAddress));
14615
+ ObjectID = SuiAddress;
14616
+ BCSBytes = /* @__PURE__ */ string3();
14617
+ JsonU64 = /* @__PURE__ */ pipe2(/* @__PURE__ */ union2([/* @__PURE__ */ string3(), /* @__PURE__ */ pipe2(/* @__PURE__ */ number3(), /* @__PURE__ */ integer2())]), /* @__PURE__ */ check2((val) => {
14618
+ try {
14619
+ BigInt(val);
14620
+ return BigInt(val) >= 0 && BigInt(val) <= 18446744073709551615n;
14621
+ } catch {
14622
+ return false;
14623
+ }
14624
+ }, "Invalid u64"));
14625
+ U32 = /* @__PURE__ */ pipe2(/* @__PURE__ */ number3(), /* @__PURE__ */ integer2(), /* @__PURE__ */ check2((val) => val >= 0 && val < 2 ** 32, "Invalid u32"));
14626
+ ObjectRefSchema = /* @__PURE__ */ object3({
14627
+ objectId: SuiAddress,
14628
+ version: JsonU64,
14629
+ digest: /* @__PURE__ */ string3()
14630
+ });
14631
+ ArgumentSchema = /* @__PURE__ */ union2([
14632
+ withKind("GasCoin", /* @__PURE__ */ object3({ GasCoin: /* @__PURE__ */ literal2(true) })),
14633
+ withKind("Input", /* @__PURE__ */ object3({
14634
+ Input: /* @__PURE__ */ pipe2(/* @__PURE__ */ number3(), /* @__PURE__ */ integer2()),
14635
+ type: /* @__PURE__ */ optional2(/* @__PURE__ */ union2([
14636
+ /* @__PURE__ */ literal2("pure"),
14637
+ /* @__PURE__ */ literal2("object"),
14638
+ /* @__PURE__ */ literal2("withdrawal")
14639
+ ]))
14640
+ })),
14641
+ withKind("Result", /* @__PURE__ */ object3({ Result: /* @__PURE__ */ pipe2(/* @__PURE__ */ number3(), /* @__PURE__ */ integer2()) })),
14642
+ withKind("NestedResult", /* @__PURE__ */ object3({ NestedResult: /* @__PURE__ */ tuple([/* @__PURE__ */ pipe2(/* @__PURE__ */ number3(), /* @__PURE__ */ integer2()), /* @__PURE__ */ pipe2(/* @__PURE__ */ number3(), /* @__PURE__ */ integer2())]) }))
14643
+ ]);
14644
+ GasDataSchema = /* @__PURE__ */ object3({
14645
+ budget: /* @__PURE__ */ nullable2(JsonU64),
14646
+ price: /* @__PURE__ */ nullable2(JsonU64),
14647
+ owner: /* @__PURE__ */ nullable2(SuiAddress),
14648
+ payment: /* @__PURE__ */ nullable2(/* @__PURE__ */ array2(ObjectRefSchema))
14649
+ });
14650
+ OpenSignatureBodySchema = /* @__PURE__ */ union2([
14651
+ /* @__PURE__ */ object3({ $kind: /* @__PURE__ */ literal2("address") }),
14652
+ /* @__PURE__ */ object3({ $kind: /* @__PURE__ */ literal2("bool") }),
14653
+ /* @__PURE__ */ object3({ $kind: /* @__PURE__ */ literal2("u8") }),
14654
+ /* @__PURE__ */ object3({ $kind: /* @__PURE__ */ literal2("u16") }),
14655
+ /* @__PURE__ */ object3({ $kind: /* @__PURE__ */ literal2("u32") }),
14656
+ /* @__PURE__ */ object3({ $kind: /* @__PURE__ */ literal2("u64") }),
14657
+ /* @__PURE__ */ object3({ $kind: /* @__PURE__ */ literal2("u128") }),
14658
+ /* @__PURE__ */ object3({ $kind: /* @__PURE__ */ literal2("u256") }),
14659
+ /* @__PURE__ */ object3({ $kind: /* @__PURE__ */ literal2("unknown") }),
14660
+ /* @__PURE__ */ object3({
14661
+ $kind: /* @__PURE__ */ literal2("vector"),
14662
+ vector: /* @__PURE__ */ lazy(() => OpenSignatureBodySchema)
14663
+ }),
14664
+ /* @__PURE__ */ object3({
14665
+ $kind: /* @__PURE__ */ literal2("datatype"),
14666
+ datatype: /* @__PURE__ */ object3({
14667
+ typeName: /* @__PURE__ */ string3(),
14668
+ typeParameters: /* @__PURE__ */ array2(/* @__PURE__ */ lazy(() => OpenSignatureBodySchema))
14669
+ })
14670
+ }),
14671
+ /* @__PURE__ */ object3({
14672
+ $kind: /* @__PURE__ */ literal2("typeParameter"),
14673
+ index: /* @__PURE__ */ pipe2(/* @__PURE__ */ number3(), /* @__PURE__ */ integer2())
14674
+ })
14675
+ ]);
14676
+ OpenSignatureSchema = /* @__PURE__ */ object3({
14677
+ reference: /* @__PURE__ */ nullable2(/* @__PURE__ */ union2([
14678
+ /* @__PURE__ */ literal2("mutable"),
14679
+ /* @__PURE__ */ literal2("immutable"),
14680
+ /* @__PURE__ */ literal2("unknown")
14681
+ ])),
14682
+ body: OpenSignatureBodySchema
14683
+ });
14684
+ ProgrammableMoveCallSchema = /* @__PURE__ */ object3({
14685
+ package: ObjectID,
14686
+ module: /* @__PURE__ */ string3(),
14687
+ function: /* @__PURE__ */ string3(),
14688
+ typeArguments: /* @__PURE__ */ array2(/* @__PURE__ */ string3()),
14689
+ arguments: /* @__PURE__ */ array2(ArgumentSchema),
14690
+ _argumentTypes: /* @__PURE__ */ optional2(/* @__PURE__ */ nullable2(/* @__PURE__ */ array2(OpenSignatureSchema)))
14691
+ });
14692
+ $Intent = /* @__PURE__ */ object3({
14693
+ name: /* @__PURE__ */ string3(),
14694
+ inputs: /* @__PURE__ */ record2(/* @__PURE__ */ string3(), /* @__PURE__ */ union2([ArgumentSchema, /* @__PURE__ */ array2(ArgumentSchema)])),
14695
+ data: /* @__PURE__ */ record2(/* @__PURE__ */ string3(), /* @__PURE__ */ unknown2())
14696
+ });
14697
+ CommandSchema = safeEnum({
14698
+ MoveCall: ProgrammableMoveCallSchema,
14699
+ TransferObjects: /* @__PURE__ */ object3({
14700
+ objects: /* @__PURE__ */ array2(ArgumentSchema),
14701
+ address: ArgumentSchema
14702
+ }),
14703
+ SplitCoins: /* @__PURE__ */ object3({
14704
+ coin: ArgumentSchema,
14705
+ amounts: /* @__PURE__ */ array2(ArgumentSchema)
14706
+ }),
14707
+ MergeCoins: /* @__PURE__ */ object3({
14708
+ destination: ArgumentSchema,
14709
+ sources: /* @__PURE__ */ array2(ArgumentSchema)
14710
+ }),
14711
+ Publish: /* @__PURE__ */ object3({
14712
+ modules: /* @__PURE__ */ array2(BCSBytes),
14713
+ dependencies: /* @__PURE__ */ array2(ObjectID)
14714
+ }),
14715
+ MakeMoveVec: /* @__PURE__ */ object3({
14716
+ type: /* @__PURE__ */ nullable2(/* @__PURE__ */ string3()),
14717
+ elements: /* @__PURE__ */ array2(ArgumentSchema)
14718
+ }),
14719
+ Upgrade: /* @__PURE__ */ object3({
14720
+ modules: /* @__PURE__ */ array2(BCSBytes),
14721
+ dependencies: /* @__PURE__ */ array2(ObjectID),
14722
+ package: ObjectID,
14723
+ ticket: ArgumentSchema
14724
+ }),
14725
+ $Intent
14726
+ });
14727
+ ObjectArgSchema = safeEnum({
14728
+ ImmOrOwnedObject: ObjectRefSchema,
14729
+ SharedObject: /* @__PURE__ */ object3({
14730
+ objectId: ObjectID,
14731
+ initialSharedVersion: JsonU64,
14732
+ mutable: /* @__PURE__ */ boolean3()
14733
+ }),
14734
+ Receiving: ObjectRefSchema
14735
+ });
14736
+ ReservationSchema = safeEnum({ MaxAmountU64: JsonU64 });
14737
+ WithdrawalTypeArgSchema = safeEnum({ Balance: /* @__PURE__ */ string3() });
14738
+ WithdrawFromSchema = safeEnum({
14739
+ Sender: /* @__PURE__ */ literal2(true),
14740
+ Sponsor: /* @__PURE__ */ literal2(true)
14741
+ });
14742
+ FundsWithdrawalArgSchema = /* @__PURE__ */ object3({
14743
+ reservation: ReservationSchema,
14744
+ typeArg: WithdrawalTypeArgSchema,
14745
+ withdrawFrom: WithdrawFromSchema
14746
+ });
14747
+ CallArgSchema = safeEnum({
14748
+ Object: ObjectArgSchema,
14749
+ Pure: /* @__PURE__ */ object3({ bytes: BCSBytes }),
14750
+ UnresolvedPure: /* @__PURE__ */ object3({ value: /* @__PURE__ */ unknown2() }),
14751
+ UnresolvedObject: /* @__PURE__ */ object3({
14752
+ objectId: ObjectID,
14753
+ version: /* @__PURE__ */ optional2(/* @__PURE__ */ nullable2(JsonU64)),
14754
+ digest: /* @__PURE__ */ optional2(/* @__PURE__ */ nullable2(/* @__PURE__ */ string3())),
14755
+ initialSharedVersion: /* @__PURE__ */ optional2(/* @__PURE__ */ nullable2(JsonU64)),
14756
+ mutable: /* @__PURE__ */ optional2(/* @__PURE__ */ nullable2(/* @__PURE__ */ boolean3()))
14757
+ }),
14758
+ FundsWithdrawal: FundsWithdrawalArgSchema
14759
+ });
14760
+ NormalizedCallArg = safeEnum({
14761
+ Object: ObjectArgSchema,
14762
+ Pure: /* @__PURE__ */ object3({ bytes: BCSBytes })
14763
+ });
14764
+ ValidDuringSchema = /* @__PURE__ */ object3({
14765
+ minEpoch: /* @__PURE__ */ nullable2(JsonU64),
14766
+ maxEpoch: /* @__PURE__ */ nullable2(JsonU64),
14767
+ minTimestamp: /* @__PURE__ */ nullable2(JsonU64),
14768
+ maxTimestamp: /* @__PURE__ */ nullable2(JsonU64),
14769
+ chain: /* @__PURE__ */ string3(),
14770
+ nonce: U32
14771
+ });
14772
+ TransactionExpiration2 = safeEnum({
14773
+ None: /* @__PURE__ */ literal2(true),
14774
+ Epoch: JsonU64,
14775
+ ValidDuring: ValidDuringSchema
14776
+ });
14777
+ TransactionDataSchema = /* @__PURE__ */ object3({
14778
+ version: /* @__PURE__ */ literal2(2),
14779
+ sender: /* @__PURE__ */ nullish2(SuiAddress),
14780
+ expiration: /* @__PURE__ */ nullish2(TransactionExpiration2),
14781
+ gasData: GasDataSchema,
14782
+ inputs: /* @__PURE__ */ array2(CallArgSchema),
14783
+ commands: /* @__PURE__ */ array2(CommandSchema)
14784
+ });
14792
14785
  }
14793
14786
  });
14794
- function G1b(a, b, c, d, msg, x) {
14795
- const Xl = msg[x], Xh = msg[x + 1];
14796
- let Al = BBUF[2 * a], Ah = BBUF[2 * a + 1];
14797
- let Bl = BBUF[2 * b], Bh = BBUF[2 * b + 1];
14798
- let Cl = BBUF[2 * c], Ch = BBUF[2 * c + 1];
14799
- let Dl = BBUF[2 * d], Dh = BBUF[2 * d + 1];
14800
- let ll = add3L(Al, Bl, Xl);
14801
- Ah = add3H(ll, Ah, Bh, Xh);
14802
- Al = ll | 0;
14803
- ({ Dh, Dl } = { Dh: Dh ^ Ah, Dl: Dl ^ Al });
14804
- ({ Dh, Dl } = { Dh: rotr32H(Dh, Dl), Dl: rotr32L(Dh, Dl) });
14805
- ({ h: Ch, l: Cl } = add(Ch, Cl, Dh, Dl));
14806
- ({ Bh, Bl } = { Bh: Bh ^ Ch, Bl: Bl ^ Cl });
14807
- ({ Bh, Bl } = { Bh: rotrSH(Bh, Bl, 24), Bl: rotrSL(Bh, Bl, 24) });
14808
- BBUF[2 * a] = Al, BBUF[2 * a + 1] = Ah;
14809
- BBUF[2 * b] = Bl, BBUF[2 * b + 1] = Bh;
14810
- BBUF[2 * c] = Cl, BBUF[2 * c + 1] = Ch;
14811
- BBUF[2 * d] = Dl, BBUF[2 * d + 1] = Dh;
14812
- }
14813
- function G2b(a, b, c, d, msg, x) {
14814
- const Xl = msg[x], Xh = msg[x + 1];
14815
- let Al = BBUF[2 * a], Ah = BBUF[2 * a + 1];
14816
- let Bl = BBUF[2 * b], Bh = BBUF[2 * b + 1];
14817
- let Cl = BBUF[2 * c], Ch = BBUF[2 * c + 1];
14818
- let Dl = BBUF[2 * d], Dh = BBUF[2 * d + 1];
14819
- let ll = add3L(Al, Bl, Xl);
14820
- Ah = add3H(ll, Ah, Bh, Xh);
14821
- Al = ll | 0;
14822
- ({ Dh, Dl } = { Dh: Dh ^ Ah, Dl: Dl ^ Al });
14823
- ({ Dh, Dl } = { Dh: rotrSH(Dh, Dl, 16), Dl: rotrSL(Dh, Dl, 16) });
14824
- ({ h: Ch, l: Cl } = add(Ch, Cl, Dh, Dl));
14825
- ({ Bh, Bl } = { Bh: Bh ^ Ch, Bl: Bl ^ Cl });
14826
- ({ Bh, Bl } = { Bh: rotrBH(Bh, Bl, 63), Bl: rotrBL(Bh, Bl, 63) });
14827
- BBUF[2 * a] = Al, BBUF[2 * a + 1] = Ah;
14828
- BBUF[2 * b] = Bl, BBUF[2 * b + 1] = Bh;
14829
- BBUF[2 * c] = Cl, BBUF[2 * c + 1] = Ch;
14830
- BBUF[2 * d] = Dl, BBUF[2 * d + 1] = Dh;
14787
+ function getIdFromCallArg(arg) {
14788
+ if (typeof arg === "string") return normalizeSuiAddress(arg);
14789
+ if (arg.Object) {
14790
+ if (arg.Object.ImmOrOwnedObject) return normalizeSuiAddress(arg.Object.ImmOrOwnedObject.objectId);
14791
+ if (arg.Object.Receiving) return normalizeSuiAddress(arg.Object.Receiving.objectId);
14792
+ return normalizeSuiAddress(arg.Object.SharedObject.objectId);
14793
+ }
14794
+ if (arg.UnresolvedObject) return normalizeSuiAddress(arg.UnresolvedObject.objectId);
14831
14795
  }
14832
- function checkBlake2Opts(outputLen, opts = {}, keyLen, saltLen, persLen) {
14833
- anumber2(keyLen);
14834
- if (outputLen < 0 || outputLen > keyLen)
14835
- throw new Error("outputLen bigger than keyLen");
14836
- const { key, salt, personalization } = opts;
14837
- if (key !== void 0 && (key.length < 1 || key.length > keyLen))
14838
- throw new Error('"key" expected to be undefined or of length=1..' + keyLen);
14839
- if (salt !== void 0)
14840
- abytes(salt, saltLen, "salt");
14841
- if (personalization !== void 0)
14842
- abytes(personalization, persLen, "personalization");
14796
+ function isArgument(value) {
14797
+ return /* @__PURE__ */ is(ArgumentSchema, value);
14843
14798
  }
14844
- var B2B_IV;
14845
- var BBUF;
14846
- var _BLAKE2;
14847
- var _BLAKE2b;
14848
- var blake2b;
14849
- var init_blake2 = __esm({
14850
- "../../node_modules/.pnpm/@noble+hashes@2.0.1/node_modules/@noble/hashes/blake2.js"() {
14851
- init_blake();
14852
- init_u64();
14853
- init_utils3();
14854
- B2B_IV = /* @__PURE__ */ Uint32Array.from([
14855
- 4089235720,
14856
- 1779033703,
14857
- 2227873595,
14858
- 3144134277,
14859
- 4271175723,
14860
- 1013904242,
14861
- 1595750129,
14862
- 2773480762,
14863
- 2917565137,
14864
- 1359893119,
14865
- 725511199,
14866
- 2600822924,
14867
- 4215389547,
14868
- 528734635,
14869
- 327033209,
14870
- 1541459225
14871
- ]);
14872
- BBUF = /* @__PURE__ */ new Uint32Array(32);
14873
- _BLAKE2 = class {
14874
- buffer;
14875
- buffer32;
14876
- finished = false;
14877
- destroyed = false;
14878
- length = 0;
14879
- pos = 0;
14880
- blockLen;
14881
- outputLen;
14882
- constructor(blockLen, outputLen) {
14883
- anumber2(blockLen);
14884
- anumber2(outputLen);
14885
- this.blockLen = blockLen;
14886
- this.outputLen = outputLen;
14887
- this.buffer = new Uint8Array(blockLen);
14888
- this.buffer32 = u32(this.buffer);
14889
- }
14890
- update(data) {
14891
- aexists(this);
14892
- abytes(data);
14893
- const { blockLen, buffer, buffer32 } = this;
14894
- const len = data.length;
14895
- const offset = data.byteOffset;
14896
- const buf = data.buffer;
14897
- for (let pos = 0; pos < len; ) {
14898
- if (this.pos === blockLen) {
14899
- swap32IfBE(buffer32);
14900
- this.compress(buffer32, 0, false);
14901
- swap32IfBE(buffer32);
14902
- this.pos = 0;
14903
- }
14904
- const take = Math.min(blockLen - this.pos, len - pos);
14905
- const dataOffset = offset + pos;
14906
- if (take === blockLen && !(dataOffset % 4) && pos + take < len) {
14907
- const data32 = new Uint32Array(buf, dataOffset, Math.floor((len - pos) / 4));
14908
- swap32IfBE(data32);
14909
- for (let pos32 = 0; pos + blockLen < len; pos32 += buffer32.length, pos += blockLen) {
14910
- this.length += blockLen;
14911
- this.compress(data32, pos32, false);
14912
- }
14913
- swap32IfBE(data32);
14914
- continue;
14915
- }
14916
- buffer.set(data.subarray(pos, pos + take), this.pos);
14917
- this.pos += take;
14918
- this.length += take;
14919
- pos += take;
14920
- }
14921
- return this;
14922
- }
14923
- digestInto(out) {
14924
- aexists(this);
14925
- aoutput(out, this);
14926
- const { pos, buffer32 } = this;
14927
- this.finished = true;
14928
- clean(this.buffer.subarray(pos));
14929
- swap32IfBE(buffer32);
14930
- this.compress(buffer32, 0, true);
14931
- swap32IfBE(buffer32);
14932
- const out32 = u32(out);
14933
- this.get().forEach((v, i) => out32[i] = swap8IfBE(v));
14934
- }
14935
- digest() {
14936
- const { buffer, outputLen } = this;
14937
- this.digestInto(buffer);
14938
- const res = buffer.slice(0, outputLen);
14939
- this.destroy();
14940
- return res;
14941
- }
14942
- _cloneInto(to) {
14943
- const { buffer, length, finished, destroyed, outputLen, pos } = this;
14944
- to ||= new this.constructor({ dkLen: outputLen });
14945
- to.set(...this.get());
14946
- to.buffer.set(buffer);
14947
- to.destroyed = destroyed;
14948
- to.finished = finished;
14949
- to.length = length;
14950
- to.pos = pos;
14951
- to.outputLen = outputLen;
14952
- return to;
14953
- }
14954
- clone() {
14955
- return this._cloneInto();
14956
- }
14957
- };
14958
- _BLAKE2b = class extends _BLAKE2 {
14959
- // Same as SHA-512, but LE
14960
- v0l = B2B_IV[0] | 0;
14961
- v0h = B2B_IV[1] | 0;
14962
- v1l = B2B_IV[2] | 0;
14963
- v1h = B2B_IV[3] | 0;
14964
- v2l = B2B_IV[4] | 0;
14965
- v2h = B2B_IV[5] | 0;
14966
- v3l = B2B_IV[6] | 0;
14967
- v3h = B2B_IV[7] | 0;
14968
- v4l = B2B_IV[8] | 0;
14969
- v4h = B2B_IV[9] | 0;
14970
- v5l = B2B_IV[10] | 0;
14971
- v5h = B2B_IV[11] | 0;
14972
- v6l = B2B_IV[12] | 0;
14973
- v6h = B2B_IV[13] | 0;
14974
- v7l = B2B_IV[14] | 0;
14975
- v7h = B2B_IV[15] | 0;
14976
- constructor(opts = {}) {
14977
- const olen = opts.dkLen === void 0 ? 64 : opts.dkLen;
14978
- super(128, olen);
14979
- checkBlake2Opts(olen, opts, 64, 16, 16);
14980
- let { key, personalization, salt } = opts;
14981
- let keyLength = 0;
14982
- if (key !== void 0) {
14983
- abytes(key, void 0, "key");
14984
- keyLength = key.length;
14985
- }
14986
- this.v0l ^= this.outputLen | keyLength << 8 | 1 << 16 | 1 << 24;
14987
- if (salt !== void 0) {
14988
- abytes(salt, void 0, "salt");
14989
- const slt = u32(salt);
14990
- this.v4l ^= swap8IfBE(slt[0]);
14991
- this.v4h ^= swap8IfBE(slt[1]);
14992
- this.v5l ^= swap8IfBE(slt[2]);
14993
- this.v5h ^= swap8IfBE(slt[3]);
14994
- }
14995
- if (personalization !== void 0) {
14996
- abytes(personalization, void 0, "personalization");
14997
- const pers = u32(personalization);
14998
- this.v6l ^= swap8IfBE(pers[0]);
14999
- this.v6h ^= swap8IfBE(pers[1]);
15000
- this.v7l ^= swap8IfBE(pers[2]);
15001
- this.v7h ^= swap8IfBE(pers[3]);
15002
- }
15003
- if (key !== void 0) {
15004
- const tmp = new Uint8Array(this.blockLen);
15005
- tmp.set(key);
15006
- this.update(tmp);
15007
- }
15008
- }
15009
- // prettier-ignore
15010
- get() {
15011
- let { v0l, v0h, v1l, v1h, v2l, v2h, v3l, v3h, v4l, v4h, v5l, v5h, v6l, v6h, v7l, v7h } = this;
15012
- return [v0l, v0h, v1l, v1h, v2l, v2h, v3l, v3h, v4l, v4h, v5l, v5h, v6l, v6h, v7l, v7h];
14799
+ function remapCommandArguments(command, inputMapping, commandMapping) {
14800
+ const remapArg = (arg) => {
14801
+ switch (arg.$kind) {
14802
+ case "Input": {
14803
+ const newInputIndex = inputMapping.get(arg.Input);
14804
+ if (newInputIndex === void 0) throw new Error(`Input ${arg.Input} not found in input mapping`);
14805
+ return {
14806
+ ...arg,
14807
+ Input: newInputIndex
14808
+ };
15013
14809
  }
15014
- // prettier-ignore
15015
- set(v0l, v0h, v1l, v1h, v2l, v2h, v3l, v3h, v4l, v4h, v5l, v5h, v6l, v6h, v7l, v7h) {
15016
- this.v0l = v0l | 0;
15017
- this.v0h = v0h | 0;
15018
- this.v1l = v1l | 0;
15019
- this.v1h = v1h | 0;
15020
- this.v2l = v2l | 0;
15021
- this.v2h = v2h | 0;
15022
- this.v3l = v3l | 0;
15023
- this.v3h = v3h | 0;
15024
- this.v4l = v4l | 0;
15025
- this.v4h = v4h | 0;
15026
- this.v5l = v5l | 0;
15027
- this.v5h = v5h | 0;
15028
- this.v6l = v6l | 0;
15029
- this.v6h = v6h | 0;
15030
- this.v7l = v7l | 0;
15031
- this.v7h = v7h | 0;
14810
+ case "Result": {
14811
+ const newCommandIndex = commandMapping.get(arg.Result);
14812
+ if (newCommandIndex !== void 0) return {
14813
+ ...arg,
14814
+ Result: newCommandIndex
14815
+ };
14816
+ return arg;
15032
14817
  }
15033
- compress(msg, offset, isLast) {
15034
- this.get().forEach((v, i) => BBUF[i] = v);
15035
- BBUF.set(B2B_IV, 16);
15036
- let { h, l: l2 } = fromBig(BigInt(this.length));
15037
- BBUF[24] = B2B_IV[8] ^ l2;
15038
- BBUF[25] = B2B_IV[9] ^ h;
15039
- if (isLast) {
15040
- BBUF[28] = ~BBUF[28];
15041
- BBUF[29] = ~BBUF[29];
15042
- }
15043
- let j = 0;
15044
- const s = BSIGMA;
15045
- for (let i = 0; i < 12; i++) {
15046
- G1b(0, 4, 8, 12, msg, offset + 2 * s[j++]);
15047
- G2b(0, 4, 8, 12, msg, offset + 2 * s[j++]);
15048
- G1b(1, 5, 9, 13, msg, offset + 2 * s[j++]);
15049
- G2b(1, 5, 9, 13, msg, offset + 2 * s[j++]);
15050
- G1b(2, 6, 10, 14, msg, offset + 2 * s[j++]);
15051
- G2b(2, 6, 10, 14, msg, offset + 2 * s[j++]);
15052
- G1b(3, 7, 11, 15, msg, offset + 2 * s[j++]);
15053
- G2b(3, 7, 11, 15, msg, offset + 2 * s[j++]);
15054
- G1b(0, 5, 10, 15, msg, offset + 2 * s[j++]);
15055
- G2b(0, 5, 10, 15, msg, offset + 2 * s[j++]);
15056
- G1b(1, 6, 11, 12, msg, offset + 2 * s[j++]);
15057
- G2b(1, 6, 11, 12, msg, offset + 2 * s[j++]);
15058
- G1b(2, 7, 8, 13, msg, offset + 2 * s[j++]);
15059
- G2b(2, 7, 8, 13, msg, offset + 2 * s[j++]);
15060
- G1b(3, 4, 9, 14, msg, offset + 2 * s[j++]);
15061
- G2b(3, 4, 9, 14, msg, offset + 2 * s[j++]);
14818
+ case "NestedResult": {
14819
+ const newCommandIndex = commandMapping.get(arg.NestedResult[0]);
14820
+ if (newCommandIndex !== void 0) return {
14821
+ ...arg,
14822
+ NestedResult: [newCommandIndex, arg.NestedResult[1]]
14823
+ };
14824
+ return arg;
14825
+ }
14826
+ default:
14827
+ return arg;
14828
+ }
14829
+ };
14830
+ switch (command.$kind) {
14831
+ case "MoveCall":
14832
+ command.MoveCall.arguments = command.MoveCall.arguments.map(remapArg);
14833
+ break;
14834
+ case "TransferObjects":
14835
+ command.TransferObjects.objects = command.TransferObjects.objects.map(remapArg);
14836
+ command.TransferObjects.address = remapArg(command.TransferObjects.address);
14837
+ break;
14838
+ case "SplitCoins":
14839
+ command.SplitCoins.coin = remapArg(command.SplitCoins.coin);
14840
+ command.SplitCoins.amounts = command.SplitCoins.amounts.map(remapArg);
14841
+ break;
14842
+ case "MergeCoins":
14843
+ command.MergeCoins.destination = remapArg(command.MergeCoins.destination);
14844
+ command.MergeCoins.sources = command.MergeCoins.sources.map(remapArg);
14845
+ break;
14846
+ case "MakeMoveVec":
14847
+ command.MakeMoveVec.elements = command.MakeMoveVec.elements.map(remapArg);
14848
+ break;
14849
+ case "Upgrade":
14850
+ command.Upgrade.ticket = remapArg(command.Upgrade.ticket);
14851
+ break;
14852
+ case "$Intent": {
14853
+ const inputs = command.$Intent.inputs;
14854
+ command.$Intent.inputs = {};
14855
+ for (const [key, value] of Object.entries(inputs)) command.$Intent.inputs[key] = Array.isArray(value) ? value.map(remapArg) : remapArg(value);
14856
+ break;
14857
+ }
14858
+ }
14859
+ }
14860
+ var init_utils4 = __esm({
14861
+ "../../node_modules/.pnpm/@mysten+sui@2.17.0_typescript@5.9.3/node_modules/@mysten/sui/dist/transactions/utils.mjs"() {
14862
+ init_sui_types();
14863
+ init_internal();
14864
+ init_dist3();
14865
+ }
14866
+ });
14867
+ function serializeV1TransactionData(transactionData) {
14868
+ const inputs = transactionData.inputs.map((input, index) => {
14869
+ if (input.Object) return {
14870
+ kind: "Input",
14871
+ index,
14872
+ value: { Object: input.Object.ImmOrOwnedObject ? { ImmOrOwned: input.Object.ImmOrOwnedObject } : input.Object.Receiving ? { Receiving: {
14873
+ digest: input.Object.Receiving.digest,
14874
+ version: input.Object.Receiving.version,
14875
+ objectId: input.Object.Receiving.objectId
14876
+ } } : { Shared: {
14877
+ mutable: input.Object.SharedObject.mutable,
14878
+ initialSharedVersion: input.Object.SharedObject.initialSharedVersion,
14879
+ objectId: input.Object.SharedObject.objectId
14880
+ } } },
14881
+ type: "object"
14882
+ };
14883
+ if (input.Pure) return {
14884
+ kind: "Input",
14885
+ index,
14886
+ value: { Pure: Array.from(fromBase64(input.Pure.bytes)) },
14887
+ type: "pure"
14888
+ };
14889
+ if (input.UnresolvedPure) return {
14890
+ kind: "Input",
14891
+ type: "pure",
14892
+ index,
14893
+ value: input.UnresolvedPure.value
14894
+ };
14895
+ if (input.UnresolvedObject) return {
14896
+ kind: "Input",
14897
+ type: "object",
14898
+ index,
14899
+ value: input.UnresolvedObject.objectId
14900
+ };
14901
+ throw new Error("Invalid input");
14902
+ });
14903
+ return {
14904
+ version: 1,
14905
+ sender: transactionData.sender ?? void 0,
14906
+ expiration: transactionData.expiration?.$kind === "Epoch" ? { Epoch: Number(transactionData.expiration.Epoch) } : transactionData.expiration ? { None: true } : null,
14907
+ gasConfig: {
14908
+ owner: transactionData.gasData.owner ?? void 0,
14909
+ budget: transactionData.gasData.budget ?? void 0,
14910
+ price: transactionData.gasData.price ?? void 0,
14911
+ payment: transactionData.gasData.payment ?? void 0
14912
+ },
14913
+ inputs,
14914
+ transactions: transactionData.commands.map((command) => {
14915
+ if (command.MakeMoveVec) return {
14916
+ kind: "MakeMoveVec",
14917
+ type: command.MakeMoveVec.type === null ? { None: true } : { Some: TypeTagSerializer.parseFromStr(command.MakeMoveVec.type) },
14918
+ objects: command.MakeMoveVec.elements.map((arg) => convertTransactionArgument(arg, inputs))
14919
+ };
14920
+ if (command.MergeCoins) return {
14921
+ kind: "MergeCoins",
14922
+ destination: convertTransactionArgument(command.MergeCoins.destination, inputs),
14923
+ sources: command.MergeCoins.sources.map((arg) => convertTransactionArgument(arg, inputs))
14924
+ };
14925
+ if (command.MoveCall) return {
14926
+ kind: "MoveCall",
14927
+ target: `${command.MoveCall.package}::${command.MoveCall.module}::${command.MoveCall.function}`,
14928
+ typeArguments: command.MoveCall.typeArguments,
14929
+ arguments: command.MoveCall.arguments.map((arg) => convertTransactionArgument(arg, inputs))
14930
+ };
14931
+ if (command.Publish) return {
14932
+ kind: "Publish",
14933
+ modules: command.Publish.modules.map((mod3) => Array.from(fromBase64(mod3))),
14934
+ dependencies: command.Publish.dependencies
14935
+ };
14936
+ if (command.SplitCoins) return {
14937
+ kind: "SplitCoins",
14938
+ coin: convertTransactionArgument(command.SplitCoins.coin, inputs),
14939
+ amounts: command.SplitCoins.amounts.map((arg) => convertTransactionArgument(arg, inputs))
14940
+ };
14941
+ if (command.TransferObjects) return {
14942
+ kind: "TransferObjects",
14943
+ objects: command.TransferObjects.objects.map((arg) => convertTransactionArgument(arg, inputs)),
14944
+ address: convertTransactionArgument(command.TransferObjects.address, inputs)
14945
+ };
14946
+ if (command.Upgrade) return {
14947
+ kind: "Upgrade",
14948
+ modules: command.Upgrade.modules.map((mod3) => Array.from(fromBase64(mod3))),
14949
+ dependencies: command.Upgrade.dependencies,
14950
+ packageId: command.Upgrade.package,
14951
+ ticket: convertTransactionArgument(command.Upgrade.ticket, inputs)
14952
+ };
14953
+ throw new Error(`Unknown transaction ${Object.keys(command)}`);
14954
+ })
14955
+ };
14956
+ }
14957
+ function convertTransactionArgument(arg, inputs) {
14958
+ if (arg.$kind === "GasCoin") return { kind: "GasCoin" };
14959
+ if (arg.$kind === "Result") return {
14960
+ kind: "Result",
14961
+ index: arg.Result
14962
+ };
14963
+ if (arg.$kind === "NestedResult") return {
14964
+ kind: "NestedResult",
14965
+ index: arg.NestedResult[0],
14966
+ resultIndex: arg.NestedResult[1]
14967
+ };
14968
+ if (arg.$kind === "Input") return inputs[arg.Input];
14969
+ throw new Error(`Invalid argument ${Object.keys(arg)}`);
14970
+ }
14971
+ function transactionDataFromV1(data) {
14972
+ return parse3(TransactionDataSchema, {
14973
+ version: 2,
14974
+ sender: data.sender ?? null,
14975
+ expiration: data.expiration ? "Epoch" in data.expiration ? { Epoch: data.expiration.Epoch } : { None: true } : null,
14976
+ gasData: {
14977
+ owner: data.gasConfig.owner ?? null,
14978
+ budget: data.gasConfig.budget?.toString() ?? null,
14979
+ price: data.gasConfig.price?.toString() ?? null,
14980
+ payment: data.gasConfig.payment?.map((ref) => ({
14981
+ digest: ref.digest,
14982
+ objectId: ref.objectId,
14983
+ version: ref.version.toString()
14984
+ })) ?? null
14985
+ },
14986
+ inputs: data.inputs.map((input) => {
14987
+ if (input.kind === "Input") {
14988
+ if (/* @__PURE__ */ is(NormalizedCallArg2, input.value)) {
14989
+ const value = parse3(NormalizedCallArg2, input.value);
14990
+ if (value.Object) {
14991
+ if (value.Object.ImmOrOwned) return { Object: { ImmOrOwnedObject: {
14992
+ objectId: value.Object.ImmOrOwned.objectId,
14993
+ version: String(value.Object.ImmOrOwned.version),
14994
+ digest: value.Object.ImmOrOwned.digest
14995
+ } } };
14996
+ if (value.Object.Shared) return { Object: { SharedObject: {
14997
+ mutable: value.Object.Shared.mutable ?? null,
14998
+ initialSharedVersion: value.Object.Shared.initialSharedVersion,
14999
+ objectId: value.Object.Shared.objectId
15000
+ } } };
15001
+ if (value.Object.Receiving) return { Object: { Receiving: {
15002
+ digest: value.Object.Receiving.digest,
15003
+ version: String(value.Object.Receiving.version),
15004
+ objectId: value.Object.Receiving.objectId
15005
+ } } };
15006
+ throw new Error("Invalid object input");
15007
+ }
15008
+ return { Pure: { bytes: toBase64(new Uint8Array(value.Pure)) } };
15062
15009
  }
15063
- this.v0l ^= BBUF[0] ^ BBUF[16];
15064
- this.v0h ^= BBUF[1] ^ BBUF[17];
15065
- this.v1l ^= BBUF[2] ^ BBUF[18];
15066
- this.v1h ^= BBUF[3] ^ BBUF[19];
15067
- this.v2l ^= BBUF[4] ^ BBUF[20];
15068
- this.v2h ^= BBUF[5] ^ BBUF[21];
15069
- this.v3l ^= BBUF[6] ^ BBUF[22];
15070
- this.v3h ^= BBUF[7] ^ BBUF[23];
15071
- this.v4l ^= BBUF[8] ^ BBUF[24];
15072
- this.v4h ^= BBUF[9] ^ BBUF[25];
15073
- this.v5l ^= BBUF[10] ^ BBUF[26];
15074
- this.v5h ^= BBUF[11] ^ BBUF[27];
15075
- this.v6l ^= BBUF[12] ^ BBUF[28];
15076
- this.v6h ^= BBUF[13] ^ BBUF[29];
15077
- this.v7l ^= BBUF[14] ^ BBUF[30];
15078
- this.v7h ^= BBUF[15] ^ BBUF[31];
15079
- clean(BBUF);
15010
+ if (input.type === "object") return { UnresolvedObject: { objectId: input.value } };
15011
+ return { UnresolvedPure: { value: input.value } };
15080
15012
  }
15081
- destroy() {
15082
- this.destroyed = true;
15083
- clean(this.buffer32);
15084
- this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
15013
+ throw new Error("Invalid input");
15014
+ }),
15015
+ commands: data.transactions.map((transaction) => {
15016
+ switch (transaction.kind) {
15017
+ case "MakeMoveVec":
15018
+ return { MakeMoveVec: {
15019
+ type: "Some" in transaction.type ? TypeTagSerializer.tagToString(transaction.type.Some) : null,
15020
+ elements: transaction.objects.map((arg) => parseV1TransactionArgument(arg))
15021
+ } };
15022
+ case "MergeCoins":
15023
+ return { MergeCoins: {
15024
+ destination: parseV1TransactionArgument(transaction.destination),
15025
+ sources: transaction.sources.map((arg) => parseV1TransactionArgument(arg))
15026
+ } };
15027
+ case "MoveCall": {
15028
+ const [pkg, mod3, fn] = transaction.target.split("::");
15029
+ return { MoveCall: {
15030
+ package: pkg,
15031
+ module: mod3,
15032
+ function: fn,
15033
+ typeArguments: transaction.typeArguments,
15034
+ arguments: transaction.arguments.map((arg) => parseV1TransactionArgument(arg))
15035
+ } };
15036
+ }
15037
+ case "Publish":
15038
+ return { Publish: {
15039
+ modules: transaction.modules.map((mod3) => toBase64(Uint8Array.from(mod3))),
15040
+ dependencies: transaction.dependencies
15041
+ } };
15042
+ case "SplitCoins":
15043
+ return { SplitCoins: {
15044
+ coin: parseV1TransactionArgument(transaction.coin),
15045
+ amounts: transaction.amounts.map((arg) => parseV1TransactionArgument(arg))
15046
+ } };
15047
+ case "TransferObjects":
15048
+ return { TransferObjects: {
15049
+ objects: transaction.objects.map((arg) => parseV1TransactionArgument(arg)),
15050
+ address: parseV1TransactionArgument(transaction.address)
15051
+ } };
15052
+ case "Upgrade":
15053
+ return { Upgrade: {
15054
+ modules: transaction.modules.map((mod3) => toBase64(Uint8Array.from(mod3))),
15055
+ dependencies: transaction.dependencies,
15056
+ package: transaction.packageId,
15057
+ ticket: parseV1TransactionArgument(transaction.ticket)
15058
+ } };
15085
15059
  }
15086
- };
15087
- blake2b = /* @__PURE__ */ createHasher((opts) => new _BLAKE2b(opts));
15060
+ throw new Error(`Unknown transaction ${Object.keys(transaction)}`);
15061
+ })
15062
+ });
15063
+ }
15064
+ function parseV1TransactionArgument(arg) {
15065
+ switch (arg.kind) {
15066
+ case "GasCoin":
15067
+ return { GasCoin: true };
15068
+ case "Result":
15069
+ return { Result: arg.index };
15070
+ case "NestedResult":
15071
+ return { NestedResult: [arg.index, arg.resultIndex] };
15072
+ case "Input":
15073
+ return { Input: arg.index };
15074
+ }
15075
+ }
15076
+ var ObjectRef;
15077
+ var ObjectArg2;
15078
+ var NormalizedCallArg2;
15079
+ var TransactionInput;
15080
+ var TransactionArgumentTypes;
15081
+ var init_v1 = __esm({
15082
+ "../../node_modules/.pnpm/@mysten+sui@2.17.0_typescript@5.9.3/node_modules/@mysten/sui/dist/transactions/data/v1.mjs"() {
15083
+ init_type_tag_serializer();
15084
+ init_internal();
15085
+ init_dist2();
15086
+ init_dist3();
15087
+ ObjectRef = /* @__PURE__ */ object3({
15088
+ digest: /* @__PURE__ */ string3(),
15089
+ objectId: /* @__PURE__ */ string3(),
15090
+ version: /* @__PURE__ */ union2([
15091
+ /* @__PURE__ */ pipe2(/* @__PURE__ */ number3(), /* @__PURE__ */ integer2()),
15092
+ /* @__PURE__ */ string3(),
15093
+ /* @__PURE__ */ bigint2()
15094
+ ])
15095
+ });
15096
+ ObjectArg2 = safeEnum({
15097
+ ImmOrOwned: ObjectRef,
15098
+ Shared: /* @__PURE__ */ object3({
15099
+ objectId: ObjectID,
15100
+ initialSharedVersion: JsonU64,
15101
+ mutable: /* @__PURE__ */ boolean3()
15102
+ }),
15103
+ Receiving: ObjectRef
15104
+ });
15105
+ NormalizedCallArg2 = safeEnum({
15106
+ Object: ObjectArg2,
15107
+ Pure: /* @__PURE__ */ array2(/* @__PURE__ */ pipe2(/* @__PURE__ */ number3(), /* @__PURE__ */ integer2()))
15108
+ });
15109
+ TransactionInput = /* @__PURE__ */ union2([/* @__PURE__ */ object3({
15110
+ kind: /* @__PURE__ */ literal2("Input"),
15111
+ index: /* @__PURE__ */ pipe2(/* @__PURE__ */ number3(), /* @__PURE__ */ integer2()),
15112
+ value: /* @__PURE__ */ unknown2(),
15113
+ type: /* @__PURE__ */ optional2(/* @__PURE__ */ literal2("object"))
15114
+ }), /* @__PURE__ */ object3({
15115
+ kind: /* @__PURE__ */ literal2("Input"),
15116
+ index: /* @__PURE__ */ pipe2(/* @__PURE__ */ number3(), /* @__PURE__ */ integer2()),
15117
+ value: /* @__PURE__ */ unknown2(),
15118
+ type: /* @__PURE__ */ literal2("pure")
15119
+ })]);
15120
+ TransactionArgumentTypes = [
15121
+ TransactionInput,
15122
+ /* @__PURE__ */ object3({ kind: /* @__PURE__ */ literal2("GasCoin") }),
15123
+ /* @__PURE__ */ object3({
15124
+ kind: /* @__PURE__ */ literal2("Result"),
15125
+ index: /* @__PURE__ */ pipe2(/* @__PURE__ */ number3(), /* @__PURE__ */ integer2())
15126
+ }),
15127
+ /* @__PURE__ */ object3({
15128
+ kind: /* @__PURE__ */ literal2("NestedResult"),
15129
+ index: /* @__PURE__ */ pipe2(/* @__PURE__ */ number3(), /* @__PURE__ */ integer2()),
15130
+ resultIndex: /* @__PURE__ */ pipe2(/* @__PURE__ */ number3(), /* @__PURE__ */ integer2())
15131
+ })
15132
+ ];
15133
+ /* @__PURE__ */ union2([...TransactionArgumentTypes]);
15088
15134
  }
15089
15135
  });
15090
15136
  function hashTypedData(typeTag, data) {
@@ -15110,7 +15156,7 @@ var init_TransactionData = __esm({
15110
15156
  init_internal();
15111
15157
  init_v1();
15112
15158
  init_hash();
15113
- init_utils2();
15159
+ init_utils4();
15114
15160
  init_dist2();
15115
15161
  init_dist3();
15116
15162
  TransactionDataBuilder = class TransactionDataBuilder2 {
@@ -15548,25 +15594,6 @@ var init_Inputs = __esm({
15548
15594
  };
15549
15595
  }
15550
15596
  });
15551
- var MOVE_STDLIB_ADDRESS;
15552
- var SUI_FRAMEWORK_ADDRESS;
15553
- var SUI_CLOCK_OBJECT_ID;
15554
- var SUI_TYPE_ARG;
15555
- var SUI_SYSTEM_STATE_OBJECT_ID;
15556
- var SUI_RANDOM_OBJECT_ID;
15557
- var SUI_DENY_LIST_OBJECT_ID;
15558
- var init_constants = __esm({
15559
- "../../node_modules/.pnpm/@mysten+sui@2.17.0_typescript@5.9.3/node_modules/@mysten/sui/dist/utils/constants.mjs"() {
15560
- BigInt(1e9);
15561
- MOVE_STDLIB_ADDRESS = "0x0000000000000000000000000000000000000000000000000000000000000001";
15562
- SUI_FRAMEWORK_ADDRESS = "0x0000000000000000000000000000000000000000000000000000000000000002";
15563
- SUI_CLOCK_OBJECT_ID = "0x0000000000000000000000000000000000000000000000000000000000000006";
15564
- SUI_TYPE_ARG = `${SUI_FRAMEWORK_ADDRESS}::sui::SUI`;
15565
- SUI_SYSTEM_STATE_OBJECT_ID = "0x0000000000000000000000000000000000000000000000000000000000000005";
15566
- SUI_RANDOM_OBJECT_ID = "0x0000000000000000000000000000000000000000000000000000000000000008";
15567
- SUI_DENY_LIST_OBJECT_ID = "0x0000000000000000000000000000000000000000000000000000000000000403";
15568
- }
15569
- });
15570
15597
  function parseTypeName(typeName) {
15571
15598
  const parts = typeName.split("::");
15572
15599
  if (parts.length !== 3) throw new Error(`Invalid type name format: ${typeName}`);
@@ -16130,25 +16157,6 @@ var init_errors2 = __esm({
16130
16157
  };
16131
16158
  }
16132
16159
  });
16133
- function deriveDynamicFieldID(parentId, typeTag, key) {
16134
- const address = suiBcs.Address.serialize(parentId).toBytes();
16135
- const tag2 = suiBcs.TypeTag.serialize(typeTag).toBytes();
16136
- const keyLength = suiBcs.u64().serialize(key.length).toBytes();
16137
- const hash = blake2b.create({ dkLen: 32 });
16138
- hash.update(new Uint8Array([240]));
16139
- hash.update(address);
16140
- hash.update(keyLength);
16141
- hash.update(key);
16142
- hash.update(tag2);
16143
- return `0x${toHex(hash.digest().slice(0, 32))}`;
16144
- }
16145
- var init_dynamic_fields = __esm({
16146
- "../../node_modules/.pnpm/@mysten+sui@2.17.0_typescript@5.9.3/node_modules/@mysten/sui/dist/utils/dynamic-fields.mjs"() {
16147
- init_bcs3();
16148
- init_dist2();
16149
- init_blake2();
16150
- }
16151
- });
16152
16160
  function deriveReservationObjectId(owner, chainIdentifier) {
16153
16161
  const accBytes = fromHex(deriveDynamicFieldID(SUI_ACCUMULATOR_ROOT_OBJECT_ID, ACCUMULATOR_KEY_TYPE_TAG, suiBcs.Address.serialize(owner).toBytes()).slice(2));
16154
16162
  const chainBytes = fromBase58(chainIdentifier);
@@ -17205,7 +17213,7 @@ var init_Transaction = __esm({
17205
17213
  init_sui_types();
17206
17214
  init_internal();
17207
17215
  init_v1();
17208
- init_utils2();
17216
+ init_utils4();
17209
17217
  init_TransactionData();
17210
17218
  init_Commands();
17211
17219
  init_v2();
@@ -17278,7 +17286,7 @@ var init_Transaction = __esm({
17278
17286
  if (!this.#data.sender) this.#data.sender = sender;
17279
17287
  }
17280
17288
  setExpiration(expiration) {
17281
- this.#data.expiration = expiration ? parse3(TransactionExpiration, expiration) : null;
17289
+ this.#data.expiration = expiration ? parse3(TransactionExpiration2, expiration) : null;
17282
17290
  }
17283
17291
  setGasPrice(price) {
17284
17292
  this.#data.gasData.price = String(price);
@@ -18462,7 +18470,7 @@ __export(transactions_exports, {
18462
18470
  });
18463
18471
  var init_transactions = __esm({
18464
18472
  "../../node_modules/.pnpm/@mysten+sui@2.17.0_typescript@5.9.3/node_modules/@mysten/sui/dist/transactions/index.mjs"() {
18465
- init_utils2();
18473
+ init_utils4();
18466
18474
  init_TransactionData();
18467
18475
  init_Commands();
18468
18476
  init_Inputs();
@@ -20221,14 +20229,6 @@ var require_json_bigint = __commonJS({
20221
20229
  module.exports.stringify = json_stringify;
20222
20230
  }
20223
20231
  });
20224
- var init_utils4 = __esm({
20225
- "../../node_modules/.pnpm/@mysten+sui@2.17.0_typescript@5.9.3/node_modules/@mysten/sui/dist/utils/index.mjs"() {
20226
- init_move_registry();
20227
- init_sui_types();
20228
- init_constants();
20229
- init_dist2();
20230
- }
20231
- });
20232
20232
  var ClientCache;
20233
20233
  var init_cache = __esm({
20234
20234
  "../../node_modules/.pnpm/@mysten+sui@2.17.0_typescript@5.9.3/node_modules/@mysten/sui/dist/client/cache.mjs"() {
@@ -52669,7 +52669,7 @@ var init_dist7 = __esm({
52669
52669
  "../../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"() {
52670
52670
  init_transactions();
52671
52671
  import_json_bigint = __toESM(require_json_bigint());
52672
- init_utils4();
52672
+ init_utils3();
52673
52673
  init_grpc();
52674
52674
  init_esm();
52675
52675
  init_bcs3();
@@ -62877,7 +62877,7 @@ var init_publickey = __esm({
62877
62877
  init_signature_scheme2();
62878
62878
  init_dist2();
62879
62879
  init_blake2();
62880
- init_utils3();
62880
+ init_utils2();
62881
62881
  PublicKey2 = class {
62882
62882
  /**
62883
62883
  * Checks if two public keys are equal
@@ -63720,7 +63720,7 @@ var PACK_WIDTH;
63720
63720
  var init_utils9 = __esm({
63721
63721
  "../../node_modules/.pnpm/@mysten+sui@2.17.0_typescript@5.9.3/node_modules/@mysten/sui/dist/zklogin/utils.mjs"() {
63722
63722
  init_poseidon();
63723
- init_utils3();
63723
+ init_utils2();
63724
63724
  MAX_KEY_CLAIM_NAME_LENGTH = 32;
63725
63725
  MAX_KEY_CLAIM_VALUE_LENGTH = 115;
63726
63726
  MAX_AUD_VALUE_LENGTH = 145;
@@ -64115,7 +64115,7 @@ var ALLOWED_FNS;
64115
64115
  var init_x402 = __esm({
64116
64116
  "../../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"() {
64117
64117
  init_transactions();
64118
- init_utils4();
64118
+ init_utils3();
64119
64119
  X402_SCHEME = "exact";
64120
64120
  X402_VERSION = 1;
64121
64121
  X402_PAYMENT_HEADER = "X-PAYMENT";
@@ -64175,7 +64175,7 @@ var init_address = __esm({
64175
64175
  init_utils9();
64176
64176
  init_jwt_utils();
64177
64177
  init_blake2();
64178
- init_utils3();
64178
+ init_utils2();
64179
64179
  MAX_HEADER_LEN_B64 = 248;
64180
64180
  MAX_PADDED_UNSIGNED_JWT_LEN = 1600;
64181
64181
  }
@@ -64206,7 +64206,7 @@ var init_nonce = __esm({
64206
64206
  init_poseidon();
64207
64207
  init_utils9();
64208
64208
  init_dist2();
64209
- init_utils3();
64209
+ init_utils2();
64210
64210
  init_base();
64211
64211
  NONCE_LENGTH = 27;
64212
64212
  }
@@ -74225,6 +74225,7 @@ var StdioServerTransport = class {
74225
74225
  });
74226
74226
  }
74227
74227
  };
74228
+ init_utils3();
74228
74229
  init_transactions();
74229
74230
  init_dist7();
74230
74231
  var import_bn7 = __toESM(require_bn2());
@@ -74233,10 +74234,10 @@ var PaymentKitClientError = class extends Error {
74233
74234
  };
74234
74235
  var PaymentKitUriError = class extends PaymentKitClientError {
74235
74236
  };
74236
- init_utils4();
74237
+ init_utils3();
74237
74238
  normalizeStructTag(SUI_TYPE_ARG);
74238
74239
  var SUI_PAYMENT_KIT_PROTOCOL = "sui:pay";
74239
- init_utils4();
74240
+ init_utils3();
74240
74241
  var isValidNonce = (nonce) => {
74241
74242
  return nonce.length <= 36;
74242
74243
  };
@@ -76732,13 +76733,12 @@ var SuiGraphQLClient = class extends BaseClient {
76732
76733
  return this.core.defaultNameServiceName(input);
76733
76734
  }
76734
76735
  };
76735
- init_utils4();
76736
76736
  init_signature_scheme2();
76737
76737
  init_publickey();
76738
76738
  init_dist2();
76739
76739
  init_md();
76740
76740
  init_u64();
76741
- init_utils3();
76741
+ init_utils2();
76742
76742
  var K512 = /* @__PURE__ */ (() => split([
76743
76743
  "0x428a2f98d728ae22",
76744
76744
  "0x7137449123ef65cd",
@@ -76945,8 +76945,8 @@ var sha512 = /* @__PURE__ */ createHasher(
76945
76945
  () => new _SHA512(),
76946
76946
  /* @__PURE__ */ oidNist(3)
76947
76947
  );
76948
- init_utils3();
76949
- init_utils3();
76948
+ init_utils2();
76949
+ init_utils2();
76950
76950
  var _0n = /* @__PURE__ */ BigInt(0);
76951
76951
  var _1n = /* @__PURE__ */ BigInt(1);
76952
76952
  function abool(value, title = "") {
@@ -78133,7 +78133,7 @@ var Ed25519PublicKey = class extends PublicKey2 {
78133
78133
  }
78134
78134
  };
78135
78135
  init_dist2();
78136
- init_utils3();
78136
+ init_utils2();
78137
78137
  var _HMAC = class {
78138
78138
  oHash;
78139
78139
  iHash;
@@ -78203,7 +78203,7 @@ var _HMAC = class {
78203
78203
  };
78204
78204
  var hmac = (hash, key, message) => new _HMAC(hash, key).update(message).digest();
78205
78205
  hmac.create = (hash, key) => new _HMAC(hash, key);
78206
- init_utils3();
78206
+ init_utils2();
78207
78207
  function pbkdf2Init(hash, _password, _salt, _opts) {
78208
78208
  ahash(hash);
78209
78209
  const opts = checkOpts({ dkLen: 32, asyncTick: 10 }, _opts);
@@ -78608,6 +78608,38 @@ var init_errors3 = __esm2({
78608
78608
  };
78609
78609
  }
78610
78610
  });
78611
+ function preflightFail(code, error2) {
78612
+ return { valid: false, code, error: error2 };
78613
+ }
78614
+ function checkPositiveAmount(amount, label = "Amount", max2 = PREFLIGHT_MAX_AMOUNT) {
78615
+ if (typeof amount !== "number" || !Number.isFinite(amount)) {
78616
+ return preflightFail("INVALID_AMOUNT", `${label} must be a finite number`);
78617
+ }
78618
+ if (amount <= 0) {
78619
+ return preflightFail("INVALID_AMOUNT", `${label} must be greater than zero`);
78620
+ }
78621
+ if (amount > max2) {
78622
+ return preflightFail("INVALID_AMOUNT", `${label} ${amount} exceeds the sane maximum (${max2})`);
78623
+ }
78624
+ return PREFLIGHT_OK;
78625
+ }
78626
+ function checkSuiAddress(address, label = "recipient") {
78627
+ try {
78628
+ if (typeof address === "string" && address.trim() !== "" && isValidSuiAddress(normalizeSuiAddress(address))) {
78629
+ return PREFLIGHT_OK;
78630
+ }
78631
+ } catch {
78632
+ }
78633
+ return preflightFail("INVALID_ADDRESS", `Invalid ${label} address: ${address}`);
78634
+ }
78635
+ var PREFLIGHT_MAX_AMOUNT;
78636
+ var PREFLIGHT_OK;
78637
+ var init_preflight = __esm2({
78638
+ "src/preflight.ts"() {
78639
+ PREFLIGHT_MAX_AMOUNT = 1e6;
78640
+ PREFLIGHT_OK = { valid: true };
78641
+ }
78642
+ });
78611
78643
  var token_registry_exports = {};
78612
78644
  __export2(token_registry_exports, {
78613
78645
  COIN_REGISTRY: () => COIN_REGISTRY,
@@ -78881,10 +78913,28 @@ __export2(cetus_swap_exports, {
78881
78913
  findSwapRoute: () => findSwapRoute,
78882
78914
  isCetusRouteFresh: () => isCetusRouteFresh,
78883
78915
  isPrecomputedRouteCompatibleWithProviders: () => isPrecomputedRouteCompatibleWithProviders,
78916
+ preflightSwap: () => preflightSwap,
78884
78917
  resolveTokenType: () => resolveTokenType,
78885
78918
  serializeCetusRoute: () => serializeCetusRoute,
78886
78919
  verifyCetusRouteCoinMatch: () => verifyCetusRouteCoinMatch
78887
78920
  });
78921
+ function preflightSwap(input) {
78922
+ if (typeof input.from !== "string" || input.from.trim() === "") {
78923
+ return preflightFail("INVALID_ASSET", "A `from` token is required to swap");
78924
+ }
78925
+ if (typeof input.to !== "string" || input.to.trim() === "") {
78926
+ return preflightFail("INVALID_ASSET", "A `to` token is required to swap");
78927
+ }
78928
+ const amountCheck = checkPositiveAmount(input.amount, "Amount", Number.POSITIVE_INFINITY);
78929
+ if (!amountCheck.valid) return amountCheck;
78930
+ const resolvedFrom = resolveTokenType(input.from);
78931
+ const resolvedTo = resolveTokenType(input.to);
78932
+ const sameToken = input.from.trim() === input.to.trim() || resolvedFrom !== null && resolvedFrom === resolvedTo;
78933
+ if (sameToken) {
78934
+ return preflightFail("INVALID_ASSET", `Cannot swap ${input.from} to itself`);
78935
+ }
78936
+ return PREFLIGHT_OK;
78937
+ }
78888
78938
  function serializeCetusRoute(route, context) {
78889
78939
  return {
78890
78940
  routerData: serializeRouterDataV3(route.routerData),
@@ -79137,6 +79187,7 @@ var clientCache;
79137
79187
  var init_cetus_swap = __esm2({
79138
79188
  "src/protocols/cetus-swap.ts"() {
79139
79189
  init_token_registry();
79190
+ init_preflight();
79140
79191
  init_token_registry();
79141
79192
  OVERLAY_FEE_RATE = 1e-3;
79142
79193
  clientCache = /* @__PURE__ */ new Map();
@@ -79462,8 +79513,33 @@ async function executeTx(client, signer, buildTx, options = {}) {
79462
79513
  return { digest: txn.digest, gasCostSui, effects };
79463
79514
  }
79464
79515
  init_errors3();
79516
+ init_preflight();
79517
+ function preflightPay(input) {
79518
+ if (typeof input.url !== "string" || input.url.trim() === "") {
79519
+ return preflightFail("FACILITATOR_REJECTION", "A target URL is required to pay");
79520
+ }
79521
+ let parsed;
79522
+ try {
79523
+ parsed = new URL(input.url);
79524
+ } catch {
79525
+ return preflightFail("FACILITATOR_REJECTION", `Invalid URL: ${input.url}`);
79526
+ }
79527
+ if (parsed.protocol !== "http:" && parsed.protocol !== "https:") {
79528
+ return preflightFail(
79529
+ "FACILITATOR_REJECTION",
79530
+ `URL must be http(s): got ${parsed.protocol}//`
79531
+ );
79532
+ }
79533
+ if (input.maxPrice !== void 0) {
79534
+ const priceCheck = checkPositiveAmount(input.maxPrice, "maxPrice");
79535
+ if (!priceCheck.valid) return priceCheck;
79536
+ }
79537
+ return PREFLIGHT_OK;
79538
+ }
79465
79539
  async function payWithMpp(args) {
79466
79540
  const { signer, client, options } = args;
79541
+ const pf = preflightPay({ url: options.url, maxPrice: options.maxPrice });
79542
+ if (!pf.valid) throw new T2000Error(pf.code, pf.error);
79467
79543
  const method = (options.method ?? "GET").toUpperCase();
79468
79544
  const canHaveBody = method !== "GET" && method !== "HEAD";
79469
79545
  const reqInit = {
@@ -79655,6 +79731,25 @@ for (const [key, info] of Object.entries(SUPPORTED_ASSETS)) {
79655
79731
  ASSET_LOOKUP.set(info.displayName.toUpperCase(), key);
79656
79732
  }
79657
79733
  }
79734
+ init_preflight();
79735
+ function preflightSend(input) {
79736
+ try {
79737
+ assertAllowedAsset("send", input.asset);
79738
+ } catch (e) {
79739
+ return preflightFail("INVALID_ASSET", e.message);
79740
+ }
79741
+ const amountCheck = checkPositiveAmount(input.amount);
79742
+ if (!amountCheck.valid) return amountCheck;
79743
+ if ((input.asset === "USDC" || input.asset === "USDsui") && input.amount < GASLESS_MIN_STABLE_AMOUNT) {
79744
+ return preflightFail(
79745
+ "INVALID_AMOUNT",
79746
+ `Minimum gasless transfer is ${GASLESS_MIN_STABLE_AMOUNT} ${input.asset}. Got ${input.amount}.`
79747
+ );
79748
+ }
79749
+ const addressCheck = checkSuiAddress(input.to);
79750
+ if (!addressCheck.valid) return addressCheck;
79751
+ return PREFLIGHT_OK;
79752
+ }
79658
79753
  async function buildSendTx({
79659
79754
  client,
79660
79755
  address,
@@ -79662,17 +79757,11 @@ async function buildSendTx({
79662
79757
  amount,
79663
79758
  asset
79664
79759
  }) {
79665
- assertAllowedAsset("send", asset);
79760
+ const pf = preflightSend({ to, amount, asset });
79761
+ if (!pf.valid) throw new T2000Error(pf.code, pf.error);
79666
79762
  const recipient = validateAddress(to);
79667
79763
  const assetInfo = SUPPORTED_ASSETS[asset];
79668
79764
  if (!assetInfo) throw new T2000Error("ASSET_NOT_SUPPORTED", `Asset ${asset} is not supported`);
79669
- if (amount <= 0) throw new T2000Error("INVALID_AMOUNT", "Amount must be greater than zero");
79670
- if ((asset === "USDC" || asset === "USDsui") && amount < GASLESS_MIN_STABLE_AMOUNT) {
79671
- throw new T2000Error(
79672
- "INVALID_AMOUNT",
79673
- `Minimum gasless transfer is ${GASLESS_MIN_STABLE_AMOUNT} ${asset}. Got ${amount}.`
79674
- );
79675
- }
79676
79765
  const rawAmount = displayToRaw(amount, assetInfo.decimals);
79677
79766
  const tx = new Transaction();
79678
79767
  tx.setSender(address);
@@ -79959,7 +80048,7 @@ var TX_NODE_FRAGMENT = `
79959
80048
  }
79960
80049
  `;
79961
80050
  var HISTORY_QUERY = `query History($address: SuiAddress!, $last: Int!) {
79962
- transactions(last: $last, filter: { sentAddress: $address }) {
80051
+ transactions(last: $last, filter: { affectedAddress: $address }) {
79963
80052
  nodes {${TX_NODE_FRAGMENT}}
79964
80053
  }
79965
80054
  }`;
@@ -80029,7 +80118,9 @@ function buildRecord(args) {
80029
80118
  return { digest, action, label, legs, amount, asset, recipient, direction, timestamp: timestampMs, gasCost };
80030
80119
  }
80031
80120
  init_token_registry();
80032
- var SUI_MAINNET_URL = "https://fullnode.mainnet.sui.io:443";
80121
+ var RESOLVE_NAME_QUERY = `query ResolveSuins($name: String!) {
80122
+ address(name: $name) { address }
80123
+ }`;
80033
80124
  var SUI_ADDRESS_REGEX = /^0x[a-fA-F0-9]{1,64}$/i;
80034
80125
  var SUINS_NAME_REGEX = /^[a-z0-9-]+(\.[a-z0-9-]+)*\.sui$/;
80035
80126
  var InvalidAddressError = class extends Error {
@@ -80066,38 +80157,22 @@ async function resolveSuinsViaRpc(rawName, ctx = {}) {
80066
80157
  if (!SUINS_NAME_REGEX.test(name)) {
80067
80158
  throw new InvalidAddressError(rawName);
80068
80159
  }
80069
- const url2 = ctx.suiRpcUrl || SUI_MAINNET_URL;
80160
+ const gql = getSuiGraphQLClient();
80070
80161
  let res;
80071
80162
  try {
80072
- res = await fetch(url2, {
80073
- method: "POST",
80074
- headers: { "Content-Type": "application/json" },
80075
- body: JSON.stringify({
80076
- jsonrpc: "2.0",
80077
- id: 1,
80078
- method: "suix_resolveNameServiceAddress",
80079
- params: [name]
80080
- }),
80081
- signal: ctx.signal ?? AbortSignal.timeout(8e3)
80163
+ res = await gql.query({
80164
+ query: RESOLVE_NAME_QUERY,
80165
+ variables: { name },
80166
+ signal: ctx.signal
80082
80167
  });
80083
80168
  } catch (err) {
80084
80169
  const msg = err instanceof Error ? err.message : String(err);
80085
80170
  throw new SuinsRpcError(name, msg);
80086
80171
  }
80087
- if (!res.ok) {
80088
- throw new SuinsRpcError(name, `HTTP ${res.status}`);
80089
- }
80090
- let body;
80091
- try {
80092
- body = await res.json();
80093
- } catch (err) {
80094
- const msg = err instanceof Error ? err.message : String(err);
80095
- throw new SuinsRpcError(name, `JSON parse failed: ${msg}`);
80096
- }
80097
- if (body.error) {
80098
- throw new SuinsRpcError(name, body.error.message);
80172
+ if (res.errors?.length) {
80173
+ throw new SuinsRpcError(name, res.errors.map((e) => e.message ?? "unknown error").join("; "));
80099
80174
  }
80100
- return body.result ?? null;
80175
+ return res.data?.address?.address ?? null;
80101
80176
  }
80102
80177
  init_errors3();
80103
80178
  var DEFAULT_CONFIG_DIR = join$1(homedir(), ".t2000");
@@ -80369,7 +80444,9 @@ var T2000 = class _T2000 extends import_index2.default {
80369
80444
  amountUsd: approxUsdValue(params.from, params.amount) ?? 0,
80370
80445
  force: params.force
80371
80446
  });
80372
- const { findSwapRoute: findSwapRoute2, buildSwapTx: buildSwapTx2, resolveTokenType: resolveTokenType2 } = await Promise.resolve().then(() => (init_cetus_swap(), cetus_swap_exports));
80447
+ const { findSwapRoute: findSwapRoute2, buildSwapTx: buildSwapTx2, resolveTokenType: resolveTokenType2, preflightSwap: preflightSwap2 } = await Promise.resolve().then(() => (init_cetus_swap(), cetus_swap_exports));
80448
+ const pf = preflightSwap2({ from: params.from, to: params.to, amount: params.amount });
80449
+ if (!pf.valid) throw new T2000Error(pf.code, pf.error);
80373
80450
  const fromType = resolveTokenType2(params.from);
80374
80451
  const toType = resolveTokenType2(params.to);
80375
80452
  if (!fromType) throw new T2000Error("ASSET_NOT_SUPPORTED", `Unknown token: ${params.from}. Provide the full coin type.`);
@@ -80703,6 +80780,7 @@ init_errors3();
80703
80780
  init_swap_quote();
80704
80781
  init_cetus_swap();
80705
80782
  init_token_registry();
80783
+ init_preflight();
80706
80784
  async function createAgent(keyPath) {
80707
80785
  return T2000.create({ keyPath });
80708
80786
  }
@@ -81088,7 +81166,7 @@ Through this wallet you can reach essentially any major external API, billed to
81088
81166
  CRITICAL: When the user asks to use any external or paid API, names a provider (e.g. "via fal.ai", "with ElevenLabs"), or requests a capability one of the services above provides, DO NOT say you cannot reach that service, that it isn't on an allowlist, or that there's no connector \u2014 and do NOT fall back to writing a script for the user to run. You CAN do it directly through this wallet. Use t2000_services to discover the endpoint and request shape, then t2000_pay to execute, then show the user the result (display image/audio URLs returned in the response).
81089
81167
 
81090
81168
  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.`;
81091
- var PKG_VERSION = "5.5.0";
81169
+ var PKG_VERSION = "5.6.0";
81092
81170
  console.log = (...args) => console.error("[log]", ...args);
81093
81171
  console.warn = (...args) => console.error("[warn]", ...args);
81094
81172
  async function startMcpServer(opts) {
@@ -81154,4 +81232,4 @@ mime-types/index.js:
81154
81232
  @scure/bip39/index.js:
81155
81233
  (*! scure-bip39 - MIT License (c) 2022 Patricio Palladino, Paul Miller (paulmillr.com) *)
81156
81234
  */
81157
- //# sourceMappingURL=dist-4JZ33TE5.js.map
81235
+ //# sourceMappingURL=dist-ULTRYNV7.js.map