Skip to content

Commit

Permalink
fix: swap example can use subset of pools
Browse files Browse the repository at this point in the history
  • Loading branch information
gmbronco committed Jul 19, 2023
1 parent 0d9f8ca commit 1a9a8f2
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion balancer-js/examples/helpers/forked-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { JsonRpcProvider } from '@ethersproject/providers'
* @param provider JsonRpcProvider
* @param blockNumber Block number to reset fork to
*/
export const reset = (provider: JsonRpcProvider, blockNumber: number, jsonRpcUrl = 'https://rpc.ankr.com/eth'): Promise<void> =>
export const reset = (provider: JsonRpcProvider, blockNumber?: number, jsonRpcUrl = 'https://rpc.ankr.com/eth'): Promise<void> =>
provider.send('hardhat_reset', [
{
forking: {
Expand Down
3 changes: 3 additions & 0 deletions balancer-js/examples/swaps/swap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import { BalancerSDK, Network } from '@balancer-labs/sdk'
import { formatFixed } from '@ethersproject/bignumber'
import { AddressZero } from '@ethersproject/constants'
import { reset } from 'examples/helpers/forked-utils'

const tokenIn = AddressZero // eth
const tokenOut = '0x2260fac5e5542a773aa44fbcfedf7c193bc2c599' // wBTC
Expand All @@ -22,6 +23,8 @@ const { swaps } = sdk
const erc20Out = sdk.contracts.ERC20(tokenOut, sdk.provider)

async function swap() {
await reset(sdk.provider)

const signer = sdk.provider.getSigner()
const account = await signer.getAddress()

Expand Down
2 changes: 1 addition & 1 deletion balancer-js/src/modules/swaps/swaps.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ export class Swaps {
*/
// eslint-disable-next-line @typescript-eslint/no-unused-vars
async fetchPools(queryArgs?: GraphQLArgs): Promise<boolean> {
return this.sor.fetchPools();
return this.sor.fetchPools(queryArgs);
}

public getPools(): SubgraphPoolBase[] {
Expand Down

0 comments on commit 1a9a8f2

Please sign in to comment.