Skip to content

Commit

Permalink
CU-86a57pv41-BS Lib - Update Flamingo Finance API being used
Browse files Browse the repository at this point in the history
  • Loading branch information
hotequil committed Oct 10, 2024
1 parent 839a7a0 commit 7bc4dcd
Show file tree
Hide file tree
Showing 9 changed files with 49 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@cityofzion/blockchain-service",
"comment": "Update Flamingo Finance API",
"type": "minor"
}
],
"packageName": "@cityofzion/blockchain-service"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@cityofzion/bs-ethereum",
"comment": "Adjust integration tests",
"type": "none"
}
],
"packageName": "@cityofzion/bs-ethereum"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@cityofzion/bs-neo-legacy",
"comment": "Adjust integration tests",
"type": "none"
}
],
"packageName": "@cityofzion/bs-neo-legacy"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@cityofzion/bs-neo3",
"comment": "Update Flamingo Finance API",
"type": "minor"
}
],
"packageName": "@cityofzion/bs-neo3"
}
5 changes: 4 additions & 1 deletion packages/blockchain-service/src/CryptoCompareEDS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,10 @@ export class CryptoCompareEDS implements ExchangeDataService {
}

async getCurrencyRatio(currency: string): Promise<number> {
const { data } = await axios.get<number>(`https://api.flamingo.finance/fiat/exchange-rate?pair=USD_${currency}`)
const { data } = await axios.get<number>(
`https://neo-api.b-cdn.net/flamingo/live-data/fiat-exchange-rate/USD_${currency}`
)

return data
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ describe('BlockscoutBDSEthereum', () => {
const transaction = await blockscoutBDSNeoX.getTransaction(txId)

expect(transaction).toEqual(expectedResponse)
})
}, 10000)

it('Should return transaction details for ERC-20 assets (Ethereum assets)', async () => {
const txId = '0x8ff7f8d3ec44f35242a9e077658c63db595bf4023b3075df5b2b4fea54fd6861'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { BSEthereumHelper } from '../helpers/BSEthereumHelper'
let moralisEDSEthereum: MoralisEDSEthereum
let network: Network<BSEthereumNetworkId>

describe('FlamingoEDSNeo3', () => {
describe('MoralisEDSEthereum', () => {
beforeAll(() => {
network = BSEthereumConstants.DEFAULT_NETWORK
const moralisBDSEthereum = new MoralisBDSEthereum(network)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { BSNeoLegacyHelper } from '../helpers/BSNeoLegacyHelper'
let cryptoCompareEDSNeoLegacy: CryptoCompareEDSNeoLegacy
let network: Network<BSNeoLegacyNetworkId>

describe('FlamingoEDSNeo3', () => {
describe('CryptoCompareEDSNeoLegacy', () => {
beforeAll(() => {
network = BSNeoLegacyConstants.DEFAULT_NETWORK
cryptoCompareEDSNeoLegacy = new CryptoCompareEDSNeoLegacy(network)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ export class FlamingoEDSNeo3 extends CryptoCompareEDS implements ExchangeDataSer
super()

this.#network = network
this.#axiosInstance = axios.create({ baseURL: 'https://api.flamingo.finance' })
this.#axiosInstance = axios.create({ baseURL: 'https://neo-api.b-cdn.net/flamingo/' })
}

async getTokenPrices(params: GetTokenPricesParams): Promise<TokenPricesResponse[]> {
if (!BSNeo3Helper.isMainnet(this.#network)) throw new Error('Exchange is only available on mainnet')

const { data } = await this.#axiosInstance.get<FlamingoTokenInfoPricesResponse>('/token-info/prices')
const { data } = await this.#axiosInstance.get<FlamingoTokenInfoPricesResponse>('/live-data/prices/latest')

const prices: TokenPricesResponse[] = []

Expand Down

0 comments on commit 7bc4dcd

Please sign in to comment.