Skip to content

Commit 4fa0ace

Browse files
authored
fix: sanitize special characters from codegen (#1503)
1 parent 8b509ec commit 4fa0ace

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

.changeset/slow-carpets-smell.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@graphprotocol/graph-cli': patch
3+
---
4+
5+
sanitize special characters in codegeneration

packages/cli/src/protocols/ethereum/codegen/abi.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ const doFixtureCodegen = fs.existsSync('./fixtures.yaml');
1414
export default class AbiCodeGenerator {
1515
constructor(private abi: ABI) {
1616
this.abi = abi;
17+
// Sanitize the name of the ABI to make it a valid class name
18+
this.abi.name = abi.name.replace(/[!@#$%^&*()_+\-=[\]{};':"\\|,.<>/?]+/g, '_');
1719
}
1820

1921
generateModuleImports() {

0 commit comments

Comments
 (0)