@snapshot-labs/snapshot.js 0.3.84 → 0.3.87

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/dist/index.d.ts CHANGED
@@ -377,7 +377,7 @@ declare const _default: {
377
377
  1: string;
378
378
  4: string;
379
379
  42: string;
380
- 97: string;
380
+ 56: string;
381
381
  100: string;
382
382
  137: string;
383
383
  250: string;
@@ -1094,7 +1094,7 @@ function getSnapshots(network, snapshot, provider, networks) {
1094
1094
  number: true
1095
1095
  }
1096
1096
  };
1097
- url = 'https://blockfinder.snapshot.org/graphql';
1097
+ url = 'https://blockfinder.snapshot.org';
1098
1098
  return [4 /*yield*/, subgraphRequest(url, query)];
1099
1099
  case 2:
1100
1100
  data = _a.sent();
@@ -1359,15 +1359,12 @@ var networks = {
1359
1359
  network: "mainnet",
1360
1360
  multicall: "0x1ee38d535d541c55c9dae27b12edf090c608e6fb",
1361
1361
  rpc: [
1362
+ "https://rpc.ankr.com/bsc",
1362
1363
  "https://speedy-nodes-nyc.moralis.io/b9aed21e7bb7bdeb35972c9a/bsc/mainnet/archive",
1363
- "https://apis.ankr.com/c0d871dd3c6d4529b01c9362a9b79e89/6106d4a3ec1d1bcc87ec72158f8fd089/binance/archive/main",
1364
1364
  "https://bsc.getblock.io/mainnet/?api_key=91f8195f-bf46-488f-846a-73d6853790e7",
1365
1365
  "https://bsc-private-dataseed1.nariox.org",
1366
- "https://bsc-private-dataseed2.nariox.org",
1367
1366
  "https://bsc-dataseed1.ninicoin.io",
1368
- "https://bsc-dataseed1.binance.org",
1369
- "https://bsc-dataseed2.binance.org",
1370
- "https://bsc-dataseed3.binance.org"
1367
+ "https://bsc-dataseed1.binance.org"
1371
1368
  ],
1372
1369
  explorer: "https://bscscan.com",
1373
1370
  start: 461230,
@@ -1897,6 +1894,19 @@ var networks = {
1897
1894
  ],
1898
1895
  explorer: "https://baobab.scope.klaytn.com/",
1899
1896
  logo: "ipfs://QmYACyZcidcFtMo4Uf9H6ZKUxTP2TQPjGzNjcUjqYa64dt"
1897
+ },
1898
+ "1002": {
1899
+ key: "1002",
1900
+ name: "KardiaChain Mainnet",
1901
+ shortName: "KAI",
1902
+ chainId: 24,
1903
+ network: "mainnet",
1904
+ multicall: "0xd9c92F2287B7802A37eC9BEce96Aa65fb5f31E1b",
1905
+ rpc: [
1906
+ "https://kai-internal.kardiachain.io"
1907
+ ],
1908
+ explorer: "https://explorer.kardiachain.io",
1909
+ logo: "ipfs://QmVH3uyPQDcrPC1DMUWCb7HayMv1oMAiKehuWwP2C2fdgM"
1900
1910
  },
