diff --git a/src/@types/DDO/DDO.ts b/src/@types/DDO/DDO.ts index 211813d6..25fba995 100644 --- a/src/@types/DDO/DDO.ts +++ b/src/@types/DDO/DDO.ts @@ -1,5 +1,4 @@ import { Service, Metadata, Credentials, Event } from '..' - /** * DID Descriptor Object. * Contains metadata about the asset, and define access in at least one service. diff --git a/src/utils/Assets.ts b/src/utils/Assets.ts index bd1aa7b9..7fa95b47 100644 --- a/src/utils/Assets.ts +++ b/src/utils/Assets.ts @@ -153,11 +153,10 @@ export async function createAsset( } const chainID = (await owner.provider.getNetwork()).chainId - if (ddo.chainId !== chainID) { - throw new Error('Chain ID from DDO is different than the configured network.') - } - if (ddo.id) { - throw new Error('DID already filled in.') + if (ddo.chainId) { + if (ddo.chainId !== chainID) { + throw new Error('Chain ID from DDO is different than the configured network.') + } } const config = new ConfigHelper().getConfig(parseInt(String(chainID))) diff --git a/src/utils/OrderUtils.ts b/src/utils/OrderUtils.ts index 69eba8e6..6bd08fdd 100644 --- a/src/utils/OrderUtils.ts +++ b/src/utils/OrderUtils.ts @@ -54,6 +54,10 @@ export async function orderAsset( consumeMarketFeeToken: asset.stats.price.tokenAddress || '0x0000000000000000000000000000000000000000' } + const chainID = (await consumerAccount.provider.getNetwork()).chainId + if (asset.chainId !== chainID) { + throw new Error('Chain ID from DDO is different than the configured network.') + } if (!asset.datatokens[datatokenIndex].address) throw new Error( diff --git a/test/integration/helpers.ts b/test/integration/helpers.ts index bafe4dea..6e3f7c75 100644 --- a/test/integration/helpers.ts +++ b/test/integration/helpers.ts @@ -133,6 +133,10 @@ export async function handleComputeOrder( - have validOrder and providerFees -> then order is valid but providerFees are not valid, we need to call reuseOrder and pay only providerFees - no validOrder -> we need to call startOrder, to pay 1 DT & providerFees */ + const chainID = (await payerAccount.provider.getNetwork()).chainId + if (config.chainId !== chainID) { + throw new Error('Chain ID from DDO is different than the configured network.') + } if (order.providerFee && order.providerFee.providerFeeAmount) { await approveWei( payerAccount,