diff --git a/balancer-js/examples/helpers/forked-utils.ts b/balancer-js/examples/helpers/forked-utils.ts index 257cd0a71..6f1bb2efa 100644 --- a/balancer-js/examples/helpers/forked-utils.ts +++ b/balancer-js/examples/helpers/forked-utils.ts @@ -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 => +export const reset = (provider: JsonRpcProvider, blockNumber?: number, jsonRpcUrl = 'https://rpc.ankr.com/eth'): Promise => provider.send('hardhat_reset', [ { forking: { diff --git a/balancer-js/examples/swaps/swap.ts b/balancer-js/examples/swaps/swap.ts index 98924d382..345156f5f 100644 --- a/balancer-js/examples/swaps/swap.ts +++ b/balancer-js/examples/swaps/swap.ts @@ -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 @@ -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() diff --git a/balancer-js/src/modules/swaps/swaps.module.ts b/balancer-js/src/modules/swaps/swaps.module.ts index 7b224d048..82c131816 100644 --- a/balancer-js/src/modules/swaps/swaps.module.ts +++ b/balancer-js/src/modules/swaps/swaps.module.ts @@ -289,7 +289,7 @@ export class Swaps { */ // eslint-disable-next-line @typescript-eslint/no-unused-vars async fetchPools(queryArgs?: GraphQLArgs): Promise { - return this.sor.fetchPools(); + return this.sor.fetchPools(queryArgs); } public getPools(): SubgraphPoolBase[] {