1
0
mirror of https://github.com/oceanprotocol/market.git synced 2024-12-02 05:57:29 +01:00

switch over to app config metadataCacheUri

This commit is contained in:
Matthias Kretschmann 2021-07-26 16:59:17 +02:00
parent 605f77e055
commit 209dd379dc
Signed by: m
GPG Key ID: 606EEEF3C479A91F
2 changed files with 7 additions and 7 deletions

View File

@ -1,7 +1,6 @@
module.exports = { module.exports = {
metadataCacheUri: metadataCacheUri:
process.env.METADATACACHE_URI || process.env.METADATACACHE_URI || 'https://aquarius.oceanprotocol.com',
'https://aquarius.mainnet.oceanprotocol.com',
// List of chainIds which metadata cache queries will return by default. // List of chainIds which metadata cache queries will return by default.
// This preselects the Chains user preferences. // This preselects the Chains user preferences.

View File

@ -12,6 +12,7 @@ import {
import { AssetSelectionAsset } from '../components/molecules/FormFields/AssetSelection' import { AssetSelectionAsset } from '../components/molecules/FormFields/AssetSelection'
import { PriceList, getAssetsPriceList } from './subgraph' import { PriceList, getAssetsPriceList } from './subgraph'
import axios, { CancelToken, AxiosResponse } from 'axios' import axios, { CancelToken, AxiosResponse } from 'axios'
import { metadataCacheUri } from '../../app.config'
function getQueryForAlgorithmDatasets(algorithmDid: string, chainId?: number) { function getQueryForAlgorithmDatasets(algorithmDid: string, chainId?: number) {
return { return {
@ -49,7 +50,7 @@ export function transformQueryResult(
} }
} }
export function transformChainIdsListToQuery(chainIds: number[]) { export function transformChainIdsListToQuery(chainIds: number[]): string {
let chainQuery = '' let chainQuery = ''
chainIds.forEach((chainId) => { chainIds.forEach((chainId) => {
chainQuery += `chainId:${chainId} OR ` chainQuery += `chainId:${chainId} OR `
@ -61,10 +62,10 @@ export function transformChainIdsListToQuery(chainIds: number[]) {
export async function queryMetadata( export async function queryMetadata(
query: SearchQuery, query: SearchQuery,
cancelToken: CancelToken cancelToken: CancelToken
): Promise<any> { ): Promise<QueryResult> {
try { try {
const response: AxiosResponse<any> = await axios.post( const response: AxiosResponse<any> = await axios.post(
`https://multiaqua.oceanprotocol.com/api/v1/aquarius/assets/ddo/query`, `${metadataCacheUri}/api/v1/aquarius/assets/ddo/query`,
{ ...query, cancelToken } { ...query, cancelToken }
) )
if (!response || response.status !== 200 || !response.data) return if (!response || response.status !== 200 || !response.data) return
@ -84,7 +85,7 @@ export async function retrieveDDO(
): Promise<DDO> { ): Promise<DDO> {
try { try {
const response: AxiosResponse<DDO> = await axios.get( const response: AxiosResponse<DDO> = await axios.get(
`https://multiaqua.oceanprotocol.com/api/v1/aquarius/assets/ddo/${did}`, `${metadataCacheUri}/api/v1/aquarius/assets/ddo/${did}`,
{ cancelToken } { cancelToken }
) )
if (!response || response.status !== 200 || !response.data) return if (!response || response.status !== 200 || !response.data) return
@ -106,7 +107,7 @@ export async function getAssetsNames(
): Promise<Record<string, string>> { ): Promise<Record<string, string>> {
try { try {
const response: AxiosResponse<Record<string, string>> = await axios.post( const response: AxiosResponse<Record<string, string>> = await axios.post(
`https://multiaqua.oceanprotocol.com/api/v1/aquarius/assets/names`, `${metadataCacheUri}/api/v1/aquarius/assets/names`,
{ {
didList, didList,
cancelToken cancelToken