Skip to content

Commit

Permalink
fix: sanitize special characters from codegen (#1503)
Browse files Browse the repository at this point in the history
  • Loading branch information
saihaj authored Nov 15, 2023
1 parent 8b509ec commit 4fa0ace
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/slow-carpets-smell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@graphprotocol/graph-cli': patch
---

sanitize special characters in codegeneration
2 changes: 2 additions & 0 deletions packages/cli/src/protocols/ethereum/codegen/abi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ const doFixtureCodegen = fs.existsSync('./fixtures.yaml');
export default class AbiCodeGenerator {
constructor(private abi: ABI) {
this.abi = abi;
// Sanitize the name of the ABI to make it a valid class name
this.abi.name = abi.name.replace(/[!@#$%^&*()_+\-=[\]{};':"\\|,.<>/?]+/g, '_');
}

generateModuleImports() {
Expand Down

0 comments on commit 4fa0ace

Please sign in to comment.