@snapshot-labs/snapshot.js 0.4.95 → 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 CHANGED
@@ -2,31 +2,57 @@
2
2
 
3
3
  [![npm](https://img.shields.io/npm/v/@snapshot-labs/snapshot.js?label=npm)](https://www.npmjs.com/package/@snapshot-labs/snapshot.js)
4
4
 
5
- ### Install
5
+ ## Install
6
+
6
7
  Snapshot.js was designed to work both in the browser and in Node.js.
7
8
 
8
- #### Node.js
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
@@ -235,8 +235,35 @@ declare const _default: {
235
235
  required: string[];
236
236
  additionalProperties: boolean;
237
237
  };
238
- delegation: {
238
+ delegationPortal: {
239
239
  type: string;
240
+ properties: {
241
+ delegationType: {
242
+ type: string;
243
+ title: string;
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
+ };
264
+ };
265
+ required: string[];
266
+ additionalProperties: boolean;
240
267
  };
241
268
  allowAlias: {
242
269
  type: string;
@@ -231,8 +231,35 @@ declare const _default: {
231
231
  required: string[];
232
232
  additionalProperties: boolean;
233
233
  };
234
- delegation: {
234
+ delegationPortal: {
235
235
  type: string;
236
+ properties: {
237
+ delegationType: {
238
+ type: string;
239
+ title: string;
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
+ };
260
+ };
261
+ required: string[];
262
+ additionalProperties: boolean;
236
263
  };
237
264
  allowAlias: {
238
265
  type: string;
@@ -751,8 +751,45 @@ var definitions = {
751
751
  ],
752
752
  additionalProperties: false
753
753
  },
754
- delegation: {
755
- type: "boolean"
754
+ delegationPortal: {
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
+ }
786
+ },
787
+ required: [
788
+ "delegationType",
789
+ "delegationApi",
790
+ "delegationContract"
791
+ ],
792
+ additionalProperties: false
756
793
  },
757
794
  allowAlias: {
758
795
  type: "boolean"
@@ -742,8 +742,45 @@ var definitions = {
742
742
  ],
743
743
  additionalProperties: false
744
744
  },
745
- delegation: {
746
- type: "boolean"
745
+ delegationPortal: {
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
+ }
777
+ },
778
+ required: [
779
+ "delegationType",
780
+ "delegationApi",
781
+ "delegationContract"
782
+ ],
783
+ additionalProperties: false
747
784
  },
748
785
  allowAlias: {
749
786
  type: "boolean"