diff --git a/package.json b/package.json index 0af7011..e94bbdc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@fuseio/earn-sdk", - "version": "1.0.1", + "version": "1.0.2", "description": "", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/src/constants/index.ts b/src/constants/index.ts index 469d68f..0953f56 100644 --- a/src/constants/index.ts +++ b/src/constants/index.ts @@ -19,4 +19,9 @@ export const MASTERCHEF_V3_SUBGRAPH_URL = 'https://api.thegraph.com/subgraphs/na export const xVOLT = '0x97a6e78c9208c21afaDa67e7E61d7ad27688eFd1' export const VOLT = '0x34Ef2Cc892a88415e9f02b91BfA9c91fC0bE6bD4' +export const STABLESWAP_POOL_LP_HASH = { + '0xa3c1046290b490e629e11ace35863cb0cae382ab': '0x2a68d7c6ea986fa06b2665d08b4d08f5e7af960c', + '0xc71cab88c1674a39a3e2841274e54e34d709af91': '0x83d158beadbb3445ac901cfd0ca33fb30ccc8f53' +} + export const STABLESWAP_POOLS = ['0x2a68D7C6Ea986fA06B2665d08b4D08F5e7aF960c', '0x83D158Beadbb3445AC901cFd0ca33FB30CCC8f53'] diff --git a/src/graphql/query.ts b/src/graphql/query.ts index b12341b..b72cace 100644 --- a/src/graphql/query.ts +++ b/src/graphql/query.ts @@ -26,7 +26,7 @@ export function pairQuery (address: string) { export function stablePoolQuery (poolAddress: string) { return gql` { - swaps(id: "${poolAddress.toLowerCase()}") { + swap(id: "${poolAddress.toLowerCase()}") { numTokens balances lpTokenSupply diff --git a/src/utils/fetchChefPairInfo.ts b/src/utils/fetchChefPairInfo.ts index 1267a54..7a59511 100644 --- a/src/utils/fetchChefPairInfo.ts +++ b/src/utils/fetchChefPairInfo.ts @@ -1,4 +1,4 @@ -import { NetworkId } from '../constants' +import { NetworkId, STABLESWAP_POOL_LP_HASH } from '../constants' import { pairQuery, stablePoolQuery } from '../graphql/query' import { stableswapClient, voltageClient } from '../graphql' import { isStableswap } from '.' @@ -7,13 +7,13 @@ async function fetchPairInfoVoltage (address: string) { let result if (isStableswap(address)) { result = await stableswapClient.query({ - query: stablePoolQuery(address) + query: stablePoolQuery(STABLESWAP_POOL_LP_HASH[address.toLowerCase()]) }) - const tokens = result?.data?.swaps?.tokens - const reserves = result?.data?.swaps?.balances + const tokens = result?.data?.swap?.tokens + const reserves = result?.data?.swap?.balances return { - reserveUSD: result?.data?.swaps?.lpTokenSupply * 1, - totalSupply: result?.data?.swaps?.lpTokenSupply, + reserveUSD: result?.data?.swap?.lpTokenSupply * 1, + totalSupply: result?.data?.swap?.lpTokenSupply, tokens, totalReserves: reserves } diff --git a/src/utils/index.ts b/src/utils/index.ts index 3986385..2407f8a 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -1,5 +1,5 @@ import { BigNumber } from 'bignumber.js' -import { MASTERCHEF_V2_ADDRESS, MASTERCHEF_V3_ADDRESS, STABLESWAP_POOLS } from '../constants' +import { MASTERCHEF_V2_ADDRESS, MASTERCHEF_V3_ADDRESS, STABLESWAP_POOL_LP_HASH } from '../constants' import { masterChefV2Client, masterChefV3Client } from '../graphql' import { Chef } from '../rewards/ChefRewardProgram' @@ -52,5 +52,5 @@ export function getChefSubgraph (chef: Chef) { } export function isStableswap (address: string) { - return STABLESWAP_POOLS.includes(address) + return !!STABLESWAP_POOL_LP_HASH[address] }