@arcblock/validator 1.29.27 → 1.30.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.d.cts CHANGED
@@ -1,55 +1,12 @@
1
- import { BNSchema } from "./extension/bn.cjs";
2
- import { DIDSchema } from "./extension/did.cjs";
3
- import BaseJoi, { Root } from "joi";
1
+ import { vDID } from "./v/did.cjs";
2
+ import { vBN, vBNGreater, vBNGt, vBNGte, vBNLess, vBNLt, vBNLte, vBNMax, vBNMin, vBNNegative, vBNPositive } from "./v/bn.cjs";
3
+ import { vFilteredRecord, vForbidden, vStripUnknown, vValidate, vWhen } from "./v/helpers.cjs";
4
+ import { schemas } from "./v/schemas.cjs";
5
+ import * as v from "valibot";
4
6
 
5
7
  //#region src/index.d.ts
6
- interface ExtendedRoot extends Root {
7
- DID(): DIDSchema;
8
- BN(): BNSchema;
9
- }
10
- declare const Joi: ExtendedRoot;
11
- declare const schemas: {
12
- context: BaseJoi.ObjectSchema<any>;
13
- tokenInput: BaseJoi.ObjectSchema<any>;
14
- multiInput: BaseJoi.ArraySchema<any[]>;
15
- multiSig: BaseJoi.ArraySchema<any[]>;
16
- foreignToken: BaseJoi.ObjectSchema<any>;
17
- variableInput: BaseJoi.ObjectSchema<any>;
18
- nftDisplay: BaseJoi.ObjectSchema<any>;
19
- nftEndpoint: BaseJoi.ObjectSchema<any>;
20
- nftIssuer: BaseJoi.ObjectSchema<any>;
21
- tokenHolder: BaseJoi.AlternativesSchema<any>;
22
- assetProps: {
23
- address: DIDSchema;
24
- moniker: BaseJoi.StringSchema<string>;
25
- data: BaseJoi.AnySchema<any>;
26
- readonly: BaseJoi.BooleanSchema<boolean>;
27
- transferrable: BaseJoi.BooleanSchema<boolean>;
28
- ttl: BaseJoi.NumberSchema<number>;
29
- parent: DIDSchema;
30
- issuer: DIDSchema;
31
- endpoint: BaseJoi.ObjectSchema<any>;
32
- display: BaseJoi.ObjectSchema<any>;
33
- tags: BaseJoi.ArraySchema<any[]>;
34
- };
35
- assetSchema: BaseJoi.ObjectSchema<any>;
36
- factoryProps: {
37
- address: DIDSchema;
38
- name: BaseJoi.StringSchema<string>;
39
- description: BaseJoi.StringSchema<string>;
40
- settlement: BaseJoi.StringSchema<string>;
41
- limit: BaseJoi.NumberSchema<number>;
42
- trustedIssuers: BaseJoi.ArraySchema<any[]>;
43
- data: BaseJoi.AnySchema<any>;
44
- display: BaseJoi.ObjectSchema<any>;
45
- input: BaseJoi.ObjectSchema<any>;
46
- output: BaseJoi.ObjectSchema<any>;
47
- hooks: BaseJoi.ArraySchema<any[]>;
48
- };
49
- factorySchema: BaseJoi.ObjectSchema<any>;
50
- };
51
8
  declare const patterns: {
52
9
  txHash: RegExp;
53
10
  };
54
11
  //#endregion
