Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CU-86a5p8cv0 - NEON2 - Upgrade to new Flamingo APIs #2750

Merged
merged 1 commit into from
Nov 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions app/actions/pricesActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ async function getPrices(useFallbackApi = false) {
async function getPricesFromFlamingo() {
const settings = await getSettings()
const { currency } = settings
const EXCHANGE_RATE_URL = `https://api.flamingo.finance/fiat/exchange-rate?pair=USD_${currency.toUpperCase()}`
const EXCHANGE_RATE_URL = `https://neo-api.b-cdn.net/flamingo/live-data/fiat-exchange-rate/USD_${currency.toUpperCase()}`
let exchangeRate = 1

if (currency !== 'usd') {
Expand All @@ -143,13 +143,17 @@ async function getPricesFromFlamingo() {

// Because all pairs are returned in their USD value
// we first check the exchange rate for all currency other than USD
const url = 'https://api.flamingo.finance/token-info/prices'
const url = 'https://neo-api.b-cdn.net/flamingo/live-data/prices/latest'
const results = await axios.get(url).catch(error => {
console.error(`Unable to retrieve prices from the api ${url}`, error)
return undefined
})
if (!results) return {}
return results.data.reduce((accum, curr) => {
if (curr.symbol === 'bNEO') {
accum.NEO = curr.usd_price * exchangeRate
}

accum[curr.symbol] = curr.usd_price * exchangeRate
return accum
}, {})
Expand Down