Closed on1force closed 1 week ago
came from this function.
async getPoolByCoins(coins, feeRate) { if (coins.length === 0) { return []; } const url = this._sdk.sdkOptions.swapCountUrl; const response = await fetch(url); let json; try { json = await response.json(); } catch (e) { throw new ClmmpoolsError(`Failed tp [arse response from ${url}].`, "InvalidSwapCountUrl" /* InvalidSwapCountUrl */); } const pools = json.data.lp_list; if (!pools || pools.length === 0) { throw new ClmmpoolsError(`Failed tp [arse response from ${url}].`, "PoolsNotFound" /* PoolsNotFound */); } const poolAddresses = []; for (const pool of pools) { if (coins.includes(pool.coin_a_address) && coins.includes(pool.coin_b_address)) { if (feeRate != null) { if (pool.object.feeRate === feeRate) { poolAddresses.push(pool.address); } } else { poolAddresses.push(pool.address); } } } if (poolAddresses.length > 0) { const poolObjects = await this.getPools(poolAddresses); return poolObjects; } return []; }
the culprit is const pools = json.data.lp_list;. the specified lp_list doesn't exist on the response object. it should be json.data.pools.
const pools = json.data.lp_list;
json.data.pools
came from this function.
the culprit is
const pools = json.data.lp_list;
. the specified lp_list doesn't exist on the response object. it should bejson.data.pools
.