diff --git a/CHANGELOG.md b/CHANGELOG.md index db79fb713..1cad1b84b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,8 +4,14 @@ All notable changes to this project will be documented in this file. Dates are d Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). +#### [v3.4.4](https://github.com/oceanprotocol/ocean.js/compare/v4.0.0-next.1...v3.4.4) + +- Remove checks from publishing. ADded chain ID check for ordering. [`#1875`](https://github.com/oceanprotocol/ocean.js/pull/1875) + #### [v4.0.0-next.1](https://github.com/oceanprotocol/ocean.js/compare/v4.0.0-next.0...v4.0.0-next.1) +> 12 November 2024 + - add datasets on ComputeAsset, new start compute fn [`8563429`](https://github.com/oceanprotocol/ocean.js/commit/85634293306fca9aaa3ab5ae06a114149ccc8911) - support for consumer signature on initialize compute [`71c5923`](https://github.com/oceanprotocol/ocean.js/commit/71c59230db99a08a6c28df66c26e32ca61c71089) - add file object types [`cd936c2`](https://github.com/oceanprotocol/ocean.js/commit/cd936c24a989633d3d8e71b908a375802d2e2970) diff --git a/src/@types/DDO/DDO.ts b/src/@types/DDO/DDO.ts index 211813d68..25fba9957 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 9916c7a47..c8b889bb1 100644 --- a/src/utils/Assets.ts +++ b/src/utils/Assets.ts @@ -154,11 +154,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 69eba8e63..6bd08fdd2 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 efafd5848..fac14b9b2 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.') + } const hasProviderFees = order.providerFee && order.providerFee.providerFeeAmount if (hasProviderFees && Number(order.providerFee.providerFeeAmount) > 0) { await approveWei(