@interest-protocol/vortex-sdk 11.2.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 +1035 -874
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1035 -874
- package/dist/index.mjs.map +1 -1
- package/dist/vortex-api.d.ts +3 -1
- package/dist/vortex-api.d.ts.map +1 -1
- package/package.json +8 -8
- package/src/vortex-api.ts +11 -2
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
|
|
2840
|
+
struct: bcs.lazy(() => StructTag),
|
|
2841
2841
|
u16: null,
|
|
2842
2842
|
u32: null,
|
|
2843
2843
|
u256: null
|
|
2844
2844
|
});
|
|
2845
|
-
const TypeTag
|
|
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
|
|
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
|
|
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$
|
|
2940
|
+
const TransactionExpiration$2 = bcs.enum("TransactionExpiration", {
|
|
2941
2941
|
None: null,
|
|
2942
2942
|
Epoch: unsafe_u64()
|
|
2943
2943
|
});
|
|
2944
|
-
const 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$
|
|
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
|
|
3286
|
+
StructTag,
|
|
3287
3287
|
SuiObjectRef,
|
|
3288
3288
|
TransactionData,
|
|
3289
3289
|
TransactionDataV1,
|
|
3290
3290
|
TransactionEffects,
|
|
3291
|
-
TransactionExpiration: TransactionExpiration$
|
|
3291
|
+
TransactionExpiration: TransactionExpiration$2,
|
|
3292
3292
|
TransactionKind,
|
|
3293
|
-
TypeTag
|
|
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.
|
|
3428
|
-
const TARGETED_RPC_VERSION = "1.
|
|
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
|
-
|
|
3830
|
-
|
|
3831
|
-
|
|
3832
|
-
|
|
3833
|
-
|
|
3834
|
-
|
|
3835
|
-
|
|
3836
|
-
|
|
3837
|
-
|
|
3838
|
-
|
|
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
|
-
|
|
3843
|
-
|
|
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
|
-
|
|
3860
|
+
return store$3?.get(lang);
|
|
3846
3861
|
}
|
|
3847
3862
|
|
|
3848
|
-
|
|
3849
|
-
|
|
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
|
-
|
|
3875
|
+
return store$2?.get(lang);
|
|
3852
3876
|
}
|
|
3853
3877
|
|
|
3854
|
-
|
|
3855
|
-
|
|
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
|
-
|
|
3891
|
+
return store$1?.get(reference)?.get(lang);
|
|
3858
3892
|
}
|
|
3859
3893
|
|
|
3860
|
-
|
|
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
|
-
|
|
3863
|
-
|
|
3864
|
-
|
|
3865
|
-
|
|
3866
|
-
|
|
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
|
-
|
|
3876
|
-
|
|
3877
|
-
|
|
3878
|
-
|
|
3879
|
-
|
|
3880
|
-
|
|
3881
|
-
|
|
3882
|
-
|
|
3883
|
-
|
|
3884
|
-
|
|
3885
|
-
|
|
3886
|
-
|
|
3887
|
-
|
|
3888
|
-
|
|
3889
|
-
|
|
3890
|
-
|
|
3891
|
-
|
|
3892
|
-
|
|
3893
|
-
|
|
3894
|
-
|
|
3895
|
-
|
|
3896
|
-
|
|
3897
|
-
|
|
3898
|
-
|
|
3899
|
-
|
|
3900
|
-
|
|
3901
|
-
|
|
3902
|
-
|
|
3903
|
-
|
|
3904
|
-
|
|
3905
|
-
|
|
3906
|
-
|
|
3907
|
-
|
|
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
|
-
|
|
3912
|
-
|
|
3913
|
-
|
|
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
|
-
|
|
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
|
-
|
|
3920
|
-
|
|
3921
|
-
|
|
3922
|
-
|
|
3923
|
-
|
|
3924
|
-
|
|
3925
|
-
|
|
3926
|
-
|
|
3927
|
-
|
|
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
|
-
|
|
3935
|
-
|
|
3936
|
-
|
|
3937
|
-
|
|
3938
|
-
|
|
3939
|
-
|
|
3940
|
-
|
|
3941
|
-
|
|
3942
|
-
|
|
3943
|
-
|
|
3944
|
-
|
|
3945
|
-
|
|
3946
|
-
|
|
3947
|
-
|
|
3948
|
-
|
|
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
|
-
|
|
3954
|
-
|
|
3955
|
-
|
|
3956
|
-
|
|
3957
|
-
|
|
3958
|
-
|
|
3959
|
-
|
|
3960
|
-
|
|
3961
|
-
|
|
3962
|
-
|
|
3963
|
-
|
|
3964
|
-
|
|
3965
|
-
|
|
3966
|
-
|
|
3967
|
-
|
|
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
|
-
|
|
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
|
-
|
|
3975
|
-
|
|
3976
|
-
|
|
3977
|
-
|
|
3978
|
-
|
|
3979
|
-
|
|
3980
|
-
|
|
3981
|
-
|
|
3982
|
-
|
|
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
|
-
|
|
3988
|
-
|
|
3989
|
-
|
|
3990
|
-
|
|
3991
|
-
|
|
3992
|
-
|
|
3993
|
-
|
|
3994
|
-
|
|
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
|
-
|
|
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
|
-
|
|
4135
|
+
return !schema["~run"]({ value: input }, { abortEarly: true }).issues;
|
|
4001
4136
|
}
|
|
4002
4137
|
|
|
4003
|
-
|
|
4004
|
-
|
|
4005
|
-
|
|
4006
|
-
|
|
4007
|
-
|
|
4008
|
-
|
|
4009
|
-
|
|
4010
|
-
|
|
4011
|
-
|
|
4012
|
-
|
|
4013
|
-
|
|
4014
|
-
|
|
4015
|
-
|
|
4016
|
-
|
|
4017
|
-
|
|
4018
|
-
|
|
4019
|
-
|
|
4020
|
-
|
|
4021
|
-
|
|
4022
|
-
|
|
4023
|
-
|
|
4024
|
-
|
|
4025
|
-
|
|
4026
|
-
|
|
4027
|
-
|
|
4028
|
-
|
|
4029
|
-
|
|
4030
|
-
|
|
4031
|
-
|
|
4032
|
-
|
|
4033
|
-
|
|
4034
|
-
|
|
4035
|
-
|
|
4036
|
-
|
|
4037
|
-
|
|
4038
|
-
|
|
4039
|
-
|
|
4040
|
-
|
|
4041
|
-
|
|
4042
|
-
|
|
4043
|
-
|
|
4044
|
-
|
|
4045
|
-
|
|
4046
|
-
|
|
4047
|
-
|
|
4048
|
-
|
|
4049
|
-
|
|
4050
|
-
|
|
4051
|
-
|
|
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
|
-
|
|
4059
|
-
|
|
4060
|
-
|
|
4061
|
-
|
|
4062
|
-
|
|
4063
|
-
|
|
4064
|
-
|
|
4065
|
-
|
|
4066
|
-
|
|
4067
|
-
|
|
4068
|
-
|
|
4069
|
-
|
|
4070
|
-
|
|
4071
|
-
|
|
4072
|
-
|
|
4073
|
-
|
|
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
|
-
|
|
4079
|
-
|
|
4080
|
-
|
|
4081
|
-
|
|
4082
|
-
|
|
4083
|
-
|
|
4084
|
-
|
|
4085
|
-
|
|
4086
|
-
|
|
4087
|
-
|
|
4088
|
-
|
|
4089
|
-
|
|
4090
|
-
|
|
4091
|
-
|
|
4092
|
-
|
|
4093
|
-
|
|
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
|
-
|
|
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
|
-
|
|
4101
|
-
|
|
4102
|
-
|
|
4103
|
-
|
|
4104
|
-
|
|
4105
|
-
|
|
4106
|
-
|
|
4107
|
-
|
|
4108
|
-
|
|
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
|
-
|
|
4114
|
-
|
|
4115
|
-
|
|
4116
|
-
|
|
4117
|
-
|
|
4118
|
-
|
|
4119
|
-
|
|
4120
|
-
|
|
4121
|
-
|
|
4122
|
-
|
|
4123
|
-
|
|
4124
|
-
|
|
4125
|
-
|
|
4126
|
-
|
|
4127
|
-
|
|
4128
|
-
|
|
4129
|
-
|
|
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
|
-
|
|
4135
|
-
|
|
4136
|
-
|
|
4137
|
-
|
|
4138
|
-
|
|
4139
|
-
|
|
4140
|
-
|
|
4141
|
-
|
|
4142
|
-
|
|
4143
|
-
|
|
4144
|
-
|
|
4145
|
-
|
|
4146
|
-
|
|
4147
|
-
|
|
4148
|
-
|
|
4149
|
-
|
|
4150
|
-
|
|
4151
|
-
|
|
4152
|
-
|
|
4153
|
-
|
|
4154
|
-
|
|
4155
|
-
|
|
4156
|
-
|
|
4157
|
-
|
|
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
|
-
|
|
4167
|
-
|
|
4168
|
-
|
|
4169
|
-
|
|
4170
|
-
|
|
4171
|
-
|
|
4172
|
-
|
|
4173
|
-
|
|
4174
|
-
|
|
4175
|
-
|
|
4176
|
-
|
|
4177
|
-
|
|
4178
|
-
|
|
4179
|
-
|
|
4180
|
-
|
|
4181
|
-
|
|
4182
|
-
|
|
4183
|
-
|
|
4184
|
-
|
|
4185
|
-
|
|
4186
|
-
|
|
4187
|
-
|
|
4188
|
-
|
|
4189
|
-
|
|
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
|
-
|
|
4199
|
-
|
|
4200
|
-
|
|
4201
|
-
|
|
4202
|
-
|
|
4203
|
-
|
|
4204
|
-
|
|
4205
|
-
|
|
4206
|
-
|
|
4207
|
-
|
|
4208
|
-
|
|
4209
|
-
|
|
4210
|
-
|
|
4211
|
-
|
|
4212
|
-
|
|
4213
|
-
|
|
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
|
-
|
|
4219
|
-
|
|
4220
|
-
|
|
4221
|
-
|
|
4222
|
-
|
|
4223
|
-
|
|
4224
|
-
|
|
4225
|
-
|
|
4226
|
-
|
|
4227
|
-
|
|
4228
|
-
|
|
4229
|
-
|
|
4230
|
-
|
|
4231
|
-
|
|
4232
|
-
|
|
4233
|
-
|
|
4234
|
-
|
|
4235
|
-
|
|
4236
|
-
|
|
4237
|
-
|
|
4238
|
-
|
|
4239
|
-
|
|
4240
|
-
|
|
4241
|
-
|
|
4242
|
-
|
|
4243
|
-
|
|
4244
|
-
|
|
4245
|
-
|
|
4246
|
-
|
|
4247
|
-
|
|
4248
|
-
|
|
4249
|
-
|
|
4250
|
-
|
|
4251
|
-
|
|
4252
|
-
|
|
4253
|
-
|
|
4254
|
-
|
|
4255
|
-
|
|
4256
|
-
|
|
4257
|
-
|
|
4258
|
-
|
|
4259
|
-
|
|
4260
|
-
|
|
4261
|
-
|
|
4262
|
-
|
|
4263
|
-
|
|
4264
|
-
|
|
4265
|
-
|
|
4266
|
-
|
|
4267
|
-
|
|
4268
|
-
|
|
4269
|
-
|
|
4270
|
-
|
|
4271
|
-
|
|
4272
|
-
|
|
4273
|
-
|
|
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
|
-
|
|
4279
|
-
|
|
4280
|
-
|
|
4281
|
-
|
|
4282
|
-
|
|
4283
|
-
|
|
4284
|
-
|
|
4285
|
-
|
|
4286
|
-
|
|
4287
|
-
|
|
4288
|
-
|
|
4289
|
-
|
|
4290
|
-
|
|
4291
|
-
|
|
4292
|
-
|
|
4293
|
-
|
|
4294
|
-
|
|
4295
|
-
|
|
4296
|
-
|
|
4297
|
-
|
|
4298
|
-
|
|
4299
|
-
|
|
4300
|
-
|
|
4301
|
-
|
|
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
|
-
|
|
4311
|
-
|
|
4312
|
-
|
|
4313
|
-
|
|
4314
|
-
|
|
4315
|
-
|
|
4316
|
-
|
|
4317
|
-
|
|
4318
|
-
|
|
4319
|
-
|
|
4320
|
-
|
|
4321
|
-
|
|
4322
|
-
|
|
4323
|
-
|
|
4324
|
-
|
|
4325
|
-
|
|
4326
|
-
|
|
4327
|
-
|
|
4328
|
-
|
|
4329
|
-
|
|
4330
|
-
|
|
4331
|
-
|
|
4332
|
-
|
|
4333
|
-
|
|
4334
|
-
|
|
4335
|
-
|
|
4336
|
-
|
|
4337
|
-
|
|
4338
|
-
|
|
4339
|
-
|
|
4340
|
-
|
|
4341
|
-
|
|
4342
|
-
|
|
4343
|
-
|
|
4344
|
-
|
|
4345
|
-
|
|
4346
|
-
|
|
4347
|
-
|
|
4348
|
-
|
|
4349
|
-
|
|
4350
|
-
|
|
4351
|
-
|
|
4352
|
-
|
|
4353
|
-
|
|
4354
|
-
|
|
4355
|
-
|
|
4356
|
-
|
|
4357
|
-
|
|
4358
|
-
|
|
4359
|
-
|
|
4360
|
-
|
|
4361
|
-
|
|
4362
|
-
|
|
4363
|
-
|
|
4364
|
-
|
|
4365
|
-
|
|
4366
|
-
|
|
4367
|
-
|
|
4368
|
-
|
|
4369
|
-
|
|
4370
|
-
|
|
4371
|
-
|
|
4372
|
-
|
|
4373
|
-
|
|
4374
|
-
|
|
4375
|
-
|
|
4376
|
-
|
|
4377
|
-
|
|
4378
|
-
|
|
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
|
-
|
|
4398
|
-
|
|
4399
|
-
|
|
4400
|
-
|
|
4401
|
-
|
|
4402
|
-
|
|
4403
|
-
|
|
4404
|
-
|
|
4405
|
-
|
|
4406
|
-
|
|
4407
|
-
|
|
4408
|
-
|
|
4409
|
-
|
|
4410
|
-
|
|
4411
|
-
|
|
4412
|
-
|
|
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
|
-
|
|
4418
|
-
|
|
4419
|
-
|
|
4420
|
-
|
|
4421
|
-
|
|
4422
|
-
|
|
4423
|
-
|
|
4424
|
-
|
|
4425
|
-
|
|
4426
|
-
|
|
4427
|
-
|
|
4428
|
-
|
|
4429
|
-
|
|
4430
|
-
|
|
4431
|
-
|
|
4432
|
-
|
|
4433
|
-
|
|
4434
|
-
|
|
4435
|
-
|
|
4436
|
-
|
|
4437
|
-
|
|
4438
|
-
|
|
4439
|
-
|
|
4440
|
-
|
|
4441
|
-
|
|
4442
|
-
|
|
4443
|
-
|
|
4444
|
-
|
|
4445
|
-
|
|
4446
|
-
|
|
4447
|
-
|
|
4448
|
-
|
|
4449
|
-
|
|
4450
|
-
|
|
4451
|
-
|
|
4452
|
-
|
|
4453
|
-
|
|
4454
|
-
|
|
4455
|
-
|
|
4456
|
-
|
|
4457
|
-
|
|
4458
|
-
|
|
4459
|
-
|
|
4460
|
-
|
|
4461
|
-
|
|
4462
|
-
|
|
4463
|
-
|
|
4464
|
-
|
|
4465
|
-
|
|
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
|
-
|
|
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
|
-
|
|
4478
|
-
|
|
4479
|
-
|
|
4480
|
-
|
|
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
|
-
|
|
4491
|
-
|
|
4492
|
-
|
|
4493
|
-
|
|
4494
|
-
|
|
4495
|
-
|
|
4496
|
-
|
|
4497
|
-
|
|
4498
|
-
|
|
4499
|
-
|
|
4500
|
-
|
|
4501
|
-
|
|
4502
|
-
|
|
4503
|
-
|
|
4504
|
-
|
|
4505
|
-
|
|
4506
|
-
|
|
4507
|
-
|
|
4508
|
-
|
|
4509
|
-
|
|
4510
|
-
|
|
4511
|
-
|
|
4512
|
-
|
|
4513
|
-
|
|
4514
|
-
|
|
4515
|
-
|
|
4516
|
-
|
|
4517
|
-
|
|
4518
|
-
|
|
4519
|
-
|
|
4520
|
-
|
|
4521
|
-
|
|
4522
|
-
|
|
4523
|
-
|
|
4524
|
-
|
|
4525
|
-
|
|
4526
|
-
|
|
4527
|
-
|
|
4528
|
-
|
|
4529
|
-
|
|
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
|
-
|
|
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
|
-
|
|
4554
|
-
|
|
4555
|
-
|
|
4556
|
-
|
|
4557
|
-
|
|
4558
|
-
|
|
4559
|
-
|
|
4560
|
-
|
|
4561
|
-
|
|
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
|
-
|
|
4567
|
-
|
|
4568
|
-
|
|
4569
|
-
|
|
4570
|
-
|
|
4571
|
-
|
|
4572
|
-
|
|
4573
|
-
|
|
4574
|
-
|
|
4575
|
-
|
|
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
|
-
|
|
4579
|
-
|
|
4580
|
-
|
|
4581
|
-
|
|
4582
|
-
|
|
4583
|
-
|
|
4584
|
-
|
|
4585
|
-
|
|
4586
|
-
|
|
4587
|
-
|
|
4588
|
-
|
|
4589
|
-
|
|
4590
|
-
|
|
4591
|
-
|
|
4592
|
-
|
|
4593
|
-
|
|
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(
|
|
4603
|
-
|
|
4604
|
-
|
|
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$
|
|
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$
|
|
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
|
-
|
|
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 <
|
|
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
|
|
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]
|
|
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$
|
|
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
|
-
|
|
7806
|
-
|
|
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));
|
|
@@ -39653,14 +39806,22 @@ class VortexAPI {
|
|
|
39653
39806
|
return response;
|
|
39654
39807
|
}
|
|
39655
39808
|
async getAllCommitments(args) {
|
|
39809
|
+
const sleepMs = Math.max(args.sleepMs ?? 200, 200);
|
|
39656
39810
|
const allCommitments = [];
|
|
39657
39811
|
let page = 1;
|
|
39658
39812
|
let hasNext = true;
|
|
39659
39813
|
while (hasNext) {
|
|
39660
|
-
const response = await this.getCommitments({
|
|
39814
|
+
const response = await this.getCommitments({
|
|
39815
|
+
...args,
|
|
39816
|
+
page,
|
|
39817
|
+
apiKey: args.apiKey,
|
|
39818
|
+
});
|
|
39661
39819
|
allCommitments.push(...response.data.items);
|
|
39662
39820
|
hasNext = response.data.pagination.hasNext;
|
|
39663
39821
|
page++;
|
|
39822
|
+
if (hasNext) {
|
|
39823
|
+
await new Promise((resolve) => setTimeout(resolve, sleepMs));
|
|
39824
|
+
}
|
|
39664
39825
|
}
|
|
39665
39826
|
return allCommitments;
|
|
39666
39827
|
}
|