@snapshot-labs/snapshot.js 0.9.8 → 0.10.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/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;
@@ -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;
@@ -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",
@@ -2298,7 +2305,7 @@ var networks = {
2298
2305
  url: "https://andromeda-explorer.metis.io"
2299
2306
  },
2300
2307
  start: 451,
2301
- logo: "ipfs://QmYeskHqrEvWHqeAuqett64LxfH52HUXZi2T9BAMmgKvBF"
2308
+ logo: "ipfs://bafkreiaqr4atnjpdnk3c4vu4377ai7bzqpgaefefbl5j5imfsvr4puimtu"
2302
2309
  },
2303
2310
  "1101": {
2304
2311
  key: "1101",
@@ -2323,13 +2330,13 @@ var networks = {
2323
2330
  network: "mainnet",
2324
2331
  multicall: "0x024f0041b76B598c2A0a75004F8447FaF67BD004",
2325
2332
  rpc: [
2326
- "https://rpc.coredao.org/"
2333
+ "https://rpcar.coredao.org/"
2327
2334
  ],
2328
2335
  explorer: {
2329
2336
  url: "https://scan.coredao.org"
2330
2337
  },
2331
2338
  start: 853908,
2332
- logo: "ipfs://QmVctLQ44vhkwejja9DDjDYUdYgVRBEWs242mhd95SeM5q"
2339
+ logo: "ipfs://bafkreigjv5yb7uhlrryzib7j2f73nnwqan2tmfnwjdu26vkk365fyesoiu"
2333
2340
  },
2334
2341
  "1284": {
2335
2342
  key: "1284",
@@ -3460,6 +3467,46 @@ ajv.addKeyword({
3460
3467
  message: 'network not allowed'
3461
3468
  }
3462
3469
  });
3470
+ ajv.addKeyword({
3471
+ keyword: 'maxLengthWithSpaceType',
3472
+ validate: function validate(schema, data) {
3473
+ // @ts-ignore
3474
+ var spaceType = this.spaceType || 'default';
3475
+ var isValid = data.length <= schema[spaceType];
3476
+ if (!isValid) {
3477
+ // @ts-ignore
3478
+ validate.errors = [
3479
+ {
3480
+ keyword: 'maxLengthWithSpaceType',
3481
+ message: "must NOT have more than " + schema[spaceType] + " characters",
3482
+ params: { limit: schema[spaceType] }
3483
+ }
3484
+ ];
3485
+ }
3486
+ return isValid;
3487
+ },
3488
+ errors: true
3489
+ });
3490
+ ajv.addKeyword({
3491
+ keyword: 'maxItemsWithSpaceType',
3492
+ validate: function validate(schema, data) {
3493
+ // @ts-ignore
3494
+ var spaceType = this.spaceType || 'default';
3495
+ var isValid = data.length <= schema[spaceType];
3496
+ if (!isValid) {
3497
+ // @ts-ignore
3498
+ validate.errors = [
3499
+ {
3500
+ keyword: 'maxItemsWithSpaceType',
3501
+ message: "must NOT have more than " + schema[spaceType] + " items",
3502
+ params: { limit: schema[spaceType] }
3503
+ }
3504
+ ];
3505
+ }
3506
+ return isValid;
3507
+ },
3508
+ errors: true
3509
+ });
3463
3510
  // Custom URL format to allow empty string values
3464
3511
  // https://github.com/snapshot-labs/snapshot.js/pull/541/files
3465
3512
  ajv.addFormat('customUrl', {
@@ -3819,7 +3866,8 @@ function validate(validation, author, space, network, snapshot, params, options)
3819
3866
  }
3820
3867
  function validateSchema(schema, data, options) {
3821
3868
  if (options === void 0) { options = {
3822
- snapshotEnv: 'default'
3869
+ snapshotEnv: 'default',
3870
+ spaceType: 'default'
3823
3871
  }; }
3824
3872
  var ajvValidate = ajv.compile(schema);
3825
3873
  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",
@@ -2289,7 +2296,7 @@ var networks = {
2289
2296
  url: "https://andromeda-explorer.metis.io"
2290
2297
  },
2291
2298
  start: 451,
2292
- logo: "ipfs://QmYeskHqrEvWHqeAuqett64LxfH52HUXZi2T9BAMmgKvBF"
2299
+ logo: "ipfs://bafkreiaqr4atnjpdnk3c4vu4377ai7bzqpgaefefbl5j5imfsvr4puimtu"
2293
2300
  },
2294
2301
  "1101": {
2295
2302
  key: "1101",
@@ -2314,13 +2321,13 @@ var networks = {
2314
2321
  network: "mainnet",
2315
2322
  multicall: "0x024f0041b76B598c2A0a75004F8447FaF67BD004",
2316
2323
  rpc: [
2317
- "https://rpc.coredao.org/"
2324
+ "https://rpcar.coredao.org/"
2318
2325
  ],
2319
2326
  explorer: {
2320
2327
  url: "https://scan.coredao.org"
2321
2328
  },
2322
2329
  start: 853908,
2323
- logo: "ipfs://QmVctLQ44vhkwejja9DDjDYUdYgVRBEWs242mhd95SeM5q"
2330
+ logo: "ipfs://bafkreigjv5yb7uhlrryzib7j2f73nnwqan2tmfnwjdu26vkk365fyesoiu"
2324
2331
  },
2325
2332
  "1284": {
2326
2333
  key: "1284",
@@ -3451,6 +3458,46 @@ ajv.addKeyword({
3451
3458
  message: 'network not allowed'
3452
3459
  }
3453
3460
  });
3461
+ ajv.addKeyword({
3462
+ keyword: 'maxLengthWithSpaceType',
3463
+ validate: function validate(schema, data) {
3464
+ // @ts-ignore
3465
+ var spaceType = this.spaceType || 'default';
3466
+ var isValid = data.length <= schema[spaceType];
3467
+ if (!isValid) {
3468
+ // @ts-ignore
3469
+ validate.errors = [
3470
+ {
3471
+ keyword: 'maxLengthWithSpaceType',
3472
+ message: "must NOT have more than " + schema[spaceType] + " characters",
3473
+ params: { limit: schema[spaceType] }
3474
+ }
3475
+ ];
3476
+ }
3477
+ return isValid;
3478
+ },
3479
+ errors: true
3480
+ });
3481
+ ajv.addKeyword({
3482
+ keyword: 'maxItemsWithSpaceType',
3483
+ validate: function validate(schema, data) {
3484
+ // @ts-ignore
3485
+ var spaceType = this.spaceType || 'default';
3486
+ var isValid = data.length <= schema[spaceType];
3487
+ if (!isValid) {
3488
+ // @ts-ignore
3489
+ validate.errors = [
3490
+ {
3491
+ keyword: 'maxItemsWithSpaceType',
3492
+ message: "must NOT have more than " + schema[spaceType] + " items",
3493
+ params: { limit: schema[spaceType] }
3494
+ }
3495
+ ];
3496
+ }
3497
+ return isValid;
3498
+ },
3499
+ errors: true
3500
+ });
3454
3501
  // Custom URL format to allow empty string values
3455
3502
  // https://github.com/snapshot-labs/snapshot.js/pull/541/files
3456
3503
  ajv.addFormat('customUrl', {
@@ -3810,7 +3857,8 @@ function validate(validation, author, space, network, snapshot, params, options)
3810
3857
  }
3811
3858
  function validateSchema(schema, data, options) {
3812
3859
  if (options === void 0) { options = {
3813
- snapshotEnv: 'default'
3860
+ snapshotEnv: 'default',
3861
+ spaceType: 'default'
3814
3862
  }; }
3815
3863
  var ajvValidate = ajv.compile(schema);
3816
3864
  var valid = ajvValidate.call(options, data);