@interest-protocol/vortex-sdk 11.3.0 → 11.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -2837,12 +2837,12 @@ const InnerTypeTag = bcs.enum("TypeTag", {
2837
2837
  address: null,
2838
2838
  signer: null,
2839
2839
  vector: bcs.lazy(() => InnerTypeTag),
2840
- struct: bcs.lazy(() => StructTag$1),
2840
+ struct: bcs.lazy(() => StructTag),
2841
2841
  u16: null,
2842
2842
  u32: null,
2843
2843
  u256: null
2844
2844
  });
2845
- const TypeTag$1 = InnerTypeTag.transform({
2845
+ const TypeTag = InnerTypeTag.transform({
2846
2846
  input: (typeTag) => typeof typeTag === "string" ? TypeTagSerializer.parseFromStr(typeTag, true) : typeTag,
2847
2847
  output: (typeTag) => TypeTagSerializer.tagToString(typeTag)
2848
2848
  });
@@ -2856,7 +2856,7 @@ const ProgrammableMoveCall$1 = bcs.struct("ProgrammableMoveCall", {
2856
2856
  package: Address,
2857
2857
  module: bcs.string(),
2858
2858
  function: bcs.string(),
2859
- typeArguments: bcs.vector(TypeTag$1),
2859
+ typeArguments: bcs.vector(TypeTag),
2860
2860
  arguments: bcs.vector(Argument$1)
2861
2861
  });
2862
2862
  const Command$1 = bcs.enum("Command", {
@@ -2905,7 +2905,7 @@ const Command$1 = bcs.enum("Command", {
2905
2905
  // * so this call serves a utility function.
2906
2906
  // */
2907
2907
  MakeMoveVec: bcs.struct("MakeMoveVec", {
2908
- type: optionEnum(TypeTag$1).transform({
2908
+ type: optionEnum(TypeTag).transform({
2909
2909
  input: (val) => val === null ? {
2910
2910
  None: true
2911
2911
  } : {
@@ -2937,11 +2937,11 @@ const TransactionKind = bcs.enum("TransactionKind", {
2937
2937
  Genesis: null,
2938
2938
  ConsensusCommitPrologue: null
2939
2939
  });
2940
- const TransactionExpiration$3 = bcs.enum("TransactionExpiration", {
2940
+ const TransactionExpiration$2 = bcs.enum("TransactionExpiration", {
2941
2941
  None: null,
2942
2942
  Epoch: unsafe_u64()
2943
2943
  });
2944
- const StructTag$1 = bcs.struct("StructTag", {
2944
+ const StructTag = bcs.struct("StructTag", {
2945
2945
  address: Address,
2946
2946
  module: bcs.string(),
2947
2947
  name: bcs.string(),
@@ -2957,7 +2957,7 @@ const TransactionDataV1 = bcs.struct("TransactionDataV1", {
2957
2957
  kind: TransactionKind,
2958
2958
  sender: Address,
2959
2959
  gasData: GasData$1,
2960
- expiration: TransactionExpiration$3
2960
+ expiration: TransactionExpiration$2
2961
2961
  });
2962
2962
  const TransactionData = bcs.enum("TransactionData", {
2963
2963
  V1: TransactionDataV1
@@ -3283,14 +3283,14 @@ const suiBcs = {
3283
3283
  SenderSignedData,
3284
3284
  SenderSignedTransaction,
3285
3285
  SharedObjectRef,
3286
- StructTag: StructTag$1,
3286
+ StructTag,
3287
3287
  SuiObjectRef,
3288
3288
  TransactionData,
3289
3289
  TransactionDataV1,
3290
3290
  TransactionEffects,
3291
- TransactionExpiration: TransactionExpiration$3,
3291
+ TransactionExpiration: TransactionExpiration$2,
3292
3292
  TransactionKind,
3293
- TypeTag: TypeTag$1
3293
+ TypeTag
3294
3294
  };
3295
3295
 
3296
3296
  function deriveDynamicFieldID(parentId, typeTag, key) {
@@ -3424,8 +3424,8 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
3424
3424
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
3425
3425
  };
3426
3426
 
3427
- const PACKAGE_VERSION = "1.43.2";
3428
- const TARGETED_RPC_VERSION = "1.60.0";
3427
+ const PACKAGE_VERSION = "1.45.2";
3428
+ const TARGETED_RPC_VERSION = "1.62.0";
3429
3429
 
3430
3430
  const CODE_TO_ERROR_TYPE = {
3431
3431
  "-32700": "ParseError",
@@ -3826,783 +3826,914 @@ class Experimental_BaseClient {
3826
3826
  }
3827
3827
  }
3828
3828
 
3829
- // src/actions/await/awaitAsync.ts
3830
-
3831
- // src/storages/globalConfig/globalConfig.ts
3832
- var store;
3833
- function getGlobalConfig(config2) {
3834
- return {
3835
- lang: config2?.lang ?? store?.lang,
3836
- message: config2?.message,
3837
- abortEarly: config2?.abortEarly ?? store?.abortEarly,
3838
- abortPipeEarly: config2?.abortPipeEarly ?? store?.abortPipeEarly
3839
- };
3829
+ //#region src/storages/globalConfig/globalConfig.ts
3830
+ let store$4;
3831
+ /**
3832
+ * Returns the global configuration.
3833
+ *
3834
+ * @param config The config to merge.
3835
+ *
3836
+ * @returns The configuration.
3837
+ */
3838
+ /* @__NO_SIDE_EFFECTS__ */
3839
+ function getGlobalConfig(config$1) {
3840
+ return {
3841
+ lang: config$1?.lang ?? store$4?.lang,
3842
+ message: config$1?.message,
3843
+ abortEarly: config$1?.abortEarly ?? store$4?.abortEarly,
3844
+ abortPipeEarly: config$1?.abortPipeEarly ?? store$4?.abortPipeEarly
3845
+ };
3840
3846
  }
3841
3847
 
3842
- // src/storages/globalMessage/globalMessage.ts
3843
- var store2;
3848
+ //#endregion
3849
+ //#region src/storages/globalMessage/globalMessage.ts
3850
+ let store$3;
3851
+ /**
3852
+ * Returns a global error message.
3853
+ *
3854
+ * @param lang The language of the message.
3855
+ *
3856
+ * @returns The error message.
3857
+ */
3858
+ /* @__NO_SIDE_EFFECTS__ */
3844
3859
  function getGlobalMessage(lang) {
3845
- return store2?.get(lang);
3860
+ return store$3?.get(lang);
3846
3861
  }
3847
3862
 
3848
- // src/storages/schemaMessage/schemaMessage.ts
3849
- var store3;
3863
+ //#endregion
3864
+ //#region src/storages/schemaMessage/schemaMessage.ts
3865
+ let store$2;
3866
+ /**
3867
+ * Returns a schema error message.
3868
+ *
3869
+ * @param lang The language of the message.
3870
+ *
3871
+ * @returns The error message.
3872
+ */
3873
+ /* @__NO_SIDE_EFFECTS__ */
3850
3874
  function getSchemaMessage(lang) {
3851
- return store3?.get(lang);
3875
+ return store$2?.get(lang);
3852
3876
  }
3853
3877
 
3854
- // src/storages/specificMessage/specificMessage.ts
3855
- var store4;
3878
+ //#endregion
3879
+ //#region src/storages/specificMessage/specificMessage.ts
3880
+ let store$1;
3881
+ /**
3882
+ * Returns a specific error message.
3883
+ *
3884
+ * @param reference The identifier reference.
3885
+ * @param lang The language of the message.
3886
+ *
3887
+ * @returns The error message.
3888
+ */
3889
+ /* @__NO_SIDE_EFFECTS__ */
3856
3890
  function getSpecificMessage(reference, lang) {
3857
- return store4?.get(reference)?.get(lang);
3891
+ return store$1?.get(reference)?.get(lang);
3858
3892
  }
3859
3893
 
3860
- // src/utils/_stringify/_stringify.ts
3894
+ //#endregion
3895
+ //#region src/utils/_stringify/_stringify.ts
3896
+ /**
3897
+ * Stringifies an unknown input to a literal or type string.
3898
+ *
3899
+ * @param input The unknown input.
3900
+ *
3901
+ * @returns A literal or type string.
3902
+ *
3903
+ * @internal
3904
+ */
3905
+ /* @__NO_SIDE_EFFECTS__ */
3861
3906
  function _stringify(input) {
3862
- const type = typeof input;
3863
- if (type === "string") {
3864
- return `"${input}"`;
3865
- }
3866
- if (type === "number" || type === "bigint" || type === "boolean") {
3867
- return `${input}`;
3868
- }
3869
- if (type === "object" || type === "function") {
3870
- return (input && Object.getPrototypeOf(input)?.constructor?.name) ?? "null";
3871
- }
3872
- return type;
3907
+ const type = typeof input;
3908
+ if (type === "string") return `"${input}"`;
3909
+ if (type === "number" || type === "bigint" || type === "boolean") return `${input}`;
3910
+ if (type === "object" || type === "function") return (input && Object.getPrototypeOf(input)?.constructor?.name) ?? "null";
3911
+ return type;
3873
3912
  }
3874
3913
 
3875
- // src/utils/_addIssue/_addIssue.ts
3876
- function _addIssue(context, label, dataset, config2, other) {
3877
- const input = other && "input" in other ? other.input : dataset.value;
3878
- const expected = other?.expected ?? context.expects ?? null;
3879
- const received = other?.received ?? _stringify(input);
3880
- const issue = {
3881
- kind: context.kind,
3882
- type: context.type,
3883
- input,
3884
- expected,
3885
- received,
3886
- message: `Invalid ${label}: ${expected ? `Expected ${expected} but r` : "R"}eceived ${received}`,
3887
- // @ts-expect-error
3888
- requirement: context.requirement,
3889
- path: other?.path,
3890
- issues: other?.issues,
3891
- lang: config2.lang,
3892
- abortEarly: config2.abortEarly,
3893
- abortPipeEarly: config2.abortPipeEarly
3894
- };
3895
- const isSchema = context.kind === "schema";
3896
- const message = other?.message ?? // @ts-expect-error
3897
- context.message ?? getSpecificMessage(context.reference, issue.lang) ?? (isSchema ? getSchemaMessage(issue.lang) : null) ?? config2.message ?? getGlobalMessage(issue.lang);
3898
- if (message) {
3899
- issue.message = typeof message === "function" ? message(issue) : message;
3900
- }
3901
- if (isSchema) {
3902
- dataset.typed = false;
3903
- }
3904
- if (dataset.issues) {
3905
- dataset.issues.push(issue);
3906
- } else {
3907
- dataset.issues = [issue];
3908
- }
3914
+ //#endregion
3915
+ //#region src/utils/_addIssue/_addIssue.ts
3916
+ /**
3917
+ * Adds an issue to the dataset.
3918
+ *
3919
+ * @param context The issue context.
3920
+ * @param label The issue label.
3921
+ * @param dataset The input dataset.
3922
+ * @param config The configuration.
3923
+ * @param other The optional props.
3924
+ *
3925
+ * @internal
3926
+ */
3927
+ function _addIssue(context, label, dataset, config$1, other) {
3928
+ const input = other && "input" in other ? other.input : dataset.value;
3929
+ const expected = other?.expected ?? context.expects ?? null;
3930
+ const received = other?.received ?? /* @__PURE__ */ _stringify(input);
3931
+ const issue = {
3932
+ kind: context.kind,
3933
+ type: context.type,
3934
+ input,
3935
+ expected,
3936
+ received,
3937
+ message: `Invalid ${label}: ${expected ? `Expected ${expected} but r` : "R"}eceived ${received}`,
3938
+ requirement: context.requirement,
3939
+ path: other?.path,
3940
+ issues: other?.issues,
3941
+ lang: config$1.lang,
3942
+ abortEarly: config$1.abortEarly,
3943
+ abortPipeEarly: config$1.abortPipeEarly
3944
+ };
3945
+ const isSchema = context.kind === "schema";
3946
+ const message$1 = other?.message ?? context.message ?? /* @__PURE__ */ getSpecificMessage(context.reference, issue.lang) ?? (isSchema ? /* @__PURE__ */ getSchemaMessage(issue.lang) : null) ?? config$1.message ?? /* @__PURE__ */ getGlobalMessage(issue.lang);
3947
+ if (message$1 !== void 0) issue.message = typeof message$1 === "function" ? message$1(issue) : message$1;
3948
+ if (isSchema) dataset.typed = false;
3949
+ if (dataset.issues) dataset.issues.push(issue);
3950
+ else dataset.issues = [issue];
3909
3951
  }
3910
3952
 
3911
- // src/utils/_isValidObjectKey/_isValidObjectKey.ts
3912
- function _isValidObjectKey(object2, key) {
3913
- return Object.hasOwn(object2, key) && key !== "__proto__" && key !== "prototype" && key !== "constructor";
3953
+ //#endregion
3954
+ //#region src/utils/_getStandardProps/_getStandardProps.ts
3955
+ /**
3956
+ * Returns the Standard Schema properties.
3957
+ *
3958
+ * @param context The schema context.
3959
+ *
3960
+ * @returns The Standard Schema properties.
3961
+ */
3962
+ /* @__NO_SIDE_EFFECTS__ */
3963
+ function _getStandardProps(context) {
3964
+ return {
3965
+ version: 1,
3966
+ vendor: "valibot",
3967
+ validate(value$1) {
3968
+ return context["~run"]({ value: value$1 }, /* @__PURE__ */ getGlobalConfig());
3969
+ }
3970
+ };
3914
3971
  }
3915
3972
 
3916
- // src/utils/ValiError/ValiError.ts
3973
+ //#endregion
3974
+ //#region src/utils/_isValidObjectKey/_isValidObjectKey.ts
3975
+ /**
3976
+ * Disallows inherited object properties and prevents object prototype
3977
+ * pollution by disallowing certain keys.
3978
+ *
3979
+ * @param object The object to check.
3980
+ * @param key The key to check.
3981
+ *
3982
+ * @returns Whether the key is allowed.
3983
+ *
3984
+ * @internal
3985
+ */
3986
+ /* @__NO_SIDE_EFFECTS__ */
3987
+ function _isValidObjectKey(object$1, key) {
3988
+ return Object.hasOwn(object$1, key) && key !== "__proto__" && key !== "prototype" && key !== "constructor";
3989
+ }
3990
+
3991
+ //#endregion
3992
+ //#region src/utils/_joinExpects/_joinExpects.ts
3993
+ /**
3994
+ * Joins multiple `expects` values with the given separator.
3995
+ *
3996
+ * @param values The `expects` values.
3997
+ * @param separator The separator.
3998
+ *
3999
+ * @returns The joined `expects` property.
4000
+ *
4001
+ * @internal
4002
+ */
4003
+ /* @__NO_SIDE_EFFECTS__ */
4004
+ function _joinExpects(values$1, separator) {
4005
+ const list = [...new Set(values$1)];
4006
+ if (list.length > 1) return `(${list.join(` ${separator} `)})`;
4007
+ return list[0] ?? "never";
4008
+ }
4009
+
4010
+ //#endregion
4011
+ //#region src/utils/ValiError/ValiError.ts
4012
+ /**
4013
+ * A Valibot error with useful information.
4014
+ */
3917
4015
  var ValiError = class extends Error {
3918
- /**
3919
- * The error issues.
3920
- */
3921
- issues;
3922
- /**
3923
- * Creates a Valibot error with useful information.
3924
- *
3925
- * @param issues The error issues.
3926
- */
3927
- constructor(issues) {
3928
- super(issues[0].message);
3929
- this.name = "ValiError";
3930
- this.issues = issues;
3931
- }
4016
+ /**
4017
+ * Creates a Valibot error with useful information.
4018
+ *
4019
+ * @param issues The error issues.
4020
+ */
4021
+ constructor(issues) {
4022
+ super(issues[0].message);
4023
+ this.name = "ValiError";
4024
+ this.issues = issues;
4025
+ }
3932
4026
  };
3933
4027
 
3934
- // src/actions/check/check.ts
3935
- function check(requirement, message) {
3936
- return {
3937
- kind: "validation",
3938
- type: "check",
3939
- reference: check,
3940
- async: false,
3941
- expects: null,
3942
- requirement,
3943
- message,
3944
- _run(dataset, config2) {
3945
- if (dataset.typed && !this.requirement(dataset.value)) {
3946
- _addIssue(this, "input", dataset, config2);
3947
- }
3948
- return dataset;
3949
- }
3950
- };
4028
+ //#endregion
4029
+ //#region src/actions/check/check.ts
4030
+ /* @__NO_SIDE_EFFECTS__ */
4031
+ function check(requirement, message$1) {
4032
+ return {
4033
+ kind: "validation",
4034
+ type: "check",
4035
+ reference: check,
4036
+ async: false,
4037
+ expects: null,
4038
+ requirement,
4039
+ message: message$1,
4040
+ "~run"(dataset, config$1) {
4041
+ if (dataset.typed && !this.requirement(dataset.value)) _addIssue(this, "input", dataset, config$1);
4042
+ return dataset;
4043
+ }
4044
+ };
3951
4045
  }
3952
4046
 
3953
- // src/actions/integer/integer.ts
3954
- function integer(message) {
3955
- return {
3956
- kind: "validation",
3957
- type: "integer",
3958
- reference: integer,
3959
- async: false,
3960
- expects: null,
3961
- requirement: Number.isInteger,
3962
- message,
3963
- _run(dataset, config2) {
3964
- if (dataset.typed && !this.requirement(dataset.value)) {
3965
- _addIssue(this, "integer", dataset, config2);
3966
- }
3967
- return dataset;
3968
- }
3969
- };
4047
+ //#endregion
4048
+ //#region src/actions/integer/integer.ts
4049
+ /* @__NO_SIDE_EFFECTS__ */
4050
+ function integer(message$1) {
4051
+ return {
4052
+ kind: "validation",
4053
+ type: "integer",
4054
+ reference: integer,
4055
+ async: false,
4056
+ expects: null,
4057
+ requirement: Number.isInteger,
4058
+ message: message$1,
4059
+ "~run"(dataset, config$1) {
4060
+ if (dataset.typed && !this.requirement(dataset.value)) _addIssue(this, "integer", dataset, config$1);
4061
+ return dataset;
4062
+ }
4063
+ };
3970
4064
  }
3971
4065
 
3972
- // src/actions/transform/transform.ts
4066
+ //#endregion
4067
+ //#region src/actions/transform/transform.ts
4068
+ /**
4069
+ * Creates a custom transformation action.
4070
+ *
4071
+ * @param operation The transformation operation.
4072
+ *
4073
+ * @returns A transform action.
4074
+ */
4075
+ /* @__NO_SIDE_EFFECTS__ */
3973
4076
  function transform(operation) {
3974
- return {
3975
- kind: "transformation",
3976
- type: "transform",
3977
- reference: transform,
3978
- async: false,
3979
- operation,
3980
- _run(dataset) {
3981
- dataset.value = this.operation(dataset.value);
3982
- return dataset;
3983
- }
3984
- };
4077
+ return {
4078
+ kind: "transformation",
4079
+ type: "transform",
4080
+ reference: transform,
4081
+ async: false,
4082
+ operation,
4083
+ "~run"(dataset) {
4084
+ dataset.value = this.operation(dataset.value);
4085
+ return dataset;
4086
+ }
4087
+ };
3985
4088
  }
3986
4089
 
3987
- // src/methods/getDefault/getDefault.ts
3988
- function getDefault(schema, dataset, config2) {
3989
- return typeof schema.default === "function" ? (
3990
- // @ts-expect-error
3991
- schema.default(dataset, config2)
3992
- ) : (
3993
- // @ts-expect-error
3994
- schema.default
3995
- );
4090
+ //#endregion
4091
+ //#region src/methods/getFallback/getFallback.ts
4092
+ /**
4093
+ * Returns the fallback value of the schema.
4094
+ *
4095
+ * @param schema The schema to get it from.
4096
+ * @param dataset The output dataset if available.
4097
+ * @param config The config if available.
4098
+ *
4099
+ * @returns The fallback value.
4100
+ */
4101
+ /* @__NO_SIDE_EFFECTS__ */
4102
+ function getFallback(schema, dataset, config$1) {
4103
+ return typeof schema.fallback === "function" ? schema.fallback(dataset, config$1) : schema.fallback;
3996
4104
  }
3997
4105
 
3998
- // src/methods/is/is.ts
4106
+ //#endregion
4107
+ //#region src/methods/getDefault/getDefault.ts
4108
+ /**
4109
+ * Returns the default value of the schema.
4110
+ *
4111
+ * @param schema The schema to get it from.
4112
+ * @param dataset The input dataset if available.
4113
+ * @param config The config if available.
4114
+ *
4115
+ * @returns The default value.
4116
+ */
4117
+ /* @__NO_SIDE_EFFECTS__ */
4118
+ function getDefault(schema, dataset, config$1) {
4119
+ return typeof schema.default === "function" ? schema.default(dataset, config$1) : schema.default;
4120
+ }
4121
+
4122
+ //#endregion
4123
+ //#region src/methods/is/is.ts
4124
+ /**
4125
+ * Checks if the input matches the schema. By using a type predicate, this
4126
+ * function can be used as a type guard.
4127
+ *
4128
+ * @param schema The schema to be used.
4129
+ * @param input The input to be tested.
4130
+ *
4131
+ * @returns Whether the input matches the schema.
4132
+ */
4133
+ /* @__NO_SIDE_EFFECTS__ */
3999
4134
  function is(schema, input) {
4000
- return !schema._run({ typed: false, value: input }, { abortEarly: true }).issues;
4135
+ return !schema["~run"]({ value: input }, { abortEarly: true }).issues;
4001
4136
  }
4002
4137
 
4003
- // src/schemas/array/array.ts
4004
- function array(item, message) {
4005
- return {
4006
- kind: "schema",
4007
- type: "array",
4008
- reference: array,
4009
- expects: "Array",
4010
- async: false,
4011
- item,
4012
- message,
4013
- _run(dataset, config2) {
4014
- const input = dataset.value;
4015
- if (Array.isArray(input)) {
4016
- dataset.typed = true;
4017
- dataset.value = [];
4018
- for (let key = 0; key < input.length; key++) {
4019
- const value2 = input[key];
4020
- const itemDataset = this.item._run({ typed: false, value: value2 }, config2);
4021
- if (itemDataset.issues) {
4022
- const pathItem = {
4023
- type: "array",
4024
- origin: "value",
4025
- input,
4026
- key,
4027
- value: value2
4028
- };
4029
- for (const issue of itemDataset.issues) {
4030
- if (issue.path) {
4031
- issue.path.unshift(pathItem);
4032
- } else {
4033
- issue.path = [pathItem];
4034
- }
4035
- dataset.issues?.push(issue);
4036
- }
4037
- if (!dataset.issues) {
4038
- dataset.issues = itemDataset.issues;
4039
- }
4040
- if (config2.abortEarly) {
4041
- dataset.typed = false;
4042
- break;
4043
- }
4044
- }
4045
- if (!itemDataset.typed) {
4046
- dataset.typed = false;
4047
- }
4048
- dataset.value.push(itemDataset.value);
4049
- }
4050
- } else {
4051
- _addIssue(this, "type", dataset, config2);
4052
- }
4053
- return dataset;
4054
- }
4055
- };
4138
+ //#endregion
4139
+ //#region src/schemas/array/array.ts
4140
+ /* @__NO_SIDE_EFFECTS__ */
4141
+ function array(item, message$1) {
4142
+ return {
4143
+ kind: "schema",
4144
+ type: "array",
4145
+ reference: array,
4146
+ expects: "Array",
4147
+ async: false,
4148
+ item,
4149
+ message: message$1,
4150
+ get "~standard"() {
4151
+ return /* @__PURE__ */ _getStandardProps(this);
4152
+ },
4153
+ "~run"(dataset, config$1) {
4154
+ const input = dataset.value;
4155
+ if (Array.isArray(input)) {
4156
+ dataset.typed = true;
4157
+ dataset.value = [];
4158
+ for (let key = 0; key < input.length; key++) {
4159
+ const value$1 = input[key];
4160
+ const itemDataset = this.item["~run"]({ value: value$1 }, config$1);
4161
+ if (itemDataset.issues) {
4162
+ const pathItem = {
4163
+ type: "array",
4164
+ origin: "value",
4165
+ input,
4166
+ key,
4167
+ value: value$1
4168
+ };
4169
+ for (const issue of itemDataset.issues) {
4170
+ if (issue.path) issue.path.unshift(pathItem);
4171
+ else issue.path = [pathItem];
4172
+ dataset.issues?.push(issue);
4173
+ }
4174
+ if (!dataset.issues) dataset.issues = itemDataset.issues;
4175
+ if (config$1.abortEarly) {
4176
+ dataset.typed = false;
4177
+ break;
4178
+ }
4179
+ }
4180
+ if (!itemDataset.typed) dataset.typed = false;
4181
+ dataset.value.push(itemDataset.value);
4182
+ }
4183
+ } else _addIssue(this, "type", dataset, config$1);
4184
+ return dataset;
4185
+ }
4186
+ };
4056
4187
  }
4057
4188
 
4058
- // src/schemas/bigint/bigint.ts
4059
- function bigint(message) {
4060
- return {
4061
- kind: "schema",
4062
- type: "bigint",
4063
- reference: bigint,
4064
- expects: "bigint",
4065
- async: false,
4066
- message,
4067
- _run(dataset, config2) {
4068
- if (typeof dataset.value === "bigint") {
4069
- dataset.typed = true;
4070
- } else {
4071
- _addIssue(this, "type", dataset, config2);
4072
- }
4073
- return dataset;
4074
- }
4075
- };
4189
+ //#endregion
4190
+ //#region src/schemas/bigint/bigint.ts
4191
+ /* @__NO_SIDE_EFFECTS__ */
4192
+ function bigint(message$1) {
4193
+ return {
4194
+ kind: "schema",
4195
+ type: "bigint",
4196
+ reference: bigint,
4197
+ expects: "bigint",
4198
+ async: false,
4199
+ message: message$1,
4200
+ get "~standard"() {
4201
+ return /* @__PURE__ */ _getStandardProps(this);
4202
+ },
4203
+ "~run"(dataset, config$1) {
4204
+ if (typeof dataset.value === "bigint") dataset.typed = true;
4205
+ else _addIssue(this, "type", dataset, config$1);
4206
+ return dataset;
4207
+ }
4208
+ };
4076
4209
  }
4077
4210
 
4078
- // src/schemas/boolean/boolean.ts
4079
- function boolean(message) {
4080
- return {
4081
- kind: "schema",
4082
- type: "boolean",
4083
- reference: boolean,
4084
- expects: "boolean",
4085
- async: false,
4086
- message,
4087
- _run(dataset, config2) {
4088
- if (typeof dataset.value === "boolean") {
4089
- dataset.typed = true;
4090
- } else {
4091
- _addIssue(this, "type", dataset, config2);
4092
- }
4093
- return dataset;
4094
- }
4095
- };
4211
+ //#endregion
4212
+ //#region src/schemas/boolean/boolean.ts
4213
+ /* @__NO_SIDE_EFFECTS__ */
4214
+ function boolean(message$1) {
4215
+ return {
4216
+ kind: "schema",
4217
+ type: "boolean",
4218
+ reference: boolean,
4219
+ expects: "boolean",
4220
+ async: false,
4221
+ message: message$1,
4222
+ get "~standard"() {
4223
+ return /* @__PURE__ */ _getStandardProps(this);
4224
+ },
4225
+ "~run"(dataset, config$1) {
4226
+ if (typeof dataset.value === "boolean") dataset.typed = true;
4227
+ else _addIssue(this, "type", dataset, config$1);
4228
+ return dataset;
4229
+ }
4230
+ };
4096
4231
  }
4097
4232
 
4098
- // src/schemas/lazy/lazy.ts
4233
+ //#endregion
4234
+ //#region src/schemas/lazy/lazy.ts
4235
+ /**
4236
+ * Creates a lazy schema.
4237
+ *
4238
+ * @param getter The schema getter.
4239
+ *
4240
+ * @returns A lazy schema.
4241
+ */
4242
+ /* @__NO_SIDE_EFFECTS__ */
4099
4243
  function lazy(getter) {
4100
- return {
4101
- kind: "schema",
4102
- type: "lazy",
4103
- reference: lazy,
4104
- expects: "unknown",
4105
- async: false,
4106
- getter,
4107
- _run(dataset, config2) {
4108
- return this.getter(dataset.value)._run(dataset, config2);
4109
- }
4110
- };
4244
+ return {
4245
+ kind: "schema",
4246
+ type: "lazy",
4247
+ reference: lazy,
4248
+ expects: "unknown",
4249
+ async: false,
4250
+ getter,
4251
+ get "~standard"() {
4252
+ return /* @__PURE__ */ _getStandardProps(this);
4253
+ },
4254
+ "~run"(dataset, config$1) {
4255
+ return this.getter(dataset.value)["~run"](dataset, config$1);
4256
+ }
4257
+ };
4111
4258
  }
4112
4259
 
4113
- // src/schemas/literal/literal.ts
4114
- function literal(literal_, message) {
4115
- return {
4116
- kind: "schema",
4117
- type: "literal",
4118
- reference: literal,
4119
- expects: _stringify(literal_),
4120
- async: false,
4121
- literal: literal_,
4122
- message,
4123
- _run(dataset, config2) {
4124
- if (dataset.value === this.literal) {
4125
- dataset.typed = true;
4126
- } else {
4127
- _addIssue(this, "type", dataset, config2);
4128
- }
4129
- return dataset;
4130
- }
4131
- };
4260
+ //#endregion
4261
+ //#region src/schemas/literal/literal.ts
4262
+ /* @__NO_SIDE_EFFECTS__ */
4263
+ function literal(literal_, message$1) {
4264
+ return {
4265
+ kind: "schema",
4266
+ type: "literal",
4267
+ reference: literal,
4268
+ expects: /* @__PURE__ */ _stringify(literal_),
4269
+ async: false,
4270
+ literal: literal_,
4271
+ message: message$1,
4272
+ get "~standard"() {
4273
+ return /* @__PURE__ */ _getStandardProps(this);
4274
+ },
4275
+ "~run"(dataset, config$1) {
4276
+ if (dataset.value === this.literal) dataset.typed = true;
4277
+ else _addIssue(this, "type", dataset, config$1);
4278
+ return dataset;
4279
+ }
4280
+ };
4132
4281
  }
4133
4282
 
4134
- // src/schemas/nullable/nullable.ts
4135
- function nullable(wrapped, ...args) {
4136
- const schema = {
4137
- kind: "schema",
4138
- type: "nullable",
4139
- reference: nullable,
4140
- expects: `${wrapped.expects} | null`,
4141
- async: false,
4142
- wrapped,
4143
- _run(dataset, config2) {
4144
- if (dataset.value === null) {
4145
- if ("default" in this) {
4146
- dataset.value = getDefault(
4147
- this,
4148
- dataset,
4149
- config2
4150
- );
4151
- }
4152
- if (dataset.value === null) {
4153
- dataset.typed = true;
4154
- return dataset;
4155
- }
4156
- }
4157
- return this.wrapped._run(dataset, config2);
4158
- }
4159
- };
4160
- if (0 in args) {
4161
- schema.default = args[0];
4162
- }
4163
- return schema;
4283
+ //#endregion
4284
+ //#region src/schemas/nullable/nullable.ts
4285
+ /* @__NO_SIDE_EFFECTS__ */
4286
+ function nullable(wrapped, default_) {
4287
+ return {
4288
+ kind: "schema",
4289
+ type: "nullable",
4290
+ reference: nullable,
4291
+ expects: `(${wrapped.expects} | null)`,
4292
+ async: false,
4293
+ wrapped,
4294
+ default: default_,
4295
+ get "~standard"() {
4296
+ return /* @__PURE__ */ _getStandardProps(this);
4297
+ },
4298
+ "~run"(dataset, config$1) {
4299
+ if (dataset.value === null) {
4300
+ if (this.default !== void 0) dataset.value = /* @__PURE__ */ getDefault(this, dataset, config$1);
4301
+ if (dataset.value === null) {
4302
+ dataset.typed = true;
4303
+ return dataset;
4304
+ }
4305
+ }
4306
+ return this.wrapped["~run"](dataset, config$1);
4307
+ }
4308
+ };
4164
4309
  }
4165
4310
 
4166
- // src/schemas/nullish/nullish.ts
4167
- function nullish(wrapped, ...args) {
4168
- const schema = {
4169
- kind: "schema",
4170
- type: "nullish",
4171
- reference: nullish,
4172
- expects: `${wrapped.expects} | null | undefined`,
4173
- async: false,
4174
- wrapped,
4175
- _run(dataset, config2) {
4176
- if (dataset.value === null || dataset.value === void 0) {
4177
- if ("default" in this) {
4178
- dataset.value = getDefault(
4179
- this,
4180
- dataset,
4181
- config2
4182
- );
4183
- }
4184
- if (dataset.value === null || dataset.value === void 0) {
4185
- dataset.typed = true;
4186
- return dataset;
4187
- }
4188
- }
4189
- return this.wrapped._run(dataset, config2);
4190
- }
4191
- };
4192
- if (0 in args) {
4193
- schema.default = args[0];
4194
- }
4195
- return schema;
4311
+ //#endregion
4312
+ //#region src/schemas/nullish/nullish.ts
4313
+ /* @__NO_SIDE_EFFECTS__ */
4314
+ function nullish(wrapped, default_) {
4315
+ return {
4316
+ kind: "schema",
4317
+ type: "nullish",
4318
+ reference: nullish,
4319
+ expects: `(${wrapped.expects} | null | undefined)`,
4320
+ async: false,
4321
+ wrapped,
4322
+ default: default_,
4323
+ get "~standard"() {
4324
+ return /* @__PURE__ */ _getStandardProps(this);
4325
+ },
4326
+ "~run"(dataset, config$1) {
4327
+ if (dataset.value === null || dataset.value === void 0) {
4328
+ if (this.default !== void 0) dataset.value = /* @__PURE__ */ getDefault(this, dataset, config$1);
4329
+ if (dataset.value === null || dataset.value === void 0) {
4330
+ dataset.typed = true;
4331
+ return dataset;
4332
+ }
4333
+ }
4334
+ return this.wrapped["~run"](dataset, config$1);
4335
+ }
4336
+ };
4196
4337
  }
4197
4338
 
4198
- // src/schemas/number/number.ts
4199
- function number(message) {
4200
- return {
4201
- kind: "schema",
4202
- type: "number",
4203
- reference: number,
4204
- expects: "number",
4205
- async: false,
4206
- message,
4207
- _run(dataset, config2) {
4208
- if (typeof dataset.value === "number" && !isNaN(dataset.value)) {
4209
- dataset.typed = true;
4210
- } else {
4211
- _addIssue(this, "type", dataset, config2);
4212
- }
4213
- return dataset;
4214
- }
4215
- };
4339
+ //#endregion
4340
+ //#region src/schemas/number/number.ts
4341
+ /* @__NO_SIDE_EFFECTS__ */
4342
+ function number(message$1) {
4343
+ return {
4344
+ kind: "schema",
4345
+ type: "number",
4346
+ reference: number,
4347
+ expects: "number",
4348
+ async: false,
4349
+ message: message$1,
4350
+ get "~standard"() {
4351
+ return /* @__PURE__ */ _getStandardProps(this);
4352
+ },
4353
+ "~run"(dataset, config$1) {
4354
+ if (typeof dataset.value === "number" && !isNaN(dataset.value)) dataset.typed = true;
4355
+ else _addIssue(this, "type", dataset, config$1);
4356
+ return dataset;
4357
+ }
4358
+ };
4216
4359
  }
4217
4360
 
4218
- // src/schemas/object/object.ts
4219
- function object(entries, message) {
4220
- return {
4221
- kind: "schema",
4222
- type: "object",
4223
- reference: object,
4224
- expects: "Object",
4225
- async: false,
4226
- entries,
4227
- message,
4228
- _run(dataset, config2) {
4229
- const input = dataset.value;
4230
- if (input && typeof input === "object") {
4231
- dataset.typed = true;
4232
- dataset.value = {};
4233
- for (const key in this.entries) {
4234
- const value2 = input[key];
4235
- const valueDataset = this.entries[key]._run(
4236
- { typed: false, value: value2 },
4237
- config2
4238
- );
4239
- if (valueDataset.issues) {
4240
- const pathItem = {
4241
- type: "object",
4242
- origin: "value",
4243
- input,
4244
- key,
4245
- value: value2
4246
- };
4247
- for (const issue of valueDataset.issues) {
4248
- if (issue.path) {
4249
- issue.path.unshift(pathItem);
4250
- } else {
4251
- issue.path = [pathItem];
4252
- }
4253
- dataset.issues?.push(issue);
4254
- }
4255
- if (!dataset.issues) {
4256
- dataset.issues = valueDataset.issues;
4257
- }
4258
- if (config2.abortEarly) {
4259
- dataset.typed = false;
4260
- break;
4261
- }
4262
- }
4263
- if (!valueDataset.typed) {
4264
- dataset.typed = false;
4265
- }
4266
- if (valueDataset.value !== void 0 || key in input) {
4267
- dataset.value[key] = valueDataset.value;
4268
- }
4269
- }
4270
- } else {
4271
- _addIssue(this, "type", dataset, config2);
4272
- }
4273
- return dataset;
4274
- }
4275
- };
4361
+ //#endregion
4362
+ //#region src/schemas/object/object.ts
4363
+ /* @__NO_SIDE_EFFECTS__ */
4364
+ function object(entries$1, message$1) {
4365
+ return {
4366
+ kind: "schema",
4367
+ type: "object",
4368
+ reference: object,
4369
+ expects: "Object",
4370
+ async: false,
4371
+ entries: entries$1,
4372
+ message: message$1,
4373
+ get "~standard"() {
4374
+ return /* @__PURE__ */ _getStandardProps(this);
4375
+ },
4376
+ "~run"(dataset, config$1) {
4377
+ const input = dataset.value;
4378
+ if (input && typeof input === "object") {
4379
+ dataset.typed = true;
4380
+ dataset.value = {};
4381
+ for (const key in this.entries) {
4382
+ const valueSchema = this.entries[key];
4383
+ if (key in input || (valueSchema.type === "exact_optional" || valueSchema.type === "optional" || valueSchema.type === "nullish") && valueSchema.default !== void 0) {
4384
+ const value$1 = key in input ? input[key] : /* @__PURE__ */ getDefault(valueSchema);
4385
+ const valueDataset = valueSchema["~run"]({ value: value$1 }, config$1);
4386
+ if (valueDataset.issues) {
4387
+ const pathItem = {
4388
+ type: "object",
4389
+ origin: "value",
4390
+ input,
4391
+ key,
4392
+ value: value$1
4393
+ };
4394
+ for (const issue of valueDataset.issues) {
4395
+ if (issue.path) issue.path.unshift(pathItem);
4396
+ else issue.path = [pathItem];
4397
+ dataset.issues?.push(issue);
4398
+ }
4399
+ if (!dataset.issues) dataset.issues = valueDataset.issues;
4400
+ if (config$1.abortEarly) {
4401
+ dataset.typed = false;
4402
+ break;
4403
+ }
4404
+ }
4405
+ if (!valueDataset.typed) dataset.typed = false;
4406
+ dataset.value[key] = valueDataset.value;
4407
+ } else if (valueSchema.fallback !== void 0) dataset.value[key] = /* @__PURE__ */ getFallback(valueSchema);
4408
+ else if (valueSchema.type !== "exact_optional" && valueSchema.type !== "optional" && valueSchema.type !== "nullish") {
4409
+ _addIssue(this, "key", dataset, config$1, {
4410
+ input: void 0,
4411
+ expected: `"${key}"`,
4412
+ path: [{
4413
+ type: "object",
4414
+ origin: "key",
4415
+ input,
4416
+ key,
4417
+ value: input[key]
4418
+ }]
4419
+ });
4420
+ if (config$1.abortEarly) break;
4421
+ }
4422
+ }
4423
+ } else _addIssue(this, "type", dataset, config$1);
4424
+ return dataset;
4425
+ }
4426
+ };
4276
4427
  }
4277
4428
 
4278
- // src/schemas/optional/optional.ts
4279
- function optional(wrapped, ...args) {
4280
- const schema = {
4281
- kind: "schema",
4282
- type: "optional",
4283
- reference: optional,
4284
- expects: `${wrapped.expects} | undefined`,
4285
- async: false,
4286
- wrapped,
4287
- _run(dataset, config2) {
4288
- if (dataset.value === void 0) {
4289
- if ("default" in this) {
4290
- dataset.value = getDefault(
4291
- this,
4292
- dataset,
4293
- config2
4294
- );
4295
- }
4296
- if (dataset.value === void 0) {
4297
- dataset.typed = true;
4298
- return dataset;
4299
- }
4300
- }
4301
- return this.wrapped._run(dataset, config2);
4302
- }
4303
- };
4304
- if (0 in args) {
4305
- schema.default = args[0];
4306
- }
4307
- return schema;
4429
+ //#endregion
4430
+ //#region src/schemas/optional/optional.ts
4431
+ /* @__NO_SIDE_EFFECTS__ */
4432
+ function optional(wrapped, default_) {
4433
+ return {
4434
+ kind: "schema",
4435
+ type: "optional",
4436
+ reference: optional,
4437
+ expects: `(${wrapped.expects} | undefined)`,
4438
+ async: false,
4439
+ wrapped,
4440
+ default: default_,
4441
+ get "~standard"() {
4442
+ return /* @__PURE__ */ _getStandardProps(this);
4443
+ },
4444
+ "~run"(dataset, config$1) {
4445
+ if (dataset.value === void 0) {
4446
+ if (this.default !== void 0) dataset.value = /* @__PURE__ */ getDefault(this, dataset, config$1);
4447
+ if (dataset.value === void 0) {
4448
+ dataset.typed = true;
4449
+ return dataset;
4450
+ }
4451
+ }
4452
+ return this.wrapped["~run"](dataset, config$1);
4453
+ }
4454
+ };
4308
4455
  }
4309
4456
 
4310
- // src/schemas/record/record.ts
4311
- function record(key, value2, message) {
4312
- return {
4313
- kind: "schema",
4314
- type: "record",
4315
- reference: record,
4316
- expects: "Object",
4317
- async: false,
4318
- key,
4319
- value: value2,
4320
- message,
4321
- _run(dataset, config2) {
4322
- const input = dataset.value;
4323
- if (input && typeof input === "object") {
4324
- dataset.typed = true;
4325
- dataset.value = {};
4326
- for (const entryKey in input) {
4327
- if (_isValidObjectKey(input, entryKey)) {
4328
- const entryValue = input[entryKey];
4329
- const keyDataset = this.key._run(
4330
- { typed: false, value: entryKey },
4331
- config2
4332
- );
4333
- if (keyDataset.issues) {
4334
- const pathItem = {
4335
- type: "object",
4336
- origin: "key",
4337
- input,
4338
- key: entryKey,
4339
- value: entryValue
4340
- };
4341
- for (const issue of keyDataset.issues) {
4342
- issue.path = [pathItem];
4343
- dataset.issues?.push(issue);
4344
- }
4345
- if (!dataset.issues) {
4346
- dataset.issues = keyDataset.issues;
4347
- }
4348
- if (config2.abortEarly) {
4349
- dataset.typed = false;
4350
- break;
4351
- }
4352
- }
4353
- const valueDataset = this.value._run(
4354
- { typed: false, value: entryValue },
4355
- config2
4356
- );
4357
- if (valueDataset.issues) {
4358
- const pathItem = {
4359
- type: "object",
4360
- origin: "value",
4361
- input,
4362
- key: entryKey,
4363
- value: entryValue
4364
- };
4365
- for (const issue of valueDataset.issues) {
4366
- if (issue.path) {
4367
- issue.path.unshift(pathItem);
4368
- } else {
4369
- issue.path = [pathItem];
4370
- }
4371
- dataset.issues?.push(issue);
4372
- }
4373
- if (!dataset.issues) {
4374
- dataset.issues = valueDataset.issues;
4375
- }
4376
- if (config2.abortEarly) {
4377
- dataset.typed = false;
4378
- break;
4379
- }
4380
- }
4381
- if (!keyDataset.typed || !valueDataset.typed) {
4382
- dataset.typed = false;
4383
- }
4384
- if (keyDataset.typed) {
4385
- dataset.value[keyDataset.value] = valueDataset.value;
4386
- }
4387
- }
4388
- }
4389
- } else {
4390
- _addIssue(this, "type", dataset, config2);
4391
- }
4392
- return dataset;
4393
- }
4394
- };
4457
+ //#endregion
4458
+ //#region src/schemas/record/record.ts
4459
+ /* @__NO_SIDE_EFFECTS__ */
4460
+ function record(key, value$1, message$1) {
4461
+ return {
4462
+ kind: "schema",
4463
+ type: "record",
4464
+ reference: record,
4465
+ expects: "Object",
4466
+ async: false,
4467
+ key,
4468
+ value: value$1,
4469
+ message: message$1,
4470
+ get "~standard"() {
4471
+ return /* @__PURE__ */ _getStandardProps(this);
4472
+ },
4473
+ "~run"(dataset, config$1) {
4474
+ const input = dataset.value;
4475
+ if (input && typeof input === "object") {
4476
+ dataset.typed = true;
4477
+ dataset.value = {};
4478
+ for (const entryKey in input) if (/* @__PURE__ */ _isValidObjectKey(input, entryKey)) {
4479
+ const entryValue = input[entryKey];
4480
+ const keyDataset = this.key["~run"]({ value: entryKey }, config$1);
4481
+ if (keyDataset.issues) {
4482
+ const pathItem = {
4483
+ type: "object",
4484
+ origin: "key",
4485
+ input,
4486
+ key: entryKey,
4487
+ value: entryValue
4488
+ };
4489
+ for (const issue of keyDataset.issues) {
4490
+ issue.path = [pathItem];
4491
+ dataset.issues?.push(issue);
4492
+ }
4493
+ if (!dataset.issues) dataset.issues = keyDataset.issues;
4494
+ if (config$1.abortEarly) {
4495
+ dataset.typed = false;
4496
+ break;
4497
+ }
4498
+ }
4499
+ const valueDataset = this.value["~run"]({ value: entryValue }, config$1);
4500
+ if (valueDataset.issues) {
4501
+ const pathItem = {
4502
+ type: "object",
4503
+ origin: "value",
4504
+ input,
4505
+ key: entryKey,
4506
+ value: entryValue
4507
+ };
4508
+ for (const issue of valueDataset.issues) {
4509
+ if (issue.path) issue.path.unshift(pathItem);
4510
+ else issue.path = [pathItem];
4511
+ dataset.issues?.push(issue);
4512
+ }
4513
+ if (!dataset.issues) dataset.issues = valueDataset.issues;
4514
+ if (config$1.abortEarly) {
4515
+ dataset.typed = false;
4516
+ break;
4517
+ }
4518
+ }
4519
+ if (!keyDataset.typed || !valueDataset.typed) dataset.typed = false;
4520
+ if (keyDataset.typed) dataset.value[keyDataset.value] = valueDataset.value;
4521
+ }
4522
+ } else _addIssue(this, "type", dataset, config$1);
4523
+ return dataset;
4524
+ }
4525
+ };
4395
4526
  }
4396
4527
 
4397
- // src/schemas/string/string.ts
4398
- function string(message) {
4399
- return {
4400
- kind: "schema",
4401
- type: "string",
4402
- reference: string,
4403
- expects: "string",
4404
- async: false,
4405
- message,
4406
- _run(dataset, config2) {
4407
- if (typeof dataset.value === "string") {
4408
- dataset.typed = true;
4409
- } else {
4410
- _addIssue(this, "type", dataset, config2);
4411
- }
4412
- return dataset;
4413
- }
4414
- };
4528
+ //#endregion
4529
+ //#region src/schemas/string/string.ts
4530
+ /* @__NO_SIDE_EFFECTS__ */
4531
+ function string(message$1) {
4532
+ return {
4533
+ kind: "schema",
4534
+ type: "string",
4535
+ reference: string,
4536
+ expects: "string",
4537
+ async: false,
4538
+ message: message$1,
4539
+ get "~standard"() {
4540
+ return /* @__PURE__ */ _getStandardProps(this);
4541
+ },
4542
+ "~run"(dataset, config$1) {
4543
+ if (typeof dataset.value === "string") dataset.typed = true;
4544
+ else _addIssue(this, "type", dataset, config$1);
4545
+ return dataset;
4546
+ }
4547
+ };
4415
4548
  }
4416
4549
 
4417
- // src/schemas/tuple/tuple.ts
4418
- function tuple(items, message) {
4419
- return {
4420
- kind: "schema",
4421
- type: "tuple",
4422
- reference: tuple,
4423
- expects: "Array",
4424
- async: false,
4425
- items,
4426
- message,
4427
- _run(dataset, config2) {
4428
- const input = dataset.value;
4429
- if (Array.isArray(input)) {
4430
- dataset.typed = true;
4431
- dataset.value = [];
4432
- for (let key = 0; key < this.items.length; key++) {
4433
- const value2 = input[key];
4434
- const itemDataset = this.items[key]._run(
4435
- { typed: false, value: value2 },
4436
- config2
4437
- );
4438
- if (itemDataset.issues) {
4439
- const pathItem = {
4440
- type: "array",
4441
- origin: "value",
4442
- input,
4443
- key,
4444
- value: value2
4445
- };
4446
- for (const issue of itemDataset.issues) {
4447
- if (issue.path) {
4448
- issue.path.unshift(pathItem);
4449
- } else {
4450
- issue.path = [pathItem];
4451
- }
4452
- dataset.issues?.push(issue);
4453
- }
4454
- if (!dataset.issues) {
4455
- dataset.issues = itemDataset.issues;
4456
- }
4457
- if (config2.abortEarly) {
4458
- dataset.typed = false;
4459
- break;
4460
- }
4461
- }
4462
- if (!itemDataset.typed) {
4463
- dataset.typed = false;
4464
- }
4465
- dataset.value.push(itemDataset.value);
4466
- }
4467
- } else {
4468
- _addIssue(this, "type", dataset, config2);
4469
- }
4470
- return dataset;
4471
- }
4472
- };
4550
+ //#endregion
4551
+ //#region src/schemas/tuple/tuple.ts
4552
+ /* @__NO_SIDE_EFFECTS__ */
4553
+ function tuple(items, message$1) {
4554
+ return {
4555
+ kind: "schema",
4556
+ type: "tuple",
4557
+ reference: tuple,
4558
+ expects: "Array",
4559
+ async: false,
4560
+ items,
4561
+ message: message$1,
4562
+ get "~standard"() {
4563
+ return /* @__PURE__ */ _getStandardProps(this);
4564
+ },
4565
+ "~run"(dataset, config$1) {
4566
+ const input = dataset.value;
4567
+ if (Array.isArray(input)) {
4568
+ dataset.typed = true;
4569
+ dataset.value = [];
4570
+ for (let key = 0; key < this.items.length; key++) {
4571
+ const value$1 = input[key];
4572
+ const itemDataset = this.items[key]["~run"]({ value: value$1 }, config$1);
4573
+ if (itemDataset.issues) {
4574
+ const pathItem = {
4575
+ type: "array",
4576
+ origin: "value",
4577
+ input,
4578
+ key,
4579
+ value: value$1
4580
+ };
4581
+ for (const issue of itemDataset.issues) {
4582
+ if (issue.path) issue.path.unshift(pathItem);
4583
+ else issue.path = [pathItem];
4584
+ dataset.issues?.push(issue);
4585
+ }
4586
+ if (!dataset.issues) dataset.issues = itemDataset.issues;
4587
+ if (config$1.abortEarly) {
4588
+ dataset.typed = false;
4589
+ break;
4590
+ }
4591
+ }
4592
+ if (!itemDataset.typed) dataset.typed = false;
4593
+ dataset.value.push(itemDataset.value);
4594
+ }
4595
+ } else _addIssue(this, "type", dataset, config$1);
4596
+ return dataset;
4597
+ }
4598
+ };
4473
4599
  }
4474
4600
 
4475
- // src/schemas/union/utils/_subIssues/_subIssues.ts
4601
+ //#endregion
4602
+ //#region src/schemas/union/utils/_subIssues/_subIssues.ts
4603
+ /**
4604
+ * Returns the sub issues of the provided datasets for the union issue.
4605
+ *
4606
+ * @param datasets The datasets.
4607
+ *
4608
+ * @returns The sub issues.
4609
+ *
4610
+ * @internal
4611
+ */
4612
+ /* @__NO_SIDE_EFFECTS__ */
4476
4613
  function _subIssues(datasets) {
4477
- let issues;
4478
- if (datasets) {
4479
- for (const dataset of datasets) {
4480
- if (issues) {
4481
- issues.push(...dataset.issues);
4482
- } else {
4483
- issues = dataset.issues;
4484
- }
4485
- }
4486
- }
4487
- return issues;
4614
+ let issues;
4615
+ if (datasets) for (const dataset of datasets) if (issues) issues.push(...dataset.issues);
4616
+ else issues = dataset.issues;
4617
+ return issues;
4488
4618
  }
4489
4619
 
4490
- // src/schemas/union/union.ts
4491
- function union(options, message) {
4492
- return {
4493
- kind: "schema",
4494
- type: "union",
4495
- reference: union,
4496
- expects: [...new Set(options.map((option) => option.expects))].join(" | ") || "never",
4497
- async: false,
4498
- options,
4499
- message,
4500
- _run(dataset, config2) {
4501
- let validDataset;
4502
- let typedDatasets;
4503
- let untypedDatasets;
4504
- for (const schema of this.options) {
4505
- const optionDataset = schema._run(
4506
- { typed: false, value: dataset.value },
4507
- config2
4508
- );
4509
- if (optionDataset.typed) {
4510
- if (optionDataset.issues) {
4511
- if (typedDatasets) {
4512
- typedDatasets.push(optionDataset);
4513
- } else {
4514
- typedDatasets = [optionDataset];
4515
- }
4516
- } else {
4517
- validDataset = optionDataset;
4518
- break;
4519
- }
4520
- } else {
4521
- if (untypedDatasets) {
4522
- untypedDatasets.push(optionDataset);
4523
- } else {
4524
- untypedDatasets = [optionDataset];
4525
- }
4526
- }
4527
- }
4528
- if (validDataset) {
4529
- return validDataset;
4530
- }
4531
- if (typedDatasets) {
4532
- if (typedDatasets.length === 1) {
4533
- return typedDatasets[0];
4534
- }
4535
- _addIssue(this, "type", dataset, config2, {
4536
- issues: _subIssues(typedDatasets)
4537
- });
4538
- dataset.typed = true;
4539
- } else if (untypedDatasets?.length === 1) {
4540
- return untypedDatasets[0];
4541
- } else {
4542
- _addIssue(this, "type", dataset, config2, {
4543
- issues: _subIssues(untypedDatasets)
4544
- });
4545
- }
4546
- return dataset;
4547
- }
4548
- };
4620
+ //#endregion
4621
+ //#region src/schemas/union/union.ts
4622
+ /* @__NO_SIDE_EFFECTS__ */
4623
+ function union(options, message$1) {
4624
+ return {
4625
+ kind: "schema",
4626
+ type: "union",
4627
+ reference: union,
4628
+ expects: /* @__PURE__ */ _joinExpects(options.map((option) => option.expects), "|"),
4629
+ async: false,
4630
+ options,
4631
+ message: message$1,
4632
+ get "~standard"() {
4633
+ return /* @__PURE__ */ _getStandardProps(this);
4634
+ },
4635
+ "~run"(dataset, config$1) {
4636
+ let validDataset;
4637
+ let typedDatasets;
4638
+ let untypedDatasets;
4639
+ for (const schema of this.options) {
4640
+ const optionDataset = schema["~run"]({ value: dataset.value }, config$1);
4641
+ if (optionDataset.typed) if (optionDataset.issues) if (typedDatasets) typedDatasets.push(optionDataset);
4642
+ else typedDatasets = [optionDataset];
4643
+ else {
4644
+ validDataset = optionDataset;
4645
+ break;
4646
+ }
4647
+ else if (untypedDatasets) untypedDatasets.push(optionDataset);
4648
+ else untypedDatasets = [optionDataset];
4649
+ }
4650
+ if (validDataset) return validDataset;
4651
+ if (typedDatasets) {
4652
+ if (typedDatasets.length === 1) return typedDatasets[0];
4653
+ _addIssue(this, "type", dataset, config$1, { issues: /* @__PURE__ */ _subIssues(typedDatasets) });
4654
+ dataset.typed = true;
4655
+ } else if (untypedDatasets?.length === 1) return untypedDatasets[0];
4656
+ else _addIssue(this, "type", dataset, config$1, { issues: /* @__PURE__ */ _subIssues(untypedDatasets) });
4657
+ return dataset;
4658
+ }
4659
+ };
4549
4660
  }
4550
4661
 
4551
- // src/schemas/unknown/unknown.ts
4662
+ //#endregion
4663
+ //#region src/schemas/unknown/unknown.ts
4664
+ /**
4665
+ * Creates a unknown schema.
4666
+ *
4667
+ * @returns A unknown schema.
4668
+ */
4669
+ /* @__NO_SIDE_EFFECTS__ */
4552
4670
  function unknown() {
4553
- return {
4554
- kind: "schema",
4555
- type: "unknown",
4556
- reference: unknown,
4557
- expects: "unknown",
4558
- async: false,
4559
- _run(dataset) {
4560
- dataset.typed = true;
4561
- return dataset;
4562
- }
4563
- };
4671
+ return {
4672
+ kind: "schema",
4673
+ type: "unknown",
4674
+ reference: unknown,
4675
+ expects: "unknown",
4676
+ async: false,
4677
+ get "~standard"() {
4678
+ return /* @__PURE__ */ _getStandardProps(this);
4679
+ },
4680
+ "~run"(dataset) {
4681
+ dataset.typed = true;
4682
+ return dataset;
4683
+ }
4684
+ };
4564
4685
  }
4565
4686
 
4566
- // src/methods/parse/parse.ts
4567
- function parse(schema, input, config2) {
4568
- const dataset = schema._run(
4569
- { typed: false, value: input },
4570
- getGlobalConfig(config2)
4571
- );
4572
- if (dataset.issues) {
4573
- throw new ValiError(dataset.issues);
4574
- }
4575
- return dataset.value;
4687
+ //#endregion
4688
+ //#region src/methods/parse/parse.ts
4689
+ /**
4690
+ * Parses an unknown input based on a schema.
4691
+ *
4692
+ * @param schema The schema to be used.
4693
+ * @param input The input to be parsed.
4694
+ * @param config The parse configuration.
4695
+ *
4696
+ * @returns The parsed input.
4697
+ */
4698
+ function parse(schema, input, config$1) {
4699
+ const dataset = schema["~run"]({ value: input }, /* @__PURE__ */ getGlobalConfig(config$1));
4700
+ if (dataset.issues) throw new ValiError(dataset.issues);
4701
+ return dataset.value;
4576
4702
  }
4577
4703
 
4578
- // src/methods/pipe/pipe.ts
4579
- function pipe(...pipe2) {
4580
- return {
4581
- ...pipe2[0],
4582
- pipe: pipe2,
4583
- _run(dataset, config2) {
4584
- for (let index = 0; index < pipe2.length; index++) {
4585
- if (dataset.issues && (pipe2[index].kind === "schema" || pipe2[index].kind === "transformation")) {
4586
- dataset.typed = false;
4587
- break;
4588
- }
4589
- if (!dataset.issues || !config2.abortEarly && !config2.abortPipeEarly) {
4590
- dataset = pipe2[index]._run(dataset, config2);
4591
- }
4592
- }
4593
- return dataset;
4594
- }
4595
- };
4704
+ //#endregion
4705
+ //#region src/methods/pipe/pipe.ts
4706
+ /* @__NO_SIDE_EFFECTS__ */
4707
+ function pipe(...pipe$1) {
4708
+ return {
4709
+ ...pipe$1[0],
4710
+ pipe: pipe$1,
4711
+ get "~standard"() {
4712
+ return /* @__PURE__ */ _getStandardProps(this);
4713
+ },
4714
+ "~run"(dataset, config$1) {
4715
+ for (const item of pipe$1) if (item.kind !== "metadata") {
4716
+ if (dataset.issues && (item.kind === "schema" || item.kind === "transformation")) {
4717
+ dataset.typed = false;
4718
+ break;
4719
+ }
4720
+ if (!dataset.issues || !config$1.abortEarly && !config$1.abortPipeEarly) dataset = item["~run"](dataset, config$1);
4721
+ }
4722
+ return dataset;
4723
+ }
4724
+ };
4596
4725
  }
4597
4726
 
4598
4727
  function safeEnum(options) {
4599
4728
  const unionOptions = Object.entries(options).map(([key, value]) => object({ [key]: value }));
4600
4729
  return pipe(
4601
4730
  union(unionOptions),
4602
- transform((value) => ({
4603
- ...value,
4604
- $kind: Object.keys(value)[0]
4605
- }))
4731
+ transform(
4732
+ (value) => ({
4733
+ ...value,
4734
+ $kind: Object.keys(value)[0]
4735
+ })
4736
+ )
4606
4737
  );
4607
4738
  }
4608
4739
  const SuiAddress = pipe(
@@ -4748,14 +4879,14 @@ const NormalizedCallArg$1 = safeEnum({
4748
4879
  bytes: BCSBytes
4749
4880
  })
4750
4881
  });
4751
- const TransactionExpiration$2 = safeEnum({
4882
+ const TransactionExpiration$1 = safeEnum({
4752
4883
  None: literal(true),
4753
4884
  Epoch: JsonU64
4754
4885
  });
4755
4886
  const TransactionDataSchema = object({
4756
4887
  version: literal(2),
4757
4888
  sender: nullish(SuiAddress),
4758
- expiration: nullish(TransactionExpiration$2),
4889
+ expiration: nullish(TransactionExpiration$1),
4759
4890
  gasData: GasDataSchema,
4760
4891
  inputs: array(CallArgSchema),
4761
4892
  commands: array(CommandSchema)
@@ -4885,131 +5016,6 @@ const NormalizedCallArg = safeEnum({
4885
5016
  Object: ObjectArg$1,
4886
5017
  Pure: array(pipe(number(), integer()))
4887
5018
  });
4888
- const TransactionInput = union([
4889
- object({
4890
- kind: literal("Input"),
4891
- index: pipe(number(), integer()),
4892
- value: unknown(),
4893
- type: optional(literal("object"))
4894
- }),
4895
- object({
4896
- kind: literal("Input"),
4897
- index: pipe(number(), integer()),
4898
- value: unknown(),
4899
- type: literal("pure")
4900
- })
4901
- ]);
4902
- const TransactionExpiration$1 = union([
4903
- object({ Epoch: pipe(number(), integer()) }),
4904
- object({ None: nullable(literal(true)) })
4905
- ]);
4906
- const StringEncodedBigint = pipe(
4907
- union([number(), string(), bigint()]),
4908
- check((val) => {
4909
- if (!["string", "number", "bigint"].includes(typeof val)) return false;
4910
- try {
4911
- BigInt(val);
4912
- return true;
4913
- } catch {
4914
- return false;
4915
- }
4916
- })
4917
- );
4918
- const TypeTag = union([
4919
- object({ bool: nullable(literal(true)) }),
4920
- object({ u8: nullable(literal(true)) }),
4921
- object({ u64: nullable(literal(true)) }),
4922
- object({ u128: nullable(literal(true)) }),
4923
- object({ address: nullable(literal(true)) }),
4924
- object({ signer: nullable(literal(true)) }),
4925
- object({ vector: lazy(() => TypeTag) }),
4926
- object({ struct: lazy(() => StructTag) }),
4927
- object({ u16: nullable(literal(true)) }),
4928
- object({ u32: nullable(literal(true)) }),
4929
- object({ u256: nullable(literal(true)) })
4930
- ]);
4931
- const StructTag = object({
4932
- address: string(),
4933
- module: string(),
4934
- name: string(),
4935
- typeParams: array(TypeTag)
4936
- });
4937
- const GasConfig = object({
4938
- budget: optional(StringEncodedBigint),
4939
- price: optional(StringEncodedBigint),
4940
- payment: optional(array(ObjectRef)),
4941
- owner: optional(string())
4942
- });
4943
- const TransactionArgumentTypes = [
4944
- TransactionInput,
4945
- object({ kind: literal("GasCoin") }),
4946
- object({ kind: literal("Result"), index: pipe(number(), integer()) }),
4947
- object({
4948
- kind: literal("NestedResult"),
4949
- index: pipe(number(), integer()),
4950
- resultIndex: pipe(number(), integer())
4951
- })
4952
- ];
4953
- const TransactionArgument = union([...TransactionArgumentTypes]);
4954
- const MoveCallTransaction = object({
4955
- kind: literal("MoveCall"),
4956
- target: pipe(
4957
- string(),
4958
- check((target) => target.split("::").length === 3)
4959
- ),
4960
- typeArguments: array(string()),
4961
- arguments: array(TransactionArgument)
4962
- });
4963
- const TransferObjectsTransaction = object({
4964
- kind: literal("TransferObjects"),
4965
- objects: array(TransactionArgument),
4966
- address: TransactionArgument
4967
- });
4968
- const SplitCoinsTransaction = object({
4969
- kind: literal("SplitCoins"),
4970
- coin: TransactionArgument,
4971
- amounts: array(TransactionArgument)
4972
- });
4973
- const MergeCoinsTransaction = object({
4974
- kind: literal("MergeCoins"),
4975
- destination: TransactionArgument,
4976
- sources: array(TransactionArgument)
4977
- });
4978
- const MakeMoveVecTransaction = object({
4979
- kind: literal("MakeMoveVec"),
4980
- type: union([object({ Some: TypeTag }), object({ None: nullable(literal(true)) })]),
4981
- objects: array(TransactionArgument)
4982
- });
4983
- const PublishTransaction = object({
4984
- kind: literal("Publish"),
4985
- modules: array(array(pipe(number(), integer()))),
4986
- dependencies: array(string())
4987
- });
4988
- const UpgradeTransaction = object({
4989
- kind: literal("Upgrade"),
4990
- modules: array(array(pipe(number(), integer()))),
4991
- dependencies: array(string()),
4992
- packageId: string(),
4993
- ticket: TransactionArgument
4994
- });
4995
- const TransactionTypes = [
4996
- MoveCallTransaction,
4997
- TransferObjectsTransaction,
4998
- SplitCoinsTransaction,
4999
- MergeCoinsTransaction,
5000
- PublishTransaction,
5001
- UpgradeTransaction,
5002
- MakeMoveVecTransaction
5003
- ];
5004
- const TransactionType = union([...TransactionTypes]);
5005
- object({
5006
- version: literal(1),
5007
- sender: optional(string()),
5008
- expiration: nullish(TransactionExpiration$1),
5009
- gasConfig: GasConfig,
5010
- inputs: array(TransactionInput),
5011
- transactions: array(TransactionType)
5012
- });
5013
5019
  function serializeV1TransactionData(transactionData) {
5014
5020
  const inputs = transactionData.inputs.map(
5015
5021
  (input, index) => {
@@ -6040,6 +6046,85 @@ function hashTypedData(typeTag, data) {
6040
6046
  return blake2b$1(dataWithTag, { dkLen: 32 });
6041
6047
  }
6042
6048
 
6049
+ function getIdFromCallArg(arg) {
6050
+ if (typeof arg === "string") {
6051
+ return normalizeSuiAddress(arg);
6052
+ }
6053
+ if (arg.Object) {
6054
+ if (arg.Object.ImmOrOwnedObject) {
6055
+ return normalizeSuiAddress(arg.Object.ImmOrOwnedObject.objectId);
6056
+ }
6057
+ if (arg.Object.Receiving) {
6058
+ return normalizeSuiAddress(arg.Object.Receiving.objectId);
6059
+ }
6060
+ return normalizeSuiAddress(arg.Object.SharedObject.objectId);
6061
+ }
6062
+ if (arg.UnresolvedObject) {
6063
+ return normalizeSuiAddress(arg.UnresolvedObject.objectId);
6064
+ }
6065
+ return void 0;
6066
+ }
6067
+ function remapCommandArguments(command, inputMapping, commandMapping) {
6068
+ const remapArg = (arg) => {
6069
+ switch (arg.$kind) {
6070
+ case "Input": {
6071
+ const newInputIndex = inputMapping.get(arg.Input);
6072
+ if (newInputIndex === void 0) {
6073
+ throw new Error(`Input ${arg.Input} not found in input mapping`);
6074
+ }
6075
+ return { ...arg, Input: newInputIndex };
6076
+ }
6077
+ case "Result": {
6078
+ const newCommandIndex = commandMapping.get(arg.Result);
6079
+ if (newCommandIndex !== void 0) {
6080
+ return { ...arg, Result: newCommandIndex };
6081
+ }
6082
+ return arg;
6083
+ }
6084
+ case "NestedResult": {
6085
+ const newCommandIndex = commandMapping.get(arg.NestedResult[0]);
6086
+ if (newCommandIndex !== void 0) {
6087
+ return { ...arg, NestedResult: [newCommandIndex, arg.NestedResult[1]] };
6088
+ }
6089
+ return arg;
6090
+ }
6091
+ default:
6092
+ return arg;
6093
+ }
6094
+ };
6095
+ switch (command.$kind) {
6096
+ case "MoveCall":
6097
+ command.MoveCall.arguments = command.MoveCall.arguments.map(remapArg);
6098
+ break;
6099
+ case "TransferObjects":
6100
+ command.TransferObjects.objects = command.TransferObjects.objects.map(remapArg);
6101
+ command.TransferObjects.address = remapArg(command.TransferObjects.address);
6102
+ break;
6103
+ case "SplitCoins":
6104
+ command.SplitCoins.coin = remapArg(command.SplitCoins.coin);
6105
+ command.SplitCoins.amounts = command.SplitCoins.amounts.map(remapArg);
6106
+ break;
6107
+ case "MergeCoins":
6108
+ command.MergeCoins.destination = remapArg(command.MergeCoins.destination);
6109
+ command.MergeCoins.sources = command.MergeCoins.sources.map(remapArg);
6110
+ break;
6111
+ case "MakeMoveVec":
6112
+ command.MakeMoveVec.elements = command.MakeMoveVec.elements.map(remapArg);
6113
+ break;
6114
+ case "Upgrade":
6115
+ command.Upgrade.ticket = remapArg(command.Upgrade.ticket);
6116
+ break;
6117
+ case "$Intent": {
6118
+ const inputs = command.$Intent.inputs;
6119
+ command.$Intent.inputs = {};
6120
+ for (const [key, value] of Object.entries(inputs)) {
6121
+ command.$Intent.inputs[key] = Array.isArray(value) ? value.map(remapArg) : remapArg(value);
6122
+ }
6123
+ break;
6124
+ }
6125
+ }
6126
+ }
6127
+
6043
6128
  function prepareSuiAddress(address) {
6044
6129
  return normalizeSuiAddress(address).replace("0x", "");
6045
6130
  }
@@ -6241,26 +6326,107 @@ class TransactionDataBuilder {
6241
6326
  return;
6242
6327
  }
6243
6328
  const sizeDiff = replacement.length - 1;
6244
- this.commands.splice(index, 1, ...replacement);
6245
- if (sizeDiff !== 0) {
6329
+ this.commands.splice(index, 1, ...structuredClone(replacement));
6330
+ this.mapArguments((arg, _command, commandIndex) => {
6331
+ if (commandIndex < index + replacement.length) {
6332
+ return arg;
6333
+ }
6334
+ if (typeof resultIndex !== "number") {
6335
+ if (arg.$kind === "Result" && arg.Result === index || arg.$kind === "NestedResult" && arg.NestedResult[0] === index) {
6336
+ if (!("NestedResult" in arg) || arg.NestedResult[1] === 0) {
6337
+ return parse(ArgumentSchema, structuredClone(resultIndex));
6338
+ } else {
6339
+ throw new Error(
6340
+ `Cannot replace command ${index} with a specific result type: NestedResult[${index}, ${arg.NestedResult[1]}] references a nested element that cannot be mapped to the replacement result`
6341
+ );
6342
+ }
6343
+ }
6344
+ }
6345
+ switch (arg.$kind) {
6346
+ case "Result":
6347
+ if (arg.Result === index && typeof resultIndex === "number") {
6348
+ arg.Result = resultIndex;
6349
+ }
6350
+ if (arg.Result > index) {
6351
+ arg.Result += sizeDiff;
6352
+ }
6353
+ break;
6354
+ case "NestedResult":
6355
+ if (arg.NestedResult[0] === index && typeof resultIndex === "number") {
6356
+ return {
6357
+ $kind: "NestedResult",
6358
+ NestedResult: [resultIndex, arg.NestedResult[1]]
6359
+ };
6360
+ }
6361
+ if (arg.NestedResult[0] > index) {
6362
+ arg.NestedResult[0] += sizeDiff;
6363
+ }
6364
+ break;
6365
+ }
6366
+ return arg;
6367
+ });
6368
+ }
6369
+ replaceCommandWithTransaction(index, otherTransaction, result) {
6370
+ if (result.$kind !== "Result" && result.$kind !== "NestedResult") {
6371
+ throw new Error("Result must be of kind Result or NestedResult");
6372
+ }
6373
+ this.insertTransaction(index, otherTransaction);
6374
+ this.replaceCommand(
6375
+ index + otherTransaction.commands.length,
6376
+ [],
6377
+ "Result" in result ? { NestedResult: [result.Result + index, 0] } : {
6378
+ NestedResult: [
6379
+ result.NestedResult[0] + index,
6380
+ result.NestedResult[1]
6381
+ ]
6382
+ }
6383
+ );
6384
+ }
6385
+ insertTransaction(atCommandIndex, otherTransaction) {
6386
+ const inputMapping = /* @__PURE__ */ new Map();
6387
+ const commandMapping = /* @__PURE__ */ new Map();
6388
+ for (let i = 0; i < otherTransaction.inputs.length; i++) {
6389
+ const otherInput = otherTransaction.inputs[i];
6390
+ const id = getIdFromCallArg(otherInput);
6391
+ let existingIndex = -1;
6392
+ if (id !== void 0) {
6393
+ existingIndex = this.inputs.findIndex((input) => getIdFromCallArg(input) === id);
6394
+ if (existingIndex !== -1 && this.inputs[existingIndex].Object?.SharedObject && otherInput.Object?.SharedObject) {
6395
+ this.inputs[existingIndex].Object.SharedObject.mutable = this.inputs[existingIndex].Object.SharedObject.mutable || otherInput.Object.SharedObject.mutable;
6396
+ }
6397
+ }
6398
+ if (existingIndex !== -1) {
6399
+ inputMapping.set(i, existingIndex);
6400
+ } else {
6401
+ const newIndex = this.inputs.length;
6402
+ this.inputs.push(otherInput);
6403
+ inputMapping.set(i, newIndex);
6404
+ }
6405
+ }
6406
+ for (let i = 0; i < otherTransaction.commands.length; i++) {
6407
+ commandMapping.set(i, atCommandIndex + i);
6408
+ }
6409
+ const remappedCommands = [];
6410
+ for (let i = 0; i < otherTransaction.commands.length; i++) {
6411
+ const command = structuredClone(otherTransaction.commands[i]);
6412
+ remapCommandArguments(command, inputMapping, commandMapping);
6413
+ remappedCommands.push(command);
6414
+ }
6415
+ this.commands.splice(atCommandIndex, 0, ...remappedCommands);
6416
+ const sizeDiff = remappedCommands.length;
6417
+ if (sizeDiff > 0) {
6246
6418
  this.mapArguments((arg, _command, commandIndex) => {
6247
- if (commandIndex < index + replacement.length) {
6419
+ if (commandIndex >= atCommandIndex && commandIndex < atCommandIndex + remappedCommands.length) {
6248
6420
  return arg;
6249
6421
  }
6250
6422
  switch (arg.$kind) {
6251
6423
  case "Result":
6252
- if (arg.Result === index) {
6253
- arg.Result = resultIndex;
6254
- }
6255
- if (arg.Result > index) {
6424
+ if (arg.Result >= atCommandIndex) {
6256
6425
  arg.Result += sizeDiff;
6257
6426
  }
6258
6427
  break;
6259
6428
  case "NestedResult":
6260
- if (arg.NestedResult[0] === index) {
6261
- arg.NestedResult[0] = resultIndex;
6262
- }
6263
- if (arg.NestedResult[0] > index) {
6429
+ if (arg.NestedResult[0] >= atCommandIndex) {
6264
6430
  arg.NestedResult[0] += sizeDiff;
6265
6431
  }
6266
6432
  break;
@@ -6361,25 +6527,6 @@ class TransactionDataBuilder {
6361
6527
  }
6362
6528
  }
6363
6529
 
6364
- function getIdFromCallArg(arg) {
6365
- if (typeof arg === "string") {
6366
- return normalizeSuiAddress(arg);
6367
- }
6368
- if (arg.Object) {
6369
- if (arg.Object.ImmOrOwnedObject) {
6370
- return normalizeSuiAddress(arg.Object.ImmOrOwnedObject.objectId);
6371
- }
6372
- if (arg.Object.Receiving) {
6373
- return normalizeSuiAddress(arg.Object.Receiving.objectId);
6374
- }
6375
- return normalizeSuiAddress(arg.Object.SharedObject.objectId);
6376
- }
6377
- if (arg.UnresolvedObject) {
6378
- return normalizeSuiAddress(arg.UnresolvedObject.objectId);
6379
- }
6380
- return void 0;
6381
- }
6382
-
6383
6530
  var __typeError$2 = (msg) => {
6384
6531
  throw TypeError(msg);
6385
6532
  };
@@ -6927,7 +7074,7 @@ const _Transaction = class _Transaction {
6927
7074
  }
6928
7075
  }
6929
7076
  setExpiration(expiration) {
6930
- __privateGet$1(this, _data).expiration = expiration ? parse(TransactionExpiration$2, expiration) : null;
7077
+ __privateGet$1(this, _data).expiration = expiration ? parse(TransactionExpiration$1, expiration) : null;
6931
7078
  }
6932
7079
  setGasPrice(price) {
6933
7080
  __privateGet$1(this, _data).gasConfig.price = String(price);
@@ -7307,6 +7454,7 @@ runPlugins_fn = async function(plugins, options) {
7307
7454
  } finally {
7308
7455
  __privateSet$1(this, _inputSection, __privateGet$1(this, _data).inputs.slice());
7309
7456
  __privateSet$1(this, _commandSection, __privateGet$1(this, _data).commands.slice());
7457
+ __privateSet$1(this, _availableResults, new Set(__privateGet$1(this, _commandSection).map((_, i) => i)));
7310
7458
  }
7311
7459
  };
7312
7460
  waitForPendingTasks_fn = async function() {
@@ -7802,8 +7950,13 @@ class JSONRpcCoreClient extends Experimental_CoreClient {
7802
7950
  errors: result.errors
7803
7951
  };
7804
7952
  }
7805
- resolveNameServiceNames(options) {
7806
- return __privateGet(this, _jsonRpcClient).resolveNameServiceNames(options);
7953
+ async defaultNameServiceName(options) {
7954
+ const name = (await __privateGet(this, _jsonRpcClient).resolveNameServiceNames(options)).data[0];
7955
+ return {
7956
+ data: {
7957
+ name
7958
+ }
7959
+ };
7807
7960
  }
7808
7961
  resolveTransactionPlugin() {
7809
7962
  return jsonRpcClientResolveTransactionPlugin(__privateGet(this, _jsonRpcClient));
@@ -39658,7 +39811,11 @@ class VortexAPI {
39658
39811
  let page = 1;
39659
39812
  let hasNext = true;
39660
39813
  while (hasNext) {
39661
- const response = await this.getCommitments({ ...args, page, apiKey: args.apiKey });
39814
+ const response = await this.getCommitments({
39815
+ ...args,
39816
+ page,
39817
+ apiKey: args.apiKey,
39818
+ });
39662
39819
  allCommitments.push(...response.data.items);
39663
39820
  hasNext = response.data.pagination.hasNext;
39664
39821
  page++;