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

use priceList interface instead of any for return type

This commit is contained in:
Bogdan Fazakas 2021-04-14 14:41:17 +03:00
parent d52d644850
commit 1696fb2c44
2 changed files with 8 additions and 4 deletions

View File

@ -10,7 +10,7 @@ import {
SearchQuery
} from '@oceanprotocol/lib/dist/node/metadatacache/MetadataCache'
import { AssetSelectionAsset } from '../components/molecules/FormFields/AssetSelection'
import { getAssetPrices } from './subgraph'
import { PriceList, getAssetPrices } from './subgraph'
import axios, { CancelToken, AxiosResponse } from 'axios'
// TODO: import directly from ocean.js somehow.
@ -113,7 +113,7 @@ export async function transformDDOToAssetSelection(
): Promise<AssetSelectionAsset[]> {
const source = axios.CancelToken.source()
const didList: string[] = []
const priceList: any = await getAssetPrices(ddoList)
const priceList: PriceList = await getAssetPrices(ddoList)
const symbolList: any = {}
for (const ddo of ddoList) {
didList.push(ddo.id)

View File

@ -3,6 +3,10 @@ import { DDO } from '@oceanprotocol/lib'
import { getApolloClientInstance } from '../providers/ApolloClientProvider'
import BigNumber from 'bignumber.js'
export interface PriceList {
[key: string]: string
}
const freQuery = gql`
query AssetFrePrice($datatoken_in: [String!]) {
fixedRateExchanges(orderBy: id, where: { datatoken_in: $datatoken_in }) {
@ -85,8 +89,8 @@ export async function getPreviousOrders(
}
}
export async function getAssetPrices(assets: DDO[]): Promise<any> {
const priceList: any = {}
export async function getAssetPrices(assets: DDO[]): Promise<PriceList> {
const priceList: PriceList = {}
const didDTMap: any = {}
const dataTokenList: string[] = []