mirror of
https://github.com/oceanprotocol/ocean.js.git
synced 2024-11-26 20:39:05 +01:00
small refactor
This commit is contained in:
parent
4f9ed04086
commit
4e02a1b2a5
@ -6,7 +6,7 @@ import {
|
||||
publisherTrustedAlgorithm
|
||||
} from '../ddo/interfaces/Service'
|
||||
import Account from './Account'
|
||||
import { SubscribablePromise, assetResolve, AssetResolver } from '../utils'
|
||||
import { SubscribablePromise, assetResolve, AssetResolved } from '../utils'
|
||||
import { Instantiable, InstantiableConfig } from '../Instantiable.abstract'
|
||||
import {
|
||||
ComputeOutput,
|
||||
@ -413,7 +413,7 @@ export class Compute extends Instantiable {
|
||||
algorithm: ComputeAlgorithm,
|
||||
algorithmDDO?: DDO
|
||||
): Promise<boolean> {
|
||||
const datasetResolved: AssetResolver = await assetResolve(dataset, this.ocean)
|
||||
const datasetResolved: AssetResolved = await assetResolve(dataset, this.ocean)
|
||||
const service: Service = datasetResolved.ddo.findServiceById(serviceIndex)
|
||||
if (!service) return false
|
||||
if (service.type === 'compute') {
|
||||
|
@ -1,5 +1,5 @@
|
||||
import Account from '../ocean/Account'
|
||||
import { noZeroX, assetResolve, AssetResolver } from '../utils'
|
||||
import { noZeroX, assetResolve } from '../utils'
|
||||
import { Instantiable, InstantiableConfig } from '../Instantiable.abstract'
|
||||
import { File } from '../ddo/interfaces/File'
|
||||
import {
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { DDO } from '../ddo/DDO'
|
||||
import { Ocean } from '../ocean/Ocean'
|
||||
|
||||
export interface AssetResolver {
|
||||
export interface AssetResolved {
|
||||
did: string
|
||||
ddo: DDO
|
||||
}
|
||||
@ -13,7 +13,7 @@ function isDdo(arg: any): arg is DDO {
|
||||
export async function assetResolve(
|
||||
asset: DDO | string,
|
||||
ocean: Ocean
|
||||
): Promise<AssetResolver> {
|
||||
): Promise<AssetResolved> {
|
||||
if (isDdo(asset)) {
|
||||
const did = asset.id
|
||||
const ddo = asset
|
||||
|
Loading…
x
Reference in New Issue
Block a user