import { assert } from 'chai' import { AbiItem } from 'web3-utils' import { web3, getTestConfig, getAddresses } from '../config' import { Config, ProviderInstance, Aquarius, Datatoken, calculateEstimatedGas, sendTx } from '../../src' import { ComputeJob, ComputeAsset, ComputeAlgorithm, Files } from '../../src/@types' import { createAsset, handleComputeOrder } from './helpers' let config: Config let aquarius: Aquarius let datatoken: Datatoken let providerUrl: string let consumerAccount: string let publisherAccount: string let providerInitializeComputeResults let computeEnvs let addresses: any let ddoWith5mTimeoutId let ddoWithNoTimeoutId let algoDdoWith5mTimeoutId let algoDdoWithNoTimeoutId let freeComputeJobId: string let paidComputeJobId: string let resolvedDdoWith5mTimeout let resolvedDdoWithNoTimeout let resolvedAlgoDdoWith5mTimeout let resolvedAlgoDdoWithNoTimeout let freeEnvDatasetTxId let freeEnvAlgoTxId let paidEnvDatasetTxId let paidEnvAlgoTxId let computeValidUntil const assetUrl: Files = { datatokenAddress: '0x0', nftAddress: '0x0', files: [ { type: 'url', url: 'https://raw.githubusercontent.com/oceanprotocol/testdatasets/main/shs_dataset_test.txt', method: 'GET' } ] } const ddoWithNoTimeout = { '@context': ['https://w3id.org/did/v1'], id: 'did:op:efba17455c127a885ec7830d687a8f6e64f5ba559f8506f8723c1f10f05c049c', version: '4.1.0', chainId: 4, nftAddress: '0x0', metadata: { created: '2021-12-20T14:35:20Z', updated: '2021-12-20T14:35:20Z', type: 'dataset', name: 'dfgdfgdg', description: 'd dfgd fgd dfg dfgdfgd dfgdf', tags: [''], author: 'dd', license: 'https://market.oceanprotocol.com/terms', additionalInformation: { termsAndConditions: true } }, services: [ { id: 'notAnId', type: 'compute', files: '', datatokenAddress: '0xa15024b732A8f2146423D14209eFd074e61964F3', serviceEndpoint: 'https://v4.provider.goerli.oceanprotocol.com', timeout: 0, compute: { publisherTrustedAlgorithmPublishers: [], publisherTrustedAlgorithms: [], allowRawAlgorithm: true, allowNetworkAccess: true } } ] } const ddoWith5mTimeout = { '@context': ['https://w3id.org/did/v1'], id: 'did:op:efba17455c127a885ec7830d687a8f6e64f5ba559f8506f8723c1f10f05c049c', version: '4.1.0', chainId: 4, nftAddress: '0x0', metadata: { created: '2021-12-20T14:35:20Z', updated: '2021-12-20T14:35:20Z', type: 'dataset', name: 'dfgdfgdg', description: 'd dfgd fgd dfg dfgdfgd dfgdf', tags: [''], author: 'dd', license: 'https://market.oceanprotocol.com/terms', additionalInformation: { termsAndConditions: true } }, services: [ { id: 'notAnId', type: 'compute', files: '', datatokenAddress: '0xa15024b732A8f2146423D14209eFd074e61964F3', serviceEndpoint: 'https://v4.provider.goerli.oceanprotocol.com', timeout: 300, compute: { publisherTrustedAlgorithmPublishers: [], publisherTrustedAlgorithms: [], allowRawAlgorithm: true, allowNetworkAccess: true } } ] } const algoAssetUrl: Files = { datatokenAddress: '0x0', nftAddress: '0x0', files: [ { type: 'url', url: 'https://raw.githubusercontent.com/oceanprotocol/test-algorithm/master/javascript/algo.js', method: 'GET' } ] } const algoDdoWithNoTimeout = { '@context': ['https://w3id.org/did/v1'], id: 'did:op:efba17455c127a885ec7830d687a8f6e64f5ba559f8506f8723c1f10f05c049c', version: '4.1.0', chainId: 4, nftAddress: '0x0', metadata: { created: '2021-12-20T14:35:20Z', updated: '2021-12-20T14:35:20Z', type: 'algorithm', name: 'dfgdfgdg', description: 'd dfgd fgd dfg dfgdfgd dfgdf', tags: [''], author: 'dd', license: 'https://market.oceanprotocol.com/terms', additionalInformation: { termsAndConditions: true }, algorithm: { language: 'Node.js', version: '1.0.0', container: { entrypoint: 'node $ALGO', image: 'ubuntu', tag: 'latest', checksum: 'sha256:2d7ecc9c5e08953d586a6e50c29b91479a48f69ac1ba1f9dc0420d18a728dfc5' } } }, services: [ { id: 'notAnId', type: 'access', files: '', datatokenAddress: '0xa15024b732A8f2146423D14209eFd074e61964F3', serviceEndpoint: 'https://v4.provider.goerli.oceanprotocol.com', timeout: 0 } ] } const algoDdoWith5mTimeout = { '@context': ['https://w3id.org/did/v1'], id: 'did:op:efba17455c127a885ec7830d687a8f6e64f5ba559f8506f8723c1f10f05c049c', version: '4.1.0', chainId: 4, nftAddress: '0x0', metadata: { created: '2021-12-20T14:35:20Z', updated: '2021-12-20T14:35:20Z', type: 'algorithm', name: 'dfgdfgdg', description: 'd dfgd fgd dfg dfgdfgd dfgdf', tags: [''], author: 'dd', license: 'https://market.oceanprotocol.com/terms', additionalInformation: { termsAndConditions: true }, algorithm: { language: 'Node.js', version: '1.0.0', container: { entrypoint: 'node $ALGO', image: 'ubuntu', tag: 'latest', checksum: 'sha256:2d7ecc9c5e08953d586a6e50c29b91479a48f69ac1ba1f9dc0420d18a728dfc5' } } }, services: [ { id: 'notAnId', type: 'access', files: '', datatokenAddress: '0xa15024b732A8f2146423D14209eFd074e61964F3', serviceEndpoint: 'https://v4.provider.goerli.oceanprotocol.com', timeout: 300 } ] } function delay(interval: number) { return it('should delay', (done) => { setTimeout(() => done(), interval) }).timeout(interval + 100) } describe('Simple compute tests', async () => { before(async () => { config = await getTestConfig(web3) addresses = getAddresses() aquarius = new Aquarius(config.metadataCacheUri) providerUrl = config.providerUri datatoken = new Datatoken(web3) }) it('should publish datasets and algorithms', async () => { const accounts = await web3.eth.getAccounts() publisherAccount = accounts[0] consumerAccount = accounts[1] // mint Ocean ///