@snapshot-labs/snapshot.js 0.12.20 → 0.12.22

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.
@@ -147,9 +147,7 @@ declare const _default: {
147
147
  maxItems: number;
148
148
  items: {
149
149
  type: string;
150
- pattern: string;
151
- minLength: number;
152
- maxLength: number;
150
+ format: string;
153
151
  };
154
152
  title: string;
155
153
  uniqueItems: boolean;
@@ -159,9 +157,7 @@ declare const _default: {
159
157
  maxItems: number;
160
158
  items: {
161
159
  type: string;
162
- pattern: string;
163
- minLength: number;
164
- maxLength: number;
160
+ format: string;
165
161
  };
166
162
  title: string;
167
163
  uniqueItems: boolean;
@@ -171,9 +167,7 @@ declare const _default: {
171
167
  maxItems: number;
172
168
  items: {
173
169
  type: string;
174
- pattern: string;
175
- minLength: number;
176
- maxLength: number;
170
+ format: string;
177
171
  };
178
172
  title: string;
179
173
  uniqueItems: boolean;
@@ -367,9 +361,9 @@ declare const _default: {
367
361
  type: string;
368
362
  title: string;
369
363
  examples: string[];
370
- pattern: string;
371
- minLength: number;
372
- maxLength: number;
364
+ anyOf: {
365
+ format: string;
366
+ }[];
373
367
  };
374
368
  network: {
375
369
  type: string;
@@ -143,9 +143,7 @@ declare const _default: {
143
143
  maxItems: number;
144
144
  items: {
145
145
  type: string;
146
- pattern: string;
147
- minLength: number;
148
- maxLength: number;
146
+ format: string;
149
147
  };
150
148
  title: string;
151
149
  uniqueItems: boolean;
@@ -155,9 +153,7 @@ declare const _default: {
155
153
  maxItems: number;
156
154
  items: {
157
155
  type: string;
158
- pattern: string;
159
- minLength: number;
160
- maxLength: number;
156
+ format: string;
161
157
  };
162
158
  title: string;
163
159
  uniqueItems: boolean;
@@ -167,9 +163,7 @@ declare const _default: {
167
163
  maxItems: number;
168
164
  items: {
169
165
  type: string;
170
- pattern: string;
171
- minLength: number;
172
- maxLength: number;
166
+ format: string;
173
167
  };
174
168
  title: string;
175
169
  uniqueItems: boolean;
@@ -363,9 +357,9 @@ declare const _default: {
363
357
  type: string;
364
358
  title: string;
365
359
  examples: string[];
366
- pattern: string;
367
- minLength: number;
368
- maxLength: number;
360
+ anyOf: {
361
+ format: string;
362
+ }[];
369
363
  };
370
364
  network: {
371
365
  type: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@snapshot-labs/snapshot.js",
3
- "version": "0.12.20",
3
+ "version": "0.12.22",
4
4
  "repository": "snapshot-labs/snapshot.js",
5
5
  "license": "MIT",
6
6
  "main": "dist/snapshot.cjs.js",
@@ -147,9 +147,7 @@
147
147
  "maxItems": 100,
148
148
  "items": {
149
149
  "type": "string",
150
- "pattern": "^0x[a-fA-F0-9]{40}$",
151
- "minLength": 42,
152
- "maxLength": 42
150
+ "format": "evmAddress"
153
151
  },
154
152
  "title": "members",
155
153
  "uniqueItems": true
@@ -159,9 +157,7 @@
159
157
  "maxItems": 100,
160
158
  "items": {
161
159
  "type": "string",
162
- "pattern": "^0x[a-fA-F0-9]{40}$",
163
- "minLength": 42,
164
- "maxLength": 42
160
+ "format": "evmAddress"
165
161
  },
166
162
  "title": "admins",
167
163
  "uniqueItems": true
@@ -171,9 +167,7 @@
171
167
  "maxItems": 100,
172
168
  "items": {
173
169
  "type": "string",
174
- "pattern": "^0x[a-fA-F0-9]{40}$",
175
- "minLength": 42,
176
- "maxLength": 42
170
+ "format": "evmAddress"
177
171
  },
178
172
  "title": "moderators",
179
173
  "uniqueItems": true
@@ -264,7 +258,7 @@
264
258
  },
265
259
  "delegationContract": {
266
260
  "type": "string",
267
- "format": "address",
261
+ "format": "evmAddress",
268
262
  "title": "Contract address",
269
263
  "description": "The address of your delegation contract",
270
264
  "examples": ["0x3901D0fDe202aF1427216b79f5243f8A022d68cf"]
@@ -378,9 +372,10 @@
378
372
  "type": "string",
379
373
  "title": "Contract address",
380
374
  "examples": ["e.g. 0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984"],
381
- "pattern": "^0x[a-fA-F0-9]{40}$",
382
- "minLength": 42,
383
- "maxLength": 42
375
+ "anyOf": [
376
+ { "format": "evmAddress" },
377
+ { "format": "starknetAddress" }
378
+ ]
384
379
  },
385
380
  "network": {
386
381
  "type": "string",
package/src/utils.ts CHANGED
@@ -99,6 +99,17 @@ ajv.addFormat('address', {
99
99
  }
100
100
  });
101
101
 
102
+ ajv.addFormat('evmAddress', {
103
+ validate: (value: string) => {
104
+ try {
105
+ getAddress(value);
106
+ return true;
107
+ } catch (e: any) {
108
+ return false;
109
+ }
110
+ }
111
+ });
112
+
102
113
  ajv.addFormat('starknetAddress', {
103
114
  validate: (value: string) => {
104
115
  try {