@snapshot-labs/snapshot.js 0.12.22 → 0.12.23
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/snapshot.cjs.js +36 -7
- package/dist/snapshot.esm.js +36 -7
- package/dist/snapshot.min.js +2 -2
- package/dist/src/index.d.ts +17 -6
- package/dist/src/schemas/index.d.ts +17 -6
- package/package.json +1 -1
- package/src/schemas/space.json +15 -9
- package/src/utils.ts +11 -0
package/dist/src/index.d.ts
CHANGED
|
@@ -258,18 +258,24 @@ declare const _default: {
|
|
|
258
258
|
};
|
|
259
259
|
delegationContract: {
|
|
260
260
|
type: string;
|
|
261
|
-
format: string;
|
|
262
261
|
title: string;
|
|
263
262
|
description: string;
|
|
264
263
|
examples: string[];
|
|
264
|
+
anyOf: {
|
|
265
|
+
format: string;
|
|
266
|
+
}[];
|
|
265
267
|
};
|
|
266
268
|
delegationNetwork: {
|
|
267
269
|
type: string;
|
|
268
|
-
snapshotNetwork: boolean;
|
|
269
270
|
title: string;
|
|
270
|
-
minLength: number;
|
|
271
|
-
maxLength: number;
|
|
272
271
|
description: string;
|
|
272
|
+
anyOf: ({
|
|
273
|
+
snapshotNetwork: boolean;
|
|
274
|
+
starknetNetwork?: undefined;
|
|
275
|
+
} | {
|
|
276
|
+
starknetNetwork: boolean;
|
|
277
|
+
snapshotNetwork?: undefined;
|
|
278
|
+
})[];
|
|
273
279
|
};
|
|
274
280
|
delegationApi: {
|
|
275
281
|
type: string;
|
|
@@ -367,9 +373,14 @@ declare const _default: {
|
|
|
367
373
|
};
|
|
368
374
|
network: {
|
|
369
375
|
type: string;
|
|
370
|
-
snapshotNetwork: boolean;
|
|
371
376
|
title: string;
|
|
372
|
-
|
|
377
|
+
anyOf: ({
|
|
378
|
+
snapshotNetwork: boolean;
|
|
379
|
+
starknetNetwork?: undefined;
|
|
380
|
+
} | {
|
|
381
|
+
starknetNetwork: boolean;
|
|
382
|
+
snapshotNetwork?: undefined;
|
|
383
|
+
})[];
|
|
373
384
|
};
|
|
374
385
|
};
|
|
375
386
|
required: string[];
|
|
@@ -254,18 +254,24 @@ declare const _default: {
|
|
|
254
254
|
};
|
|
255
255
|
delegationContract: {
|
|
256
256
|
type: string;
|
|
257
|
-
format: string;
|
|
258
257
|
title: string;
|
|
259
258
|
description: string;
|
|
260
259
|
examples: string[];
|
|
260
|
+
anyOf: {
|
|
261
|
+
format: string;
|
|
262
|
+
}[];
|
|
261
263
|
};
|
|
262
264
|
delegationNetwork: {
|
|
263
265
|
type: string;
|
|
264
|
-
snapshotNetwork: boolean;
|
|
265
266
|
title: string;
|
|
266
|
-
minLength: number;
|
|
267
|
-
maxLength: number;
|
|
268
267
|
description: string;
|
|
268
|
+
anyOf: ({
|
|
269
|
+
snapshotNetwork: boolean;
|
|
270
|
+
starknetNetwork?: undefined;
|
|
271
|
+
} | {
|
|
272
|
+
starknetNetwork: boolean;
|
|
273
|
+
snapshotNetwork?: undefined;
|
|
274
|
+
})[];
|
|
269
275
|
};
|
|
270
276
|
delegationApi: {
|
|
271
277
|
type: string;
|
|
@@ -363,9 +369,14 @@ declare const _default: {
|
|
|
363
369
|
};
|
|
364
370
|
network: {
|
|
365
371
|
type: string;
|
|
366
|
-
snapshotNetwork: boolean;
|
|
367
372
|
title: string;
|
|
368
|
-
|
|
373
|
+
anyOf: ({
|
|
374
|
+
snapshotNetwork: boolean;
|
|
375
|
+
starknetNetwork?: undefined;
|
|
376
|
+
} | {
|
|
377
|
+
starknetNetwork: boolean;
|
|
378
|
+
snapshotNetwork?: undefined;
|
|
379
|
+
})[];
|
|
369
380
|
};
|
|
370
381
|
};
|
|
371
382
|
required: string[];
|
package/package.json
CHANGED
package/src/schemas/space.json
CHANGED
|
@@ -258,18 +258,22 @@
|
|
|
258
258
|
},
|
|
259
259
|
"delegationContract": {
|
|
260
260
|
"type": "string",
|
|
261
|
-
"format": "evmAddress",
|
|
262
261
|
"title": "Contract address",
|
|
263
262
|
"description": "The address of your delegation contract",
|
|
264
|
-
"examples": ["0x3901D0fDe202aF1427216b79f5243f8A022d68cf"]
|
|
263
|
+
"examples": ["0x3901D0fDe202aF1427216b79f5243f8A022d68cf"],
|
|
264
|
+
"anyOf": [
|
|
265
|
+
{ "format": "evmAddress" },
|
|
266
|
+
{ "format": "starknetAddress" }
|
|
267
|
+
]
|
|
265
268
|
},
|
|
266
269
|
"delegationNetwork": {
|
|
267
270
|
"type": "string",
|
|
268
|
-
"snapshotNetwork": true,
|
|
269
271
|
"title": "Delegation network",
|
|
270
|
-
"
|
|
271
|
-
"
|
|
272
|
-
|
|
272
|
+
"description": "The network of your delegation contract",
|
|
273
|
+
"anyOf": [
|
|
274
|
+
{ "snapshotNetwork": true },
|
|
275
|
+
{ "starknetNetwork": true }
|
|
276
|
+
]
|
|
273
277
|
},
|
|
274
278
|
"delegationApi": {
|
|
275
279
|
"type": "string",
|
|
@@ -281,7 +285,7 @@
|
|
|
281
285
|
]
|
|
282
286
|
}
|
|
283
287
|
},
|
|
284
|
-
"required": ["delegationType", "delegationApi", "delegationContract"],
|
|
288
|
+
"required": ["delegationType", "delegationNetwork", "delegationApi", "delegationContract"],
|
|
285
289
|
"additionalProperties": false
|
|
286
290
|
},
|
|
287
291
|
"allowAlias": {
|
|
@@ -379,9 +383,11 @@
|
|
|
379
383
|
},
|
|
380
384
|
"network": {
|
|
381
385
|
"type": "string",
|
|
382
|
-
"snapshotNetwork": true,
|
|
383
386
|
"title": "Network",
|
|
384
|
-
"
|
|
387
|
+
"anyOf": [
|
|
388
|
+
{ "snapshotNetwork": true },
|
|
389
|
+
{ "starknetNetwork": true }
|
|
390
|
+
]
|
|
385
391
|
}
|
|
386
392
|
},
|
|
387
393
|
"required": ["name", "address", "network"],
|
package/src/utils.ts
CHANGED
|
@@ -36,6 +36,7 @@ const ENS_ABI = [
|
|
|
36
36
|
'function resolver(bytes32 node) view returns (address)' // ENS registry ABI
|
|
37
37
|
];
|
|
38
38
|
const EMPTY_ADDRESS = '0x0000000000000000000000000000000000000000';
|
|
39
|
+
const STARKNET_NETWORKS = ['0x534e5f4d41494e', '0x534e5f5345504f4c4941'];
|
|
39
40
|
|
|
40
41
|
const scoreApiHeaders = {
|
|
41
42
|
Accept: 'application/json',
|
|
@@ -166,6 +167,16 @@ ajv.addKeyword({
|
|
|
166
167
|
}
|
|
167
168
|
});
|
|
168
169
|
|
|
170
|
+
ajv.addKeyword({
|
|
171
|
+
keyword: 'starknetNetwork',
|
|
172
|
+
validate: function (schema, data) {
|
|
173
|
+
return STARKNET_NETWORKS.includes(data);
|
|
174
|
+
},
|
|
175
|
+
error: {
|
|
176
|
+
message: 'network not allowed'
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
|
|
169
180
|
ajv.addKeyword({
|
|
170
181
|
keyword: 'maxLengthWithSpaceType',
|
|
171
182
|
validate: function validate(schema, data) {
|