@sparkdotfi/abi-cli 0.2.0-20250908.2e329053 → 0.2.0-20250908.c48fdeb7

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.
@@ -1,8 +1,9 @@
1
- import { Effect } from 'effect';
1
+ import { Chunk, Effect, Stream } from 'effect';
2
2
  import { entries, uniqueBy } from 'remeda';
3
3
  import { CliConfig } from '../config/Config.js';
4
4
  import { ProgressBar } from '../services/ProgressBar.js';
5
5
  import { AbiFetcher } from './AbiFetcher.js';
6
+ const FETCH_CHUNK_SIZE = 5;
6
7
  export const fetchAbis = Effect.gen(function* () {
7
8
  const config = yield* (yield* CliConfig).getConfig();
8
9
  const abiFetcher = yield* AbiFetcher;
@@ -10,8 +11,10 @@ export const fetchAbis = Effect.gen(function* () {
10
11
  const contracts = getContractsToFetch(config);
11
12
  yield* Effect.logInfo(`Fetching ${contracts.length} ABIs`);
12
13
  yield* progressBar.create(contracts.length);
13
- const effects = contracts.map((contract) => abiFetcher.fetchAbi(contract).pipe(Effect.map((abi) => ({ contract, abi })), Effect.tap(() => progressBar.increment)));
14
- const downloadedAbis = yield* Effect.all(effects, { concurrency: 3 });
14
+ const fetchJobs = contracts.map((contract) => abiFetcher.fetchAbi(contract).pipe(Effect.map((abi) => ({ contract, abi })), Effect.tap(() => progressBar.increment)));
15
+ // Split fetching into chunks that are processed in a sequence. This reduces parallelization but it works well with etherscan apis that are heavily rate limited
16
+ const downloadedAbisChunk = yield* Stream.fromIterable(fetchJobs).pipe(Stream.rechunk(FETCH_CHUNK_SIZE), Stream.chunks, Stream.mapEffect(Effect.allWith({ concurrency: 'unbounded' })), Stream.flattenIterables, Stream.runCollect);
17
+ const downloadedAbis = Chunk.toArray(downloadedAbisChunk);
15
18
  return getMetadataStore(downloadedAbis);
16
19
  }).pipe(Effect.scoped, Effect.withSpan('fetchAbis'));
17
20
  function getContractsToFetch(config) {
@@ -1 +1 @@
1
- {"version":3,"file":"fetchAbis.d.ts","sourceRoot":"","sources":["../../../../src/fetch/fetchAbis.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAE/B,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAC/C,OAAO,EAAE,wBAAwB,EAAgB,MAAM,qBAAqB,CAAA;AAC5E,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAA;AACxD,OAAO,EAAO,aAAa,EAAyB,MAAM,aAAa,CAAA;AACvE,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAE5C,eAAO,MAAM,SAAS;;uVAmBuF,CAAA;AAc7G,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,wBAAwB,EAAE,IAAI,EAAE,MAAM,GAAG,aAAa,EAAE,CAQrG"}
1
+ {"version":3,"file":"fetchAbis.d.ts","sourceRoot":"","sources":["../../../../src/fetch/fetchAbis.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,MAAM,EAAU,MAAM,QAAQ,CAAA;AAE9C,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAC/C,OAAO,EAAE,wBAAwB,EAAgB,MAAM,qBAAqB,CAAA;AAC5E,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAA;AACxD,OAAO,EAAO,aAAa,EAAyB,MAAM,aAAa,CAAA;AACvE,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAI5C,eAAO,MAAM,SAAS;;uVA4BuF,CAAA;AAc7G,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,wBAAwB,EAAE,IAAI,EAAE,MAAM,GAAG,aAAa,EAAE,CAQrG"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sparkdotfi/abi-cli",
3
- "version": "0.2.0-20250908.2e329053",
3
+ "version": "0.2.0-20250908.c48fdeb7",
4
4
  "engines": {
5
5
  "node": ">=22.0.0"
6
6
  },