@snapshot-labs/snapshot.js 0.12.0-beta.0 → 0.12.0-beta.2

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.
Files changed (56) hide show
  1. package/README.md +2 -2
  2. package/dist/index.d.ts +20 -2
  3. package/dist/schemas/index.d.ts +19 -1
  4. package/dist/sign/types.d.ts +2 -0
  5. package/dist/snapshot.cjs.js +1851 -1929
  6. package/dist/snapshot.esm.js +1852 -1930
  7. package/dist/snapshot.min.js +16 -5
  8. package/dist/src/index.d.ts +725 -0
  9. package/dist/src/schemas/index.d.ts +671 -0
  10. package/dist/src/sign/index.d.ts +29 -0
  11. package/dist/src/sign/types.d.ts +227 -0
  12. package/dist/src/utils/blockfinder.d.ts +1 -0
  13. package/dist/src/utils/delegation.d.ts +18 -0
  14. package/dist/src/utils/multicaller.d.ts +12 -0
  15. package/dist/src/utils/provider.d.ts +5 -0
  16. package/dist/src/utils/web3.d.ts +2 -0
  17. package/dist/src/utils.d.ts +91 -0
  18. package/dist/src/verify/evm.d.ts +4 -0
  19. package/dist/src/verify/evm.spec.d.ts +1 -0
  20. package/dist/src/verify/index.d.ts +11 -0
  21. package/dist/src/verify/index.spec.d.ts +1 -0
  22. package/dist/src/verify/starknet.d.ts +6 -0
  23. package/dist/src/verify/starknet.spec.d.ts +1 -0
  24. package/dist/src/voting/approval.d.ts +22 -0
  25. package/dist/src/voting/index.d.ts +14 -0
  26. package/dist/src/voting/quadratic.d.ts +20 -0
  27. package/dist/src/voting/rankedChoice.d.ts +18 -0
  28. package/dist/src/voting/singleChoice.d.ts +18 -0
  29. package/dist/src/voting/types.d.ts +35 -0
  30. package/dist/src/voting/weighted.d.ts +26 -0
  31. package/dist/utils/delegation.d.ts +1 -1
  32. package/dist/utils.d.ts +3 -2
  33. package/package.json +6 -3
  34. package/src/delegationSubgraphs.json +8 -8
  35. package/src/gateways.json +1 -2
  36. package/src/networks.json +222 -60
  37. package/src/schemas/profile.json +30 -0
  38. package/src/schemas/proposal.json +1 -1
  39. package/src/schemas/space.json +8 -7
  40. package/src/schemas/statement.json +17 -2
  41. package/src/schemas/vote.json +1 -1
  42. package/src/sign/hashedTypes.json +8 -1
  43. package/src/sign/index.ts +8 -6
  44. package/src/sign/types.ts +11 -1
  45. package/src/utils/provider.ts +8 -2
  46. package/src/utils/web3.ts +1 -1
  47. package/src/utils.spec.js +86 -31
  48. package/src/utils.ts +111 -38
  49. package/src/verify/evm.spec.ts +32 -0
  50. package/src/verify/evm.ts +82 -0
  51. package/src/verify/index.spec.ts +84 -0
  52. package/src/verify/index.ts +41 -0
  53. package/src/verify/starknet.spec.ts +55 -0
  54. package/src/verify/starknet.ts +82 -0
  55. package/src/sign/eip1271.ts +0 -55
  56. package/src/sign/utils.ts +0 -27
package/src/networks.json CHANGED
@@ -10,7 +10,7 @@
10
10
  "0x4976fb03C32e5B8cfe2b6cCB31c09Ba78EBaBa41"
11
11
  ],
12
12
  "ensNameWrapper": "0xD4416b13d2b3a9aBae7AcD5D6C2BbDBE25686401",
