@0xpolygonid/js-sdk 1.20.0 → 1.20.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.
@@ -21038,169 +21038,162 @@ var codegen = {};
21038
21038
 
21039
21039
  var code$1 = {};
21040
21040
 
21041
- var hasRequiredCode$1;
21042
-
21043
- function requireCode$1 () {
21044
- if (hasRequiredCode$1) return code$1;
21045
- hasRequiredCode$1 = 1;
21046
- (function (exports) {
21047
- Object.defineProperty(exports, "__esModule", { value: true });
21048
- exports.regexpCode = exports.getEsmExportName = exports.getProperty = exports.safeStringify = exports.stringify = exports.strConcat = exports.addCodeArg = exports.str = exports._ = exports.nil = exports._Code = exports.Name = exports.IDENTIFIER = exports._CodeOrName = void 0;
21049
- class _CodeOrName {
21050
- }
21051
- exports._CodeOrName = _CodeOrName;
21052
- exports.IDENTIFIER = /^[a-z$_][a-z$_0-9]*$/i;
21053
- class Name extends _CodeOrName {
21054
- constructor(s) {
21055
- super();
21056
- if (!exports.IDENTIFIER.test(s))
21057
- throw new Error("CodeGen: name must be a valid identifier");
21058
- this.str = s;
21059
- }
21060
- toString() {
21061
- return this.str;
21062
- }
21063
- emptyStr() {
21064
- return false;
21065
- }
21066
- get names() {
21067
- return { [this.str]: 1 };
21068
- }
21069
- }
21070
- exports.Name = Name;
21071
- class _Code extends _CodeOrName {
21072
- constructor(code) {
21073
- super();
21074
- this._items = typeof code === "string" ? [code] : code;
21075
- }
21076
- toString() {
21077
- return this.str;
21078
- }
21079
- emptyStr() {
21080
- if (this._items.length > 1)
21081
- return false;
21082
- const item = this._items[0];
21083
- return item === "" || item === '""';
21084
- }
21085
- get str() {
21086
- var _a;
21087
- return ((_a = this._str) !== null && _a !== void 0 ? _a : (this._str = this._items.reduce((s, c) => `${s}${c}`, "")));
21088
- }
21089
- get names() {
21090
- var _a;
21091
- return ((_a = this._names) !== null && _a !== void 0 ? _a : (this._names = this._items.reduce((names, c) => {
21092
- if (c instanceof Name)
21093
- names[c.str] = (names[c.str] || 0) + 1;
21094
- return names;
21095
- }, {})));
21096
- }
21097
- }
21098
- exports._Code = _Code;
21099
- exports.nil = new _Code("");
21100
- function _(strs, ...args) {
21101
- const code = [strs[0]];
21102
- let i = 0;
21103
- while (i < args.length) {
21104
- addCodeArg(code, args[i]);
21105
- code.push(strs[++i]);
21106
- }
21107
- return new _Code(code);
21108
- }
21109
- exports._ = _;
21110
- const plus = new _Code("+");
21111
- function str(strs, ...args) {
21112
- const expr = [safeStringify(strs[0])];
21113
- let i = 0;
21114
- while (i < args.length) {
21115
- expr.push(plus);
21116
- addCodeArg(expr, args[i]);
21117
- expr.push(plus, safeStringify(strs[++i]));
21118
- }
21119
- optimize(expr);
21120
- return new _Code(expr);
21121
- }
21122
- exports.str = str;
21123
- function addCodeArg(code, arg) {
21124
- if (arg instanceof _Code)
21125
- code.push(...arg._items);
21126
- else if (arg instanceof Name)
21127
- code.push(arg);
21128
- else
21129
- code.push(interpolate(arg));
21130
- }
21131
- exports.addCodeArg = addCodeArg;
21132
- function optimize(expr) {
21133
- let i = 1;
21134
- while (i < expr.length - 1) {
21135
- if (expr[i] === plus) {
21136
- const res = mergeExprItems(expr[i - 1], expr[i + 1]);
21137
- if (res !== undefined) {
21138
- expr.splice(i - 1, 3, res);
21139
- continue;
21140
- }
21141
- expr[i++] = "+";
21142
- }
21143
- i++;
21144
- }
21145
- }
21146
- function mergeExprItems(a, b) {
21147
- if (b === '""')
21148
- return a;
21149
- if (a === '""')
21150
- return b;
21151
- if (typeof a == "string") {
21152
- if (b instanceof Name || a[a.length - 1] !== '"')
21153
- return;
21154
- if (typeof b != "string")
21155
- return `${a.slice(0, -1)}${b}"`;
21156
- if (b[0] === '"')
21157
- return a.slice(0, -1) + b.slice(1);
21158
- return;
21159
- }
21160
- if (typeof b == "string" && b[0] === '"' && !(a instanceof Name))
21161
- return `"${a}${b.slice(1)}`;
21162
- return;
21163
- }
21164
- function strConcat(c1, c2) {
21165
- return c2.emptyStr() ? c1 : c1.emptyStr() ? c2 : str `${c1}${c2}`;
21166
- }
21167
- exports.strConcat = strConcat;
21168
- // TODO do not allow arrays here
21169
- function interpolate(x) {
21170
- return typeof x == "number" || typeof x == "boolean" || x === null
21171
- ? x
21172
- : safeStringify(Array.isArray(x) ? x.join(",") : x);
21173
- }
21174
- function stringify(x) {
21175
- return new _Code(safeStringify(x));
21176
- }
21177
- exports.stringify = stringify;
21178
- function safeStringify(x) {
21179
- return JSON.stringify(x)
21180
- .replace(/\u2028/g, "\\u2028")
21181
- .replace(/\u2029/g, "\\u2029");
21182
- }
21183
- exports.safeStringify = safeStringify;
21184
- function getProperty(key) {
21185
- return typeof key == "string" && exports.IDENTIFIER.test(key) ? new _Code(`.${key}`) : _ `[${key}]`;
21186
- }
21187
- exports.getProperty = getProperty;
21188
- //Does best effort to format the name properly
21189
- function getEsmExportName(key) {
21190
- if (typeof key == "string" && exports.IDENTIFIER.test(key)) {
21191
- return new _Code(`${key}`);
21192
- }
21193
- throw new Error(`CodeGen: invalid export name: ${key}, use explicit $id name mapping`);
21194
- }
21195
- exports.getEsmExportName = getEsmExportName;
21196
- function regexpCode(rx) {
21197
- return new _Code(rx.toString());
21198
- }
21199
- exports.regexpCode = regexpCode;
21200
-
21201
- } (code$1));
21202
- return code$1;
21203
- }
21041
+ (function (exports) {
21042
+ Object.defineProperty(exports, "__esModule", { value: true });
21043
+ exports.regexpCode = exports.getEsmExportName = exports.getProperty = exports.safeStringify = exports.stringify = exports.strConcat = exports.addCodeArg = exports.str = exports._ = exports.nil = exports._Code = exports.Name = exports.IDENTIFIER = exports._CodeOrName = void 0;
21044
+ class _CodeOrName {
21045
+ }
21046
+ exports._CodeOrName = _CodeOrName;
21047
+ exports.IDENTIFIER = /^[a-z$_][a-z$_0-9]*$/i;
21048
+ class Name extends _CodeOrName {
21049
+ constructor(s) {
21050
+ super();
21051
+ if (!exports.IDENTIFIER.test(s))
21052
+ throw new Error("CodeGen: name must be a valid identifier");
21053
+ this.str = s;
21054
+ }
21055
+ toString() {
21056
+ return this.str;
21057
+ }
21058
+ emptyStr() {
21059
+ return false;
21060
+ }
21061
+ get names() {
21062
+ return { [this.str]: 1 };
21063
+ }
21064
+ }
21065
+ exports.Name = Name;
21066
+ class _Code extends _CodeOrName {
21067
+ constructor(code) {
21068
+ super();
21069
+ this._items = typeof code === "string" ? [code] : code;
21070
+ }
21071
+ toString() {
21072
+ return this.str;
21073
+ }
21074
+ emptyStr() {
21075
+ if (this._items.length > 1)
21076
+ return false;
21077
+ const item = this._items[0];
21078
+ return item === "" || item === '""';
21079
+ }
21080
+ get str() {
21081
+ var _a;
21082
+ return ((_a = this._str) !== null && _a !== void 0 ? _a : (this._str = this._items.reduce((s, c) => `${s}${c}`, "")));
21083
+ }
21084
+ get names() {
21085
+ var _a;
21086
+ return ((_a = this._names) !== null && _a !== void 0 ? _a : (this._names = this._items.reduce((names, c) => {
21087
+ if (c instanceof Name)
21088
+ names[c.str] = (names[c.str] || 0) + 1;
21089
+ return names;
21090
+ }, {})));
21091
+ }
21092
+ }
21093
+ exports._Code = _Code;
21094
+ exports.nil = new _Code("");
21095
+ function _(strs, ...args) {
21096
+ const code = [strs[0]];
21097
+ let i = 0;
21098
+ while (i < args.length) {
21099
+ addCodeArg(code, args[i]);
21100
+ code.push(strs[++i]);
21101
+ }
21102
+ return new _Code(code);
21103
+ }
21104
+ exports._ = _;
21105
+ const plus = new _Code("+");
21106
+ function str(strs, ...args) {
21107
+ const expr = [safeStringify(strs[0])];
21108
+ let i = 0;
21109
+ while (i < args.length) {
21110
+ expr.push(plus);
21111
+ addCodeArg(expr, args[i]);
21112
+ expr.push(plus, safeStringify(strs[++i]));
21113
+ }
21114
+ optimize(expr);
21115
+ return new _Code(expr);
21116
+ }
21117
+ exports.str = str;
21118
+ function addCodeArg(code, arg) {
21119
+ if (arg instanceof _Code)
21120
+ code.push(...arg._items);
21121
+ else if (arg instanceof Name)
21122
+ code.push(arg);
21123
+ else
21124
+ code.push(interpolate(arg));
21125
+ }
21126
+ exports.addCodeArg = addCodeArg;
21127
+ function optimize(expr) {
21128
+ let i = 1;
21129
+ while (i < expr.length - 1) {
21130
+ if (expr[i] === plus) {
21131
+ const res = mergeExprItems(expr[i - 1], expr[i + 1]);
21132
+ if (res !== undefined) {
21133
+ expr.splice(i - 1, 3, res);
21134
+ continue;
21135
+ }
21136
+ expr[i++] = "+";
21137
+ }
21138
+ i++;
21139
+ }
21140
+ }
21141
+ function mergeExprItems(a, b) {
21142
+ if (b === '""')
21143
+ return a;
21144
+ if (a === '""')
21145
+ return b;
21146
+ if (typeof a == "string") {
21147
+ if (b instanceof Name || a[a.length - 1] !== '"')
21148
+ return;
21149
+ if (typeof b != "string")
21150
+ return `${a.slice(0, -1)}${b}"`;
21151
+ if (b[0] === '"')
21152
+ return a.slice(0, -1) + b.slice(1);
21153
+ return;
21154
+ }
21155
+ if (typeof b == "string" && b[0] === '"' && !(a instanceof Name))
21156
+ return `"${a}${b.slice(1)}`;
21157
+ return;
21158
+ }
21159
+ function strConcat(c1, c2) {
21160
+ return c2.emptyStr() ? c1 : c1.emptyStr() ? c2 : str `${c1}${c2}`;
21161
+ }
21162
+ exports.strConcat = strConcat;
21163
+ // TODO do not allow arrays here
21164
+ function interpolate(x) {
21165
+ return typeof x == "number" || typeof x == "boolean" || x === null
21166
+ ? x
21167
+ : safeStringify(Array.isArray(x) ? x.join(",") : x);
21168
+ }
21169
+ function stringify(x) {
21170
+ return new _Code(safeStringify(x));
21171
+ }
21172
+ exports.stringify = stringify;
21173
+ function safeStringify(x) {
21174
+ return JSON.stringify(x)
21175
+ .replace(/\u2028/g, "\\u2028")
21176
+ .replace(/\u2029/g, "\\u2029");
21177
+ }
21178
+ exports.safeStringify = safeStringify;
21179
+ function getProperty(key) {
21180
+ return typeof key == "string" && exports.IDENTIFIER.test(key) ? new _Code(`.${key}`) : _ `[${key}]`;
21181
+ }
21182
+ exports.getProperty = getProperty;
21183
+ //Does best effort to format the name properly
21184
+ function getEsmExportName(key) {
21185
+ if (typeof key == "string" && exports.IDENTIFIER.test(key)) {
21186
+ return new _Code(`${key}`);
21187
+ }
21188
+ throw new Error(`CodeGen: invalid export name: ${key}, use explicit $id name mapping`);
21189
+ }
21190
+ exports.getEsmExportName = getEsmExportName;
21191
+ function regexpCode(rx) {
21192
+ return new _Code(rx.toString());
21193
+ }
21194
+ exports.regexpCode = regexpCode;
21195
+
21196
+ } (code$1));
21204
21197
 
