Skip to content

Commit 59154fb

Browse files
committed
chore: support ethersv5 types for interfaces
Signed-off-by: Tomás Migone <[email protected]>
1 parent 72162d1 commit 59154fb

File tree

4 files changed

+52
-16
lines changed

4 files changed

+52
-16
lines changed

.gitignore

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ build/
3232
typechain/
3333
typechain-types/
3434
types/
35+
types-v5/
36+
wagmi/
3537
deployments/hardhat/
3638

3739
# TypeScript incremental compilation cache
@@ -81,6 +83,3 @@ tx-builder-*.json
8183
**/ignition/deployments/*-hardhat/
8284
**/ignition/deployments/*-31337/
8385
**/ignition/deployments/*-1337/
84-
85-
# wagmi generated types
86-
wagmi/

packages/interfaces/package.json

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,25 +15,32 @@
1515
"./wagmi": {
1616
"default": "./dist/wagmi/generated.js",
1717
"types": "./dist/wagmi/generated.d.ts"
18+
},
19+
"./types-v5": {
20+
"default": "./dist/types-v5/index.js",
21+
"types": "./dist/types-v5/index.d.ts"
1822
}
1923
},
2024
"files": [
2125
"artifacts/**/*",
2226
"dist/**/*",
2327
"contracts/**/*",
2428
"types/**/*",
29+
"types-v5/**/*",
30+
"wagmi/**/*",
2531
"README.md"
2632
],
2733
"author": "The Graph Team",
2834
"license": "GPL-2.0-or-later",
2935
"scripts": {
30-
"clean": "rm -rf dist cache artifacts types",
36+
"clean": "rm -rf dist cache artifacts types wagmi",
3137
"lint": "pnpm lint:ts; pnpm lint:sol; pnpm lint:json",
3238
"lint:ts": "eslint --fix --cache '**/*.{js,ts,cjs,mjs,jsx,tsx}'; prettier -w --cache --log-level warn '**/*.{js,ts,cjs,mjs,jsx,tsx}'",
3339
"lint:sol": "solhint --fix --noPrompt --noPoster 'contracts/**/*.sol'; prettier -w --cache --log-level warn 'contracts/**/*.sol'",
3440
"lint:json": "prettier -w --cache --log-level warn '**/*.json'",
3541
"format": "prettier -w --cache --log-level warn '**/*.{js,ts,cjs,mjs,jsx,tsx,json,md,yaml,yml}'",
36-
"build": "hardhat compile && wagmi generate && tsc",
42+
"build": "hardhat compile && pnpm build:types && tsc",
43+
"build:types": "scripts/build-types.sh",
3744
"build:clean": "pnpm clean && pnpm build",
3845
"watch": "tsc --watch",
3946
"prepublishOnly": "pnpm run build"
@@ -43,13 +50,15 @@
4350
"@nomicfoundation/hardhat-toolbox": "^4.0.0",
4451
"@openzeppelin/contracts": "3.4.1",
4552
"@openzeppelin/contracts-upgradeable": "3.4.2",
53+
"@typechain/ethers-v5": "^10.2.1",
4654
"@wagmi/cli": "^2.3.1",
4755
"ethers": "6.13.7",
4856
"hardhat": "^2.24.0",
4957
"markdownlint-cli": "^0.45.0",
5058
"prettier": "^3.5.3",
5159
"prettier-plugin-solidity": "^2.0.0",
5260
"solhint": "5.1.0",
61+
"typechain": "^8.3.2",
5362
"viem": "^2.31.7"
5463
}
5564
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/bash
2+
3+
# This script builds WAGMI and ethers-v5 types for interacting with the contracts
4+
# Note that ethers-v6 types are automatically generated by hardhat compilation step
5+
# - wagmi: wagmi/
6+
# - ethers-v5: types-v5/
7+
# - ethers-v6: types/
8+
9+
# Build wagmi types
10+
pnpm wagmi generate
11+
12+
# Build ethers-v5 types
13+
pnpm typechain \
14+
--target ethers-v5 \
15+
--out-dir types-v5 \
16+
'artifacts/contracts/**/!(*.dbg).json' \
17+
'artifacts/@openzeppelin/**/!(*.dbg).json'

pnpm-lock.yaml

Lines changed: 22 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)