datahaven/test/bunfig.toml
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

5 lines
169 B
TOML

# Keeping this file around to remind us
# to check patch notes to see if they add things here we can use
[test]
# Sadly there isnt any global timeout options here yet