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:
commit
e3b34eee03
@ -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(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user