13
- "ensSubgraph": "https://api.thegraph.com/subgraphs/name/ensdomains/ens",
13
+ "ensSubgraph": "https://subgrapher.snapshot.org/subgraph/arbitrum/5XqPmWe6gjyrJtFn9cLy237i4cWw2j9HcUJEXsP5qGtH",
14
14
  "rpc": [
15
15
  "https://rpc.ankr.com/eth",
16
16
  {
@@ -36,30 +36,6 @@
36
36
  "start": 7929876,
37
37
  "logo": "ipfs://bafkreid7ndxh6y2ljw2jhbisodiyrhcy2udvnwqgon5wgells3kh4si5z4"
38
38
  },
39
- "5": {
40
- "key": "5",
41
- "name": "Goerli testnet",
42
- "shortName": "Goerli",
43
- "chainId": 5,
44
- "network": "goerli",
45
- "testnet": true,
46
- "multicall": "0x77dca2c955b15e9de4dbbcf1246b4b85b651e50e",
47
- "ensResolvers": [
48
- "0xd7a4F6473f32aC2Af804B3686AE8F1932bC35750",
49
- "0x4B1488B7a6B320d2D721406204aBc3eeAa9AD329"
50
- ],
51
- "ensNameWrapper": "0x114D4603199df73e7D157787f8778E21fCd13066",
52
- "ensSubgraph": "https://api.thegraph.com/subgraphs/name/ensdomains/ensgoerli",
53
- "rpc": [
54
- "https://eth-goerli.alchemyapi.io/v2/v4nqH_J-J3STit45Mm07TxuYexMHQsYZ"
55
- ],
56
- "explorer": {
57
- "url": "https://goerli.etherscan.io",
58
- "apiUrl": "https://api-goerli.etherscan.io"
59
- },
60
- "start": 743550,
61
- "logo": "ipfs://bafkreid7ndxh6y2ljw2jhbisodiyrhcy2udvnwqgon5wgells3kh4si5z4"
62
- },
63
39
  "8": {
64
40
  "key": "8",
65
41
  "name": "Ubiq",
@@ -485,22 +461,20 @@
485
461
  "start": 13960096,
486
462
  "logo": "ipfs://QmU7f1MyRz8rLELFfypnWZQjGbDGYgZtC9rjw47jYMYrnu"
487
463
  },
488
- "280": {
489
- "key": "280",
490
- "name": "zkSync Era Testnet",
491
- "shortName": "zkSync testnet",
492
- "chainId": 280,
493
- "network": "zkSync alpha testnet",
494
- "testnet": true,
495
- "multicall": "0xbDAd32d600915cB70576D3d935d49bFf3C9cB0CF",
496
- "rpc": [
497
- "https://testnet.era.zksync.dev"
498
- ],
464
+ "300": {
465
+ "key": "300",
466
+ "name": "zkSync Sepolia Testnet",
467
+ "shortName": "testnet",
468
+ "chainId": 300,
469
+ "network": "testnet",
470
+ "multicall": "0xF9cda624FBC7e059355ce98a31693d299FACd963",
471
+ "rpc": [],
499
472
  "explorer": {
500
- "url": "https://goerli.explorer.zksync.io/"
473
+ "url": "https://sepolia.explorer.zksync.dev/"
501
474
  },
502
- "start": 9012429,
503
- "logo": "ipfs://bafkreih6y7ri7h667cwxe5miisxghfheiidtbw2747y75stoxt3gp3a2yy"
475
+ "start": 2292,
476
+ "logo": "ipfs://bafkreih6y7ri7h667cwxe5miisxghfheiidtbw2747y75stoxt3gp3a2yy",
477
+ "testnet": true
504
478
  },
505
479
  "314": {
506
480
  "key": "314",
@@ -808,6 +782,35 @@
808
782
  "start": 859041,
809
783
  "logo": "ipfs://QmeGbNTU2Jqwg8qLTMGW8n8HSi2VdgCncAaeGzLx6gYnD7"
810
784
  },
785
+ "1328": {
786
+ "key": "1328",
787
+ "name": "Sei atlantic testnet",
788
+ "shortName": "testnet",
789
+ "chainId": 1328,
790
+ "network": "testnet",
791
+ "multicall": "0xc454132B017b55b427f45078E335549A7124f5f7",
792
+ "rpc": [],
793
+ "explorer": {
794
+ "url": "https://seitrace.com"
795
+ },
796
+ "start": 96978658,
797
+ "logo": "ipfs://bafkreiammyt7uztbztqbcqv4bydnczsh2fqmnjf6jxj4xnskzzl6sjrigq",
798
+ "testnet": true
799
+ },
800
+ "1329": {
801
+ "key": "1329",
802
+ "name": "Sei",
803
+ "shortName": "mainnet",
804
+ "chainId": 1329,
805
+ "network": "mainnet",
806
+ "multicall": "0xe033Bed7cae4114Af84Be1e9F1CA7DEa07Dfe1Cf",
807
+ "rpc": [],
808
+ "explorer": {
809
+ "url": "https://seitrace.com/"
810
+ },
811
+ "start": 79164574,
812
+ "logo": "ipfs://bafkreiammyt7uztbztqbcqv4bydnczsh2fqmnjf6jxj4xnskzzl6sjrigq"
813
+ },
811
814
  "1559": {
812
815
  "key": "1559",
813
816
  "name": "Tenet",
@@ -887,6 +890,35 @@
887
890
  "start": 4219343,
888
891
  "logo": "ipfs://QmXkneyRB6HbHTHRLCZpZqSsawiyJY7b2kZ2V8ydvKYAgv"
889
892
  },
893
+ "2221": {
894
+ "key": "2221",
895
+ "name": "Kava Testnet",
896
+ "shortName": "testnet",
897
+ "chainId": 2221,
898
+ "network": "testnet",
899
+ "multicall": "0xc7193EFE367DF0C9349a1149F4E95A2A35604262",
900
+ "rpc": [],
901
+ "explorer": {
902
+ "url": "https://testnet.kavascan.com"
903
+ },
904
+ "start": 6193104,
905
+ "logo": "ipfs://bafkreibpfubharx32fjqkqbfdhygwdjb2khxdg6meaasrcxsgvowos26f4",
906
+ "testnet": true
907
+ },
908
+ "2222": {
909
+ "key": "2222",
910
+ "name": "Kava",
911
+ "shortName": "mainnet",
912
+ "chainId": 2222,
913
+ "network": "mainnet",
914
+ "multicall": "0xcA11bde05977b3631167028862bE2a173976CA11",
915
+ "rpc": [],
916
+ "explorer": {
917
+ "url": "https://kavascan.com/"
918
+ },
919
+ "start": 3661165,
920
+ "logo": "ipfs://bafkreibpfubharx32fjqkqbfdhygwdjb2khxdg6meaasrcxsgvowos26f4"
921
+ },
890
922
  "2400": {
891
923
  "key": "2400",
892
924
  "name": "TCG Verse",
@@ -1025,6 +1057,20 @@
1025
1057
  "start": 3673983,
1026
1058
  "logo": "ipfs://bafkreifwxnnfk6koabzmxgcxcwlrwt6b5gijdain2gyqee77q4ajfb7fu4"
1027
1059
  },
1060
+ "7560": {
1061
+ "key": "7560",
1062
+ "name": "Cyber",
1063
+ "shortName": "mainnet",
1064
+ "chainId": 7560,
1065
+ "network": "mainnet",
1066
+ "multicall": "0xcA11bde05977b3631167028862bE2a173976CA11",
1067
+ "rpc": [],
1068
+ "explorer": {
1069
+ "url": "https://cyberscan.co"
1070
+ },
1071
+ "start": 1731707,
1072
+ "logo": "ipfs://bafkreifm2bbehoqpz4454o7gixnxfi6cgvqlxigqr3f6ipj7l2omtgfgnm"
1073
+ },
1028
1074
  "8217": {
1029
1075
  "key": "8217",
1030
1076
  "name": "Klaytn Cypress",
@@ -1125,6 +1171,35 @@
1125
1171
  "logo": "ipfs://QmaKRLxXPdeTsLx7MFLS3CJbhpSbResgoeL4fCgHB1mTsF",
1126
1172
  "testnet": true
1127
1173
  },
1174
+ "13371": {
1175
+ "key": "13371",
1176
+ "name": "Immutable zkEVM",
1177
+ "shortName": "mainnet",
1178
+ "chainId": 13371,
1179
+ "network": "mainnet",
1180
+ "multicall": "0xcA11bde05977b3631167028862bE2a173976CA11",
1181
+ "rpc": [],
1182
+ "explorer": {
1183
+ "url": "https://explorer.immutable.com"
1184
+ },
1185
+ "start": 3680945,
1186
+ "logo": "ipfs://bafkreiepnhfv3hgexddjpyaeemxo3byhtxxit6t4zsponyczee6ddjqxwi"
1187
+ },
1188
+ "13473": {
1189
+ "key": "13473",
1190
+ "name": "Immutable zkEVM Testnet",
1191
+ "shortName": "testnet",
1192
+ "chainId": 13473,
1193
+ "network": "testnet",
1194
+ "multicall": "0xcA11bde05977b3631167028862bE2a173976CA11",
1195
+ "rpc": [],
1196
+ "explorer": {
1197
+ "url": "https://explorer.testnet.immutable.com"
1198
+ },
1199
+ "start": 5307209,
1200
+ "logo": "ipfs://bafkreiepnhfv3hgexddjpyaeemxo3byhtxxit6t4zsponyczee6ddjqxwi",
1201
+ "testnet": true
1202
+ },
1128
1203
  "16718": {
1129
1204
  "key": "16718",
1130
1205
  "name": "AirDAO",
@@ -1271,18 +1346,18 @@
1271
1346
  "start": 62,
1272
1347
  "logo": "ipfs://QmZNkpVgPbuVbDcsi6arwH1om3456FGnwfDqYQJWUfHDEx"
1273
1348
  },
1274
- "59140": {
1275
- "key": "59140",
1276
- "name": "Linea Goerli testnet",
1277
- "shortName": "linea",
1278
- "chainId": 59140,
1349
+ "59141": {
1350
+ "key": "59141",
1351
+ "name": "Linea Sepolia",
1352
+ "shortName": "testnet",
1353
+ "chainId": 59141,
1279
1354
  "network": "testnet",
1280
1355
  "multicall": "0xcA11bde05977b3631167028862bE2a173976CA11",
1281
1356
  "rpc": [],
1282
1357
  "explorer": {
1283
- "url": "https://goerli.lineascan.build/"
1358
+ "url": "https://sepolia.lineascan.build/"
1284
1359
  },
1285
- "start": 498623,
1360
+ "start": 227427,
1286
1361
  "logo": "ipfs://bafkreihtyzolub3sejuwc32hpdpjnt7ksowaguni2yuho3kyihhcqrtqce",
1287
1362
  "testnet": true
1288
1363
  },
@@ -1321,21 +1396,34 @@
1321
1396
  "start": 12011090,
1322
1397
  "logo": "ipfs://bafkreihgr7zy7vi5kqddybfaezwuhvssg57qluwmyan4qq7l57nr7w7wey"
1323
1398
  },
1324
- "84531": {
1325
- "key": "84531",
1326
- "name": "Base Goerli Testnet",
1327
- "chainId": 84531,
1328
- "network": "Base",
1329
- "testnet": true,
1330
- "multicall": "0x0012989E982C2c473e36418384Ab707C72f2B782",
1331
- "rpc": [
1332
- "https://goerli.base.org"
1333
- ],
1399
+ "81457": {
1400
+ "key": "81457",
1401
+ "name": "Blast",
1402
+ "shortName": "mainnet",
1403
+ "chainId": 81457,
1404
+ "network": "mainnet",
1405
+ "multicall": "0xcA11bde05977b3631167028862bE2a173976CA11",
1406
+ "rpc": [],
1334
1407
  "explorer": {
1335
- "url": "https://goerli.basescan.org/"
1408
+ "url": "https://blastscan.io"
1336
1409
  },
1337
- "start": 1151797,
1338
- "logo": "ipfs://QmaxRoHpxZd8PqccAynherrMznMufG6sdmHZLihkECXmZv"
1410
+ "start": 88189,
1411
+ "logo": "ipfs://bafkreibfmkjg22cozxppzcoxswj45clvh2rqhxzax57cmmgudbtkf4dkce"
1412
+ },
1413
+ "84532": {
1414
+ "key": "84532",
1415
+ "name": "Base Sepolia",
1416
+ "shortName": "testnet",
1417
+ "chainId": 84532,
1418
+ "network": "testnet",
1419
+ "multicall": "0xcA11bde05977b3631167028862bE2a173976CA11",
1420
+ "rpc": [],
1421
+ "explorer": {
1422
+ "url": "https://base-sepolia.blockscout.com/"
1423
+ },
1424
+ "start": 1059647,
1425
+ "logo": "ipfs://QmaxRoHpxZd8PqccAynherrMznMufG6sdmHZLihkECXmZv",
1426
+ "testnet": true
1339
1427
  },
1340
1428
  "686868": {
1341
1429
  "key": "686868",
@@ -1367,6 +1455,35 @@
1367
1455
  "logo": "ipfs://bafkreiammyt7uztbztqbcqv4bydnczsh2fqmnjf6jxj4xnskzzl6sjrigq",
1368
1456
  "testnet": true
1369
1457
  },
1458
+ "810181": {
1459
+ "key": "810181",
1460
+ "name": "zkLink Nova Sepolia",
1461
+ "shortName": "testnet",
1462
+ "chainId": 810181,
1463
+ "network": "testnet",
1464
+ "multicall": "0x97148F8fDdd9A1620f72EC1Bb2932916623d9da5",
1465
+ "rpc": [],
1466
+ "explorer": {
1467
+ "url": "https://sepolia.explorer.zklink.io/"
1468
+ },
1469
+ "start": 43723,
1470
+ "logo": "ipfs://bafkreic6c3iems5235qapyhyrygha7akqrsfact2nok3y2uhljpzxrdu74",
1471
+ "testnet": true
1472
+ },
1473
+ "810180": {
1474
+ "key": "810180",
1475
+ "name": "zkLink Nova",
1476
+ "shortName": "zlink",
1477
+ "chainId": 810180,
1478
+ "network": "mainnet",
1479
+ "multicall": "0x825267E0fA5CAe92F98540828a54198dcB3Eaeb5",
1480
+ "rpc": [],
1481
+ "explorer": {
1482
+ "url": "https://explorer.zklink.io"
1483
+ },
1484
+ "start": 146055,
1485
+ "logo": "ipfs://bafkreic6c3iems5235qapyhyrygha7akqrsfact2nok3y2uhljpzxrdu74"
1486
+ },
1370
1487
  "11155111": {
1371
1488
  "key": "11155111",
1372
1489
  "name": "Sepolia testnet",
@@ -1390,6 +1507,51 @@
1390
1507
  "start": 751532,
1391
1508
  "logo": "ipfs://bafkreid7ndxh6y2ljw2jhbisodiyrhcy2udvnwqgon5wgells3kh4si5z4"
1392
1509
  },
1510
+ "11155420": {
1511
+ "key": "11155420",
1512
+ "name": "OP Sepolia",
1513
+ "shortName": "testnet",
1514
+ "chainId": 11155420,
1515
+ "network": "testnet",
1516
+ "multicall": "0xcA11bde05977b3631167028862bE2a173976CA11",
1517
+ "rpc": [],
1518
+ "explorer": {
1519
+ "url": "https://sepolia-optimism.etherscan.io"
1520
+ },
1521
+ "start": 1620204,
1522
+ "logo": "ipfs://QmfF4kwhGL8QosUXvgq2KWCmavhKBvwD6kbhs7L4p5ZAWb",
1523
+ "testnet": true
1524
+ },
1525
+ "111557560": {
1526
+ "key": "111557560",
1527
+ "name": "Cyber Testnet",
1528
+ "shortName": "testnet",
1529
+ "chainId": 111557560,
1530
+ "network": "testnet",
1531
+ "multicall": "0xffc391F0018269d4758AEA1a144772E8FB99545E",
1532
+ "rpc": [],
1533
+ "explorer": {
1534
+ "url": "https://testnet.cyberscan.co/"
1535
+ },
1536
+ "start": 304545,
1537
+ "logo": "ipfs://bafkreifm2bbehoqpz4454o7gixnxfi6cgvqlxigqr3f6ipj7l2omtgfgnm",
1538
+ "testnet": true
1539
+ },
1540
+ "168587773": {
1541
+ "key": "168587773",
1542
+ "name": "Blast Sepolia",
1543
+ "shortName": "testnet",
1544
+ "chainId": 168587773,
1545
+ "network": "testnet",
1546
+ "multicall": "0xcA11bde05977b3631167028862bE2a173976CA11",
1547
+ "rpc": [],
1548
+ "explorer": {
1549
+ "url": "https://sepolia.blastexplorer.io"
1550
+ },
1551
+ "start": 756690,
1552
+ "logo": "ipfs://bafkreibfmkjg22cozxppzcoxswj45clvh2rqhxzax57cmmgudbtkf4dkce",
1553
+ "testnet": true
1554
+ },
1393
1555
  "245022926": {
1394
1556
  "key": "245022926",
1395
1557
  "name": "Neon Devnet",
@@ -1460,4 +1622,4 @@
1460
1622
  "start": 7521509,
1461
1623
  "logo": "ipfs://QmNnGPr1CNvj12SSGzKARtUHv9FyEfE5nES73U4vBWQSJL"
1462
1624
  }
1463
- }
1625
+ }
@@ -21,6 +21,36 @@
21
21
  "title": "avatar",
22
22
  "format": "customUrl",
23
23
  "maxLength": 256
24
+ },
25
+ "cover": {
26
+ "type": "string",
27
+ "title": "avatar",
28
+ "format": "customUrl",
29
+ "maxLength": 256
30
+ },
31
+ "twitter": {
32
+ "type": "string",
33
+ "title": "twitter",
34
+ "pattern": "^[A-Za-z0-9_]*$",
35
+ "maxLength": 15
36
+ },
37
+ "github": {
38
+ "type": "string",
39
+ "title": "github",
40
+ "pattern": "^[A-Za-z0-9_-]*$",
41
+ "maxLength": 39
42
+ },
43
+ "lens": {
44
+ "type": "string",
45
+ "title": "lens",
46
+ "pattern": "^[A-Za-z0-9_]*$",
47
+ "maxLength": 26
48
+ },
49
+ "farcaster": {
50
+ "type": "string",
51
+ "title": "farcaster",
52
+ "pattern": "^[a-z0-9-]*$",
53
+ "maxLength": 17
24
54
  }
