@certik/skynet 0.10.65 → 0.11.0

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/examples/producer CHANGED
@@ -8,7 +8,7 @@
8
8
  // $ examples/producer deploy --protocol eth
9
9
  // $ examples/producer --help
10
10
 
11
- const { producer, every, SENSITIVE_VALUE, ERROR_LEVEL } = require("../app");
11
+ import { producer, every, SENSITIVE_VALUE, ERROR_LEVEL } from "../app";
12
12
 
13
13
  async function produce({ protocol, from, to, verbose, send }) {
14
14
  console.log("produce called with", protocol, from, to, verbose);
package/graphql.d.ts CHANGED
@@ -1,5 +1,3 @@
1
- import { Response } from "node-fetch";
2
-
3
1
  type GraphqlVariables = { [key: string]: any };
4
2
 
5
3
  export function gql(query: string, variables?: GraphqlVariables): Promise<Response>;
package/graphql.js CHANGED
@@ -1,8 +1,6 @@
1
- const fetch = require("node-fetch");
2
-
3
1
  const GRAPHQL_API_KEY = process.env.SKYNET_GRAPHQL_API_KEY || process.env.GRAPHQL_API_KEY;
4
2
 
5
- async function gql(url, query, variables = {}) {
3
+ export async function gql(url, query, variables = {}) {
6
4
  const res = await fetch(url, {
7
5
  method: "POST",
8
6
  headers: {
@@ -24,7 +22,3 @@ async function gql(url, query, variables = {}) {
24
22
  throw new Error(await res.text());
25
23
  }
26
24
  }
27
-
28
- module.exports = {
29
- gql,
30
- };
package/indexer.js CHANGED
@@ -1,12 +1,12 @@
1
- const meow = require("meow");
2
- const { createRecord, getRecordByKey } = require("./dynamodb");
3
- const { getEnvironment } = require("./env");
4
- const { exponentialRetry } = require("./availability");
5
- const { range: numberRange, fillRange: fillNumberRange } = require("./util");
6
- const { getSelectorFlags, getSelectorDesc, toSelectorString } = require("./selector");
7
- const { getBinaryName } = require("./cli");
8
- const { inline } = require("./log");
9
- const { findDateAfter, dateRange, daysInRange: fillDateRange } = require("./date");
1
+ import meow from "meow";
2
+ import { createRecord, getRecordByKey } from "./dynamodb.js";
3
+ import { getEnvironment } from "./env.js";
4
+ import { exponentialRetry } from "./availability.js";
5
+ import { range as numberRange, fillRange as fillNumberRange } from "./util.js";
6
+ import { getSelectorFlags, getSelectorDesc, toSelectorString } from "./selector.js";
7
+ import { getBinaryName } from "./cli.js";
8
+ import { inline } from "./log.js";
9
+ import { findDateAfter, dateRange, daysInRange as fillDateRange } from "./date.js";
10
10
 
11
11
  const STATE_TABLE_NAME = "skynet-" + getEnvironment() + "-indexer-state";
12
12
 
@@ -623,7 +623,7 @@ ${getSelectorDesc(selector)}
623
623
  return { run };
624
624
  }
625
625
 
626
- module.exports = {
626
+ export {
627
627
  increaseId,
628
628
  createModeIndexerApp,
629
629
  createIndexerApp,
package/kafka.js CHANGED
@@ -1,13 +1,12 @@
1
- const meow = require("meow");
2
- const { getEnvironment, getEnvOrThrow } = require("./env");
3
- const { wait } = require("./availability");
4
- const { Kafka, logLevel } = require("kafkajs");
5
- const { getJobName, getSelectorFlags, getSelectorDesc, toSelectorString } = require("./selector");
6
- const { createRecord, getRecordByKey, deleteRecordsByHashKey } = require("./dynamodb");
7
- const { exponentialRetry } = require("./availability");
8
- const { useLock } = require("./distributed-lock");
9
- const { getBinaryName } = require("./cli");
10
- const { inline } = require("./log");
1
+ import meow from "meow";
2
+ import { Kafka, logLevel } from "kafkajs";
3
+ import { getEnvironment, getEnvOrThrow } from "./env.js";
4
+ import { getJobName, getSelectorFlags, getSelectorDesc, toSelectorString } from "./selector.js";
5
+ import { createRecord, getRecordByKey, deleteRecordsByHashKey } from "./dynamodb.js";
6
+ import { wait, exponentialRetry } from "./availability.js";
7
+ import { useLock } from "./distributed-lock.js";
8
+ import { getBinaryName } from "./cli.js";
9
+ import { inline } from "./log.js";
11
10
 
12
11
  const STATE_TABLE_NAME = "skynet-" + getEnvironment() + "-indexer-state";
13
12
 
@@ -438,7 +437,7 @@ ${getSelectorDesc(selector)}
438
437
  return { run };
439
438
  }
440
439
 
441
- module.exports = {
440
+ export {
442
441
  createProducerApp,
443
442
  createConsumerApp,
444
443
  produceMessages,
package/log.js CHANGED
@@ -40,7 +40,7 @@ const inline = {
40
40
  },
41
41
  };
42
42
 
43
- module.exports = {
43
+ export {
44
44
  getLine,
45
45
  print,
46
46
  inline,
package/metric.js CHANGED
@@ -1,8 +1,8 @@
1
- const { getDocClient } = require("./dynamodb");
1
+ import { getDocClient } from "./dynamodb.js";
2
2
 
3
3
  /* Assume table has name/timestamp/value fields */
4
4
 
5
- async function getMetricAt(tableName, name, timestamp) {
5
+ export async function getMetricAt(tableName, name, timestamp) {
6
6
  const docClient = getDocClient();
7
7
 
8
8
  const query = await docClient
@@ -31,7 +31,7 @@ async function getMetricAt(tableName, name, timestamp) {
31
31
  }
32
32
  }
33
33
 
34
- async function getMetricPreviousValue(tableName, name, timestamp) {
34
+ export async function getMetricPreviousValue(tableName, name, timestamp) {
35
35
  const docClient = getDocClient();
36
36
 
37
37
  const query = await docClient
@@ -58,8 +58,3 @@ async function getMetricPreviousValue(tableName, name, timestamp) {
58
58
  return value;
59
59
  }
60
60
  }
61
-
62
- module.exports = {
63
- getMetricAt,
64
- getMetricPreviousValue
65
- }
package/monitor.js CHANGED
@@ -1,10 +1,9 @@
1
- const meow = require("meow");
2
- const fetch = require("node-fetch");
3
- const { getSelectorFlags, getSelectorDesc, toSelectorString } = require("./selector");
4
- const { getBinaryName } = require("./cli");
5
- const { exponentialRetry } = require("./availability");
6
- const { postGenieMessage } = require("./opsgenie");
7
- const { getJobName } = require("./deploy");
1
+ import meow from "meow";
2
+ import { getSelectorFlags, getSelectorDesc, toSelectorString } from "./selector.js";
3
+ import { getBinaryName } from "./cli.js";
4
+ import { exponentialRetry } from "./availability.js";
5
+ import { postGenieMessage } from "./opsgenie.js";
6
+ import { getJobName } from "./deploy.js";
8
7
 
9
8
  const ERROR_LEVEL = {
10
9
  INFO: "Info",
@@ -49,6 +48,7 @@ async function getMostRecentJobLaunch(name) {
49
48
  const recentFinishedJob = jobs.reverse().find((job) => {
50
49
  // filter out monitor job
51
50
  return job.ID.indexOf("-monitor") === -1 && job.Status === "dead";
51
+
52
52
  });
53
53
 
54
54
  if (!recentFinishedJob) {
@@ -193,4 +193,4 @@ ${
193
193
  return { monitor };
194
194
  }
195
195
 
196
- module.exports = { createMonitor, ERROR_LEVEL, LEVEL_EMOJI };
196
+ export { createMonitor, ERROR_LEVEL, LEVEL_EMOJI };
package/opensearch.js CHANGED
@@ -1,7 +1,7 @@
1
- const { Client } = require("@opensearch-project/opensearch");
1
+ import { Client } from "@opensearch-project/opensearch";
2
2
 
3
3
  // newOpensearchClient creates a new opensearch client with the given endpoint, key, secret and extra opensearch client options.
4
- function newOpensearchClient(endpoint, key, secret, options = {}) {
4
+ export function newOpensearchClient(endpoint, key, secret, options = {}) {
5
5
  return new Client({
6
6
  node: endpoint,
7
7
  auth: {
@@ -18,7 +18,7 @@ function newOpensearchClient(endpoint, key, secret, options = {}) {
18
18
  // the index from growing too large.
19
19
  // Returns an object with status and result properties. The status is either "ok" or "error". The result is the response from opensearch
20
20
  // if the status is "ok" or the error message if the status is "error".
21
- async function sendToOpensearch(client, appName, index, record, indexSuffixes = []) {
21
+ export async function sendToOpensearch(client, appName, index, record, indexSuffixes = []) {
22
22
  try {
23
23
  const result = await client.index({
24
24
  index: indexSuffixes ? [index, ...indexSuffixes].join("-") : index,
@@ -32,8 +32,3 @@ async function sendToOpensearch(client, appName, index, record, indexSuffixes =
32
32
  return { status: "error", result: err.stack ? err.stack : err };
33
33
  }
34
34
  }
35
-
36
- module.exports = {
37
- newOpensearchClient,
38
- sendToOpensearch,
39
- };
package/opsgenie.js CHANGED
@@ -1,5 +1,4 @@
1
- const fetch = require("node-fetch");
2
- const md5 = require("md5");
1
+ import md5 from "md5";
3
2
 
4
3
  function getGenieKey(key) {
5
4
  return key || process.env.OPSGENIE_API_KEY;
@@ -9,7 +8,7 @@ function getGenieEndPoint() {
9
8
  return process.env.OPSGENIE_END_POINT || "https://api.opsgenie.com/v2/alerts";
10
9
  }
11
10
 
12
- async function postGenieMessage(body, apiKey, verbose) {
11
+ export async function postGenieMessage(body, apiKey, verbose) {
13
12
  try {
14
13
  const genieKey = apiKey || getGenieKey();
15
14
  const genieEndPoint = getGenieEndPoint(genieKey);
@@ -45,5 +44,3 @@ async function postGenieMessage(body, apiKey, verbose) {
45
44
  throw error;
46
45
  }
47
46
  }
48
-
49
- module.exports = { postGenieMessage };
package/package.json CHANGED
@@ -1,39 +1,47 @@
1
1
  {
2
2
  "name": "@certik/skynet",
3
- "version": "0.10.65",
3
+ "version": "0.11.0",
4
4
  "description": "Skynet Shared JS library",
5
+ "type": "module",
5
6
  "main": "index.js",
6
7
  "author": "CertiK Engineering",
7
8
  "scripts": {
8
9
  "lint": "eslint *.js test",
9
- "test": "doppler run -- ava"
10
+ "test": "doppler run -- ava --timeout=1m",
11
+ "format": "prettier --write '*.js' '**/*.js'",
12
+ "pub": "npm publish --access public"
10
13
  },
11
14
  "engines": {
12
- "node": ">= 14"
15
+ "node": ">= 18"
13
16
  },
14
17
  "dependencies": {
18
+ "@aws-sdk/client-dynamodb": "^3.409.0",
19
+ "@aws-sdk/client-s3": "^3.409.0",
20
+ "@aws-sdk/client-sqs": "^3.409.0",
21
+ "@aws-sdk/lib-dynamodb": "^3.409.0",
15
22
  "@opensearch-project/opensearch": "^2.3.1",
16
- "@slack/web-api": "^6.4.0",
17
- "ably": "^1.2.22",
18
- "abort-controller": "^3.0.0",
19
- "aws-sdk": "^2.1164.0",
23
+ "@slack/web-api": "^6.9.0",
24
+ "ably": "^1.2.44",
20
25
  "bottleneck": "^2.19.5",
21
- "chalk": "^4.1.2",
22
- "execa": "^5.1.1",
23
- "express": "^4.18.1",
24
- "kafkajs": "^2.1.0",
26
+ "chalk": "^5.3.0",
27
+ "execa": "^8.0.1",
28
+ "express": "^4.18.2",
29
+ "kafkajs": "^2.2.4",
25
30
  "md5": "^2.3.0",
26
- "meow": "^9.0.0",
27
- "node-fetch": "^2.6.7",
28
- "snowflake-sdk": "^1.6.23",
29
- "web3": "^1.3.5",
30
- "which": "^2.0.2"
31
+ "meow": "^12.1.1",
32
+ "snowflake-sdk": "^1.8.0",
33
+ "web3": "^4.1.1",
34
+ "which": "^4.0.0"
31
35
  },
32
36
  "devDependencies": {
33
- "ava": "^5.0.1",
34
- "eslint": "^8.39.0",
35
- "eslint-plugin-import": "^2.27.5",
36
- "sinon": "^14.0.0"
37
+ "ava": "^5.3.1",
38
+ "eslint": "^8.49.0",
39
+ "eslint-plugin-import": "^2.28.1",
40
+ "prettier": "^3.0.3",
41
+ "sinon": "^15.2.0"
37
42
  },
38
- "license": "MIT"
43
+ "license": "MIT",
44
+ "publishConfig": {
45
+ "access": "public"
46
+ }
39
47
  }
package/price.js CHANGED
@@ -1,24 +1,25 @@
1
- const { getDocClient } = require("./dynamodb");
1
+ import { QueryCommand } from "@aws-sdk/lib-dynamodb";
2
+ import { getDocClient } from "./dynamodb.js";
2
3
 
3
4
  async function queryPrice(tableName, address, timestamp, op = "<") {
4
5
  const docClient = getDocClient();
5
6
 
6
- return await docClient
7
- .query({
7
+ return await docClient.send(
8
+ new QueryCommand({
8
9
  TableName: tableName,
9
10
  KeyConditionExpression: `#address = :address and #timestamp ${op} :timestamp`,
10
11
  ExpressionAttributeNames: {
11
12
  "#timestamp": "timestamp",
12
- "#address": "address"
13
+ "#address": "address",
13
14
  },
14
15
  ExpressionAttributeValues: {
15
16
  ":timestamp": timestamp,
16
- ":address": address
17
+ ":address": address,
17
18
  },
18
19
  Limit: 1,
19
- ScanIndexForward: false
20
- })
21
- .promise();
20
+ ScanIndexForward: false,
21
+ }),
22
+ );
22
23
  }
23
24
 
24
25
  async function getPricePreviousRecord(tableName, address, timestamp) {
@@ -42,7 +43,4 @@ async function getPriceClosestTo(tableName, address, timestamp) {
42
43
  }
43
44
  }
44
45
 
45
- module.exports = {
46
- getPriceClosestTo,
47
- getPricePreviousRecord
48
- };
46
+ export { getPriceClosestTo, getPricePreviousRecord };
package/primitive.js CHANGED
@@ -71,7 +71,8 @@ async function overrideScoreAndIssues(
71
71
  issues,
72
72
  };
73
73
  }
74
- module.exports = {
74
+
75
+ export {
75
76
  getOverrides,
76
77
  overrideScoreAndIssues,
77
78
  };
package/proxy.d.ts CHANGED
@@ -1,5 +1,3 @@
1
- import { RequestInit, Response } from "node-fetch";
2
-
3
1
  type Options = {
4
2
  verbose: boolean;
5
3
  timeout: number;
package/proxy.js CHANGED
@@ -1,6 +1,3 @@
1
- const fetch = require("node-fetch");
2
- const AbortController = require("abort-controller");
3
-
4
1
  const PROXY_INSTANCES = [
5
2
  "https://uer87capga.execute-api.us-east-1.amazonaws.com/", // 0
6
3
  "https://t7utq0a5hb.execute-api.us-east-1.amazonaws.com/",
@@ -154,4 +151,4 @@ async function proxyFetch(url, options = {}) {
154
151
  }
155
152
  }
156
153
 
157
- module.exports = proxyFetch;
154
+ export default proxyFetch;
package/s3.js CHANGED
@@ -1,10 +1,20 @@
1
- const { getAWSAccessKeyId, getAWSSecretAccessKey, getAWSRegion } = require("./env");
2
- const { S3 } = require("aws-sdk");
1
+ import {
2
+ S3Client,
3
+ GetObjectCommand,
4
+ HeadObjectCommand,
5
+ PutObjectCommand,
6
+ DeleteObjectCommand,
7
+ ListObjectsV2Command,
8
+ NotFound,
9
+ } from "@aws-sdk/client-s3";
10
+ import { getAWSAccessKeyId, getAWSSecretAccessKey, getAWSRegion } from "./env.js";
3
11
 
4
12
  function getS3() {
5
- return new S3({
6
- accessKeyId: getAWSAccessKeyId(),
7
- secretAccessKey: getAWSSecretAccessKey(),
13
+ return new S3Client({
14
+ credentials: {
15
+ accessKeyId: getAWSAccessKeyId(),
16
+ secretAccessKey: getAWSSecretAccessKey(),
17
+ },
8
18
  region: getAWSRegion(),
9
19
  });
10
20
  }
@@ -15,8 +25,8 @@ async function readFile(bucketName, key, verbose = false) {
15
25
  const params = { Bucket: bucketName, Key: key };
16
26
 
17
27
  try {
18
- const result = await s3.getObject(params).promise();
19
- return result.Body.toString("utf-8");
28
+ const result = await s3.send(new GetObjectCommand(params));
29
+ return result.Body.transformToString();
20
30
  } catch (noSuchKeyErr) {
21
31
  if (verbose) {
22
32
  console.log("no such bucket or key", bucketName, key);
@@ -30,11 +40,11 @@ async function hasFile(bucketName, key) {
30
40
  const s3 = getS3();
31
41
 
32
42
  try {
33
- await s3.headObject({ Bucket: bucketName, Key: key }).promise();
43
+ await s3.send(new HeadObjectCommand({ Bucket: bucketName, Key: key }));
34
44
 
35
45
  return true;
36
46
  } catch (headErr) {
37
- if (headErr.statusCode === 404) {
47
+ if (headErr instanceof NotFound) {
38
48
  return false;
39
49
  }
40
50
 
@@ -67,7 +77,7 @@ async function writeFile(bucketName, key, body, options = {}) {
67
77
  console.log("uploading", key);
68
78
  }
69
79
 
70
- await s3.upload(params).promise();
80
+ await s3.send(new PutObjectCommand(params));
71
81
  }
72
82
 
73
83
  async function deleteFile(bucketName, key, verbose = false) {
@@ -76,7 +86,7 @@ async function deleteFile(bucketName, key, verbose = false) {
76
86
  const params = { Bucket: bucketName, Key: key };
77
87
 
78
88
  try {
79
- await s3.deleteObject(params).promise();
89
+ await s3.send(new DeleteObjectCommand(params));
80
90
  } catch (noSuchKeyErr) {
81
91
  if (verbose) {
82
92
  console.log("no such bucket or key", bucketName, key);
@@ -95,7 +105,7 @@ async function listKeys(bucketname, prefix, continuationToken) {
95
105
 
96
106
  let data = null;
97
107
  try {
98
- data = await s3.listObjectsV2(params).promise();
108
+ data = await s3.send(new ListObjectsV2Command(params));
99
109
  } catch (err) {
100
110
  if (err.statusCode && err.statusCode === 400) {
101
111
  return null;
@@ -112,11 +122,4 @@ async function listKeys(bucketname, prefix, continuationToken) {
112
122
  return res;
113
123
  }
114
124
 
115
- module.exports = {
116
- getS3,
117
- hasFile,
118
- readFile,
119
- writeFile,
120
- deleteFile,
121
- listKeys,
122
- };
125
+ export { getS3, hasFile, readFile, writeFile, deleteFile, listKeys };
package/scan.js CHANGED
@@ -1,6 +1,5 @@
1
- const { exponentialRetry, wait } = require("./availability");
2
- const { PROTOCOLS } = require("./const");
3
- const fetch = require("node-fetch");
1
+ import { exponentialRetry, wait } from "./availability.js";
2
+ import { PROTOCOLS } from "./const.js";
4
3
 
5
4
  const BATCH_SIZE = 10_000; // Max number of transactions fetched from scan api at once
6
5
 
@@ -72,4 +71,4 @@ async function streamTxs(address, since, to, callback, verbose) {
72
71
  }
73
72
  }
74
73
 
75
- module.exports = { streamTxs, fetchTxs, fetchTxsWithRetry };
74
+ export { streamTxs, fetchTxs, fetchTxsWithRetry };
package/selector.js CHANGED
@@ -68,7 +68,7 @@ function getJobName(name, selectorFlags, mode = null) {
68
68
  return jobName;
69
69
  }
70
70
 
71
- module.exports = {
71
+ export {
72
72
  getJobName,
73
73
  getSelectorDesc,
74
74
  getSelectorFlags,
package/slack.js CHANGED
@@ -1,4 +1,4 @@
1
- const { WebClient } = require("@slack/web-api");
1
+ import { WebClient } from "@slack/web-api";
2
2
 
3
3
  function getToken() {
4
4
  return process.env.SKYNET_SLACK_TOKEN;
@@ -89,4 +89,4 @@ async function postMessage(channel, message, verbose) {
89
89
  }
90
90
  }
91
91
 
92
- module.exports = { getClient, findConversation, postMessage };
92
+ export { getClient, findConversation, postMessage };
package/snowflake.js CHANGED
@@ -1,6 +1,6 @@
1
- const snowflake = require("snowflake-sdk");
2
- const { promisify } = require("util");
3
- const { ensureAndGet } = require("./env");
1
+ import snowflake from "snowflake-sdk";
2
+ import { promisify } from "util";
3
+ import { ensureAndGet } from "./env.js";
4
4
 
5
5
  async function getConnection(options) {
6
6
  const connection = snowflake.createConnection({
@@ -30,7 +30,7 @@ async function executeSql(options, sql, binds) {
30
30
  });
31
31
  }
32
32
 
33
- module.exports = {
33
+ export {
34
34
  getConnection,
35
35
  executeSql,
36
36
  };
package/sqs.js CHANGED
@@ -1,12 +1,10 @@
1
- const { SQS } = require("aws-sdk");
2
- const { getAWSAccessKeyId, getAWSSecretAccessKey, getAWSRegion } = require("./env");
1
+ import { SQS } from "@aws-sdk/client-sqs";
2
+ import { getAWSAccessKeyId, getAWSSecretAccessKey, getAWSRegion } from "./env.js";
3
3
 
4
- function getSQS() {
4
+ export function getSQS() {
5
5
  return new SQS({
6
6
  accessKeyId: getAWSAccessKeyId(),
7
7
  secretAccessKey: getAWSSecretAccessKey(),
8
8
  region: getAWSRegion(),
9
9
  });
10
10
  }
11
-
12
- module.exports = { getSQS };
package/token.js CHANGED
@@ -1,6 +1,6 @@
1
- const { getEnvironment } = require("./env");
2
- const { getPriceClosestTo } = require("./price");
3
- const BigNumber = require("bignumber.js");
1
+ import { getEnvironment } from "./env.js";
2
+ import { getPriceClosestTo } from "./price.js";
3
+ import BigNumber from "bignumber.js";
4
4
 
5
5
  const TOKEN_PRICE_TABLE_NAME = `skynet-${getEnvironment()}-token-prices`;
6
6
  const TOKEN_PRICE_CACHE = {};
@@ -39,7 +39,7 @@ function toHumanDecimal(bigNumber, decimals) {
39
39
  return new BigNumber(bigNumber).dividedBy(dividend);
40
40
  }
41
41
 
42
- module.exports = {
42
+ export {
43
43
  getTokenPriceAt,
44
44
  toNativeDecimal,
45
45
  toHumanDecimal,
package/transaction.js CHANGED
@@ -1,6 +1,5 @@
1
- const fetch = require("node-fetch");
2
- const { PROTOCOLS } = require("./const");
3
- const { exponentialRetry } = require("./availability");
1
+ import { PROTOCOLS } from "./const.js";
2
+ import { exponentialRetry } from "./availability.js";
4
3
 
5
4
  async function getTxReceipt(protocol, txHash, verbose = false) {
6
5
  const { endpoint } = PROTOCOLS[protocol];
@@ -38,6 +37,6 @@ async function getTxReceipt(protocol, txHash, verbose = false) {
38
37
  return result;
39
38
  }
40
39
 
41
- module.exports = {
40
+ export {
42
41
  getTxReceipt
43
42
  };
package/util.js CHANGED
@@ -58,7 +58,7 @@ function chunk(array, count) {
58
58
  return result;
59
59
  }
60
60
 
61
- module.exports = {
61
+ export {
62
62
  arrayGroup,
63
63
  partition,
64
64
  range,
package/web3.js CHANGED
@@ -1,7 +1,7 @@
1
- const Web3 = require("web3");
2
- const { PROTOCOLS } = require("./const");
3
- const { MULTICALL } = require("./abi");
4
- const { chunk } = require("./util");
1
+ import { Web3 } from "web3";
2
+ import { PROTOCOLS } from "./const.js";
3
+ import { MULTICALL } from "./abi.js";
4
+ import { chunk } from "./util.js";
5
5
  const MULTICALL_CHUNK_SIZE = 400;
6
6
 
7
7
  function newWeb3ByProtocol(protocol) {
@@ -110,7 +110,7 @@ async function multiCall({ protocol, limiter = null, target, abi, calls }) {
110
110
  return { actualCallCount: callChunks.length, output: responses };
111
111
  }
112
112
 
113
- module.exports = {
113
+ export {
114
114
  newWeb3ByProtocol,
115
115
  singleCall,
116
116
  multiCall,
package/.eslintrc.js DELETED
@@ -1,13 +0,0 @@
1
- module.exports = {
2
- env: {
3
- node: true,
4
- browser: false,
5
- commonjs: true,
6
- es2021: true,
7
- },
8
- extends: ["eslint:recommended", "plugin:import/recommended"],
9
- parserOptions: {
10
- ecmaVersion: 12,
11
- },
12
- rules: {},
13
- };
package/.prettierrc.js DELETED
@@ -1,3 +0,0 @@
1
- module.exports = {
2
- printWidth: 120,
3
- };