-
Notifications
You must be signed in to change notification settings - Fork 68
fix: typescript generated files errors - #475 #477
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 8 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
c30a6fc
fix: generate
s2imonovic 8afbd0e
Revert "fix: generate"
s2imonovic 1c10186
fix: typescript generated files errors
s2imonovic d035f93
fix: generate
s2imonovic a924fd6
Merge remote-tracking branch 'origin/main' into fix/generate-action
s2imonovic ae2f8ba
fix: update ethers version
s2imonovic bdafe97
Merge remote-tracking branch 'origin/main' into fix/generate-action
s2imonovic 3ef6691
Merge remote-tracking branch 'origin/main' into fix/generate-action
s2imonovic f2088e3
fix: create script for removing duplicates from types.ts
s2imonovic File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,7 @@ | |
"lint:fix": "npx eslint . --fix --ignore-pattern coverage/ --ignore-pattern coverage.json --ignore-pattern lib/ --ignore-pattern out --ignore-pattern cache_forge/", | ||
"test": "forge clean && forge test -vvv", | ||
"coverage": "forge coverage --no-match-coverage \"(script|test|legacy)\" --report lcov", | ||
"typechain": "npx typechain --target ethers-v6 \"out/**/!(*.t|test).sol/!(*.abi).json\" --out-dir types", | ||
"typechain": "npx typechain --target ethers-v6 \"out/**/!(*.t|test|IERC20|ZetaConnectorBase|ZetaErrors|ZetaNonEthInterface).sol/!(*.abi).json\" --out-dir types", | ||
"generate": "forge clean && forge build && forge fmt && ./scripts/generate_go.sh || true && ./scripts/generate_addresses.sh && yarn lint:fix && yarn typechain && yarn docs && del-cli dist && tsc || true", | ||
"prepublishOnly": "copyfiles -u 1 'out/**/*' 'abi'", | ||
"docs": "./scripts/generate_docs.sh" | ||
|
@@ -59,7 +59,7 @@ | |
"@openzeppelin/contracts": "^5.0.2", | ||
"@openzeppelin/contracts-upgradeable": "^5.0.2", | ||
"@zetachain/networks": "^10.0.0", | ||
"ethers": "5.6.8" | ||
"ethers": "6.13.5" | ||
}, | ||
"types": "./dist/lib/index.d.ts", | ||
"packageManager": "[email protected]+sha1.1959a18351b811cdeedbd484a8f86c3cc3bbaf72" | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
/* Autogenerated file. Do not edit manually. */ | ||
/* tslint:disable */ | ||
/* eslint-disable */ | ||
export * as erc20 from "./ERC20"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. just to double check, did you remove these manually or it is now working fine with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. that got removed when I ran yarn generate |
||
export * as errorsSol from "./Errors.sol"; | ||
export * as ierc20CustodySol from "./IERC20Custody.sol"; | ||
export * as ierc721Sol from "./IERC721.sol"; | ||
|
@@ -53,7 +52,6 @@ export { IAccessControl__factory } from "./IAccessControl__factory"; | |
export { IBeacon__factory } from "./IBeacon__factory"; | ||
export { IERC165__factory } from "./IERC165__factory"; | ||
export { IERC1967__factory } from "./IERC1967__factory"; | ||
export { IERC20__factory } from "./IERC20__factory"; | ||
export { IERC20Metadata__factory } from "./IERC20Metadata__factory"; | ||
export { IERC20Permit__factory } from "./IERC20Permit__factory"; | ||
export { IMulticall3__factory } from "./IMulticall3__factory"; | ||
|
@@ -84,10 +82,7 @@ export { TestERC20__factory } from "./TestERC20__factory"; | |
export { TestUniversalContract__factory } from "./TestUniversalContract__factory"; | ||
export { UUPSUpgradeable__factory } from "./UUPSUpgradeable__factory"; | ||
export { UpgradeableBeacon__factory } from "./UpgradeableBeacon__factory"; | ||
export { ZetaConnectorBase__factory } from "./ZetaConnectorBase__factory"; | ||
export { ZetaConnectorNative__factory } from "./ZetaConnectorNative__factory"; | ||
export { ZetaConnectorNativeUpgradeTest__factory } from "./ZetaConnectorNativeUpgradeTest__factory"; | ||
export { ZetaConnectorNonNative__factory } from "./ZetaConnectorNonNative__factory"; | ||
export { ZetaConnectorNonNativeUpgradeTest__factory } from "./ZetaConnectorNonNativeUpgradeTest__factory"; | ||
export { ZetaErrors__factory } from "./ZetaErrors__factory"; | ||
export { ZetaNonEthInterface__factory } from "./ZetaNonEthInterface__factory"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you please add some details on why is this excluded? is it because these are imported in other contracts and it is duplicated or something else? wondering if there is some configuration on typechain to exclude duplicates automatically
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the duplicates happen because these interfaces (IERC20, ZetaConnectorBase, etc.) are imported in multiple places in our contracts.
When forge compiles, it creates JSON artifacts for these interfaces in different locations based on where they were imported from. That's why we see IERC20 both in the root directory and in the ERC20 subdirectory.
Typechain doesn't have a built-in config option to automatically detect and exclude duplicates. It just processes all JSON files that match the glob pattern.
My solution of explicitly excluding the problematic interfaces works for now, though we'll need to update it if we encounter more duplicates later.
examples:
export type { IERC20 } from "./IERC20";
export type { IERC20 } from "./ERC20/IERC20";
export type { ZetaConnectorBase } from "./ZetaConnectorBase";
export type { ZetaConnectorBase } from "./ZetaConnector.base.sol/ZetaConnectorBase";
export type { ZetaErrors } from "./ZetaErrors";
export type { ZetaErrors } from "./Zeta.non-eth.sol/ZetaErrors";
export type { ZetaNonEthInterface } from "./ZetaNonEthInterface";
export type { ZetaNonEthInterface } from "./Zeta.non-eth.sol/ZetaNonEthInterface";
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
got it, previously we had v1 and v2 directories and then they got merged into 1 repo, so probably some of these can be removed in the solidity code itself, and only have them on 1 place and import from that 1 place
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will check it