You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After upgrading the subgraphs endpoint from version v1.1.5 to v1.1.6-beta.23, this code snippet that refreshes a pool state periodically is no longer functioning as expected. Specifically, the example pool is never refreshed.
Code Snippet:
const balancerSDK = new BalancerSDK({ network: Network.MAINNET, rpcUrl: chainData.chainConfig.nodeEndpoint });
const pool = await balancerSDK.pools.find('0xb9debddf1d894c79d2b2d09f819ff9b856fca55200000000000000000000062a');
if (!pool) throw new Error('Pool not found');
const sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms));
// Every 5 seconds, log rate weWETH / WETH
// eslint-disable-next-line no-constant-condition
while (true) {
await sleep(5_000);
// Refresh pool
await balancerSDK.data.poolsOnChain.refresh(pool);
const res = pool.calcSpotPrice('0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', '0xcd5fe23c85820f7b72d0926fc9b05b43e359b7ee');
console.log(`timestamp: ${Date.now()} | rate = ${res}`);
}
Expected Behavior:
The pool state should be refreshed every 5 seconds, and the spot price should be logged correctly.
Actual Behavior:
After upgrading to v1.1.6-beta.23, the pool state is never refreshed, and the spot price remains unchanged.
The text was updated successfully, but these errors were encountered:
AngeloCa
changed the title
Refresh method isn't working on v1.1.6-beta.23
Pool Refresh Functionality Broken After Upgrade to v1.1.6-beta.23
Jul 3, 2024
Need to update your example a bit to use pool = await balancer.pools.refresh(pool.id);
let pool = await balancer.pools.find('0xb9debddf1d894c79d2b2d09f819ff9b856fca55200000000000000000000062a');
const sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms));
// Every 5 seconds, log rate weWETH / WETH
// eslint-disable-next-line no-constant-condition
while (true) {
await sleep(5_000);
// Refresh pool
if (!pool) throw new Error('Pool not found');
pool = await balancer.pools.refresh(pool.id);
if (!pool) throw new Error('Pool not found');
const res = pool.calcSpotPrice('0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', '0xcd5fe23c85820f7b72d0926fc9b05b43e359b7ee');
console.log(`timestamp: ${Date.now()} | rate = ${res}`);
}
Description:
After upgrading the subgraphs endpoint from version v1.1.5 to v1.1.6-beta.23, this code snippet that refreshes a pool state periodically is no longer functioning as expected. Specifically, the example pool is never refreshed.
Code Snippet:
Expected Behavior:
The pool state should be refreshed every 5 seconds, and the spot price should be logged correctly.
Actual Behavior:
After upgrading to v1.1.6-beta.23, the pool state is never refreshed, and the spot price remains unchanged.
The text was updated successfully, but these errors were encountered: