From 439773b40f2393df452151e54ad1ce1f05ffae96 Mon Sep 17 00:00:00 2001 From: Moritz Kirstein Date: Fri, 20 Oct 2023 07:08:49 +0200 Subject: [PATCH] fix: check for multi chaion provider --- src/modules/ocean/compute-to-data/C2D.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/modules/ocean/compute-to-data/C2D.ts b/src/modules/ocean/compute-to-data/C2D.ts index 502402f..0beaa70 100644 --- a/src/modules/ocean/compute-to-data/C2D.ts +++ b/src/modules/ocean/compute-to-data/C2D.ts @@ -88,8 +88,11 @@ export class C2D { // get compute environments and choose the first one const computeEnvs = await ProviderInstance.getComputeEnvironments(this.providerUrl); - if (computeEnvs.length === 0) throw new Error('No compute environment'); - this.computeEnv = computeEnvs[0]; + const computeEnv = Array.isArray(computeEnvs) ? computeEnvs[0] : computeEnvs[this.config.chainId][0]; + + if (!computeEnv) throw new Error('No compute environment'); + + this.computeEnv = computeEnv; console.log('compute env:', this.computeEnv); const validUntil = getValidUntilTime(