datahaven/test/wagmi.config.ts
Tim B fa4d3b8391
test: 🧙 Generate Type Bindings for Contracts (#58)
## Summary
This PR adds statically typed bindings for contracts. This allows you to
write E2E tests with full completions in TS.

## Additions

- `ts-build.yml` New CI, this will make sure that if there's changes
made to the contracts that the contract-bindings are up to date.
- `package.json` script changes
- `start:e2e:ci` - Designed to be run with all options specified since
CIs are famously bad with iteractive CLI prompts
  - `test:e2e` - added timeout
- `generate:wagmi` - This generates the smart contract bindings for our
tests
- New Function Helpers:
- `generateRandomAccount()` Returns a viem account type object for a
random account. Useful for tests where you want idempotency on a long
lived network since the state is probabilistically fresh
- `getContractInstance()` Returns a viem contract instance that allows
you to read/write to the deployed contract. You should get full type
inference here for the methods available and parameters required.

### Example

```ts
 it("avs() can be read from contract instance", async () => {
    const value = await instance.read.avs();
    expect(isAddress(value), "AVS getter should return an address").toBeTrue();
  });
```

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Facundo Farall <37149322+ffarall@users.noreply.github.com>
2025-05-01 11:14:19 +01:00

33 lines
1 KiB
TypeScript

import { defineConfig } from "@wagmi/cli";
import { actions, foundry } from "@wagmi/cli/plugins";
export default defineConfig({
out: "contract-bindings/generated.ts",
plugins: [
actions(), // TODO: Investigate why the actions() plugin is not functioning as expected. Refer to the @wagmi/cli documentation for potential solutions.
foundry({
project: "../contracts",
include: [
"BeefyClient.sol/**",
"AgentExecutor.sol/**",
"Gateway.sol/**",
"TransparentUpgradeableProxy.sol/**",
"VetoableSlasher.sol/**",
"RewardsRegistry.sol/**",
"Agent.sol/**",
"StrategyManager.sol/**",
"AVSDirectory.sol/**",
"DataHavenServiceManager.sol/**",
"EigenPodManager.sol/**",
"EigenPod.sol/**",
"UpgradeableBeacon.sol/**",
"RewardsCoordinator.sol/**",
"AllocationManager.sol/**",
"DelegationManager.sol/**",
"PermissionController.sol/**",
"IETHPOSDeposit.sol/**",
"StrategyBaseTVLLimits.sol/**"
]
})
]
});