25
55
  },
26
56
  "required": [],
@@ -18,7 +18,7 @@
18
18
  "minLength": 0,
19
19
  "maxLengthWithSpaceType": {
20
20
  "default": 10000,
21
- "turbo": 20000
21
+ "turbo": 40000
22
22
  }
23
23
  },
24
24
  "discussion": {
@@ -248,7 +248,8 @@
248
248
  "title": "Delegation type",
249
249
  "description": "Specify the type of delegation that you are using",
250
250
  "anyOf": [
251
- { "const": "compound-governor", "title": "Compound governor" }
251
+ { "const": "compound-governor", "title": "Compound governor" },
252
+ { "const": "split-delegation", "title": "Split Delegation" }
252
253
  ]
253
254
  },
254
255
  "delegationContract": {
@@ -264,7 +265,7 @@
264
265
  "title": "Delegation API",
265
266
  "description": "The URL of your delegation API (e.g a subgraph)",
266
267
  "examples": [
267
- "https://api.thegraph.com/subgraphs/name/arr00/uniswap-governance-v2"
268
+ "https://subgrapher.snapshot.org/subgraph/arbitrum/FTzC6VrZd8JhJgWfTJnwWgH1Z1dS3GxaosKkRbCqkZAZ"
268
269
  ]
269
270
  }