55
- export { ExtendedRoot, Joi, patterns, schemas };
12
+ export { patterns, schemas, v, vBN, vBNGreater, vBNGt, vBNGte, vBNLess, vBNLt, vBNLte, vBNMax, vBNMin, vBNNegative, vBNPositive, vDID, vFilteredRecord, vForbidden, vStripUnknown, vValidate, vWhen };
package/lib/v/bn.cjs ADDED
@@ -0,0 +1,67 @@
1
+ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
+ let valibot = require("valibot");
3
+ valibot = require_rolldown_runtime.__toESM(valibot);
4
+ let bn_js = require("bn.js");
5
+ bn_js = require_rolldown_runtime.__toESM(bn_js);
6
+
7
+ //#region src/v/bn.ts
8
+ const BN_ZERO = new bn_js.default(0);
9
+ const bnOps = {
10
+ gte: (a, b) => a.gte(b),
11
+ lte: (a, b) => a.lte(b),
12
+ gt: (a, b) => a.gt(b),
13
+ lt: (a, b) => a.lt(b)
14
+ };
15
+ const opLabels = {
16
+ gte: ">=",
17
+ lte: "<=",
18
+ gt: ">",
19
+ lt: "<"
20
+ };
21
+ function bnCompare(op, threshold) {
22
+ const t = bn_js.default.isBN(threshold) ? threshold : new bn_js.default(threshold);
23
+ return valibot.check((value) => bnOps[op](value, t), `Value must be ${opLabels[op]} ${t.toString(10)}`);
24
+ }
25
+ const vBNMin = (t) => bnCompare("gte", t);
26
+ const vBNMax = (t) => bnCompare("lte", t);
27
+ const vBNGreater = (t) => bnCompare("gt", t);
28
+ const vBNLess = (t) => bnCompare("lt", t);
29
+ const vBNPositive = () => bnCompare("gt", BN_ZERO);
30
+ const vBNNegative = () => bnCompare("lt", BN_ZERO);
31
+ const vBNGte = vBNMin;
32
+ const vBNLte = vBNMax;
33
+ const vBNGt = vBNGreater;
34
+ const vBNLt = vBNLess;
35
+ function safeBN(input) {
36
+ if (input === null || input === void 0 || typeof input === "number" && Number.isNaN(input)) return false;
37
+ try {
38
+ const bn = new bn_js.default(input);
39
+ bn.toString(10);
40
+ return bn;
41
+ } catch {
42
+ return false;
43
+ }
44
+ }
45
+ function vBN(...actions) {
46
+ const pipeItems = [
47
+ valibot.any(),
48
+ valibot.check((input) => safeBN(input) !== false, "is not a big number"),
49
+ valibot.transform((input) => safeBN(input)),
50
+ ...actions,
51
+ valibot.transform((value) => value.toString(10))
52
+ ];
53
+ return valibot.pipe(...pipeItems);
54
+ }
55
+
56
+ //#endregion
57
+ exports.vBN = vBN;
58
+ exports.vBNGreater = vBNGreater;
59
+ exports.vBNGt = vBNGt;
60
+ exports.vBNGte = vBNGte;
61
+ exports.vBNLess = vBNLess;
62
+ exports.vBNLt = vBNLt;
63
+ exports.vBNLte = vBNLte;
64
+ exports.vBNMax = vBNMax;
65
+ exports.vBNMin = vBNMin;
66
+ exports.vBNNegative = vBNNegative;
67
+ exports.vBNPositive = vBNPositive;
package/lib/v/bn.d.cts ADDED
@@ -0,0 +1,16 @@
1
+ import * as v from "valibot";
2
+
3
+ //#region src/v/bn.d.ts
4
+ declare const vBNMin: (t: any) => v.CheckAction<any, `Value must be >= ${string}` | `Value must be <= ${string}` | `Value must be > ${string}` | `Value must be < ${string}`>;
5
+ declare const vBNMax: (t: any) => v.CheckAction<any, `Value must be >= ${string}` | `Value must be <= ${string}` | `Value must be > ${string}` | `Value must be < ${string}`>;
6
+ declare const vBNGreater: (t: any) => v.CheckAction<any, `Value must be >= ${string}` | `Value must be <= ${string}` | `Value must be > ${string}` | `Value must be < ${string}`>;
7
+ declare const vBNLess: (t: any) => v.CheckAction<any, `Value must be >= ${string}` | `Value must be <= ${string}` | `Value must be > ${string}` | `Value must be < ${string}`>;
8
+ declare const vBNPositive: () => v.CheckAction<any, `Value must be >= ${string}` | `Value must be <= ${string}` | `Value must be > ${string}` | `Value must be < ${string}`>;
9
+ declare const vBNNegative: () => v.CheckAction<any, `Value must be >= ${string}` | `Value must be <= ${string}` | `Value must be > ${string}` | `Value must be < ${string}`>;
10
+ declare const vBNGte: (t: any) => v.CheckAction<any, `Value must be >= ${string}` | `Value must be <= ${string}` | `Value must be > ${string}` | `Value must be < ${string}`>;
11
+ declare const vBNLte: (t: any) => v.CheckAction<any, `Value must be >= ${string}` | `Value must be <= ${string}` | `Value must be > ${string}` | `Value must be < ${string}`>;
12
+ declare const vBNGt: (t: any) => v.CheckAction<any, `Value must be >= ${string}` | `Value must be <= ${string}` | `Value must be > ${string}` | `Value must be < ${string}`>;
13
+ declare const vBNLt: (t: any) => v.CheckAction<any, `Value must be >= ${string}` | `Value must be <= ${string}` | `Value must be > ${string}` | `Value must be < ${string}`>;
14
+ declare function vBN(...actions: any[]): any;
15
+ //#endregion
16
+ export { vBN, vBNGreater, vBNGt, vBNGte, vBNLess, vBNLt, vBNLte, vBNMax, vBNMin, vBNNegative, vBNPositive };
package/lib/v/did.cjs ADDED
@@ -0,0 +1,43 @@
1
+ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
+ let valibot = require("valibot");
3
+ valibot = require_rolldown_runtime.__toESM(valibot);
4
+ let _arcblock_did = require("@arcblock/did");
5
+
6
+ //#region src/v/did.ts
7
+ const isEqual = (a, b) => {
8
+ const aKeys = Object.keys(a);
9
+ const bKeys = Object.keys(b);
10
+ if (aKeys.length !== bKeys.length) return false;
11
+ return aKeys.every((k) => a[k] === b[k]);
12
+ };
13
+ function vDID(opts = {}) {
14
+ const pipeItems = [
15
+ valibot.string(),
16
+ valibot.trim(),
17
+ valibot.check((value) => {
18
+ return !!value && (0, _arcblock_did.isKnownDid)(value) !== false;
19
+ }, "Expected value to be a valid DID")
20
+ ];
21
+ if (opts.prefix !== void 0 && opts.prefix !== false) {
22
+ if (opts.prefix === true || opts.prefix === "") pipeItems.push(valibot.check((value) => (0, _arcblock_did.toAddress)(value) === value, "Expected value to have no DID prefix"));
23
+ else if (typeof opts.prefix === "string") pipeItems.push(valibot.check((value) => value.startsWith(opts.prefix), `Expected DID prefix to be "${opts.prefix}"`));
24
+ }
25
+ if (opts.role || opts.pk || opts.hash) pipeItems.push(valibot.check((value) => {
26
+ const t = (0, _arcblock_did.toTypeInfoStr)(value);
27
+ if (opts.role && t.role !== opts.role) return false;
28
+ if (opts.pk && t.pk !== opts.pk) return false;
29
+ if (opts.hash && t.hash !== opts.hash) return false;
30
+ return true;
31
+ }, "Expected DID type info to match specified constraints"));
32
+ if (opts.wallet) pipeItems.push(valibot.check((value) => {
33
+ const type = (0, _arcblock_did.toTypeInfo)(value);
34
+ if (["ethereum", "eth"].includes(opts.wallet)) return isEqual(type, _arcblock_did.DID_TYPE_ETHEREUM);
35
+ if (["arcblock", "default"].includes(opts.wallet)) return isEqual(type, _arcblock_did.DID_TYPE_ARCBLOCK);
36
+ if (["passkey"].includes(opts.wallet)) return isEqual(type, _arcblock_did.DID_TYPE_PASSKEY);
37
+ return true;
38
+ }, `Expected wallet type to be "${opts.wallet}"`));
39
+ return valibot.pipe(...pipeItems);
40
+ }
41
+
42
+ //#endregion
43
+ exports.vDID = vDID;
@@ -0,0 +1,14 @@
1
+ import { DIDTypeShortcut } from "@arcblock/did";
2
+ import { HashType, KeyType, RoleType } from "@ocap/mcrypto";
3
+
4
+ //#region src/v/did.d.ts
5
+ interface VDIDOptions {
6
+ prefix?: boolean | string;
7
+ role?: RoleType;
8
+ wallet?: DIDTypeShortcut;
9
+ pk?: KeyType;
10
+ hash?: HashType;
11
+ }
12
+ declare function vDID(opts?: VDIDOptions): any;
13
+ //#endregion
14
+ export { VDIDOptions, vDID };
@@ -0,0 +1,67 @@
1
+ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
+ let valibot = require("valibot");
3
+ valibot = require_rolldown_runtime.__toESM(valibot);
4
+
5
+ //#region src/v/helpers.ts
6
+ function vStripUnknown() {
7
+ return valibot.transform((value) => value);
8
+ }
9
+ function vValidate(schema, data) {
10
+ const result = valibot.safeParse(schema, data);
11
+ if (result.success) return {
12
+ value: result.output,
13
+ error: void 0
14
+ };
15
+ return {
16
+ value: void 0,
17
+ error: {
18
+ message: result.issues.map((issue) => {
19
+ const path = issue.path?.map((p) => p.key).filter(Boolean).join(".");
20
+ return path ? `"${path}" ${issue.message}` : issue.message;
21
+ }).join("; "),
22
+ details: result.issues.map((issue) => ({
23
+ message: issue.message,
24
+ path: issue.path?.map((p) => p.key)
25
+ }))
26
+ }
27
+ };
28
+ }
29
+ function vWhen(field, conditions) {
30
+ return valibot.rawTransform(({ dataset, addIssue, NEVER }) => {
31
+ const obj = dataset.value;
32
+ if (!obj || typeof obj !== "object") return obj;
33
+ const targetSchema = (typeof conditions.is === "function" ? conditions.is(obj[field]) : obj[field] === conditions.is) ? conditions.then : conditions.otherwise;
34
+ if (!targetSchema) return obj;
35
+ const result = valibot.safeParse(targetSchema, obj);
36
+ if (!result.success) {
37
+ for (const issue of result.issues) addIssue({
38
+ message: issue.message,
39
+ path: issue.path
40
+ });
41
+ return NEVER;
42
+ }
43
+ return result.output;
44
+ });
45
+ }
46
+ function vForbidden(message = "Field is forbidden") {
47
+ return valibot.pipe(valibot.never(message));
48
+ }
49
+ function vFilteredRecord(keySchema, valueSchema) {
50
+ return valibot.pipe(valibot.record(valibot.string(), valibot.any()), valibot.transform((obj) => {
51
+ const result = {};
52
+ for (const [key, val] of Object.entries(obj)) {
53
+ if (!valibot.safeParse(keySchema, key).success) continue;
54
+ const valResult = valibot.safeParse(valueSchema, val);
55
+ if (!valResult.success) continue;
56
+ result[key] = valResult.output;
57
+ }
58
+ return result;
59
+ }));
60
+ }
61
+
62
+ //#endregion
63
+ exports.vFilteredRecord = vFilteredRecord;
64
+ exports.vForbidden = vForbidden;
65
+ exports.vStripUnknown = vStripUnknown;
66
+ exports.vValidate = vValidate;
67
+ exports.vWhen = vWhen;
@@ -0,0 +1,15 @@
1
+ //#region src/v/helpers.d.ts
2
+ declare function vStripUnknown(): any;
3
+ declare function vValidate(schema: any, data: any): {
4
+ error?: any;
5
+ value?: any;
6
+ };
7
+ declare function vWhen(field: string, conditions: {
8
+ is: any;
9
+ then?: any;
10
+ otherwise?: any;
11
+ }): any;
12
+ declare function vForbidden(message?: string): any;
13
+ declare function vFilteredRecord(keySchema: any, valueSchema: any): any;
14
+ //#endregion
15
+ export { vFilteredRecord, vForbidden, vStripUnknown, vValidate, vWhen };
@@ -0,0 +1,30 @@
1
+ const require_v_did = require('./did.cjs');
2
+ const require_v_bn = require('./bn.cjs');
3
+ const require_v_helpers = require('./helpers.cjs');
4
+ const require_v_schemas = require('./schemas.cjs');
5
+
6
+ exports.schemas = require_v_schemas.schemas;
7
+ exports.vBN = require_v_bn.vBN;
8
+ exports.vBNGreater = require_v_bn.vBNGreater;
9
+ exports.vBNGt = require_v_bn.vBNGt;
10
+ exports.vBNGte = require_v_bn.vBNGte;
11
+ exports.vBNLess = require_v_bn.vBNLess;
12
+ exports.vBNLt = require_v_bn.vBNLt;
13
+ exports.vBNLte = require_v_bn.vBNLte;
14
+ exports.vBNMax = require_v_bn.vBNMax;
15
+ exports.vBNMin = require_v_bn.vBNMin;
16
+ exports.vBNNegative = require_v_bn.vBNNegative;
17
+ exports.vBNPositive = require_v_bn.vBNPositive;
18
+ exports.vDID = require_v_did.vDID;
19
+ exports.vFilteredRecord = require_v_helpers.vFilteredRecord;
20
+ exports.vForbidden = require_v_helpers.vForbidden;
21
+ exports.vStripUnknown = require_v_helpers.vStripUnknown;
22
+ exports.vValidate = require_v_helpers.vValidate;
23
+ exports.vWhen = require_v_helpers.vWhen;
24
+ var valibot = require("valibot");
25
+ Object.keys(valibot).forEach(function (k) {
26
+ if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
27
+ enumerable: true,
28
+ get: function () { return valibot[k]; }
29
+ });
30
+ });
@@ -0,0 +1,6 @@
1
+ import { VDIDOptions, vDID } from "./did.cjs";
2
+ import { vBN, vBNGreater, vBNGt, vBNGte, vBNLess, vBNLt, vBNLte, vBNMax, vBNMin, vBNNegative, vBNPositive } from "./bn.cjs";
3
+ import { vFilteredRecord, vForbidden, vStripUnknown, vValidate, vWhen } from "./helpers.cjs";
4
+ import { schemas } from "./schemas.cjs";
5
+ export * from "valibot";
6
+ export { type VDIDOptions, schemas, vBN, vBNGreater, vBNGt, vBNGte, vBNLess, vBNLt, vBNLte, vBNMax, vBNMin, vBNNegative, vBNPositive, vDID, vFilteredRecord, vForbidden, vStripUnknown, vValidate, vWhen };
@@ -0,0 +1,196 @@
1
+ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
+ const require_v_did = require('./did.cjs');
3
+ const require_v_bn = require('./bn.cjs');
4
+ let valibot = require("valibot");
5
+ valibot = require_rolldown_runtime.__toESM(valibot);
6
+
7
+ //#region src/v/schemas.ts
8
+ const txHash = /^(0x)?([A-Fa-f0-9]{64})$/;
9
+ const ISO_DATE_RE = /^\d{4}-\d{2}-\d{2}(T\d{2}:\d{2}(:\d{2}(\.\d+)?)?(Z|[+-]\d{2}:?\d{2})?)?$/;
10
+ const isIsoDateString = (s) => ISO_DATE_RE.test(s) && !Number.isNaN(new Date(s).getTime());
11
+ const isoDateString = valibot.pipe(valibot.string(), valibot.check(isIsoDateString, "Must be valid ISO date"));
12
+ const txHashOrEmpty = valibot.pipe(valibot.string(), valibot.check((s) => s === "" || txHash.test(s), "Must match tx hash pattern or be empty"));
13
+ const context = valibot.object({
14
+ genesisTime: isoDateString,
15
+ genesisTx: txHashOrEmpty,
16
+ renaissanceTime: isoDateString,
17
+ renaissanceTx: txHashOrEmpty
18
+ });
19
+ const tokenInput = valibot.object({
20
+ address: require_v_did.vDID({
21
+ prefix: true,
22
+ role: "ROLE_TOKEN"
23
+ }),
24
+ value: require_v_bn.vBN(require_v_bn.vBNMin(0))
25
+ });
26
+ const variableInput = valibot.object({
27
+ name: valibot.pipe(valibot.string(), valibot.minLength(1), valibot.maxLength(256)),
28
+ value: valibot.pipe(valibot.string(), valibot.minLength(1), valibot.maxLength(1024)),
29
+ description: valibot.optional(valibot.pipe(valibot.string(), valibot.maxLength(256)), ""),
30
+ required: valibot.optional(valibot.boolean(), false)
31
+ });
32
+ const tokenHolder = valibot.union([
33
+ require_v_did.vDID({
34
+ prefix: true,
35
+ role: "ROLE_ACCOUNT"
36
+ }),
37
+ require_v_did.vDID({
38
+ prefix: true,
39
+ role: "ROLE_APPLICATION"
40
+ }),
41
+ require_v_did.vDID({
42
+ prefix: true,
43
+ role: "ROLE_BLOCKLET"
44
+ }),
45
+ require_v_did.vDID({
46
+ prefix: true,
47
+ wallet: "ethereum"
48
+ }),
49
+ require_v_did.vDID({
50
+ prefix: true,
51
+ wallet: "passkey"
52
+ })
53
+ ]);
54
+ const multiInput = valibot.array(valibot.object({
55
+ owner: tokenHolder,
56
+ tokensList: valibot.optional(valibot.array(tokenInput), []),
57
+ assetsList: valibot.optional(valibot.array(require_v_did.vDID({
58
+ prefix: true,
59
+ role: "ROLE_ASSET"
60
+ })), [])
61
+ }));
62
+ const multiSig = valibot.array(valibot.object({
63
+ signer: require_v_did.vDID({ prefix: true }),
64
+ pk: valibot.any(),
65
+ signature: valibot.any(),
66
+ delegator: valibot.optional(valibot.union([valibot.literal(""), require_v_did.vDID({ prefix: true })])),
67
+ data: valibot.optional(valibot.any())
68
+ }));
69
+ const foreignToken = valibot.object({
70
+ type: valibot.pipe(valibot.string(), valibot.minLength(1), valibot.maxLength(32)),
71
+ contractAddress: require_v_did.vDID({
72
+ prefix: true,
73
+ wallet: "ethereum"
74
+ }),
75
+ chainType: valibot.pipe(valibot.string(), valibot.minLength(1), valibot.maxLength(32)),
76
+ chainName: valibot.pipe(valibot.string(), valibot.minLength(1), valibot.maxLength(32)),
77
+ chainId: valibot.pipe(valibot.number(), valibot.check((n) => n > 0, "Must be positive"))
78
+ });
79
+ const isDataUri = (s) => /^data:[^;]*;base64,/.test(s) || /^data:[^,]*,/.test(s);
80
+ const isHttpUrl = (s) => {
81
+ try {
82
+ const url = new URL(s);
83
+ return ["http:", "https:"].includes(url.protocol);
84
+ } catch {
85
+ return false;
86
+ }
87
+ };
88
+ const nftDisplay = valibot.union([
89
+ valibot.object({
90
+ type: valibot.literal("uri"),
91
+ content: valibot.pipe(valibot.string(), valibot.maxLength(20480), valibot.check(isDataUri, "Must be a data URI"))
92
+ }),
93
+ valibot.object({
94
+ type: valibot.literal("url"),
95
+ content: valibot.pipe(valibot.string(), valibot.maxLength(2048), valibot.check(isHttpUrl, "Must be a valid HTTP/HTTPS URL"))
96
+ }),
97
+ valibot.object({
98
+ type: valibot.literal("svg"),
99
+ content: valibot.string()
100
+ })
101
+ ]);
102
+ const nftEndpoint = valibot.object({
103
+ id: valibot.pipe(valibot.string(), valibot.maxLength(2048), valibot.check(isHttpUrl, "Must be a valid HTTP/HTTPS URL")),
104
+ scope: valibot.optional(valibot.picklist(["public", "private"]), "public")
105
+ });
106
+ const nftIssuer = valibot.object({
107
+ id: require_v_did.vDID({ prefix: true }),
108
+ pk: valibot.string(),
109
+ name: valibot.pipe(valibot.string(), valibot.minLength(1), valibot.maxLength(256))
110
+ });
111
+ const assetProps = {
112
+ address: require_v_did.vDID({
113
+ prefix: true,
114
+ role: "ROLE_ASSET"
115
+ }),
116
+ moniker: valibot.pipe(valibot.string(), valibot.minLength(2), valibot.maxLength(255)),
117
+ data: valibot.any(),
118
+ readonly: valibot.optional(valibot.boolean(), false),
119
+ transferrable: valibot.optional(valibot.boolean(), false),
120
+ ttl: valibot.optional(valibot.pipe(valibot.number(), valibot.minValue(0)), 0),
121
+ parent: valibot.optional(valibot.union([valibot.literal(""), require_v_did.vDID({ prefix: true })])),
122
+ issuer: valibot.optional(valibot.union([valibot.literal(""), require_v_did.vDID({ prefix: true })])),
123
+ endpoint: valibot.optional(valibot.nullable(nftEndpoint), null),
124
+ display: valibot.optional(valibot.nullable(nftDisplay), null),
125
+ tags: valibot.optional(valibot.pipe(valibot.array(valibot.pipe(valibot.string(), valibot.minLength(1), valibot.maxLength(64))), valibot.maxLength(4)))
126
+ };
127
+ const factoryProps = {
128
+ address: require_v_did.vDID({
129
+ prefix: true,
130
+ role: "ROLE_FACTORY"
131
+ }),
132
+ name: valibot.pipe(valibot.string(), valibot.minLength(2), valibot.maxLength(255)),
133
+ description: valibot.pipe(valibot.string(), valibot.minLength(2), valibot.maxLength(255)),
134
+ settlement: valibot.optional(valibot.picklist(["instant", "periodic"]), "instant"),
135
+ limit: valibot.optional(valibot.pipe(valibot.number(), valibot.integer(), valibot.minValue(0)), 0),
136
+ trustedIssuers: valibot.optional(valibot.pipe(valibot.array(require_v_did.vDID({ prefix: true })), valibot.maxLength(8))),
137
+ data: valibot.optional(valibot.nullable(valibot.any()), null),
138
+ display: valibot.optional(valibot.nullable(nftDisplay), null),
139
+ input: valibot.object({
140
+ value: valibot.optional(require_v_bn.vBN(require_v_bn.vBNMin("0")), "0"),
141
+ tokens: valibot.optional(valibot.pipe(valibot.array(tokenInput), valibot.maxLength(8))),
142
+ assets: valibot.optional(valibot.pipe(valibot.array(valibot.union([require_v_did.vDID({
143
+ prefix: true,
144
+ role: "ROLE_ASSET"
145
+ }), require_v_did.vDID({
146
+ prefix: true,
147
+ role: "ROLE_FACTORY"
148
+ })])), valibot.maxLength(8))),
149
+ variables: valibot.optional(valibot.array(valibot.object({
150
+ name: valibot.pipe(valibot.string(), valibot.minLength(1), valibot.maxLength(255)),
151
+ description: valibot.optional(valibot.pipe(valibot.string(), valibot.maxLength(255)), ""),
152
+ required: valibot.boolean()
153
+ })))
154
+ }),
155
+ output: valibot.object({
156
+ moniker: valibot.pipe(valibot.string(), valibot.minLength(2), valibot.maxLength(255)),
157
+ data: valibot.any(),
158
+ readonly: valibot.optional(valibot.boolean(), false),
159
+ transferrable: valibot.optional(valibot.boolean(), false),
160
+ ttl: valibot.optional(valibot.pipe(valibot.number(), valibot.minValue(0)), 0),
161
+ parent: valibot.pipe(valibot.string(), valibot.maxLength(255)),
162
+ issuer: valibot.pipe(valibot.string(), valibot.maxLength(255)),
163
+ endpoint: valibot.optional(nftEndpoint),
164
+ display: valibot.optional(nftDisplay),
165
+ tags: valibot.optional(valibot.pipe(valibot.array(valibot.pipe(valibot.string(), valibot.minLength(1), valibot.maxLength(64))), valibot.maxLength(4)))
166
+ }),
167
+ hooks: valibot.optional(valibot.array(valibot.object({
168
+ name: valibot.picklist([
169
+ "mint",
170
+ "postMint",
171
+ "preMint"
172
+ ]),
173
+ type: valibot.picklist(["url", "contract"]),
174
+ hook: valibot.pipe(valibot.string(), valibot.minLength(1), valibot.maxLength(4096)),
175
+ compiled: valibot.optional(valibot.array(valibot.looseObject({})))
176
+ })))
177
+ };
178
+ const schemas = {
179
+ context,
180
+ tokenInput,
181
+ multiInput,
182
+ multiSig,
183
+ foreignToken,
184
+ variableInput,
185
+ nftDisplay,
186
+ nftEndpoint,
187
+ nftIssuer,
188
+ tokenHolder,
189
+ assetProps,
190
+ assetSchema: valibot.object(assetProps),
191
+ factoryProps,
192
+ factorySchema: valibot.object(factoryProps)
193
+ };
194
+
195
+ //#endregion
196
+ exports.schemas = schemas;