mirror of
https://github.com/oceanprotocol/ocean.js.git
synced 2024-11-26 20:39:05 +01:00
also check for validity of passed data token
This commit is contained in:
parent
127b0c2fcc
commit
7d34e1c99c
@ -67,6 +67,13 @@ export class Assets extends Instantiable {
|
|||||||
name?: string,
|
name?: string,
|
||||||
symbol?: string
|
symbol?: string
|
||||||
): SubscribablePromise<CreateProgressStep, DDO> {
|
): SubscribablePromise<CreateProgressStep, DDO> {
|
||||||
|
if (!isAddress(dtAddress)) {
|
||||||
|
this.logger.error(
|
||||||
|
`Passed Data Token address ${dtAddress} is not valid. Aborting publishing.`
|
||||||
|
)
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
this.logger.log('Creating asset')
|
this.logger.log('Creating asset')
|
||||||
return new SubscribablePromise(async (observer) => {
|
return new SubscribablePromise(async (observer) => {
|
||||||
if (services.length === 0) {
|
if (services.length === 0) {
|
||||||
|
@ -222,6 +222,21 @@ describe('Marketplace flow', () => {
|
|||||||
assert.equal(metaData.attributes.additionalInformation.links, newMetaData.links)
|
assert.equal(metaData.attributes.additionalInformation.links, newMetaData.links)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('Alice publishes a dataset but passed data token is invalid', async () => {
|
||||||
|
price = datatoken.toWei('10') // in datatoken
|
||||||
|
const publishedDate = new Date(Date.now()).toISOString().split('.')[0] + 'Z'
|
||||||
|
const timeout = 0
|
||||||
|
service1 = await ocean.assets.createAccessServiceAttributes(
|
||||||
|
alice,
|
||||||
|
price,
|
||||||
|
publishedDate,
|
||||||
|
timeout
|
||||||
|
)
|
||||||
|
|
||||||
|
ddo = await ocean.assets.create(asset, alice, [service1], 'gibberishDataToken')
|
||||||
|
assert.equal(ddo, null)
|
||||||
|
})
|
||||||
|
|
||||||
it('Alice publishes a dataset but created data token is invalid', async () => {
|
it('Alice publishes a dataset but created data token is invalid', async () => {
|
||||||
price = datatoken.toWei('10') // in datatoken
|
price = datatoken.toWei('10') // in datatoken
|
||||||
const publishedDate = new Date(Date.now()).toISOString().split('.')[0] + 'Z'
|
const publishedDate = new Date(Date.now()).toISOString().split('.')[0] + 'Z'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user