Skip to content

Commit

Permalink
Added toCamelCase which takes care of some edge cases
Browse files Browse the repository at this point in the history
which we have observed in the wild.
  • Loading branch information
zomglings committed Jan 15, 2024
1 parent 47982e7 commit 5846057
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion starknet/generators.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ type HeaderParameters struct {
PackageName string
}

func toCamelCase(s string) string {
t := strings.Replace(s, "-", "Dash", -1)
return strcase.ToCamel(t)
}

// Generates a Go name for a Starknet ABI item given its fully qualified ABI name.
// Qualified names for Starknet ABI items are of the form:
// `core::starknet::contract_address::ContractAddress`
Expand Down Expand Up @@ -143,7 +148,7 @@ func GenerateSnippets(parsed *ParsedABI) (map[string]string, error) {
}

templateFuncs := map[string]any{
"CamelCase": strcase.ToCamel,
"CamelCase": toCamelCase,
"GenerateGoNameForType": GenerateGoNameForType,
"ParserFunction": ParserFunction,
}
Expand Down

0 comments on commit 5846057

Please sign in to comment.