diff --git a/common/changes/@cityofzion/bs-ethereum/CU-86a2bxqbk_2024-02-21-22-57.json b/common/changes/@cityofzion/bs-ethereum/CU-86a2bxqbk_2024-02-21-22-57.json new file mode 100644 index 0000000..222d91b --- /dev/null +++ b/common/changes/@cityofzion/bs-ethereum/CU-86a2bxqbk_2024-02-21-22-57.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@cityofzion/bs-ethereum", + "comment": "Fix getTokenPrices that is returning a wrong price for ETH token address", + "type": "patch" + } + ], + "packageName": "@cityofzion/bs-ethereum" +} \ No newline at end of file diff --git a/packages/bs-ethereum/src/__tests__/BitqueryEDSEthereum.spec.ts b/packages/bs-ethereum/src/__tests__/BitqueryEDSEthereum.spec.ts index a0b2c01..a0994e0 100644 --- a/packages/bs-ethereum/src/__tests__/BitqueryEDSEthereum.spec.ts +++ b/packages/bs-ethereum/src/__tests__/BitqueryEDSEthereum.spec.ts @@ -46,4 +46,10 @@ describe('FlamingoEDSNeo3', () => { }) }) }) + + it('Should return the ETH price in USD', async () => { + const tokenPriceList = await bitqueryEDSEthereum.getTokenPrices('USD') + + expect(tokenPriceList).toEqual(expect.arrayContaining([{ symbol: 'ETH', hash: '-', price: expect.any(Number) }])) + }) }) diff --git a/packages/bs-ethereum/src/graphql.ts b/packages/bs-ethereum/src/graphql.ts index 9299e93..2e759e1 100644 --- a/packages/bs-ethereum/src/graphql.ts +++ b/packages/bs-ethereum/src/graphql.ts @@ -269,10 +269,7 @@ export type BitQueryGetTokenPricesVariables = { export const bitqueryGetPricesQuery = gql` query getPrice($after: ISO8601DateTime!, $network: EthereumNetwork!) { ethereum(network: $network) { - dexTrades( - options: { limitBy: { each: "baseCurrency.address", limit: 1 }, desc: "date.date" } - time: { after: $after } - ) { + dexTrades(options: { desc: "date.date" }, time: { after: $after }) { quoteCurrency(quoteCurrency: { is: "0xdac17f958d2ee523a2206206994597c13d831ec7" }) { symbol address