Skip to content

Commit

Permalink
Merge pull request #223 from curvefi/fix/fixed-bsc-network-fetch
Browse files Browse the repository at this point in the history
fix: fixed bsc network fetch for cryptoPool and tricryptoPool
  • Loading branch information
fedorovdg authored Nov 9, 2023
2 parents 40b651a + 824647b commit f1758cb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@curvefi/api",
"version": "2.50.8",
"version": "2.50.9",
"description": "JavaScript library for curve.fi",
"main": "lib/index.js",
"author": "Macket",
Expand Down
13 changes: 6 additions & 7 deletions src/curve.ts
Original file line number Diff line number Diff line change
Expand Up @@ -736,7 +736,7 @@ class Curve implements ICurve {
}

fetchCryptoFactoryPools = async (useApi = true): Promise<void> => {
if (![1, 137, 250, 8453].includes(this.chainId)) return;
if (![1, 56, 137, 250, 8453].includes(this.chainId)) return;

if (useApi) {
this.constants.CRYPTO_FACTORY_POOLS_DATA = lowerCasePoolDataAddresses(await getFactoryPoolsDataFromApi.call(this, "factory-crypto"));
Expand All @@ -752,7 +752,7 @@ class Curve implements ICurve {
}

fetchTricryptoFactoryPools = async (useApi = true): Promise<void> => {
if (![1, 8453, 42161].includes(this.chainId)) return; // Ethereum, Arbitrum
if (![1, 56, 8453, 42161].includes(this.chainId)) return; // Ethereum, Arbitrum

if (useApi) {
this.constants.TRICRYPTO_FACTORY_POOLS_DATA = lowerCasePoolDataAddresses(await getFactoryPoolsDataFromApi.call(this, "factory-tricrypto"));
Expand Down Expand Up @@ -786,7 +786,7 @@ class Curve implements ICurve {
}

fetchNewCryptoFactoryPools = async (): Promise<string[]> => {
if (![1, 137, 250, 8453].includes(this.chainId)) return [];
if (![1, 56, 137, 250, 8453].includes(this.chainId)) return [];

const currentPoolIds = Object.keys(this.constants.CRYPTO_FACTORY_POOLS_DATA);
const lastPoolIdx = currentPoolIds.length === 0 ? -1 : Number(currentPoolIds[currentPoolIds.length - 1].split("-")[2]);
Expand All @@ -798,7 +798,7 @@ class Curve implements ICurve {
}

fetchNewTricryptoFactoryPools = async (): Promise<string[]> => {
if (![1, 8453, 42161].includes(this.chainId)) return []; // Ethereum, Arbitrum
if (![1, 56, 8453, 42161].includes(this.chainId)) return []; // Ethereum, Arbitrum

const currentPoolIds = Object.keys(this.constants.TRICRYPTO_FACTORY_POOLS_DATA);
const lastPoolIdx = currentPoolIds.length === 0 ? -1 : Number(currentPoolIds[currentPoolIds.length - 1].split("-")[2]);
Expand All @@ -820,8 +820,7 @@ class Curve implements ICurve {
}

fetchRecentlyDeployedCryptoFactoryPool = async (poolAddress: string): Promise<string> => {
if (![1, 137, 250, 8453].includes(this.chainId)) return '';

if (![1, 56, 137, 250, 8453].includes(this.chainId)) return '';
const poolData = lowerCasePoolDataAddresses(await getCryptoFactoryPoolData.call(this, 0, poolAddress));
this.constants.CRYPTO_FACTORY_POOLS_DATA = { ...this.constants.CRYPTO_FACTORY_POOLS_DATA, ...poolData };
this._updateDecimalsAndGauges(this.constants.CRYPTO_FACTORY_POOLS_DATA);
Expand All @@ -830,7 +829,7 @@ class Curve implements ICurve {
}

fetchRecentlyDeployedTricryptoFactoryPool = async (poolAddress: string): Promise<string> => {
if (![1, 8453, 42161].includes(this.chainId)) return ''; // Ethereum, Arbitrum
if (![1, 56, 8453, 42161].includes(this.chainId)) return ''; // Ethereum, Arbitrum
const poolData = lowerCasePoolDataAddresses(await getTricryptoFactoryPoolData.call(this, 0, poolAddress));
this.constants.TRICRYPTO_FACTORY_POOLS_DATA = { ...this.constants.TRICRYPTO_FACTORY_POOLS_DATA, ...poolData };
this._updateDecimalsAndGauges(this.constants.TRICRYPTO_FACTORY_POOLS_DATA);
Expand Down

0 comments on commit f1758cb

Please sign in to comment.