Skip to content

Commit 279b542

Browse files
authored
fix abi spacing issue (#1288)
1 parent 1cb7f8e commit 279b542

File tree

42 files changed

+73
-40
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+73
-40
lines changed

chains/evm/gobindings/cmd/extract_bytecode/main.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"go/token"
88
"os"
99
"path/filepath"
10+
"regexp"
1011
"strconv"
1112
"strings"
1213
)
@@ -196,7 +197,24 @@ func writeBytecode(bytecodeDir, version, baseFilename, bytecode string) error {
196197
return nil
197198
}
198199

200+
// fixABIInternalTypes fixes malformed internalType fields in ABI JSON strings.
201+
// The Go binding generator sometimes omits spaces after type keywords like "contract", "struct", and "enum".
202+
// For example: "contractIERC20" should be "contract IERC20"
203+
func fixABIInternalTypes(abi string) string {
204+
// Pattern matches: internalType":"<keyword><CapitalLetter>
205+
// where keyword is "contract", "struct", or "enum"
206+
// This regex finds cases where there's no space between the keyword and the type name
207+
pattern := regexp.MustCompile(`("internalType":")(contract|struct|enum)([A-Z])`)
208+
209+
// Replace with a space between the keyword and the type name
210+
// $1 = '"internalType":"', $2 = keyword (contract/struct/enum), $3 = capital letter
211+
return pattern.ReplaceAllString(abi, `${1}${2} ${3}`)
212+
}
213+
199214
func writeABI(abiDir, version, baseFilename, abi string) error {
215+
// Fix malformed internalType fields before writing
216+
abi = fixABIInternalTypes(abi)
217+
200218
filename := baseFilename + ".json"
201219
filePath := filepath.Join(abiDir, version, filename)
202220
relPath := filepath.Join(version, filename)

chains/evm/gobindings/generated/latest/burn_from_mint_token_pool/burn_from_mint_token_pool.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

chains/evm/gobindings/generated/latest/burn_mint_token_pool/burn_mint_token_pool.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

chains/evm/gobindings/generated/latest/burn_mint_with_lock_release_flag_token_pool/burn_mint_with_lock_release_flag_token_pool.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

chains/evm/gobindings/generated/latest/burn_to_address_mint_token_pool/burn_to_address_mint_token_pool.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

chains/evm/gobindings/generated/latest/burn_with_from_mint_token_pool/burn_with_from_mint_token_pool.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

chains/evm/gobindings/generated/latest/ccip_encoding_utils/ccip_encoding_utils.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

chains/evm/gobindings/generated/latest/ccip_home/ccip_home.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)