270
271
  },
@@ -302,12 +303,11 @@
302
303
  },
303
304
  "quorum": {
304
305
  "type": "number",
305
- "minimum": 0,
306
- "optimisticMinimum": 1
306
+ "minimum": 0
307
307
  },
308
308
  "quorumType": {
309
309
  "type": "string",
310
- "enum": ["optimistic"]
310
+ "enum": ["rejection"]
311
311
  },
312
312
  "blind": {
313
313
  "type": "boolean"
@@ -380,11 +380,12 @@
380
380
  },
381
381
  "children": {
382
382
  "type": "array",
383
- "maxItems": 8,
383
+ "maxItems": 16,
384
384
  "title": "children",
385
385
  "items": {
386
386
  "type": "string"
387
- }
387
+ },
388
+ "uniqueItems": true
388
389
  },
389
390
  "boost": {
390
391
  "type": "object",
@@ -10,7 +10,6 @@
10
10
  "type": "string",
11
11
  "format": "long",
12
12
  "title": "About",
13
- "minLength": 1,
14
13
  "maxLength": 140
15
14
  },
16
15
  "statement": {
@@ -18,9 +17,25 @@
18
17
  "format": "long",
19
18
  "title": "Statement",
20
19
  "maxLength": 10000
20
+ },
21
+ "discourse": {
22
+ "type": "string",
23
+ "title": "discourse",
24
+ "pattern": "^[A-Za-z0-9-_.]*$",
25
+ "maxLength": 30
26
+ },
27
+ "network": {
28
+ "type": "string",
29
+ "title": "network",
30
+ "pattern": "^[a-z0-9-]*$",
31
+ "maxLength": 24
32
+ },
33
+ "status": {
34
+ "enum": ["ACTIVE", "INACTIVE"],
35
+ "title": "status"
21
36
  }
