Skip to content

Commit

Permalink
Changing hardhat to anvil client in tests;
Browse files Browse the repository at this point in the history
Creating script to start anvil node;
Adding docs about anvil node installation in the README.md;
  • Loading branch information
Luiz Gustavo Abou Hatem De Liz committed Oct 11, 2023
1 parent 3862fd5 commit 1fbd05e
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 5 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,6 @@ typechain-types
cache
artifacts

#IDE
.idea

10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,13 @@ If your platform does not support one of the required features, it is also possi
Testing requires access to an archive node for onchain quote comparisons. This can be done using Infura.

`pnpm test`

## Anvil client
To download and install the anvil client, run the following commands (MacOS):
- `curl -L https://foundry.paradigm.xyz | bash`
- `brew install libusb`
- `source /Users/$(whoami)/.zshenv`
- `foundryup`

For other SO's check https://book.getfoundry.sh/getting-started/installation
```
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
"test:ci": "vitest run",
"changeset": "changeset",
"changeset:release": "pnpm build && changeset publish",
"node": "npx hardhat node --tsconfig tsconfig.testing.json --fork $(. ./.env && echo $ETHEREUM_RPC_URL)"
"node": "npx hardhat node --tsconfig tsconfig.testing.json --fork $(. ./.env && echo $ETHEREUM_RPC_URL)",
"node:anvil": "anvil --fork-url $(. ./.env && echo $ETHEREUM_RPC_URL)"
},
"dependencies": {
"async-retry": "^1.3.3",
Expand Down
4 changes: 2 additions & 2 deletions test/lib/utils/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const approveToken = async (
args: [BALANCER_VAULT, amount],
});

const txReceipt = await client.getTransactionReceipt({
const txReceipt = await client.waitForTransactionReceipt({
hash,
});
return txReceipt.status === 'success';
Expand Down Expand Up @@ -107,7 +107,7 @@ export async function sendTransactionGetBalances(
to,
value,
});
const transactionReceipt = await client.getTransactionReceipt({
const transactionReceipt = await client.waitForTransactionReceipt({
hash,
});
const { gasUsed, effectiveGasPrice } = transactionReceipt;
Expand Down
2 changes: 1 addition & 1 deletion test/weightedExit.integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ describe('weighted exit test', () => {
const poolInput = await api.getPool(poolId);

const client = createTestClient({
mode: 'hardhat',
mode: 'anvil',
chain: CHAINS[chainId],
transport: http(rpcUrl),
})
Expand Down
2 changes: 1 addition & 1 deletion test/weightedJoin.integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ describe('weighted join test', () => {
const poolInput = await api.getPool(poolId);

const client = createTestClient({
mode: 'hardhat',
mode: 'anvil',
chain: CHAINS[chainId],
transport: http(rpcUrl),
})
Expand Down

0 comments on commit 1fbd05e

Please sign in to comment.