1901
1911
  "1088": {
1902
1912
  key: "1088",
@@ -2577,18 +2587,23 @@ function getHash(data) {
2577
2587
  }
2578
2588
  function verify$1(address, sig, data) {
2579
2589
  return __awaiter(this, void 0, void 0, function () {
2580
- var domain, types, message, recoverAddress, hash;
2590
+ var domain, types, message, hash, recoverAddress;
2581
2591
  return __generator(this, function (_a) {
2582
2592
  switch (_a.label) {
2583
2593
  case 0:
2584
2594
  domain = data.domain, types = data.types, message = data.message;
2585
- recoverAddress = wallet.verifyTypedData(domain, types, message, sig);
2586
2595
  hash = getHash(data);
2587
2596
  console.log('Hash', hash);
2588
2597
  console.log('Address', address);
2589
- console.log('Recover address', recoverAddress);
2590
- if (address === recoverAddress)
2591
- return [2 /*return*/, true];
2598
+ try {
2599
+ recoverAddress = wallet.verifyTypedData(domain, types, message, sig);
2600
+ console.log('Recover address', recoverAddress);
2601
+ if (address === recoverAddress)
2602
+ return [2 /*return*/, true];
2603
+ }
2604
+ catch (e) {
2605
+ console.log('Could not recoverAddress:' + e.message);
2606
+ }
2592
2607
  console.log('Check EIP1271 signature');
2593
2608
  return [4 /*yield*/, verify(address, sig, hash)];
2594
2609
  case 1: return [2 /*return*/, _a.sent()];
@@ -2913,7 +2928,7 @@ var SNAPSHOT_SUBGRAPH_URL = {
2913
2928
  '1': 'https://gateway.thegraph.com/api/0f15b42bdeff7a063a4e1757d7e2f99e/deployments/id/QmXvEzRJXby7KFuTr7NJsM47hGefM5VckEXZrQyZzL9eJd',
2914
2929
  '4': 'https://api.thegraph.com/subgraphs/name/snapshot-labs/snapshot-rinkeby',
2915
2930
  '42': 'https://api.thegraph.com/subgraphs/name/snapshot-labs/snapshot-kovan',
2916
- '97': 'https://api.thegraph.com/subgraphs/name/snapshot-labs/snapshot-binance-smart-chain',
2931
+ '56': 'https://api.thegraph.com/subgraphs/name/snapshot-labs/snapshot-binance-smart-chain',
2917
2932
  '100': 'https://api.thegraph.com/subgraphs/name/snapshot-labs/snapshot-gnosis-chain',
2918
2933
  '137': 'https://api.thegraph.com/subgraphs/name/snapshot-labs/snapshot-polygon',
2919
2934
  '250': 'https://api.thegraph.com/subgraphs/name/snapshot-labs/snapshot-fantom'
@@ -3155,6 +3170,9 @@ function getDelegatesBySpace(network, space, snapshot) {
3155
3170
  return __generator(this, function (_a) {
3156
3171
  switch (_a.label) {
3157
3172
  case 0:
3173
+ if (!SNAPSHOT_SUBGRAPH_URL[network]) {
3174
+ return [2 /*return*/, Promise.reject("Delegation subgraph not available for network " + network)];
3175
+ }
3158
3176
  spaceIn = ['', space];
3159
3177
  if (space.includes('.eth'))
3160
3178
  spaceIn.push(space.replace('.eth', ''));
@@ -1085,7 +1085,7 @@ function getSnapshots(network, snapshot, provider, networks) {
1085
1085
  number: true
1086
1086
  }
1087
1087
  };
1088
- url = 'https://blockfinder.snapshot.org/graphql';
1088
+ url = 'https://blockfinder.snapshot.org';
1089
1089
  return [4 /*yield*/, subgraphRequest(url, query)];
1090
1090
  case 2:
1091
1091
  data = _a.sent();
@@ -1350,15 +1350,12 @@ var networks = {
1350
1350
  network: "mainnet",
1351
1351
  multicall: "0x1ee38d535d541c55c9dae27b12edf090c608e6fb",
1352
1352
  rpc: [
1353
+ "https://rpc.ankr.com/bsc",
1353
1354
  "https://speedy-nodes-nyc.moralis.io/b9aed21e7bb7bdeb35972c9a/bsc/mainnet/archive",
1354
- "https://apis.ankr.com/c0d871dd3c6d4529b01c9362a9b79e89/6106d4a3ec1d1bcc87ec72158f8fd089/binance/archive/main",
1355
1355
  "https://bsc.getblock.io/mainnet/?api_key=91f8195f-bf46-488f-846a-73d6853790e7",
1356
1356
  "https://bsc-private-dataseed1.nariox.org",
1357
- "https://bsc-private-dataseed2.nariox.org",
1358
1357
  "https://bsc-dataseed1.ninicoin.io",
1359
- "https://bsc-dataseed1.binance.org",
1360
- "https://bsc-dataseed2.binance.org",
1361
- "https://bsc-dataseed3.binance.org"
1358
+ "https://bsc-dataseed1.binance.org"
1362
1359
  ],
1363
1360
  explorer: "https://bscscan.com",
1364
1361
  start: 461230,
@@ -1888,6 +1885,19 @@ var networks = {
1888
1885
  ],
1889
1886
  explorer: "https://baobab.scope.klaytn.com/",
1890
1887
  logo: "ipfs://QmYACyZcidcFtMo4Uf9H6ZKUxTP2TQPjGzNjcUjqYa64dt"
1888
+ },
1889
+ "1002": {
1890
+ key: "1002",
1891
+ name: "KardiaChain Mainnet",
1892
+ shortName: "KAI",
1893
+ chainId: 24,
1894
+ network: "mainnet",
1895
+ multicall: "0xd9c92F2287B7802A37eC9BEce96Aa65fb5f31E1b",
1896
+ rpc: [
1897
+ "https://kai-internal.kardiachain.io"
1898
+ ],
1899
+ explorer: "https://explorer.kardiachain.io",
1900
+ logo: "ipfs://QmVH3uyPQDcrPC1DMUWCb7HayMv1oMAiKehuWwP2C2fdgM"
1891
1901
  },
1892
1902
  "1088": {
1893
1903
  key: "1088",
@@ -2568,18 +2578,23 @@ function getHash(data) {
2568
2578
  }
2569
2579
  function verify$1(address, sig, data) {
2570
2580
  return __awaiter(this, void 0, void 0, function () {
2571
- var domain, types, message, recoverAddress, hash;
2581
+ var domain, types, message, hash, recoverAddress;
2572
2582
  return __generator(this, function (_a) {
2573
2583
  switch (_a.label) {
2574
2584
  case 0:
2575
2585
  domain = data.domain, types = data.types, message = data.message;
2576
- recoverAddress = verifyTypedData(domain, types, message, sig);
2577
2586
  hash = getHash(data);
2578
2587
  console.log('Hash', hash);
2579
2588
  console.log('Address', address);
2580
- console.log('Recover address', recoverAddress);
2581
- if (address === recoverAddress)
2582
- return [2 /*return*/, true];
2589
+ try {
2590
+ recoverAddress = verifyTypedData(domain, types, message, sig);
2591
+ console.log('Recover address', recoverAddress);
2592
+ if (address === recoverAddress)
2593
+ return [2 /*return*/, true];
2594
+ }
2595
+ catch (e) {
2596
+ console.log('Could not recoverAddress:' + e.message);
2597
+ }
2583
2598
  console.log('Check EIP1271 signature');
2584
2599
  return [4 /*yield*/, verify(address, sig, hash)];
2585
2600
  case 1: return [2 /*return*/, _a.sent()];
@@ -2904,7 +2919,7 @@ var SNAPSHOT_SUBGRAPH_URL = {
2904
2919
  '1': 'https://gateway.thegraph.com/api/0f15b42bdeff7a063a4e1757d7e2f99e/deployments/id/QmXvEzRJXby7KFuTr7NJsM47hGefM5VckEXZrQyZzL9eJd',
2905
2920
  '4': 'https://api.thegraph.com/subgraphs/name/snapshot-labs/snapshot-rinkeby',
2906
2921
  '42': 'https://api.thegraph.com/subgraphs/name/snapshot-labs/snapshot-kovan',
2907
- '97': 'https://api.thegraph.com/subgraphs/name/snapshot-labs/snapshot-binance-smart-chain',
2922
+ '56': 'https://api.thegraph.com/subgraphs/name/snapshot-labs/snapshot-binance-smart-chain',
2908
2923
  '100': 'https://api.thegraph.com/subgraphs/name/snapshot-labs/snapshot-gnosis-chain',
2909
2924
  '137': 'https://api.thegraph.com/subgraphs/name/snapshot-labs/snapshot-polygon',
2910
2925
  '250': 'https://api.thegraph.com/subgraphs/name/snapshot-labs/snapshot-fantom'
@@ -3146,6 +3161,9 @@ function getDelegatesBySpace(network, space, snapshot) {
3146
3161
  return __generator(this, function (_a) {
3147
3162
  switch (_a.label) {
3148
3163
  case 0:
3164
+ if (!SNAPSHOT_SUBGRAPH_URL[network]) {
3165
+ return [2 /*return*/, Promise.reject("Delegation subgraph not available for network " + network)];
3166
+ }
3149
3167
  spaceIn = ['', space];
3150
3168
  if (space.includes('.eth'))
3151
3169
  spaceIn.push(space.replace('.eth', ''));