@snapshot-labs/snapshot.js 0.12.5 → 0.12.7

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.
@@ -15,5 +15,5 @@ type Delegation = {
15
15
  space: string;
16
16
  timestamp: number;
17
17
  };
18
- export default function getDelegatesBySpace(network: string, space: string, snapshot?: string | number, options?: any): Promise<Delegation[]>;
18
+ export default function getDelegatesBySpace(network: string, space: string | null, snapshot?: string | number, options?: any): Promise<Delegation[]>;
19
19
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@snapshot-labs/snapshot.js",
3
- "version": "0.12.5",
3
+ "version": "0.12.7",
4
4
  "repository": "snapshot-labs/snapshot.js",
5
5
  "license": "MIT",
6
6
  "main": "dist/snapshot.cjs.js",
package/src/networks.json CHANGED
@@ -442,6 +442,20 @@
442
442
  "start": 2497732,
443
443
  "logo": "ipfs://QmVEgNeQDKnXygeGxfY9FywZpNGQu98ktZtRJ9bToYF6g7"
444
444
  },
445
+ "252": {
446
+ "key": "252",
447
+ "name": "Fraxtal",
448
+ "shortName": "mainnet",
449
+ "chainId": 252,
450
+ "network": "mainnet",
451
+ "multicall": "0xcA11bde05977b3631167028862bE2a173976CA11",
452
+ "rpc": [],
453
+ "explorer": {
454
+ "url": "https://fraxscan.com"
455
+ },
456
+ "start": 1,
457
+ "logo": "ipfs://bafkreieflj4wq6tx7k5kq47z3xnsrdrn2xgm4bxa3uovrnndcb2vqqwlyu"
458
+ },
445
459
  "269": {
446
460
  "key": "269",
447
461
  "name": "High Performance Blockchain",
@@ -935,6 +949,21 @@
935
949
  "start": 57500,
936
950
  "logo": "ipfs://bafkreidg4wpewve5mdxrofneqblydkrjl3oevtgpdf3fk3z3vjqam6ocoe"
937
951
  },
952
+ "2522": {
953
+ "key": "2522",
954
+ "name": "Fraxtal Testnet",
955
+ "shortName": "testnet",
956
+ "chainId": 2522,
957
+ "network": "testnet",
958
+ "multicall": "0xcA11bde05977b3631167028862bE2a173976CA11",
959
+ "rpc": [],
960
+ "explorer": {
961
+ "url": "https://holesky.fraxscan.com/"
962
+ },
963
+ "start": 1,
964
+ "logo": "ipfs://bafkreieflj4wq6tx7k5kq47z3xnsrdrn2xgm4bxa3uovrnndcb2vqqwlyu",
965
+ "testnet": true
966
+ },
938
967
  "4200": {
939
968
  "key": "4200",
940
969
  "name": "Merlin",
@@ -1455,6 +1484,20 @@
1455
1484
  "logo": "ipfs://bafkreiammyt7uztbztqbcqv4bydnczsh2fqmnjf6jxj4xnskzzl6sjrigq",
1456
1485
  "testnet": true
1457
1486
  },
1487
+ "810180": {
1488
+ "key": "810180",
1489
+ "name": "zkLink Nova",
1490
+ "shortName": "zlink",
1491
+ "chainId": 810180,
1492
+ "network": "mainnet",
1493
+ "multicall": "0x825267E0fA5CAe92F98540828a54198dcB3Eaeb5",
1494
+ "rpc": [],
1495
+ "explorer": {
1496
+ "url": "https://explorer.zklink.io"
1497
+ },
1498
+ "start": 146055,
1499
+ "logo": "ipfs://bafkreic6c3iems5235qapyhyrygha7akqrsfact2nok3y2uhljpzxrdu74"
1500
+ },
1458
1501
  "810181": {
1459
1502
  "key": "810181",
1460
1503
  "name": "zkLink Nova Sepolia",
@@ -1470,20 +1513,6 @@
1470
1513
  "logo": "ipfs://bafkreic6c3iems5235qapyhyrygha7akqrsfact2nok3y2uhljpzxrdu74",
1471
1514
  "testnet": true
1472
1515
  },
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
- },
1487
1516
  "11155111": {
1488
1517
  "key": "11155111",
1489
1518
  "name": "Sepolia testnet",
@@ -1622,4 +1651,4 @@
1622
1651
  "start": 7521509,
1623
1652
  "logo": "ipfs://QmNnGPr1CNvj12SSGzKARtUHv9FyEfE5nES73U4vBWQSJL"
1624
1653
  }
1625
- }
1654
+ }
@@ -13,7 +13,7 @@ type Delegation = {
13
13
 
14
14
  export default async function getDelegatesBySpace(
15
15
  network: string,
16
- space: string,
16
+ space: string | null,
17
17
  snapshot: string | number = 'latest',
18
18
  options: any = {}
19
19
  ) {
@@ -26,7 +26,7 @@ export default async function getDelegatesBySpace(
26
26
 
27
27
  let pivot = 0;
28
28
  const result = new Map<string, Delegation>();
29
- const spaceIn = buildSpaceIn(space);
29
+ const spaceIn = space ? buildSpaceIn(space) : null;
30
30
 
31
31
  while (true) {
32
32
  const newResults = await fetchData({
@@ -86,7 +86,7 @@ async function fetchData({
86
86
  snapshot
87
87
  }: {
88
88
  url: string;
89
- spaces: string[];
89
+ spaces: string[] | null;
90
90
  pivot: number;
91
91
  snapshot: string | number;
92
92
  }): Promise<Delegation[]> {
@@ -94,7 +94,6 @@ async function fetchData({
94
94
  delegations: {
95
95
  __args: {
96
96
  where: {
97
- space_in: spaces,
98
97
  timestamp_gte: pivot
99
98
  },
100
99
  first: PAGE_SIZE,
@@ -113,5 +112,9 @@ async function fetchData({
113
112
  params.delegations.__args.block = { number: snapshot };
114
113
  }
115
114
 
115
+ if (spaces !== null) {
116
+ params.delegations.__args.where.space_in = spaces;
117
+ }
118
+
116
119
  return (await subgraphRequest(url, params)).delegations || [];
117
120
  }