1
0
mirror of https://github.com/oceanprotocol/ocean.js.git synced 2024-11-26 20:39:05 +01:00

Remove checks from publishing. ADded chain ID check for ordering. (#1875)

* Remove checks from publishing. ADded chain ID check for ordering.

* Add 2 more keys for DDO object.

* Fix lint.

* Remove stats and nft from DDO.

* Add check back for chain id only if ddo chain id.
This commit is contained in:
Maria Carmina 2024-11-20 15:17:33 +02:00 committed by GitHub
parent 9d385b0f0b
commit 8687962abd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 12 additions and 6 deletions

View File

@ -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.

View File

@ -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)))

View File

@ -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(

View File

@ -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,