Skip to content

Commit

Permalink
enforce asset files object type
Browse files Browse the repository at this point in the history
  • Loading branch information
paulo-ocean committed Dec 12, 2024
1 parent 583db8e commit 7df390a
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/utils/Assets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { ProviderInstance } from '../services/Provider'
import AccessListFactory from '@oceanprotocol/contracts/artifacts/contracts/accesslists/AccessListFactory.sol/AccessListFactory.json'
import ERC20Template4 from '@oceanprotocol/contracts/artifacts/contracts/templates/ERC20Template4.sol/ERC20Template4.json'
import { calculateActiveTemplateIndex } from './Adresses'
import { FileObjectType } from '../@types'

// import * as hre from 'hardhat'

Expand Down Expand Up @@ -113,6 +114,15 @@ export async function createAsset(
mpFeeAddress: ZERO_ADDRESS
}

if (
!assetUrl.type ||
![FileObjectType.ARWEAVE, FileObjectType.IPFS, FileObjectType.URL].includes(
assetUrl.type.toLowerCase()
)
) {
console.log('Missing or invalid files object type, defaulting to "url"')
assetUrl.type = FileObjectType.URL
}
// include fileObject in the DT constructor
if (config.sdk === 'oasis') {
datatokenParams.filesObject = assetUrl
Expand Down

0 comments on commit 7df390a

Please sign in to comment.