Skip to content

Commit

Permalink
Merge branch 'feat/remove-c2d' into feat/2033-update-all-relevant-dep…
Browse files Browse the repository at this point in the history
…endencies
  • Loading branch information
tom1145 committed May 31, 2024
2 parents dfef2b5 + a7a1d7a commit 1e43d10
Show file tree
Hide file tree
Showing 66 changed files with 375 additions and 4,173 deletions.
596 changes: 298 additions & 298 deletions .jest/__fixtures__/datasetsWithAccessDetails.ts

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion content/site.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"link": "/profile"
}
],
"announcement": "[Lock your OCEAN](https://df.oceandao.org/) to get veOCEAN, earn rewards and curate data.",
"announcement": "",
"warning": {
"ctd": "Please note that Compute-to-Data is still in alpha phase."
}
Expand Down
12 changes: 0 additions & 12 deletions src/@types/Compute.d.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
import { ComputeJob } from '@oceanprotocol/lib'
import { OrdersData_orders_datatoken as OrdersDatatoken } from '../@types/subgraph/OrdersData'

// declaring into global scope to be able to use this as
// ambiant types despite the above imports
declare global {
interface ComputeJobMetaData extends ComputeJob {
assetName: string
assetDtSymbol: string
networkId: number
}

interface AlgorithmOption {
did: string
name: string
Expand All @@ -23,11 +16,6 @@ declare global {
createdTimestamp: number
}

interface ComputeResults {
computeJobs: ComputeJobMetaData[]
isLoaded: boolean
}

interface totalPriceMap {
value: string
symbol: string
Expand Down
6 changes: 2 additions & 4 deletions src/@types/aquarius/SearchQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,11 @@ export enum SortTermOptions {
// and gets imported in components.

export enum FilterByTypeOptions {
Data = 'dataset',
Algorithm = 'algorithm'
Data = 'dataset'
}

export enum FilterByAccessOptions {
Download = 'access',
Compute = 'compute'
Download = 'access'
}

declare global {
Expand Down
46 changes: 4 additions & 42 deletions src/@utils/aquarius/index.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import { Asset, LoggerInstance } from '@oceanprotocol/lib'
import { AssetSelectionAsset } from '@shared/FormInput/InputElement/AssetSelection'
import axios, { CancelToken, AxiosResponse } from 'axios'
import { OrdersData_orders as OrdersData } from '../../@types/subgraph/OrdersData'
import { metadataCacheUri } from '../../../app.config'
import {
SortDirectionOptions,
SortTermOptions
} from '../../@types/aquarius/SearchQuery'
import { transformAssetToAssetSelection } from '../assetConvertor'

export interface UserSales {
id: string
Expand Down Expand Up @@ -206,41 +204,6 @@ export async function getAssetsFromDids(
}
}

export async function getAlgorithmDatasetsForCompute(
algorithmId: string,
datasetProviderUri: string,
datasetChainId?: number,
cancelToken?: CancelToken
): Promise<AssetSelectionAsset[]> {
const baseQueryParams = {
chainIds: [datasetChainId],
nestedQuery: {
must: {
match: {
'services.compute.publisherTrustedAlgorithms.did': {
query: algorithmId
}
}
}
},
sortOptions: {
sortBy: SortTermOptions.Created,
sortDirection: SortDirectionOptions.Descending
}
} as BaseQueryParams

const query = generateBaseQuery(baseQueryParams)
const computeDatasets = await queryMetadata(query, cancelToken)
if (computeDatasets?.totalResults === 0) return []

const datasets = await transformAssetToAssetSelection(
datasetProviderUri,
computeDatasets.results,
[]
)
return datasets
}

export async function getPublishedAssets(
accountId: string,
chainIds: number[],
Expand All @@ -256,9 +219,8 @@ export async function getPublishedAssets(

filters.push(getFilterTerm('nft.state', [0, 4, 5]))
filters.push(getFilterTerm('nft.owner', accountId.toLowerCase()))
accesType !== undefined &&
filters.push(getFilterTerm('services.type', accesType))
type !== undefined && filters.push(getFilterTerm('metadata.type', type))
filters.push(getFilterTerm('services.type', 'access'))
filters.push(getFilterTerm('metadata.type', 'dataset'))

const baseQueryParams = {
chainIds,
Expand Down Expand Up @@ -306,8 +268,8 @@ async function getTopPublishers(
const filters: FilterTerm[] = []

accesType !== undefined &&
filters.push(getFilterTerm('services.type', accesType))
type !== undefined && filters.push(getFilterTerm('metadata.type', type))
filters.push(getFilterTerm('services.type', 'access'))
type !== undefined && filters.push(getFilterTerm('metadata.type', 'dataset'))

const baseQueryParams = {
chainIds,
Expand Down
3 changes: 1 addition & 2 deletions src/@utils/assetConvertor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ export async function transformAssetToAssetSelection(
const algorithmList: AssetSelectionAsset[] = []

for (const asset of assets) {
const algoService =
getServiceByName(asset, 'compute') || getServiceByName(asset, 'access')
const algoService = getServiceByName(asset, 'access')

if (
asset?.stats?.price?.value >= 0 &&
Expand Down
Loading

0 comments on commit 1e43d10

Please sign in to comment.