21205
21198
  var scope = {};
21206
21199
 
@@ -21212,7 +21205,7 @@ function requireScope () {
21212
21205
  (function (exports) {
21213
21206
  Object.defineProperty(exports, "__esModule", { value: true });
21214
21207
  exports.ValueScope = exports.ValueScopeName = exports.Scope = exports.varKinds = exports.UsedValueState = void 0;
21215
- const code_1 = requireCode$1();
21208
+ const code_1 = code$1;
21216
21209
  class ValueError extends Error {
21217
21210
  constructor(name) {
21218
21211
  super(`CodeGen: "code" for ${name} not defined`);
@@ -21364,9 +21357,9 @@ function requireCodegen () {
21364
21357
  (function (exports) {
21365
21358
  Object.defineProperty(exports, "__esModule", { value: true });
21366
21359
  exports.or = exports.and = exports.not = exports.CodeGen = exports.operators = exports.varKinds = exports.ValueScopeName = exports.ValueScope = exports.Scope = exports.Name = exports.regexpCode = exports.stringify = exports.getProperty = exports.nil = exports.strConcat = exports.str = exports._ = void 0;
21367
- const code_1 = requireCode$1();
21360
+ const code_1 = code$1;
21368
21361
  const scope_1 = requireScope();
21369
- var code_2 = requireCode$1();
21362
+ var code_2 = code$1;
21370
21363
  Object.defineProperty(exports, "_", { enumerable: true, get: function () { return code_2._; } });
21371
21364
  Object.defineProperty(exports, "str", { enumerable: true, get: function () { return code_2.str; } });
21372
21365
  Object.defineProperty(exports, "strConcat", { enumerable: true, get: function () { return code_2.strConcat; } });
@@ -22068,7 +22061,7 @@ var util = {};
22068
22061
  Object.defineProperty(exports, "__esModule", { value: true });
22069
22062
  exports.checkStrictMode = exports.getErrorPath = exports.Type = exports.useFunc = exports.setEvaluated = exports.evaluatedPropsToName = exports.mergeEvaluated = exports.eachItem = exports.unescapeJsonPointer = exports.escapeJsonPointer = exports.escapeFragment = exports.unescapeFragment = exports.schemaRefOrVal = exports.schemaHasRulesButRef = exports.schemaHasRules = exports.checkUnknownRules = exports.alwaysValidSchema = exports.toHash = void 0;
22070
22063
  const codegen_1 = requireCodegen();
22071
- const code_1 = requireCode$1();
22064
+ const code_1 = code$1;
22072
22065
  // TODO refactor to use Set
22073
22066
  function toHash(arr) {
22074
22067
  const hash = {};
@@ -22501,37 +22494,29 @@ rules.getRules = getRules;
22501
22494
 
22502
22495
  var applicability = {};
22503
22496
 
22504
- var hasRequiredApplicability;
22505
-
22506
- function requireApplicability () {
22507
- if (hasRequiredApplicability) return applicability;
22508
- hasRequiredApplicability = 1;
22509
- Object.defineProperty(applicability, "__esModule", { value: true });
22510
- applicability.shouldUseRule = applicability.shouldUseGroup = applicability.schemaHasRulesForType = void 0;
22511
- function schemaHasRulesForType({ schema, self }, type) {
22512
- const group = self.RULES.types[type];
22513
- return group && group !== true && shouldUseGroup(schema, group);
22514
- }
22515
- applicability.schemaHasRulesForType = schemaHasRulesForType;
22516
- function shouldUseGroup(schema, group) {
22517
- return group.rules.some((rule) => shouldUseRule(schema, rule));
22518
- }
22519
- applicability.shouldUseGroup = shouldUseGroup;
22520
- function shouldUseRule(schema, rule) {
22521
- var _a;
22522
- return (schema[rule.keyword] !== undefined ||
22523
- ((_a = rule.definition.implements) === null || _a === void 0 ? void 0 : _a.some((kwd) => schema[kwd] !== undefined)));
22524
- }
22525
- applicability.shouldUseRule = shouldUseRule;
22526
-
22527
- return applicability;
22497
+ Object.defineProperty(applicability, "__esModule", { value: true });
22498
+ applicability.shouldUseRule = applicability.shouldUseGroup = applicability.schemaHasRulesForType = void 0;
22499
+ function schemaHasRulesForType({ schema, self }, type) {
22500
+ const group = self.RULES.types[type];
22501
+ return group && group !== true && shouldUseGroup(schema, group);
22502
+ }
22503
+ applicability.schemaHasRulesForType = schemaHasRulesForType;
22504
+ function shouldUseGroup(schema, group) {
22505
+ return group.rules.some((rule) => shouldUseRule(schema, rule));
22506
+ }
22507
+ applicability.shouldUseGroup = shouldUseGroup;
22508
+ function shouldUseRule(schema, rule) {
22509
+ var _a;
22510
+ return (schema[rule.keyword] !== undefined ||
22511
+ ((_a = rule.definition.implements) === null || _a === void 0 ? void 0 : _a.some((kwd) => schema[kwd] !== undefined)));
22528
22512
  }
22513
+ applicability.shouldUseRule = shouldUseRule;
22529
22514
 
22530
22515
  (function (exports) {
22531
22516
  Object.defineProperty(exports, "__esModule", { value: true });
22532
22517
  exports.reportTypeError = exports.checkDataTypes = exports.checkDataType = exports.coerceAndCheckDataType = exports.getJSONTypes = exports.getSchemaTypes = exports.DataType = void 0;
22533
22518
  const rules_1 = rules;
22534
- const applicability_1 = requireApplicability();
22519
+ const applicability_1 = applicability;
22535
22520
  const errors_1 = requireErrors();
22536
22521
  const codegen_1 = requireCodegen();
22537
22522
  const util_1 = util;
@@ -22779,143 +22764,135 @@ var keyword = {};
22779
22764
 
22780
22765
  var code = {};
22781
22766
 
22782
- var hasRequiredCode;
22783
-
22784
- function requireCode () {
22785
- if (hasRequiredCode) return code;
22786
- hasRequiredCode = 1;
22787
- Object.defineProperty(code, "__esModule", { value: true });
22788
- code.validateUnion = code.validateArray = code.usePattern = code.callValidateCode = code.schemaProperties = code.allSchemaProperties = code.noPropertyInData = code.propertyInData = code.isOwnProperty = code.hasPropFunc = code.reportMissingProp = code.checkMissingProp = code.checkReportMissingProp = void 0;
22789
- const codegen_1 = requireCodegen();
22790
- const util_1 = util;
22791
- const names_1 = requireNames();
22792
- const util_2 = util;
22793
- function checkReportMissingProp(cxt, prop) {
22794
- const { gen, data, it } = cxt;
22795
- gen.if(noPropertyInData(gen, data, prop, it.opts.ownProperties), () => {
22796
- cxt.setParams({ missingProperty: (0, codegen_1._) `${prop}` }, true);
22797
- cxt.error();
22798
- });
22799
- }
22800
- code.checkReportMissingProp = checkReportMissingProp;
22801
- function checkMissingProp({ gen, data, it: { opts } }, properties, missing) {
22802
- return (0, codegen_1.or)(...properties.map((prop) => (0, codegen_1.and)(noPropertyInData(gen, data, prop, opts.ownProperties), (0, codegen_1._) `${missing} = ${prop}`)));
22803
- }
22804
- code.checkMissingProp = checkMissingProp;
22805
- function reportMissingProp(cxt, missing) {
22806
- cxt.setParams({ missingProperty: missing }, true);
22807
- cxt.error();
22808
- }
22809
- code.reportMissingProp = reportMissingProp;
22810
- function hasPropFunc(gen) {
22811
- return gen.scopeValue("func", {
22812
- // eslint-disable-next-line @typescript-eslint/unbound-method
22813
- ref: Object.prototype.hasOwnProperty,
22814
- code: (0, codegen_1._) `Object.prototype.hasOwnProperty`,
22815
- });
22816
- }
22817
- code.hasPropFunc = hasPropFunc;
22818
- function isOwnProperty(gen, data, property) {
22819
- return (0, codegen_1._) `${hasPropFunc(gen)}.call(${data}, ${property})`;
22820
- }
22821
- code.isOwnProperty = isOwnProperty;
22822
- function propertyInData(gen, data, property, ownProperties) {
22823
- const cond = (0, codegen_1._) `${data}${(0, codegen_1.getProperty)(property)} !== undefined`;
22824
- return ownProperties ? (0, codegen_1._) `${cond} && ${isOwnProperty(gen, data, property)}` : cond;
22825
- }
22826
- code.propertyInData = propertyInData;
22827
- function noPropertyInData(gen, data, property, ownProperties) {
22828
- const cond = (0, codegen_1._) `${data}${(0, codegen_1.getProperty)(property)} === undefined`;
22829
- return ownProperties ? (0, codegen_1.or)(cond, (0, codegen_1.not)(isOwnProperty(gen, data, property))) : cond;
22830
- }
22831
- code.noPropertyInData = noPropertyInData;
22832
- function allSchemaProperties(schemaMap) {
22833
- return schemaMap ? Object.keys(schemaMap).filter((p) => p !== "__proto__") : [];
22834
- }
22835
- code.allSchemaProperties = allSchemaProperties;
22836
- function schemaProperties(it, schemaMap) {
22837
- return allSchemaProperties(schemaMap).filter((p) => !(0, util_1.alwaysValidSchema)(it, schemaMap[p]));
22838
- }
22839
- code.schemaProperties = schemaProperties;
22840
- function callValidateCode({ schemaCode, data, it: { gen, topSchemaRef, schemaPath, errorPath }, it }, func, context, passSchema) {
22841
- const dataAndSchema = passSchema ? (0, codegen_1._) `${schemaCode}, ${data}, ${topSchemaRef}${schemaPath}` : data;
22842
- const valCxt = [
22843
- [names_1.default.instancePath, (0, codegen_1.strConcat)(names_1.default.instancePath, errorPath)],
22844
- [names_1.default.parentData, it.parentData],
22845
- [names_1.default.parentDataProperty, it.parentDataProperty],
22846
- [names_1.default.rootData, names_1.default.rootData],
22847
- ];
22848
- if (it.opts.dynamicRef)
22849
- valCxt.push([names_1.default.dynamicAnchors, names_1.default.dynamicAnchors]);
22850
- const args = (0, codegen_1._) `${dataAndSchema}, ${gen.object(...valCxt)}`;
22851
- return context !== codegen_1.nil ? (0, codegen_1._) `${func}.call(${context}, ${args})` : (0, codegen_1._) `${func}(${args})`;
22852
- }
22853
- code.callValidateCode = callValidateCode;
22854
- const newRegExp = (0, codegen_1._) `new RegExp`;
22855
- function usePattern({ gen, it: { opts } }, pattern) {
22856
- const u = opts.unicodeRegExp ? "u" : "";
22857
- const { regExp } = opts.code;
22858
- const rx = regExp(pattern, u);
22859
- return gen.scopeValue("pattern", {
22860
- key: rx.toString(),
22861
- ref: rx,
22862
- code: (0, codegen_1._) `${regExp.code === "new RegExp" ? newRegExp : (0, util_2.useFunc)(gen, regExp)}(${pattern}, ${u})`,
22863
- });
22864
- }
22865
- code.usePattern = usePattern;
22866
- function validateArray(cxt) {
22867
- const { gen, data, keyword, it } = cxt;
22868
- const valid = gen.name("valid");
22869
- if (it.allErrors) {
22870
- const validArr = gen.let("valid", true);
22871
- validateItems(() => gen.assign(validArr, false));
22872
- return validArr;
22873
- }
22874
- gen.var(valid, true);
22875
- validateItems(() => gen.break());
22876
- return valid;
22877
- function validateItems(notValid) {
22878
- const len = gen.const("len", (0, codegen_1._) `${data}.length`);
22879
- gen.forRange("i", 0, len, (i) => {
22880
- cxt.subschema({
22881
- keyword,
22882
- dataProp: i,
22883
- dataPropType: util_1.Type.Num,
22884
- }, valid);
22885
- gen.if((0, codegen_1.not)(valid), notValid);
22886
- });
22887
- }
22888
- }
22889
- code.validateArray = validateArray;
22890
- function validateUnion(cxt) {
22891
- const { gen, schema, keyword, it } = cxt;
22892
- /* istanbul ignore if */
22893
- if (!Array.isArray(schema))
22894
- throw new Error("ajv implementation error");
22895
- const alwaysValid = schema.some((sch) => (0, util_1.alwaysValidSchema)(it, sch));
22896
- if (alwaysValid && !it.opts.unevaluated)
22897
- return;
22898
- const valid = gen.let("valid", false);
22899
- const schValid = gen.name("_valid");
22900
- gen.block(() => schema.forEach((_sch, i) => {
22901
- const schCxt = cxt.subschema({
22902
- keyword,
22903
- schemaProp: i,
22904
- compositeRule: true,
22905
- }, schValid);
22906
- gen.assign(valid, (0, codegen_1._) `${valid} || ${schValid}`);
22907
- const merged = cxt.mergeValidEvaluated(schCxt, schValid);
22908
- // can short-circuit if `unevaluatedProperties/Items` not supported (opts.unevaluated !== true)
22909
- // or if all properties and items were evaluated (it.props === true && it.items === true)
22910
- if (!merged)
22911
- gen.if((0, codegen_1.not)(valid));
22912
- }));
22913
- cxt.result(valid, () => cxt.reset(), () => cxt.error(true));
22914
- }
22915
- code.validateUnion = validateUnion;
22916
-
22917
- return code;
22767
+ Object.defineProperty(code, "__esModule", { value: true });
22768
+ code.validateUnion = code.validateArray = code.usePattern = code.callValidateCode = code.schemaProperties = code.allSchemaProperties = code.noPropertyInData = code.propertyInData = code.isOwnProperty = code.hasPropFunc = code.reportMissingProp = code.checkMissingProp = code.checkReportMissingProp = void 0;
22769
+ const codegen_1$r = requireCodegen();
22770
+ const util_1$q = util;
22771
+ const names_1$6 = requireNames();
22772
+ const util_2$1 = util;
22773
+ function checkReportMissingProp(cxt, prop) {
22774
+ const { gen, data, it } = cxt;
22775
+ gen.if(noPropertyInData(gen, data, prop, it.opts.ownProperties), () => {
22776
+ cxt.setParams({ missingProperty: (0, codegen_1$r._) `${prop}` }, true);
22777
+ cxt.error();
22778
+ });
22779
+ }
22780
+ code.checkReportMissingProp = checkReportMissingProp;
22781
+ function checkMissingProp({ gen, data, it: { opts } }, properties, missing) {
22782
+ return (0, codegen_1$r.or)(...properties.map((prop) => (0, codegen_1$r.and)(noPropertyInData(gen, data, prop, opts.ownProperties), (0, codegen_1$r._) `${missing} = ${prop}`)));
22783
+ }
22784
+ code.checkMissingProp = checkMissingProp;
22785
+ function reportMissingProp(cxt, missing) {
22786
+ cxt.setParams({ missingProperty: missing }, true);
22787
+ cxt.error();
22788
+ }
22789
+ code.reportMissingProp = reportMissingProp;
22790
+ function hasPropFunc(gen) {
22791
+ return gen.scopeValue("func", {
22792
+ // eslint-disable-next-line @typescript-eslint/unbound-method
22793
+ ref: Object.prototype.hasOwnProperty,
22794
+ code: (0, codegen_1$r._) `Object.prototype.hasOwnProperty`,
22795
+ });
22796
+ }
22797
+ code.hasPropFunc = hasPropFunc;
22798
+ function isOwnProperty(gen, data, property) {
22799
+ return (0, codegen_1$r._) `${hasPropFunc(gen)}.call(${data}, ${property})`;
22800
+ }
22801
+ code.isOwnProperty = isOwnProperty;
22802
+ function propertyInData(gen, data, property, ownProperties) {
22803
+ const cond = (0, codegen_1$r._) `${data}${(0, codegen_1$r.getProperty)(property)} !== undefined`;
22804
+ return ownProperties ? (0, codegen_1$r._) `${cond} && ${isOwnProperty(gen, data, property)}` : cond;
22805
+ }
22806
+ code.propertyInData = propertyInData;
22807
+ function noPropertyInData(gen, data, property, ownProperties) {
22808
+ const cond = (0, codegen_1$r._) `${data}${(0, codegen_1$r.getProperty)(property)} === undefined`;
22809
+ return ownProperties ? (0, codegen_1$r.or)(cond, (0, codegen_1$r.not)(isOwnProperty(gen, data, property))) : cond;
22810
+ }
22811
+ code.noPropertyInData = noPropertyInData;
22812
+ function allSchemaProperties(schemaMap) {
22813
+ return schemaMap ? Object.keys(schemaMap).filter((p) => p !== "__proto__") : [];
22814
+ }
22815
+ code.allSchemaProperties = allSchemaProperties;
22816
+ function schemaProperties(it, schemaMap) {
22817
+ return allSchemaProperties(schemaMap).filter((p) => !(0, util_1$q.alwaysValidSchema)(it, schemaMap[p]));
22818
+ }
22819
+ code.schemaProperties = schemaProperties;
22820
+ function callValidateCode({ schemaCode, data, it: { gen, topSchemaRef, schemaPath, errorPath }, it }, func, context, passSchema) {
22821
+ const dataAndSchema = passSchema ? (0, codegen_1$r._) `${schemaCode}, ${data}, ${topSchemaRef}${schemaPath}` : data;
22822
+ const valCxt = [
22823
+ [names_1$6.default.instancePath, (0, codegen_1$r.strConcat)(names_1$6.default.instancePath, errorPath)],
22824
+ [names_1$6.default.parentData, it.parentData],
22825
+ [names_1$6.default.parentDataProperty, it.parentDataProperty],
22826
+ [names_1$6.default.rootData, names_1$6.default.rootData],
22827
+ ];
22828
+ if (it.opts.dynamicRef)
22829
+ valCxt.push([names_1$6.default.dynamicAnchors, names_1$6.default.dynamicAnchors]);
22830
+ const args = (0, codegen_1$r._) `${dataAndSchema}, ${gen.object(...valCxt)}`;
22831
+ return context !== codegen_1$r.nil ? (0, codegen_1$r._) `${func}.call(${context}, ${args})` : (0, codegen_1$r._) `${func}(${args})`;
22832
+ }
22833
+ code.callValidateCode = callValidateCode;
22834
+ const newRegExp = (0, codegen_1$r._) `new RegExp`;
22835
+ function usePattern({ gen, it: { opts } }, pattern) {
22836
+ const u = opts.unicodeRegExp ? "u" : "";
22837
+ const { regExp } = opts.code;
22838
+ const rx = regExp(pattern, u);
22839
+ return gen.scopeValue("pattern", {
22840
+ key: rx.toString(),
22841
+ ref: rx,
22842
+ code: (0, codegen_1$r._) `${regExp.code === "new RegExp" ? newRegExp : (0, util_2$1.useFunc)(gen, regExp)}(${pattern}, ${u})`,
22843
+ });
22844
+ }
22845
+ code.usePattern = usePattern;
22846
+ function validateArray(cxt) {
22847
+ const { gen, data, keyword, it } = cxt;
22848
+ const valid = gen.name("valid");
22849
+ if (it.allErrors) {
22850
+ const validArr = gen.let("valid", true);
22851
+ validateItems(() => gen.assign(validArr, false));
22852
+ return validArr;
22853
+ }
22854
+ gen.var(valid, true);
22855
+ validateItems(() => gen.break());
22856
+ return valid;
22857
+ function validateItems(notValid) {
22858
+ const len = gen.const("len", (0, codegen_1$r._) `${data}.length`);
22859
+ gen.forRange("i", 0, len, (i) => {
22860
+ cxt.subschema({
22861
+ keyword,
22862
+ dataProp: i,
22863
+ dataPropType: util_1$q.Type.Num,
22864
+ }, valid);
22865
+ gen.if((0, codegen_1$r.not)(valid), notValid);
22866
+ });
22867
+ }
22868
+ }
22869
+ code.validateArray = validateArray;
22870
+ function validateUnion(cxt) {
22871
+ const { gen, schema, keyword, it } = cxt;
22872
+ /* istanbul ignore if */
22873
+ if (!Array.isArray(schema))
22874
+ throw new Error("ajv implementation error");
22875
+ const alwaysValid = schema.some((sch) => (0, util_1$q.alwaysValidSchema)(it, sch));
22876
+ if (alwaysValid && !it.opts.unevaluated)
22877
+ return;
22878
+ const valid = gen.let("valid", false);
22879
+ const schValid = gen.name("_valid");
22880
+ gen.block(() => schema.forEach((_sch, i) => {
22881
+ const schCxt = cxt.subschema({
22882
+ keyword,
22883
+ schemaProp: i,
22884
+ compositeRule: true,
22885
+ }, schValid);
22886
+ gen.assign(valid, (0, codegen_1$r._) `${valid} || ${schValid}`);
22887
+ const merged = cxt.mergeValidEvaluated(schCxt, schValid);
22888
+ // can short-circuit if `unevaluatedProperties/Items` not supported (opts.unevaluated !== true)
22889
+ // or if all properties and items were evaluated (it.props === true && it.items === true)
22890
+ if (!merged)
22891
+ gen.if((0, codegen_1$r.not)(valid));
22892
+ }));
22893
+ cxt.result(valid, () => cxt.reset(), () => cxt.error(true));
22918
22894
  }
22895
+ code.validateUnion = validateUnion;
22919
22896
 
22920
22897
  var hasRequiredKeyword;
22921
22898
 
@@ -22926,7 +22903,7 @@ function requireKeyword () {
22926
22903
  keyword.validateKeywordUsage = keyword.validSchemaType = keyword.funcKeywordCode = keyword.macroKeywordCode = void 0;
22927
22904
  const codegen_1 = requireCodegen();
22928
22905
  const names_1 = requireNames();
22929
- const code_1 = requireCode();
22906
+ const code_1 = code;
22930
22907
  const errors_1 = requireErrors();
22931
22908
  function macroKeywordCode(cxt, def) {
22932
22909
  const { gen, keyword, schema, parentSchema, it } = cxt;
@@ -23444,7 +23421,7 @@ function requireValidate () {
23444
23421
  validate.getData = validate.KeywordCxt = validate.validateFunctionCode = void 0;
23445
23422
  const boolSchema_1 = requireBoolSchema();
23446
23423
  const dataType_1 = dataType;
23447
- const applicability_1 = requireApplicability();
23424
+ const applicability_1 = applicability;
23448
23425
  const dataType_2 = dataType;
23449
23426
  const defaults_1 = requireDefaults();
23450
23427
  const keyword_1 = requireKeyword();
@@ -26330,7 +26307,7 @@ var ref = {};
26330
26307
  Object.defineProperty(ref, "__esModule", { value: true });
26331
26308
  ref.callRef = ref.getValidate = void 0;
26332
26309
  const ref_error_1 = requireRef_error();
26333
- const code_1$8 = requireCode();
26310
+ const code_1$8 = code;
26334
26311
  const codegen_1$p = requireCodegen();
26335
26312
  const names_1$4 = requireNames();
26336
26313
  const compile_1$2 = compile;
@@ -26576,7 +26553,7 @@ limitLength.default = def$x;
26576
26553
  var pattern = {};
26577
26554
 
26578
26555
  Object.defineProperty(pattern, "__esModule", { value: true });
26579
- const code_1$7 = requireCode();
26556
+ const code_1$7 = code;
26580
26557
  const codegen_1$l = requireCodegen();
26581
26558
  const error$h = {
26582
26559
  message: ({ schemaCode }) => (0, codegen_1$l.str) `must match pattern "${schemaCode}"`,
@@ -26626,7 +26603,7 @@ limitProperties.default = def$v;
26626
26603
  var required = {};
26627
26604
 
26628
26605
  Object.defineProperty(required, "__esModule", { value: true });
26629
- const code_1$6 = requireCode();
26606
+ const code_1$6 = code;
26630
26607
  const codegen_1$j = requireCodegen();
26631
26608
  const util_1$l = util;
26632
26609
  const error$f = {
@@ -26968,7 +26945,7 @@ Object.defineProperty(items, "__esModule", { value: true });
26968
26945
  items.validateTuple = void 0;
26969
26946
  const codegen_1$d = requireCodegen();
26970
26947
  const util_1$g = util;
26971
- const code_1$5 = requireCode();
26948
+ const code_1$5 = code;
26972
26949
  const def$o = {
26973
26950
  keyword: "items",
26974
26951
  type: "array",
@@ -27031,7 +27008,7 @@ var items2020 = {};
27031
27008
  Object.defineProperty(items2020, "__esModule", { value: true });
27032
27009
  const codegen_1$c = requireCodegen();
27033
27010
  const util_1$f = util;
27034
- const code_1$4 = requireCode();
27011
+ const code_1$4 = code;
27035
27012
  const additionalItems_1$1 = additionalItems;
27036
27013
  const error$9 = {
27037
27014
  message: ({ params: { len } }) => (0, codegen_1$c.str) `must NOT have more than ${len} items`,
@@ -27160,7 +27137,7 @@ var dependencies = {};
27160
27137
  exports.validateSchemaDeps = exports.validatePropertyDeps = exports.error = void 0;
27161
27138
  const codegen_1 = requireCodegen();
27162
27139
  const util_1 = util;
27163
- const code_1 = requireCode();
27140
+ const code_1 = code;
27164
27141
  exports.error = {
27165
27142
  message: ({ params: { property, depsCount, deps } }) => {
27166
27143
  const property_ies = depsCount === 1 ? "property" : "properties";
@@ -27284,7 +27261,7 @@ propertyNames.default = def$k;
27284
27261
  var additionalProperties = {};
27285
27262
 
27286
27263
  Object.defineProperty(additionalProperties, "__esModule", { value: true });
27287
- const code_1$3 = requireCode();
27264
+ const code_1$3 = code;
27288
27265
  const codegen_1$9 = requireCodegen();
27289
27266
  const names_1$3 = requireNames();
27290
27267
  const util_1$c = util;
@@ -27392,7 +27369,7 @@ var properties$g = {};
27392
27369
 
27393
27370
  Object.defineProperty(properties$g, "__esModule", { value: true });
27394
27371
  const validate_1 = requireValidate();
27395
- const code_1$2 = requireCode();
27372
+ const code_1$2 = code;
27396
27373
  const util_1$b = util;
27397
27374
  const additionalProperties_1$1 = additionalProperties;
27398
27375
  const def$i = {
@@ -27446,7 +27423,7 @@ properties$g.default = def$i;
27446
27423
  var patternProperties = {};
27447
27424
 
27448
27425
  Object.defineProperty(patternProperties, "__esModule", { value: true });
27449
- const code_1$1 = requireCode();
27426
+ const code_1$1 = code;
27450
27427
  const codegen_1$8 = requireCodegen();
27451
27428
  const util_1$a = util;
27452
27429
  const util_2 = util;
@@ -27549,7 +27526,7 @@ not.default = def$g;
27549
27526
  var anyOf = {};
27550
27527
 
27551
27528
  Object.defineProperty(anyOf, "__esModule", { value: true });
27552
- const code_1 = requireCode();
27529
+ const code_1 = code;
27553
27530
  const def$f = {
27554
27531
  keyword: "anyOf",
27555
27532
  schemaType: "array",
@@ -53601,7 +53578,7 @@ class OnChainZKPVerifier {
53601
53578
  });
53602
53579
  }
53603
53580
  }
53604
- const metadata = this.packMetadatas(metadataArr);
53581
+ const metadata = metadataArr.length ? this.packMetadatas(metadataArr) : '0x';
53605
53582
  payload.push({
53606
53583
  requestId: requestID,
53607
53584
  zkProof: zkProofEncoded,