diff --git a/packages/celotool/src/cmds/deploy/initial/contracts.ts b/packages/celotool/src/cmds/deploy/initial/contracts.ts index 59b1d41f77c..161ae6604d1 100644 --- a/packages/celotool/src/cmds/deploy/initial/contracts.ts +++ b/packages/celotool/src/cmds/deploy/initial/contracts.ts @@ -73,10 +73,9 @@ async function makeMetadata(testnet: string, address: string, index: number) { const fileName = `validator-${testnet}-${address}-metadata.json` const filePath = `/tmp/${fileName}` - const metadata = new IdentityMetadataWrapper(IdentityMetadataWrapper.emptyData) + const metadata = IdentityMetadataWrapper.fromEmpty() metadata.addClaim(nameClaim) metadata.addClaim(attestationServiceClaim) - writeFileSync(filePath, metadata.toString()) await uploadFileToGoogleStorage( diff --git a/packages/cli/src/commands/identity/create-metadata.ts b/packages/cli/src/commands/identity/create-metadata.ts index 0e3543e248d..fad6f339d14 100644 --- a/packages/cli/src/commands/identity/create-metadata.ts +++ b/packages/cli/src/commands/identity/create-metadata.ts @@ -19,7 +19,7 @@ export default class CreateMetadata extends BaseCommand { async run() { const { args } = this.parse(CreateMetadata) - const metadata = new IdentityMetadataWrapper(IdentityMetadataWrapper.emptyData) + const metadata = new IdentityMetadataWrapper(IdentityMetadataWrapper.fromEmpty()) writeFileSync(args.file, metadata.toString()) } } diff --git a/packages/contractkit/src/identity/metadata.ts b/packages/contractkit/src/identity/metadata.ts index f7a6fcd4534..c59ab44645a 100644 --- a/packages/contractkit/src/identity/metadata.ts +++ b/packages/contractkit/src/identity/metadata.ts @@ -62,8 +62,10 @@ const isOfType = (type: K) => ( export class IdentityMetadataWrapper { data: IdentityMetadata - static emptyData: IdentityMetadata = { - claims: [], + static fromEmpty() { + return new IdentityMetadataWrapper({ + claims: [], + }) } static async fetchFromURL(url: string) { diff --git a/packages/utils/src/async.ts b/packages/utils/src/async.ts index f4a696d5ece..7b26b1f8ae7 100644 --- a/packages/utils/src/async.ts +++ b/packages/utils/src/async.ts @@ -71,7 +71,7 @@ export async function concurrentMap( const remaining = xs.length - i const sliceSize = Math.min(remaining, concurrency) const slice = xs.slice(i, i + sliceSize) - res = res.concat(await Promise.all(slice.map(mapFn))) + res = res.concat(await Promise.all(slice.map((elem, index) => mapFn(elem, i + index)))) } return res }