@snapshot-labs/snapshot.js 0.4.94 → 0.4.96
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/README.md +29 -3
- package/dist/index.d.ts +26 -21
- package/dist/schemas/index.d.ts +26 -21
- package/dist/snapshot.cjs.js +37 -28
- package/dist/snapshot.esm.js +37 -28
- package/dist/snapshot.min.js +1 -1
- package/package.json +1 -1
- package/src/schemas/space.json +28 -23
package/README.md
CHANGED
|
@@ -2,31 +2,57 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/@snapshot-labs/snapshot.js)
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## Install
|
|
6
|
+
|
|
6
7
|
Snapshot.js was designed to work both in the browser and in Node.js.
|
|
7
8
|
|
|
8
|
-
|
|
9
|
+
### In Node Applications
|
|
10
|
+
|
|
9
11
|
To install Snapshot.js on Node.js, open your terminal and run:
|
|
10
|
-
|
|
12
|
+
|
|
13
|
+
```bash
|
|
11
14
|
npm i @snapshot-labs/snapshot.js
|
|
12
15
|
```
|
|
13
16
|
|
|
14
17
|
#### Browser
|
|
18
|
+
|
|
15
19
|
You can create an index.html file and include Snapshot.js with:
|
|
20
|
+
|
|
16
21
|
```html
|
|
17
22
|
<script src="https://cdn.jsdelivr.net/npm/@snapshot-labs/snapshot.js"></script>
|
|
18
23
|
```
|
|
24
|
+
|
|
19
25
|
### Development
|
|
20
26
|
|
|
21
27
|
#### Install dependencies
|
|
28
|
+
|
|
22
29
|
```bash
|
|
23
30
|
yarn
|
|
24
31
|
```
|
|
25
32
|
|
|
26
33
|
#### Build package
|
|
34
|
+
|
|
27
35
|
```bash
|
|
28
36
|
yarn build
|
|
29
37
|
```
|
|
30
38
|
|
|
39
|
+
#### Test cases
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
yarn test
|
|
43
|
+
# or
|
|
44
|
+
yarn test:once
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
#### Other useful scripts
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
# Format ABI
|
|
51
|
+
ts-node scripts/abi.ts
|
|
52
|
+
# Generate hash for types
|
|
53
|
+
ts-node scripts/generateHashWithTypes.ts
|
|
54
|
+
```
|
|
55
|
+
|
|
31
56
|
### License
|
|
57
|
+
|
|
32
58
|
[MIT](LICENSE).
|
package/dist/index.d.ts
CHANGED
|
@@ -236,29 +236,34 @@ declare const _default: {
|
|
|
236
236
|
additionalProperties: boolean;
|
|
237
237
|
};
|
|
238
238
|
delegationPortal: {
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
anyOf: {
|
|
244
|
-
const: string;
|
|
239
|
+
type: string;
|
|
240
|
+
properties: {
|
|
241
|
+
delegationType: {
|
|
242
|
+
type: string;
|
|
245
243
|
title: string;
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
244
|
+
description: string;
|
|
245
|
+
anyOf: {
|
|
246
|
+
const: string;
|
|
247
|
+
title: string;
|
|
248
|
+
}[];
|
|
249
|
+
};
|
|
250
|
+
delegationContract: {
|
|
251
|
+
type: string;
|
|
252
|
+
pattern: string;
|
|
253
|
+
title: string;
|
|
254
|
+
description: string;
|
|
255
|
+
examples: string[];
|
|
256
|
+
};
|
|
257
|
+
delegationApi: {
|
|
258
|
+
type: string;
|
|
259
|
+
format: string;
|
|
260
|
+
title: string;
|
|
261
|
+
description: string;
|
|
262
|
+
examples: string[];
|
|
263
|
+
};
|
|
261
264
|
};
|
|
265
|
+
required: string[];
|
|
266
|
+
additionalProperties: boolean;
|
|
262
267
|
};
|
|
263
268
|
allowAlias: {
|
|
264
269
|
type: string;
|
package/dist/schemas/index.d.ts
CHANGED
|
@@ -232,29 +232,34 @@ declare const _default: {
|
|
|
232
232
|
additionalProperties: boolean;
|
|
233
233
|
};
|
|
234
234
|
delegationPortal: {
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
anyOf: {
|
|
240
|
-
const: string;
|
|
235
|
+
type: string;
|
|
236
|
+
properties: {
|
|
237
|
+
delegationType: {
|
|
238
|
+
type: string;
|
|
241
239
|
title: string;
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
240
|
+
description: string;
|
|
241
|
+
anyOf: {
|
|
242
|
+
const: string;
|
|
243
|
+
title: string;
|
|
244
|
+
}[];
|
|
245
|
+
};
|
|
246
|
+
delegationContract: {
|
|
247
|
+
type: string;
|
|
248
|
+
pattern: string;
|
|
249
|
+
title: string;
|
|
250
|
+
description: string;
|
|
251
|
+
examples: string[];
|
|
252
|
+
};
|
|
253
|
+
delegationApi: {
|
|
254
|
+
type: string;
|
|
255
|
+
format: string;
|
|
256
|
+
title: string;
|
|
257
|
+
description: string;
|
|
258
|
+
examples: string[];
|
|
259
|
+
};
|
|
257
260
|
};
|
|
261
|
+
required: string[];
|
|
262
|
+
additionalProperties: boolean;
|
|
258
263
|
};
|
|
259
264
|
allowAlias: {
|
|
260
265
|
type: string;
|
package/dist/snapshot.cjs.js
CHANGED
|
@@ -752,35 +752,44 @@ var definitions = {
|
|
|
752
752
|
additionalProperties: false
|
|
753
753
|
},
|
|
754
754
|
delegationPortal: {
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
"
|
|
773
|
-
|
|
755
|
+
type: "object",
|
|
756
|
+
properties: {
|
|
757
|
+
delegationType: {
|
|
758
|
+
type: "string",
|
|
759
|
+
title: "Delegation type",
|
|
760
|
+
description: "Specify the type of delegation that you are using",
|
|
761
|
+
anyOf: [
|
|
762
|
+
{
|
|
763
|
+
"const": "compound-governor",
|
|
764
|
+
title: "Compound governor"
|
|
765
|
+
}
|
|
766
|
+
]
|
|
767
|
+
},
|
|
768
|
+
delegationContract: {
|
|
769
|
+
type: "string",
|
|
770
|
+
pattern: "^0x[a-fA-F0-9]{40}$",
|
|
771
|
+
title: "Contract address",
|
|
772
|
+
description: "The address of your delegation contract",
|
|
773
|
+
examples: [
|
|
774
|
+
"0x3901D0fDe202aF1427216b79f5243f8A022d68cf"
|
|
775
|
+
]
|
|
776
|
+
},
|
|
777
|
+
delegationApi: {
|
|
778
|
+
type: "string",
|
|
779
|
+
format: "uri",
|
|
780
|
+
title: "Delegation API",
|
|
781
|
+
description: "The URL of your delegation API (e.g a subgraph)",
|
|
782
|
+
examples: [
|
|
783
|
+
"https://api.thegraph.com/subgraphs/name/arr00/uniswap-governance-v2"
|
|
784
|
+
]
|
|
785
|
+
}
|
|
774
786
|
},
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
"https://api.thegraph.com/subgraphs/name/arr00/uniswap-governance-v2"
|
|
782
|
-
]
|
|
783
|
-
}
|
|
787
|
+
required: [
|
|
788
|
+
"delegationType",
|
|
789
|
+
"delegationApi",
|
|
790
|
+
"delegationContract"
|
|
791
|
+
],
|
|
792
|
+
additionalProperties: false
|
|
784
793
|
},
|
|
785
794
|
allowAlias: {
|
|
786
795
|
type: "boolean"
|
package/dist/snapshot.esm.js
CHANGED
|
@@ -743,35 +743,44 @@ var definitions = {
|
|
|
743
743
|
additionalProperties: false
|
|
744
744
|
},
|
|
745
745
|
delegationPortal: {
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
"
|
|
764
|
-
|
|
746
|
+
type: "object",
|
|
747
|
+
properties: {
|
|
748
|
+
delegationType: {
|
|
749
|
+
type: "string",
|
|
750
|
+
title: "Delegation type",
|
|
751
|
+
description: "Specify the type of delegation that you are using",
|
|
752
|
+
anyOf: [
|
|
753
|
+
{
|
|
754
|
+
"const": "compound-governor",
|
|
755
|
+
title: "Compound governor"
|
|
756
|
+
}
|
|
757
|
+
]
|
|
758
|
+
},
|
|
759
|
+
delegationContract: {
|
|
760
|
+
type: "string",
|
|
761
|
+
pattern: "^0x[a-fA-F0-9]{40}$",
|
|
762
|
+
title: "Contract address",
|
|
763
|
+
description: "The address of your delegation contract",
|
|
764
|
+
examples: [
|
|
765
|
+
"0x3901D0fDe202aF1427216b79f5243f8A022d68cf"
|
|
766
|
+
]
|
|
767
|
+
},
|
|
768
|
+
delegationApi: {
|
|
769
|
+
type: "string",
|
|
770
|
+
format: "uri",
|
|
771
|
+
title: "Delegation API",
|
|
772
|
+
description: "The URL of your delegation API (e.g a subgraph)",
|
|
773
|
+
examples: [
|
|
774
|
+
"https://api.thegraph.com/subgraphs/name/arr00/uniswap-governance-v2"
|
|
775
|
+
]
|
|
776
|
+
}
|
|
765
777
|
},
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
"https://api.thegraph.com/subgraphs/name/arr00/uniswap-governance-v2"
|
|
773
|
-
]
|
|
774
|
-
}
|
|
778
|
+
required: [
|
|
779
|
+
"delegationType",
|
|
780
|
+
"delegationApi",
|
|
781
|
+
"delegationContract"
|
|
782
|
+
],
|
|
783
|
+
additionalProperties: false
|
|
775
784
|
},
|
|
776
785
|
allowAlias: {
|
|
777
786
|
type: "boolean"
|