@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 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
@@ -236,29 +236,34 @@ declare const _default: {
236
236
  additionalProperties: boolean;
237
237
  };
238
238
  delegationPortal: {
239
- delegationType: {
240
- type: string;
241
- title: string;
242
- description: string;
243
- anyOf: {
244
- const: string;
239
+ type: string;
240
+ properties: {
241
+ delegationType: {
242
+ type: string;
245
243
  title: string;
246
- }[];
247
- };
248
- delegationContract: {
249
- type: string;
250
- format: string;
251
- title: string;
252
- description: string;
253
- examples: string[];
254
- };
255
- delegationApi: {
256
- type: string;
257
- format: string;
258
- title: string;
259
- description: string;
260
- examples: 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
+ };
261
264
  };
265
+ required: string[];
266
+ additionalProperties: boolean;
262
267
  };
263
268
  allowAlias: {
264
269
  type: string;
@@ -232,29 +232,34 @@ declare const _default: {
232
232
  additionalProperties: boolean;
233
233
  };
234
234
  delegationPortal: {
235
- delegationType: {
236
- type: string;
237
- title: string;
238
- description: string;
239
- anyOf: {
240
- const: string;
235
+ type: string;
236
+ properties: {
237
+ delegationType: {
238
+ type: string;
241
239
  title: string;
242
- }[];
243
- };
244
- delegationContract: {
245
- type: string;
246
- format: string;
247
- title: string;
248
- description: string;
249
- examples: string[];
250
- };
251
- delegationApi: {
252
- type: string;
253
- format: string;
254
- title: string;
255
- description: string;
256
- examples: 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
+ };
257
260
  };
261
+ required: string[];
262
+ additionalProperties: boolean;
258
263
  };
259
264
  allowAlias: {
260
265
  type: string;
@@ -752,35 +752,44 @@ var definitions = {
752
752
  additionalProperties: false
753
753
  },
754
754
  delegationPortal: {
755
- delegationType: {
756
- type: "string",
757
- title: "Delegation type",
758
- description: "Specify the type of delegation that you are using",
759
- anyOf: [
760
- {
761
- "const": "compound-governor",
762
- title: "Compound governor"
763
- }
764
- ]
765
- },
766
- delegationContract: {
767
- type: "string",
768
- format: "address",
769
- title: "Contract address",
770
- description: "The address of your delegation contract",
771
- examples: [
772
- "0x3901D0fDe202aF1427216b79f5243f8A022d68cf"
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
- delegationApi: {
776
- type: "string",
777
- format: "uri",
778
- title: "Delegation API",
779
- description: "The URL of your delegation API (e.g a subgraph)",
780
- examples: [
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"
@@ -743,35 +743,44 @@ var definitions = {
743
743
  additionalProperties: false
744
744
  },
745
745
  delegationPortal: {
746
- delegationType: {
747
- type: "string",
748
- title: "Delegation type",
749
- description: "Specify the type of delegation that you are using",
750
- anyOf: [
751
- {
752
- "const": "compound-governor",
753
- title: "Compound governor"
754
- }
755
- ]
756
- },
757
- delegationContract: {
758
- type: "string",
759
- format: "address",
760
- title: "Contract address",
761
- description: "The address of your delegation contract",
762
- examples: [
763
- "0x3901D0fDe202aF1427216b79f5243f8A022d68cf"
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
- delegationApi: {
767
- type: "string",
768
- format: "uri",
769
- title: "Delegation API",
770
- description: "The URL of your delegation API (e.g a subgraph)",
771
- examples: [
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"