@snapshot-labs/snapshot.js 0.9.9 → 0.10.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.d.ts CHANGED
@@ -104,7 +104,11 @@ declare const _default: {
104
104
  strategies: {
105
105
  type: string;
106
106
  minItems: number;
107
- maxItems: number;
107
+ maxItemsWithSpaceType: {
108
+ default: number;
109
+ turbo: number;
110
+ };
111
+ uniqueItems: boolean;
108
112
  items: {
109
113
  type: string;
110
114
  properties: {
@@ -378,7 +382,10 @@ declare const _default: {
378
382
  type: string;
379
383
  title: string;
380
384
  minLength: number;
381
- maxLength: number;
385
+ maxLengthWithSpaceType: {
386
+ default: number;
387
+ turbo: number;
388
+ };
382
389
  };
383
390
  discussion: {
384
391
  type: string;
@@ -443,7 +450,10 @@ declare const _default: {
443
450
  type: string;
444
451
  title: string;
445
452
  minLength: number;
446
- maxLength: number;
453
+ maxLengthWithSpaceType: {
454
+ default: number;
455
+ turbo: number;
456
+ };
447
457
  };
448
458
  discussion: {
449
459
  type: string;
@@ -100,7 +100,11 @@ declare const _default: {
100
100
  strategies: {
101
101
  type: string;
102
102
  minItems: number;
103
- maxItems: number;
103
+ maxItemsWithSpaceType: {
104
+ default: number;
105
+ turbo: number;
106
+ };
107
+ uniqueItems: boolean;
104
108
  items: {
105
109
  type: string;
106
110
  properties: {
@@ -374,7 +378,10 @@ declare const _default: {
374
378
  type: string;
375
379
  title: string;
376
380
  minLength: number;
377
- maxLength: number;
381
+ maxLengthWithSpaceType: {
382
+ default: number;
383
+ turbo: number;
384
+ };
378
385
  };
379
386
  discussion: {
380
387
  type: string;
@@ -439,7 +446,10 @@ declare const _default: {
439
446
  type: string;
440
447
  title: string;
441
448
  minLength: number;
442
- maxLength: number;
449
+ maxLengthWithSpaceType: {
450
+ default: number;
451
+ turbo: number;
452
+ };
443
453
  };
444
454
  discussion: {
445
455
  type: string;
@@ -674,7 +674,11 @@ var definitions = {
674
674
  strategies: {
675
675
  type: "array",
676
676
  minItems: 1,
677
- maxItems: 8,
677
+ maxItemsWithSpaceType: {
678
+ "default": 8,
679
+ turbo: 10
680
+ },
681
+ uniqueItems: true,
678
682
  items: {
679
683
  type: "object",
680
684
  properties: {
@@ -1001,7 +1005,10 @@ var definitions$1 = {
1001
1005
  type: "string",
1002
1006
  title: "body",
1003
1007
  minLength: 0,
1004
- maxLength: 20000
1008
+ maxLengthWithSpaceType: {
1009
+ "default": 10000,
1010
+ turbo: 20000
1011
+ }
1005
1012
  },
1006
1013
  discussion: {
1007
1014
  type: "string",
@@ -1091,7 +1098,10 @@ var definitions$2 = {
1091
1098
  type: "string",
1092
1099
  title: "body",
1093
1100
  minLength: 0,
1094
- maxLength: 20000
1101
+ maxLengthWithSpaceType: {
1102
+ "default": 10000,
1103
+ turbo: 20000
1104
+ }
1095
1105
  },
1096
1106
  discussion: {
1097
1107
  type: "string",
@@ -2323,13 +2333,13 @@ var networks = {
2323
2333
  network: "mainnet",
2324
2334
  multicall: "0x024f0041b76B598c2A0a75004F8447FaF67BD004",
2325
2335
  rpc: [
2326
- "https://rpc.coredao.org/"
2336
+ "https://rpcar.coredao.org/"
2327
2337
  ],
2328
2338
  explorer: {
2329
2339
  url: "https://scan.coredao.org"
2330
2340
  },
2331
2341
  start: 853908,
2332
- logo: "ipfs://QmVctLQ44vhkwejja9DDjDYUdYgVRBEWs242mhd95SeM5q"
2342
+ logo: "ipfs://bafkreigjv5yb7uhlrryzib7j2f73nnwqan2tmfnwjdu26vkk365fyesoiu"
2333
2343
  },
2334
2344
  "1284": {
2335
2345
  key: "1284",
@@ -3460,6 +3470,46 @@ ajv.addKeyword({
3460
3470
  message: 'network not allowed'
3461
3471
  }
3462
3472
  });
3473
+ ajv.addKeyword({
3474
+ keyword: 'maxLengthWithSpaceType',
3475
+ validate: function validate(schema, data) {
3476
+ // @ts-ignore
3477
+ var spaceType = this.spaceType || 'default';
3478
+ var isValid = data.length <= schema[spaceType];
3479
+ if (!isValid) {
3480
+ // @ts-ignore
3481
+ validate.errors = [
3482
+ {
3483
+ keyword: 'maxLengthWithSpaceType',
3484
+ message: "must NOT have more than " + schema[spaceType] + " characters",
3485
+ params: { limit: schema[spaceType] }
3486
+ }
3487
+ ];
3488
+ }
3489
+ return isValid;
3490
+ },
3491
+ errors: true
3492
+ });
3493
+ ajv.addKeyword({
3494
+ keyword: 'maxItemsWithSpaceType',
3495
+ validate: function validate(schema, data) {
3496
+ // @ts-ignore
3497
+ var spaceType = this.spaceType || 'default';
3498
+ var isValid = data.length <= schema[spaceType];
3499
+ if (!isValid) {
3500
+ // @ts-ignore
3501
+ validate.errors = [
3502
+ {
3503
+ keyword: 'maxItemsWithSpaceType',
3504
+ message: "must NOT have more than " + schema[spaceType] + " items",
3505
+ params: { limit: schema[spaceType] }
3506
+ }
3507
+ ];
3508
+ }
3509
+ return isValid;
3510
+ },
3511
+ errors: true
3512
+ });
3463
3513
  // Custom URL format to allow empty string values
3464
3514
  // https://github.com/snapshot-labs/snapshot.js/pull/541/files
3465
3515
  ajv.addFormat('customUrl', {
@@ -3819,7 +3869,8 @@ function validate(validation, author, space, network, snapshot, params, options)
3819
3869
  }
3820
3870
  function validateSchema(schema, data, options) {
3821
3871
  if (options === void 0) { options = {
3822
- snapshotEnv: 'default'
3872
+ snapshotEnv: 'default',
3873
+ spaceType: 'default'
3823
3874
  }; }
3824
3875
  var ajvValidate = ajv.compile(schema);
3825
3876
  var valid = ajvValidate.call(options, data);
@@ -665,7 +665,11 @@ var definitions = {
665
665
  strategies: {
666
666
  type: "array",
667
667
  minItems: 1,
668
- maxItems: 8,
668
+ maxItemsWithSpaceType: {
669
+ "default": 8,
670
+ turbo: 10
671
+ },
672
+ uniqueItems: true,
669
673
  items: {
670
674
  type: "object",
671
675
  properties: {
@@ -992,7 +996,10 @@ var definitions$1 = {
992
996
  type: "string",
993
997
  title: "body",
994
998
  minLength: 0,
995
- maxLength: 20000
999
+ maxLengthWithSpaceType: {
1000
+ "default": 10000,
1001
+ turbo: 20000
1002
+ }
996
1003
  },
997
1004
  discussion: {
998
1005
  type: "string",
@@ -1082,7 +1089,10 @@ var definitions$2 = {
1082
1089
  type: "string",
1083
1090
  title: "body",
1084
1091
  minLength: 0,
1085
- maxLength: 20000
1092
+ maxLengthWithSpaceType: {
1093
+ "default": 10000,
1094
+ turbo: 20000
1095
+ }
1086
1096
  },
1087
1097
  discussion: {
1088
1098
  type: "string",
@@ -2314,13 +2324,13 @@ var networks = {
2314
2324
  network: "mainnet",
2315
2325
  multicall: "0x024f0041b76B598c2A0a75004F8447FaF67BD004",
2316
2326
  rpc: [
2317
- "https://rpc.coredao.org/"
2327
+ "https://rpcar.coredao.org/"
2318
2328
  ],
2319
2329
  explorer: {
2320
2330
  url: "https://scan.coredao.org"
2321
2331
  },
2322
2332
  start: 853908,
2323
- logo: "ipfs://QmVctLQ44vhkwejja9DDjDYUdYgVRBEWs242mhd95SeM5q"
2333
+ logo: "ipfs://bafkreigjv5yb7uhlrryzib7j2f73nnwqan2tmfnwjdu26vkk365fyesoiu"
2324
2334
  },
2325
2335
  "1284": {
2326
2336
  key: "1284",
@@ -3451,6 +3461,46 @@ ajv.addKeyword({
3451
3461
  message: 'network not allowed'
3452
3462
  }
3453
3463
  });
3464
+ ajv.addKeyword({
3465
+ keyword: 'maxLengthWithSpaceType',
3466
+ validate: function validate(schema, data) {
3467
+ // @ts-ignore
3468
+ var spaceType = this.spaceType || 'default';
3469
+ var isValid = data.length <= schema[spaceType];
3470
+ if (!isValid) {
3471
+ // @ts-ignore
3472
+ validate.errors = [
3473
+ {
3474
+ keyword: 'maxLengthWithSpaceType',
3475
+ message: "must NOT have more than " + schema[spaceType] + " characters",
3476
+ params: { limit: schema[spaceType] }
3477
+ }
3478
+ ];
3479
+ }
3480
+ return isValid;
3481
+ },
3482
+ errors: true
3483
+ });
3484
+ ajv.addKeyword({
3485
+ keyword: 'maxItemsWithSpaceType',
3486
+ validate: function validate(schema, data) {
3487
+ // @ts-ignore
3488
+ var spaceType = this.spaceType || 'default';
3489
+ var isValid = data.length <= schema[spaceType];
3490
+ if (!isValid) {
3491
+ // @ts-ignore
3492
+ validate.errors = [
3493
+ {
3494
+ keyword: 'maxItemsWithSpaceType',
3495
+ message: "must NOT have more than " + schema[spaceType] + " items",
3496
+ params: { limit: schema[spaceType] }
3497
+ }
3498
+ ];
3499
+ }
3500
+ return isValid;
3501
+ },
3502
+ errors: true
3503
+ });
3454
3504
  // Custom URL format to allow empty string values
3455
3505
  // https://github.com/snapshot-labs/snapshot.js/pull/541/files
3456
3506
  ajv.addFormat('customUrl', {
@@ -3810,7 +3860,8 @@ function validate(validation, author, space, network, snapshot, params, options)
3810
3860
  }
3811
3861
  function validateSchema(schema, data, options) {
3812
3862
  if (options === void 0) { options = {
3813
- snapshotEnv: 'default'
3863
+ snapshotEnv: 'default',
3864
+ spaceType: 'default'
3814
3865
  }; }
3815
3866
  var ajvValidate = ajv.compile(schema);
3816
3867
  var valid = ajvValidate.call(options, data);