mirror of
https://github.com/oceanprotocol/market.git
synced 2024-12-02 05:57:29 +01:00
mock ddo.chainId response
This commit is contained in:
parent
8ac4f59dee
commit
ea15f20cac
@ -29,7 +29,7 @@ interface OceanProviderValue {
|
|||||||
const OceanContext = createContext({} as OceanProviderValue)
|
const OceanContext = createContext({} as OceanProviderValue)
|
||||||
|
|
||||||
// TODO: remove temporary typing once ddo.chainId is present in ocean.js
|
// TODO: remove temporary typing once ddo.chainId is present in ocean.js
|
||||||
interface DDO_TEMPORARY extends DDO {
|
export interface DDO_TEMPORARY extends DDO {
|
||||||
chainId: number
|
chainId: number
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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 { DDO_TEMPORARY } from '../providers/Ocean'
|
||||||
|
|
||||||
// TODO: import directly from ocean.js somehow.
|
// TODO: import directly from ocean.js somehow.
|
||||||
// Transforming Aquarius' direct response is needed for getting actual DDOs
|
// Transforming Aquarius' direct response is needed for getting actual DDOs
|
||||||
@ -64,7 +65,7 @@ export async function retrieveDDO(
|
|||||||
did: string | DID,
|
did: string | DID,
|
||||||
metadataCacheUri: string,
|
metadataCacheUri: string,
|
||||||
cancelToken: CancelToken
|
cancelToken: CancelToken
|
||||||
): Promise<DDO> {
|
): Promise<DDO_TEMPORARY> {
|
||||||
try {
|
try {
|
||||||
const response: AxiosResponse<DDO> = await axios.get(
|
const response: AxiosResponse<DDO> = await axios.get(
|
||||||
`${metadataCacheUri}/api/v1/aquarius/assets/ddo/${did}`,
|
`${metadataCacheUri}/api/v1/aquarius/assets/ddo/${did}`,
|
||||||
@ -72,7 +73,9 @@ export async function retrieveDDO(
|
|||||||
)
|
)
|
||||||
if (!response || response.status !== 200 || !response.data) return
|
if (!response || response.status !== 200 || !response.data) return
|
||||||
|
|
||||||
return new DDO(response.data)
|
// TODO: remove hacking in chainId in DDO response once Aquarius gives us that
|
||||||
|
const data = { ...response.data, chainId: 1 }
|
||||||
|
return new DDO(data) as DDO_TEMPORARY
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (axios.isCancel(error)) {
|
if (axios.isCancel(error)) {
|
||||||
Logger.log(error.message)
|
Logger.log(error.message)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user