forked from safe-global/safe-eth-py
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of github.com:safe-global/safe-eth-py
- Loading branch information
Showing
27 changed files
with
12,821 additions
and
552 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
Routines for EIP712 encoding and signing. | ||
Copyright (C) 2022 Judd Vinet <[email protected]> | ||
Uxío Fuentefría <[email protected]> | ||
Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
this software and associated documentation files (the "Software"), to deal in | ||
|
@@ -75,15 +76,16 @@ def _encode_field(name, typ, value): | |
return ["bytes32", fast_keccak(value)] | ||
|
||
if typ.endswith("]"): | ||
parsed_type = typ[:-2] | ||
type_value_pairs = dict( | ||
[_encode_field(name, parsed_type, v) for v in value] | ||
) | ||
h = fast_keccak( | ||
encode_abi( | ||
list(type_value_pairs.keys()), list(type_value_pairs.values()) | ||
) | ||
) | ||
# Array type | ||
if value: | ||
parsed_type = typ[: typ.rindex("[")] | ||
type_value_pairs = [_encode_field(name, parsed_type, v) for v in value] | ||
data_types, data_hashes = zip(*type_value_pairs) | ||
else: | ||
# Empty array | ||
data_types, data_hashes = [], [] | ||
|
||
h = fast_keccak(encode_abi(data_types, data_hashes)) | ||
return ["bytes32", h] | ||
|
||
return [typ, value] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.