Skip to content

Commit

Permalink
Add example for retrieving volume on Avalanche
Browse files Browse the repository at this point in the history
  • Loading branch information
timjrobinson committed Aug 1, 2023
1 parent ca46dd6 commit 3d5a5f5
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions balancer-js/examples/pools/volume/volume.avalanche.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/**
* Display APRs for pool ids hardcoded under `const ids`
*
* Run command:
* yarn example ./examples/pools/volume/volume.avalanche.ts
*/
import { BalancerSDK } from '@balancer-labs/sdk';

const sdk = new BalancerSDK({
network: 43114,
rpcUrl:
'https://avalanche-mainnet.infura.io/v3/5f045135319c4c99965dc62b31ccdd50',
});

const { pools } = sdk;

const main = async () => {
const pool = await pools.find(
'0xa1d14d922a575232066520eda11e27760946c991000000000000000000000012'
);

if (pool) {
const volume = await pools.volume(pool);
console.table([
{
id: pool.id,
type: pool.poolType,
totalVolume: pool.totalSwapVolume,
volume,
},
]);
}
};

main();

0 comments on commit 3d5a5f5

Please sign in to comment.