-
Notifications
You must be signed in to change notification settings - Fork 22
generate go bindings in one package per contract/library #270
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -39,6 +39,7 @@ CONTRACT_JSON_FILES = $(filter-out $(CONTRACT_ABI_FILES),$(CONTRACT_BOTH_FILES)) | |
| .PHONY: build-contracts bindings-gen-go bindings-gen-ts | ||
|
|
||
| build-contracts: | ||
| forge --version || exit 1; \ | ||
| echo "Building contracts"; \ | ||
| rm -frd ./out; \ | ||
| forge install; \ | ||
|
|
@@ -54,7 +55,9 @@ build-contracts: | |
| # as they are not publicly exposed, but rather used within the contract itself. | ||
| # | ||
| # ABIGen issue ref: https://github.com/ethereum/solidity/issues/9278 | ||
| bindings-gen-go: build-contracts | ||
| bindings-gen-go: build-contracts | ||
| go version || exit 1; \ | ||
| abigen --version || exit 1; \ | ||
| echo "Generating Go vIBC bindings..."; \ | ||
| rm -rfd ./bindings/go/* ; \ | ||
| for abi_file in $(CONTRACT_ABI_FILES); do \ | ||
|
|
@@ -63,14 +66,16 @@ bindings-gen-go: build-contracts | |
| continue; \ | ||
| fi; \ | ||
| type=$$(basename $$abi_file .abi.json); \ | ||
| pkg=$$(basename $$abi_base .sol | tr "[:upper:]" "[:lower:]"); \ | ||
| pkg=$$(basename $$type .sol | tr "[:upper:]" "[:lower:]"); \ | ||
| mkdir -p ./bindings/go/$$pkg; \ | ||
| abigen --abi $$abi_file --pkg $$pkg --type $$type --out ./bindings/go/$$pkg/$$type.go; \ | ||
| abigen --abi $$abi_file --pkg $$pkg --type $$type --out ./bindings/go/$$pkg/$$type.go || exit 1; \ | ||
| done; \ | ||
| echo "Done." | ||
| echo Running sanity check on go bindings ; \ | ||
| go build ./... || exit 1; \ | ||
|
Contributor
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. nit: you need the
Contributor
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. nit2: maybe add a message saying "running check sanity on bindings" or similar?
Collaborator
Author
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. (assuming you meant I don't need the I think we actually do need this Similar to the behavior we're seeing with abigen
Collaborator
Author
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. re second nit though I added messaging as you requested, thanks for the suggestion
Contributor
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. Sorry, I did mean "don't need" LOL
Here's a clear example Things like for loops need to be within a single subshell (so you need the |
||
| echo "Successfully generated go bindings." | ||
|
|
||
| bindings-gen-ts: build-contracts | ||
| echo "Generating TypeScript bindings..."; \ | ||
| rm -rfd ./src/evm/contracts/*; \ | ||
| typechain --target ethers-v6 --out-dir ./src/evm/contracts $(CONTRACT_JSON_FILES); \ | ||
| echo "Done." | ||
| echo "Successfully generated ts bindings." | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.