@snapshot-labs/snapshot.js 0.12.6 → 0.12.8

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.6",
3
+ "version": "0.12.8",
4
4
  "repository": "snapshot-labs/snapshot.js",
5
5
  "license": "MIT",
6
6
  "main": "dist/snapshot.cjs.js",
package/src/networks.json CHANGED
@@ -1261,6 +1261,20 @@
1261
1261
  "start": 27458402,
1262
1262
  "logo": "ipfs://QmZZnwR1y6cU1sare2TQmwqkNDLXQxD4GdPrmHLmUoPtbU"
1263
1263
  },
1264
+ "33111": {
1265
+ "key": "33111",
1266
+ "name": "Curtis",
1267
+ "shortName": "apechain",
1268
+ "chainId": 33111,
1269
+ "network": "mainnet",
1270
+ "multicall": "0xc454132B017b55b427f45078E335549A7124f5f7",
1271
+ "rpc": [],
1272
+ "explorer": {
1273
+ "url": "https://explorer.curtis.apechain.com"
1274
+ },
1275
+ "start": 6661339,
1276
+ "logo": "ipfs://bafkreicljxttjq2xkgfwwpii5xegirgq2ctrnsjnzelxudjj33qzq65apu"
1277
+ },
1264
1278
  "42161": {
1265
1279
  "key": "42161",
1266
1280
  "name": "Arbitrum One",
@@ -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
  }