Created
February 19, 2019 14:39
-
-
Save hellwolf/473d598b7963079e32af98ab168bc78a to your computer and use it in GitHub Desktop.
Truffle minimize json artifacts
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
#!/usr/bin/env bash | |
# Notes: | |
# - Shchema: https://github.com/trufflesuite/truffle/tree/develop/packages/truffle-contract-schema | |
# - bytecode vs deployedBytecode: https://ethereum.stackexchange.com/questions/32234/difference-between-bytecode-and-runtime-bytecode | |
for i in "$1"/*.json;do | |
[ -z "${i%%*.min.json}" ] && continue # already minified | |
m=${i%%.json}.min.json | |
echo "Minimizing truffle json artifact: $i" | |
echo "Original size: $(wc -c "$i")" | |
jq 'del(.ast,.legacyAST,.source,.deployedSourceMap,.userdoc,.sourcePath)' $i > $m | |
echo "Minimized size: $(wc -c "$m")" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you only need the ABI part of it, you could simply extract .abi only and trim everything off.