Skip to content

Commit

Permalink
Update publish actions
Browse files Browse the repository at this point in the history
  • Loading branch information
adamgall committed Jun 15, 2024
1 parent 2a397ce commit d867ddf
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ node_modules
/docs

# Publish files
addresses.ts
abis.ts
index.ts
/publish

# TypeChain files
/typechain
Expand Down
10 changes: 8 additions & 2 deletions scripts/prepublish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,18 @@ npx hardhat export --export-all deployments.json

jq 'walk(if type == "object" then del(.abi, .name, .chainId) else . end)' deployments.json > temp_addresses.json
jq 'to_entries | map({key: .key, value: .value[0]}) | from_entries' temp_addresses.json > addresses.json
echo "export default $(cat addresses.json) as const;" > addresses.ts
echo "export default $(cat addresses.json) as const;" > publish/addresses.ts
rm temp_addresses.json addresses.json

jq '."1"[0].contracts' deployments.json > temp_abis.json
jq 'to_entries | map({key: .key, value: {abi: .value.abi}}) | from_entries' temp_abis.json > abis.json
echo "export default $(cat abis.json) as const;" > abis.ts
echo "export default $(cat abis.json) as const;" > publish/abis.ts
rm temp_abis.json abis.json

rm deployments.json

cat << EOF > index.ts
import abis from "./publish/abis.ts";
import addresses from "./publish/addresses.ts";
export { abis, addresses };
EOF

0 comments on commit d867ddf

Please sign in to comment.