22
37
  },
23
- "required": ["about"],
38
+ "required": [],
24
39
  "additionalProperties": false
25
40
  }
26
41
  }
@@ -27,7 +27,7 @@
27
27
  "reason": {
28
28
  "type": "string",
29
29
  "title": "reason",
30
- "maxLength": 140
30
+ "maxLength": 1000
31
31
  },
32
32
  "app": {
33
33
  "type": "string",
@@ -47,10 +47,17 @@
47
47
  "9cf05f3cc08b78654652fb2494d9b2beab8803b723cf1c36e1abaab7427f3823": "vote-array",
48
48
  "40bc49afc0f4084a08af0d768ff67816dde5c61550ff65008c835982a62c351e": "vote-string",
49
49
  "5339bc75243597107916a39d9235470342ad7ac8486b9424272afe4877d62f6b": "statement",
50
+ "8ae78362e9de73180e72a7e8429ef727a019ae6a4f4ea1280d4c53136bd585b3": "statement",
50
51
  "8887cc25c04622fa37b81fd97615e56c6eb5f21821e3cd69ed621b0f22b6a0a7": "follow",
51
52
  "0709a2eb5e9535594e809f7eadafe734d89ba9bf497498ede185332b6bd381d5": "unfollow",
53
+ "65df19852816ead53c157161c62cd1580f509f9c33d27c06d46206eb3526b8b5": "follow",
54
+ "150feb61a4a0f6d140f5444349c8baa068b062e7552d314a3119991e37ca6f8b": "unfollow",
52
55
  "daaf0ff7d3e2ec189cf851228c386c7a4c432076d0ed197864916dd3f656531c": "subscribe",
53
56
  "f542edb6f9fe79d0b85554667991352be2fcca85df3dd3c6a6f451d189c7c25d": "unsubscribe",
54
57
  "6f6cdd15a1e9e6c4ee544231c4fa7b6c7e5183bc2b37fa4bd1a695f458348ab7": "delete-space",
55
- "1aad7825b991457fca04aae48a2a49d815ada524e10316af0da5522ea48b3df6": "alias"
58
+ "1aad7825b991457fca04aae48a2a49d815ada524e10316af0da5522ea48b3df6": "alias",
59
+ "8ea9074bff3a30cb61f4f0f0f142c9335c6be828feba0571a45de3f1fd0319c0": "alias",
60
+ "42f8858a21d4aa232721cb97074851e729829ea362b88bb21f3879899663b586": "follow",
61
+ "2bb75450e28b06f259ea764cd669de6bde0ba70ce729b0ff05ab9df56e0ff21d": "unfollow",
62
+ "2ffbebcbd22ef48fd2f4a1182ff1feda7795b57689bd6f0dd73c89e925e7fefb": "profile"
56
63
  }
