Commit 299157e7 authored by smartcontracts's avatar smartcontracts Committed by GitHub

fix(ct): improve bundle size (#3337)

Significantly improves the bundle size of the contracts package by
exporting deployments more intentionally and by removing certain
unnecessary exports.
parent f772f66c
---
'@eth-optimism/contracts': patch
---
Significantly reduces contracts package bundle size
...@@ -8,8 +8,11 @@ ...@@ -8,8 +8,11 @@
"dist/**/*.js", "dist/**/*.js",
"dist/**/*.d.ts", "dist/**/*.d.ts",
"dist/types", "dist/types",
"artifacts/contracts/**/*.json", "artifacts/contracts/chugsplash/**/*.json",
"deployments/**/*.json", "artifacts/contracts/L1/**/*.json",
"artifacts/contracts/L2/**/*.json",
"artifacts/contracts/libraries/**/*.json",
"artifacts/contracts/standards/**/*.json",
"chugsplash", "chugsplash",
"L1", "L1",
"L2", "L2",
...@@ -104,6 +107,7 @@ ...@@ -104,6 +107,7 @@
"prettier": "^2.3.1", "prettier": "^2.3.1",
"prettier-plugin-solidity": "^1.0.0-beta.18", "prettier-plugin-solidity": "^1.0.0-beta.18",
"random-bytes-seed": "^1.0.3", "random-bytes-seed": "^1.0.3",
"rimraf": "^3.0.2",
"rlp": "^2.2.6", "rlp": "^2.2.6",
"solhint": "^3.3.6", "solhint": "^3.3.6",
"solhint-plugin-prettier": "^0.0.5", "solhint-plugin-prettier": "^0.0.5",
......
...@@ -50,7 +50,11 @@ const main = async () => { ...@@ -50,7 +50,11 @@ const main = async () => {
) )
artifactNames.push(artifactName) artifactNames.push(artifactName)
content += `const ${artifactName} = require('${relPath}')\n` // eslint-disable-next-line @typescript-eslint/no-var-requires
const artifact = require(relPath)
content += `const ${artifactName} = { abi: ${JSON.stringify(
artifact.abi
)}, address: '${artifact.address}' }\n`
} }
} }
......
...@@ -31,7 +31,10 @@ export const getContractDefinition = (name: string): any => { ...@@ -31,7 +31,10 @@ export const getContractDefinition = (name: string): any => {
export const getDeployedContractDefinition = ( export const getDeployedContractDefinition = (
name: string, name: string,
network: string network: string
): any => { ): {
address: string
abi: any
} => {
const { const {
getDeployedContractArtifact, getDeployedContractArtifact,
// eslint-disable-next-line @typescript-eslint/no-var-requires // eslint-disable-next-line @typescript-eslint/no-var-requires
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment