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 372ce31
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions balancer-js/examples/pools/volume/volume.avalanche.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/**
* 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.public-rpc.com',
});

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 372ce31

Please sign in to comment.