From 53828bf2ab56d051ce22eb6d157b3279e82f07e0 Mon Sep 17 00:00:00 2001 From: lbqds Date: Fri, 29 Nov 2024 18:08:09 +0800 Subject: [PATCH] Address comments --- packages/cli/src/project.ts | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/packages/cli/src/project.ts b/packages/cli/src/project.ts index 873591691..a50b6c1c0 100644 --- a/packages/cli/src/project.ts +++ b/packages/cli/src/project.ts @@ -37,6 +37,7 @@ import * as path from 'path' import fs from 'fs' import { promises as fsPromises } from 'fs' import { parseError } from './error' +import * as fetchRetry from 'fetch-retry' const crypto = new WebCrypto() const defaultMainnetNodeUrl = 'https://node.mainnet.alephium.org' @@ -595,7 +596,19 @@ export class Project { sourceInfos: SourceInfo[], artifactsRootDir: string ): Promise { - const nodeProvider = new NodeProvider(mainnetNodeUrl ?? defaultMainnetNodeUrl) + const nodeProvider = new NodeProvider( + mainnetNodeUrl ?? defaultMainnetNodeUrl, + undefined, + fetchRetry.default(fetch, { + retryOn: [429], + retries: 3, + retryDelay: 1000 + }) + ) + const networkId = (await nodeProvider.infos.getInfosChainParams()).networkId + if (networkId !== 0) { + throw new Error(`The node url ${mainnetNodeUrl} does not point to the mainnet`) + } const result: string[] = [] for (const sourceInfo of sourceInfos) { const artifactPath = sourceInfo.getArtifactPath(artifactsRootDir)