hyperlane-xyz / hyperlane-monorepo

The home for Hyperlane core contracts, sdk packages, and other infrastructure
https://hyperlane.xyz
Other
336 stars 369 forks source link

Export ABIs for core contracts from core package #3151

Open jmrossy opened 10 months ago

jmrossy commented 10 months ago

Problem

The @hypelane-xyz/core package doesn't export the ABIs for the core contracts in a way that's discoverable and conveniently usable with libraries like Viem. We do export the Ethers V5 Factories, from which the ABI can be retrieved, but that's not direct and obvious.

Solution

Export the ABIs. They already exist in the solidity/artifacts dir but we need to modify the package files and exports fields.

The Celo ABIs package does a good job and structuring the exports to enable tree-shaking and support both CJS/ESM but the downside of their approach is that each ABI is under its own path. There may be a better solution, I'm not sure.

Nice to Have

Find a way to avoid the duplication of ABIs between the typechain Ethers5 artifacts and the pure ABIs

jmrossy commented 10 months ago

https://webpack.js.org/guides/tree-shaking/#mark-the-file-as-side-effect-free https://github.com/wevm/wagmi/blob/main/packages/connectors/package.json