1
0
mirror of https://github.com/oceanprotocol/react.git synced 2025-02-14 21:10:38 +01:00

Merge pull request #117 from oceanprotocol/fix/publishFixes

Fix/publish fixes
This commit is contained in:
mihaisc 2020-09-16 15:09:36 +03:00 committed by GitHub
commit e3b34eee03
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -51,13 +51,12 @@ export async function getCheapestExchange(
ocean: Ocean, ocean: Ocean,
dataTokenAddress: string dataTokenAddress: string
): Promise<{ address?: string; price: string } | null> { ): Promise<{ address?: string; price: string } | null> {
if (!ocean || !dataTokenAddress) return null if (!ocean || !dataTokenAddress) return
try {
const tokenExchanges = await ocean.fixedRateExchange.searchforDT( const tokenExchanges = await ocean.fixedRateExchange.searchforDT(
dataTokenAddress, dataTokenAddress,
'1' '1'
) )
if (tokenExchanges === undefined || tokenExchanges.length === 0) { if (tokenExchanges === undefined || tokenExchanges.length === 0) {
return { return {
address: '', address: '',
@ -82,6 +81,13 @@ export async function getCheapestExchange(
address: cheapestExchangeAddress, address: cheapestExchangeAddress,
price: cheapestExchangePrice.toString() price: cheapestExchangePrice.toString()
} }
} catch (err) {
Logger.log(err)
return {
address: '',
price: ''
}
}
} }
export async function getBestDataTokenPrice( export async function getBestDataTokenPrice(