package/src/sign/index.ts CHANGED
@@ -43,10 +43,10 @@ import constants from '../constants.json';
43
43
  const NAME = 'snapshot';
44
44
  const VERSION = '0.1.4';
45
45
 
46
- export const domain:{
47
- name: string,
48
- version: string,
49
- chainId?: number
46
+ export const domain: {
47
+ name: string;
48
+ version: string;
49
+ chainId?: number;
50
50
  } = {
51
51
  name: NAME,
52
52
  version: VERSION
@@ -83,7 +83,7 @@ export default class Client {
83
83
  ...domain
84
84
  };
85
85
  // @ts-ignore
86
- if (window?.ethereum?.isTrust) {
86
+ if (typeof window !== 'undefined' && window.ethereum?.isTrust) {
87
87
  domainData.chainId = (await signer.provider.getNetwork()).chainId;
88
88
  }
89
89
  const data: any = { domain: domainData, types, message };
@@ -107,9 +107,11 @@ export default class Client {
107
107
  fetch(address, init)
108
108
  .then((res) => {
109
109
  if (res.ok) return resolve(res.json());
110
+ if (res.headers.get('content-type')?.includes('application/json'))
111
+ return res.json().then(reject).catch(reject);
110
112
  throw res;
111
113
  })
112
- .catch((e) => reject(e));
114
+ .catch(reject);
113
115
  });
114
116
  }
115
117
 
package/src/sign/types.ts CHANGED
@@ -71,12 +71,14 @@ export interface Vote {
71
71
 
72
72
  export interface Follow {
73
73
  from?: string;
74
+ network?: string;
74
75
  space: string;
75
76
  timestamp?: number;
76
77
  }
77
78
 
78
79
  export interface Unfollow {
79
80
  from?: string;
81
+ network?: string;
80
82
  space: string;
81
83
  timestamp?: number;
82
84
  }
@@ -105,6 +107,9 @@ export interface Statement {
105
107
  space: string;
106
108
  about: string;
107
109
  statement: string;
110
+ discourse?: string;
111
+ status?: string;
112
+ network?: string;
108
113
  }
109
114
 
110
115
  export interface Alias {
@@ -269,6 +274,7 @@ export const voteString2Types = {
269
274
  export const followTypes = {
270
275
  Follow: [
271
276
  { name: 'from', type: 'address' },
277
+ { name: 'network', type: 'string' },
272
278
  { name: 'space', type: 'string' },
273
279
  { name: 'timestamp', type: 'uint64' }
274
280
  ]
@@ -277,6 +283,7 @@ export const followTypes = {
277
283
  export const unfollowTypes = {
278
284
  Unfollow: [
279
285
  { name: 'from', type: 'address' },
286
+ { name: 'network', type: 'string' },
280
287
  { name: 'space', type: 'string' },
281
288
  { name: 'timestamp', type: 'uint64' }
282
289
  ]
@@ -312,7 +319,10 @@ export const statementTypes = {
312
319
  { name: 'timestamp', type: 'uint64' },
313
320
  { name: 'space', type: 'string' },
314
321
  { name: 'about', type: 'string' },
315
- { name: 'statement', type: 'string' }
322
+ { name: 'statement', type: 'string' },
323
+ { name: 'discourse', type: 'string' },
324
+ { name: 'status', type: 'string' },
325
+ { name: 'network', type: 'string' }
316
326
  ]
317
327
  };
318
328
 
@@ -6,9 +6,15 @@ import {
6
6
  const providers = {};
7
7
  const batchedProviders = {};
8
8
 
9
+ export type ProviderOptions = {
10
+ broviderUrl?: string;
11
+ };
12
+
13
+ const DEFAULT_BROVIDER_URL = 'https://rpc.snapshot.org';
14
+
9
15
  export default function getProvider(
10
16
  network,
11
- { broviderUrl = 'https://rpc.snapshot.org' } = {}
17
+ { broviderUrl = DEFAULT_BROVIDER_URL }: ProviderOptions = {}
12
18
  ) {
13
19
  const url = `${broviderUrl}/${network}`;
14
20
  if (!providers[network])
@@ -25,7 +31,7 @@ export default function getProvider(
25
31
 
26
32
  export function getBatchedProvider(
27
33
  network,
28
- { broviderUrl = 'https://rpc.snapshot.org' } = {}
34
+ { broviderUrl = DEFAULT_BROVIDER_URL }: ProviderOptions = {}
29
35
  ) {
30
36
  const url = `${broviderUrl}/${network}`;
31
37
  if (!batchedProviders[network])
package/src/utils/web3.ts CHANGED
@@ -9,7 +9,7 @@ export async function getBlockNumber(provider) {
9
9
  try {
10
10
  const blockNumber: any = await provider.getBlockNumber();
11
11
  return parseInt(blockNumber);
12
- } catch (e) {
12
+ } catch (e: any) {
13
13
  return Promise.reject();
14
14
  }
15
15
  }