Skip to content

Commit

Permalink
chore: ensure 0x is always prepended
Browse files Browse the repository at this point in the history
  • Loading branch information
JonathanAmenechi committed Jul 29, 2024
1 parent 0db4618 commit 60c75e1
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion py_order_utils/builders/base_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ def _create_struct_hash(self, order: EIP712Struct):
"""
Creates an EIP712 compliant struct hash for the Order
"""
return "0x" + keccak(order.signable_bytes(domain=self.domain_separator)).hex()
struct_hash = keccak(order.signable_bytes(domain=self.domain_separator)).hex()
if len(struct_hash) > 2 and struct_hash[:2] != "0x":
struct_hash = f"0x{struct_hash}"
return struct_hash

def sign(self, struct_hash):
"""
Expand Down

0 comments on commit 60c75e1

Please sign in to comment.